Exemplo n.º 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;
 }
Exemplo n.º 2
0
 /**
  * @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;
 }
Exemplo n.º 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;
 }
Exemplo n.º 4
0
 /**
  * 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;
 }
Exemplo n.º 5
0
 /**
  * Generate FSS objects. The FSS extension must be available.
  */
 function generateFssObjects()
 {
     foreach ($this->mTables as $variant => $table) {
         $this->mFssObjects[$variant] = fss_prep_replace($table);
     }
 }