-
Notifications
You must be signed in to change notification settings - Fork 0
Home
The CharConverter is a Zend Framework plugin designed to convert special characters to ascii table, he can do with an easy way to convert a title for url (alias) for example.
The CharConverter is an extension of the Zend_Filter_Interface (Zend Framework) class implements some other tasks and / or features. When we think about the term "internationalization", we are faced with special characters such as accents, cedilla etc. And when we remove them? well, it serves to CharConverter and other things more.
-
setReplaceWhiteSpace This function is for you to specify any character you want to insert in place of the blank spaces between words.
-
getReplaceWhiteSpace Returns the character specified in the function setReplaceWhiteSpace or the default value "-".
-
setOnlyAlnum Arrow configuration for alphanumeric characters only return backquotes removing accents among others.
-
getOnlyAlnum Returns only alphanumeric characters accents removing backticks among others.
-
setLocale Sets the local language
-
getLocale Get the local language
-
setEncoding Sets the encoding type that you want to convert UTF-8, ISO-8859-1 etc.
-
getEncoding Get the encoding type that you want to convert UTF-8, ISO-8859-1 etc.
-
filter In this function you move the text you want to convert
##Examples
-
Passing parameter as array
$filter1 = new Zag_Filter_CharConvert(array( 'replaceWhiteSpace' => '-', 'locale' => 'en_US', 'charset'=> 'UTF-8' ));
echo $filter1->filter('ééé ááá 90');//eee-aaa-90 echo $filter1->filter('óóó 10aáééé');//ooo-10aaeee
-
Passing parameter as arguments
$filter2 = new Zag_Filter_CharConvert('UTF-8', 'en_US', '-'); echo $filter2->filter('éééé ááááá 90');//eeee-aaaaa-90
-
Using default behavior
$filter3 = new Zag_Filter_CharConvert(); echo $filter3->filter('éééé ááááá 90');//eeee aaaaa 90