PHP Class Pop\Filter\String

Author: Nick Sagona, III ([email protected])
Mostra file Open project: nicksagona/PopPHP Class Usage Examples

Public Methods

Method Description
between ( string $string, integer $start, integer $end ) : string Method to return a substring of the string between two delimiters.
camelCaseToDash ( string $string ) : string Method to convert the string from camelCase to dash format
camelCaseToSeparator ( string $string, string $sep = DIRECTORY_SEPARATOR ) : string Method to convert the string from camelCase to separator format
camelCaseToUnderscore ( string $string ) : string Method to convert the string from camelCase to under_score format
clean ( string $string, boolean $html = false ) : string Method to clean the string of any of the standard MS Word based characters and return the newly edited string
dashToCamelcase ( string $string ) : string Method to convert the string from dash to camelCase format
dashToSeparator ( string $string, string $sep = DIRECTORY_SEPARATOR ) : string Method to convert the string from dash to separator format
dashToUnderscore ( string $string ) : string Method to convert the string from dash to under_score format
dosToUnix ( string $string ) : string Method to convert newlines from DOS to UNIX
escape ( string $string, boolean $all = false ) : string Method to simulate escaping a string for DB entry, much like mysql_real_escape_string(), but without requiring a DB connection.
links ( string $string, boolean $target = false ) : string Method to convert any links in the string to clickable HTML links.
random ( integer $length, integer $type = String::ALL, integer $case = String::MIXED ) : string Method to generate a random alphanumeric string of a predefined length.
slug ( string $string, string $sep = null ) : string Method to convert the string into an SEO-friendly slug.
underscoreToCamelcase ( string $string ) : string Method to convert the string from under_score to camelCase format
underscoreToDash ( string $string ) : string Method to convert the string from under_score to dash format
underscoreToSeparator ( string $string, string $sep = DIRECTORY_SEPARATOR ) : string Method to convert the string from under_score to separator format
unixToDos ( string $string ) : string Method to convert newlines from UNIX to DOS

Protected Methods

Method Description
convertCamelCase ( string $string, string $sep ) : string Method to convert a camelCase string using the $sep value passed

Method Details

between() public static method

Method to return a substring of the string between two delimiters.
public static between ( string $string, integer $start, integer $end ) : string
$string string
$start integer
$end integer
return string

camelCaseToDash() public static method

Method to convert the string from camelCase to dash format
public static camelCaseToDash ( string $string ) : string
$string string
return string

camelCaseToSeparator() public static method

Method to convert the string from camelCase to separator format
public static camelCaseToSeparator ( string $string, string $sep = DIRECTORY_SEPARATOR ) : string
$string string
$sep string
return string

camelCaseToUnderscore() public static method

Method to convert the string from camelCase to under_score format
public static camelCaseToUnderscore ( string $string ) : string
$string string
return string

clean() public static method

Method to clean the string of any of the standard MS Word based characters and return the newly edited string
public static clean ( string $string, boolean $html = false ) : string
$string string
$html boolean
return string

convertCamelCase() protected static method

Method to convert a camelCase string using the $sep value passed
protected static convertCamelCase ( string $string, string $sep ) : string
$string string
$sep string
return string

dashToCamelcase() public static method

Method to convert the string from dash to camelCase format
public static dashToCamelcase ( string $string ) : string
$string string
return string

dashToSeparator() public static method

Method to convert the string from dash to separator format
public static dashToSeparator ( string $string, string $sep = DIRECTORY_SEPARATOR ) : string
$string string
$sep string
return string

dashToUnderscore() public static method

Method to convert the string from dash to under_score format
public static dashToUnderscore ( string $string ) : string
$string string
return string

dosToUnix() public static method

Method to convert newlines from DOS to UNIX
public static dosToUnix ( string $string ) : string
$string string
return string

escape() public static method

The parameter $all is boolean flag that, when set to true, causes the '%' and '_' characters to be escaped as well.
public static escape ( string $string, boolean $all = false ) : string
$string string
$all boolean
return string

random() public static method

Method to generate a random alphanumeric string of a predefined length.
public static random ( integer $length, integer $type = String::ALL, integer $case = String::MIXED ) : string
$length integer
$type integer
$case integer
return string

slug() public static method

Method to convert the string into an SEO-friendly slug.
public static slug ( string $string, string $sep = null ) : string
$string string
$sep string
return string

underscoreToCamelcase() public static method

Method to convert the string from under_score to camelCase format
public static underscoreToCamelcase ( string $string ) : string
$string string
return string

underscoreToDash() public static method

Method to convert the string from under_score to dash format
public static underscoreToDash ( string $string ) : string
$string string
return string

underscoreToSeparator() public static method

Method to convert the string from under_score to separator format
public static underscoreToSeparator ( string $string, string $sep = DIRECTORY_SEPARATOR ) : string
$string string
$sep string
return string

unixToDos() public static method

Method to convert newlines from UNIX to DOS
public static unixToDos ( string $string ) : string
$string string
return string