Exemple #1
0
 function replace($subject)
 {
     if (function_exists('fss_prep_replace')) {
         wfProfileIn(__METHOD__ . '-fss');
         if ($this->fss === false) {
             $this->fss = fss_prep_replace($this->data);
         }
         $result = fss_exec_replace($this->fss, $subject);
         wfProfileOut(__METHOD__ . '-fss');
     } else {
         wfProfileIn(__METHOD__ . '-strtr');
         $result = strtr($subject, $this->data);
         wfProfileOut(__METHOD__ . '-strtr');
     }
     return $result;
 }
 /**
  * @param string $subject
  * @return string
  */
 public function replace($subject)
 {
     if (function_exists('fss_prep_replace') && version_compare(PHP_VERSION, '5.5.0') < 0) {
         if ($this->fss === false) {
             $this->fss = fss_prep_replace($this->data);
         }
         $result = fss_exec_replace($this->fss, $subject);
     } else {
         $result = strtr($subject, $this->data);
     }
     return $result;
 }
Exemple #3
0
 /**
  * Unaccent
  */
 function _unaccent($str = '')
 {
     if (!common()->is_utf8($str)) {
         $str = utf8_encode($str);
     }
     if ($this->fss_exists && !$GLOBALS['force_strtr']) {
         if (!isset($GLOBALS['fss']['unaccent'])) {
             $s = array_merge($this->UTF8_UPPER_ACCENTS, $this->UTF8_LOWER_ACCENTS);
             $GLOBALS['fss']['unaccent'] = fss_prep_replace($s);
         }
         $str = fss_exec_replace($GLOBALS['fss']['unaccent'], $str);
         return $str;
     }
     $str = strtr($str, $this->UTF8_UPPER_ACCENTS);
     $str = strtr($str, $this->UTF8_LOWER_ACCENTS);
     return $str;
 }
 /**
  * Short description for 'replace'
  *
  * Long description (if any) ...
  *
  * @param      unknown $subject Parameter description (if any) ...
  * @return     unknown Return description (if any) ...
  */
 function replace($subject)
 {
     if (function_exists('fss_prep_replace')) {
         if ($this->fss === false) {
             $this->fss = fss_prep_replace($this->data);
         }
         $result = fss_exec_replace($this->fss, $subject);
     } else {
         $result = strtr($subject, $this->data);
     }
     return $result;
 }
 /**
  * Translate a string to a variant
  * Doesn't process markup or do any of that other stuff, for that use convert()
  *
  * @param string $text Text to convert
  * @param string $variant Variant language code
  * @return string Translated text
  */
 function translate($text, $variant)
 {
     if (!$this->mTablesLoaded) {
         $this->loadTables();
     }
     if ($this->mUseFss) {
         return fss_exec_replace($this->mFssObjects[$variant], $text);
     } else {
         return strtr($text, $this->mTables[$variant]);
     }
 }