Gentics Portal.Node PHP API
 All Classes Namespaces Functions Variables Pages
Static Public Member Functions | List of all members
UrlTransliterate Class Reference

Static Public Member Functions

static cleanString ($string, $separator= '-', $cleanPunctuation=TRUE, $cleanSlash=TRUE)
static cleanSeparators ($string, $separator=NULL, $toLowCase=TRUE)
static punctuationChars ()
static i18nToAscII ()

Detailed Description

Definition at line 2 of file UrlTransliterate.php.

Member Function Documentation

static UrlTransliterate::cleanSeparators (   $string,
  $separator = NULL,
  $toLowCase = TRUE 
)
static

Clean path separators from a given string.

Trims duplicates and strips leading and trailing separators.

Parameters
$stringThe string to clean path separators from.
$separatorThe path separator to use when cleaning.
Returns
The cleaned version of the string.
See Also
pathauto_cleanstring()
pathauto_clean_alias()

Definition at line 79 of file UrlTransliterate.php.

{
$output = $string;
// Clean duplicate or trailing separators.
if (isset($separator) && strlen($separator))
{
// Escape the separator.
$seppattern = preg_quote($separator, '/');
// Trim any leading or trailing separators.
$output = preg_replace("/^$seppattern+|$seppattern+$/", '', $output);
// Replace trailing separators around slashes.
$output = preg_replace("/$seppattern+\/|\/$seppattern+/", "/", $output);
// Replace multiple separators with a single one.
$output = preg_replace("/$seppattern+/", $separator, $output);
}
// Optionally convert to lower case.
if ($toLowCase)
{
$output = strtolower($output);
}
return $output;
}
static UrlTransliterate::punctuationChars ( )
static

Return an array of arrays for punctuation values.

Returns an array of arrays for punctuation values keyed by a name, including the value and a textual description. Can and should be expanded to include "all" non text punctuation values.

Returns
An array of arrays for punctuation values keyed by a name, including the value and a textual description.

Definition at line 119 of file UrlTransliterate.php.

{
// Handle " ' ` , . - _ : ; | { [ } ] + = * & % ^ $ # @ ! ~ ( ) ? < > \
return array(
"double_quotes"=>'"',
"quotes"=>"'",
"backtick"=>"`",
"comma"=>",",
"period"=>".",
"hyphen"=>"-",
"underscore"=>"_",
"colon"=>":",
"semicolon"=>";",
"pipe"=>"|",
"left_curly"=>"{",
"left_square"=>"[",
"right_curly"=>"}",
"right_square"=>"]",
"plus"=>"+",
"equal"=>"=",
"asterisk"=>"*",
"ampersand"=>"&",
"percent"=>"%",
"caret"=>"^",
"dollar"=>"$",
"hash"=>"#",
"at"=>"@",
"exclamation"=>"!",
"tilde"=>"~",
"left_parenthesis"=>"(",
"right_parenthesis"=>")",
"question_mark"=>"?",
"less_than"=>"<",
"greater_than"=>">",
"back_slash"=>'\\',
);
}

The documentation for this class was generated from the following file: