68 Classifieds API

Features
class tree: 68Classifieds | index: 68Classifieds | all elements

 Class String

Description

String manipulation class

  • author: John Snyder
  • version: 0.1
  • copyright: Copyright (c) 2008, John Snyder
  • license: GNU Public License

Located in /includes/classes/format/String.php (line 22)


	
			
Method Summary
 string dot (string $str, int $len, [string $dots = "..."])
 string formatPhone (string $string, [integer $length = 10], [string $seperator = '-'])
 string generateToken ([string $seed = 'vsmVCHtiYKJkNIxwdRzreEZOWblghqA'])
 string hash ( $input, string $string)
 string prepDisplay (string $value)
 string random ([integer $length = 8], [string $pattern = false])
 string removeDirectory (string $string)
 string removeExtension (string $string)
 string removeLastChar (string $string, string $char)
 string safeAddSlashes ( $string, string $theValue)
 string safeStripSlashes ( $string, string $str)
 string specialChars (string $string)
 string stringHTML (string $string)
 string truncate (string $string, [integer $chars = 40])
Methods
dot (line 100)

Trim a string and add dots to the end.

string dot (string $str, int $len, [string $dots = "..."])
  • string $str: The string
  • int $len: The length you want returned
  • string $dots: the suffix
formatPhone (line 194)

Formats a phone number for display

  • return: formatted phone number ex (555) 555-5555 false on failure
  • access: public
string formatPhone (string $string, [integer $length = 10], [string $seperator = '-'])
  • string $string: unformatted phone number
  • integer $length: number of digits in phone number
  • string $seperator: charcter that seperates prefix from line number
generateToken (line 249)

Generate a random Token

  • access: public
string generateToken ([string $seed = 'vsmVCHtiYKJkNIxwdRzreEZOWblghqA'])
  • string $seed
hash (line 178)

Generate a hash

Provides an easy way to globally change the hash for a site

  • access: public
string hash ( $input, string $string)
  • string $string
  • $input
prepDisplay (line 76)

Preps the display of a string

string prepDisplay (string $value)
  • string $value: The value
random (line 156)

Generate a random string

  • access: public
string random ([integer $length = 8], [string $pattern = false])
  • integer $length
  • string $pattern
removeDirectory (line 117)

Removes directory information from a string ie /directory/directory/file.php returns file.php

  • return: processed string
  • access: public
string removeDirectory (string $string)
  • string $string: raw string for processing
removeExtension (line 137)

Removes the file extension from a string ie file.tpl.php returns file Note will return part of a file name if it has a period in it, ie some.file.tpl.php returns some

  • return: processed string
  • access: public
string removeExtension (string $string)
  • string $string: raw string for processing
removeLastChar (line 214)

Removes the specified last character if it is in the string.

  • return: without last character specified
  • access: public
string removeLastChar (string $string, string $char)
  • string $string: with last character to be removed
  • string $char: character to be removed
safeAddSlashes (line 43)

Attempts to safely add slashes

string safeAddSlashes ( $string, string $theValue)
  • string $theValue: The string
  • $string
safeStripSlashes (line 56)

Attempts to safely strip slashes

string safeStripSlashes ( $string, string $str)
  • string $str: The string
  • $string
specialChars (line 87)

htmlspecialchars a string

string specialChars (string $string)
  • string $string: The value
stringHTML (line 31)

Generates a safe html string

string stringHTML (string $string)
  • string $string: The string
truncate (line 232)

Truncate a string to a set length

  • access: public
string truncate (string $string, [integer $chars = 40])
  • string $string
  • integer $chars