Clean functions.php
This commit is contained in:
parent
ec33842949
commit
1c7c45ea56
3 changed files with 32 additions and 125 deletions
|
|
@ -20,29 +20,23 @@
|
|||
*/
|
||||
function smarty_modifier_url($string)
|
||||
{
|
||||
$string = trim($string);
|
||||
|
||||
if ( ctype_digit($string) )
|
||||
$string = trim($string);
|
||||
|
||||
if (!ctype_digit($string))
|
||||
{
|
||||
return $string;
|
||||
// replace accented chars
|
||||
$accents = '/&([A-Za-z]{1,2})(grave|acute|circ|cedil|uml|lig);/';
|
||||
$string_encoded = htmlentities($string,ENT_NOQUOTES,'UTF-8');
|
||||
|
||||
$string = preg_replace($accents, '$1', $string_encoded);
|
||||
|
||||
// clean out the rest
|
||||
$replace = array('([\40\'/])','([^a-zA-Z0-9-])','(-{2,})');
|
||||
$with = array('-','','-');
|
||||
$string = preg_replace($replace, $with, $string);
|
||||
}
|
||||
else
|
||||
{
|
||||
// replace accented chars
|
||||
$accents = '/&([A-Za-z]{1,2})(grave|acute|circ|cedil|uml|lig);/';
|
||||
$string_encoded = htmlentities($string,ENT_NOQUOTES,'UTF-8');
|
||||
|
||||
$string = preg_replace($accents,'$1',$string_encoded);
|
||||
|
||||
// clean out the rest
|
||||
$replace = array('([\40\'/])','([^a-zA-Z0-9-])','(-{2,})');
|
||||
$with = array('-','','-');
|
||||
$string = preg_replace($replace,$with,$string);
|
||||
}
|
||||
|
||||
return strtolower($string);
|
||||
|
||||
return strtolower($string);
|
||||
}
|
||||
|
||||
/* vim: set expandtab: */
|
||||
|
||||
?>
|
||||
Reference in a new issue