Пример #1
0
 /**
  * Initializes the character map.
  */
 private static function init($language = "")
 {
     if (count(self::$map) > 0 && ($language == "" || $language == self::$language)) {
         return;
     }
     /* Is a specific map associated with $language ? */
     if (isset(self::$maps[$language]) && is_array(self::$maps[$language])) {
         /* Move this map to end. This means it will have priority over others */
         $m = self::$maps[$language];
         unset(self::$maps[$language]);
         self::$maps[$language] = $m;
         /* Reset static vars */
         self::$language = $language;
         self::$map = array();
         self::$chars = '';
         self::$regex = '';
     }
     foreach (self::$maps as $map) {
         foreach ($map as $orig => $conv) {
             self::$map[$orig] = $conv;
             self::$chars .= $orig;
         }
     }
     self::$regex = '/[' . self::$chars . ']/u';
 }
Пример #2
0
 /**
  * Initializes the character map.
  */
 private static function init()
 {
     if (count(self::$map) > 0) {
         return;
     }
     foreach (self::$maps as $map) {
         foreach ($map as $orig => $conv) {
             self::$map[$orig] = $conv;
             self::$chars .= $orig;
         }
     }
     self::$regex = '/[' . self::$chars . ']/u';
 }
Пример #3
0
 /**
  * Initializes the character map.
  *
  * @param string $language
  *
  * @return bool
  */
 private static function init($language = 'de')
 {
     // check if lang is set
     if (!$language) {
         return false;
     }
     // check if we already created the regex for this lang
     if (count(self::$map) > 0 && $language == self::$language) {
         return true;
     }
     // is a specific map associated with $language?
     if (isset(self::$maps[$language]) && is_array(self::$maps[$language])) {
         // move this map to end. This means it will have priority over others
         $m = self::$maps[$language];
         unset(self::$maps[$language]);
         self::$maps[$language] = $m;
     }
     // reset static vars
     self::$language = $language;
     self::$map = array();
     self::$chars = '';
     foreach (self::$maps as $map) {
         foreach ($map as $orig => $conv) {
             self::$map[$orig] = $conv;
             self::$chars .= $orig;
         }
     }
     self::$regex = '/[' . self::$chars . ']/u';
     return true;
 }