API16:JFilterOutput/stringURLUnicodeSlug
From Joomla! Documentation
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.
Contents |
Description
This method implements unicode slugs instead of transliteration.
Description:JFilterOutput/stringURLUnicodeSlug
Syntax
stringURLUnicodeSlug($string)
| Parameter Name | Default Value | Description |
|---|---|---|
| $string | $input String to process |
Returns
string Processed string
Defined in
libraries/joomla/filter/filteroutput.php
Importing
jimport( 'joomla.filter.filteroutput' );
Source Body
function stringURLUnicodeSlug($string) { //replace double byte whitespaces by single byte (Far-East languages) $str = preg_replace('/\xE3\x80\x80/', ' ', $string); // remove any '-' from the string as they will be used as concatenator. // Would be great to let the spaces in but only Firefox is friendly with this $str = str_replace('-', ' ', $str); // replace forbidden characters by whitespaces $str = preg_replace( '#[:\#\*"@+=;!&%()\]\/\'\\\\|\[]#',"\x20", $str ); //delete all '?' $str = str_replace('?', '', $str); //trim white spaces at beginning and end of alias $str = trim( $str ); // remove any duplicate whitespace and replace whitespaces by hyphens $str =preg_replace('#\x20+#','-', $str); return $str; }
[Edit See Also] SeeAlso:JFilterOutput/stringURLUnicodeSlug
Examples
<CodeExamplesForm />
