Exemple #1
0
 /**
  * Converts a sting to a normalized (no-spaces, non-letters) string
  *
  * @param string $strSubject	original string
  * @return string				normalized string
  */
 public static function normalize($strSubject)
 {
     $strNormalized = iconv('UTF-8', 'ASCII//TRANSLIT', $strSubject);
     // this is influenced by the setlocale() call with category LC_CTYPE; see PopulateDatabases.php
     $strNormalized = Xerxes_Framework_Parser::strtolower($strNormalized);
     $strNormalized = str_replace("&", "", $strNormalized);
     $strNormalized = str_replace("'", "", $strNormalized);
     $strNormalized = str_replace("+", "-", $strNormalized);
     $strNormalized = str_replace(" ", "-", $strNormalized);
     $strNormalized = Xerxes_Framework_Parser::preg_replace('/\\W/', "-", $strNormalized);
     while (strstr($strNormalized, "--")) {
         $strNormalized = str_replace("--", "-", $strNormalized);
     }
     return $strNormalized;
 }