API16

Difference between revisions of "JFilterOutput/stringURLUnicodeSlug"

From Joomla! Documentation

< API16:JFilterOutput
(New page: ===Description=== This method implements unicode slugs instead of transliteration. <span class="editsection" style="font-size:76%;"> <nowiki>[</nowiki>[[Description:JFilterOutput/stri...)
 
m (removing red link to edit, no existant pages)
Line 3: Line 3:
  
 
<span class="editsection" style="font-size:76%;">
 
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>[[Description:JFilterOutput/stringURLUnicodeSlug|Edit Descripton]]<nowiki>]</nowiki>
+
<nowiki>[<! removed edit link to red link >]</nowiki>
 
</span>
 
</span>
  
{{Description:JFilterOutput/stringURLUnicodeSlug}}
+
<! removed transcluded page call, red link never existed >
  
 
===Syntax===
 
===Syntax===
Line 59: Line 59:
  
 
<span class="editsection" style="font-size:76%;">
 
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>[[SeeAlso:JFilterOutput/stringURLUnicodeSlug|Edit See Also]]<nowiki>]</nowiki>
+
<nowiki>[<! removed edit link to red link >]</nowiki>
 
</span>
 
</span>
{{SeeAlso:JFilterOutput/stringURLUnicodeSlug}}
+
<! removed transcluded page call, red link never existed >
  
 
===Examples===
 
===Examples===
Line 74: Line 74:
 
  format= ,,,
 
  format= ,,,
 
</dpl>
 
</dpl>
 +
[[Category:Archived pages API16]]

Revision as of 21:51, 13 May 2013

The "API16" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.

Description[edit]

This method implements unicode slugs instead of transliteration.

[<! removed edit link to red link >]

<! removed transcluded page call, red link never existed >

Syntax[edit]

stringURLUnicodeSlug($string)
Parameter Name Default Value Description
$string $input String to process

Returns[edit]

string Processed string

Defined in[edit]

libraries/joomla/filter/filteroutput.php

Importing[edit]

jimport( 'joomla.filter.filteroutput' );

Source Body[edit]

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;
}

[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >

Examples[edit]

<CodeExamplesForm />