当前位置: 首页>>代码示例>>PHP>>正文


PHP Doctrine_Inflector::unaccent方法代码示例

本文整理汇总了PHP中Doctrine_Inflector::unaccent方法的典型用法代码示例。如果您正苦于以下问题:PHP Doctrine_Inflector::unaccent方法的具体用法?PHP Doctrine_Inflector::unaccent怎么用?PHP Doctrine_Inflector::unaccent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Doctrine_Inflector的用法示例。


在下文中一共展示了Doctrine_Inflector::unaccent方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: slugify

 public static function slugify($text)
 {
     $text = Doctrine_Inflector::unaccent($text);
     // replace all non letters or digits by -
     $text = preg_replace('/\\W+/', '-', $text);
     // trim and lowercase
     $text = strtolower(trim($text, '-'));
     return $text;
     /**********************
     
         // Remove all non url friendly characters with the unaccent function
         $text = Doctrine_Inflector::unaccent($this->get('title'));
     
         if (function_exists('mb_strtolower')) {
           $text = mb_strtolower($text);
         } else {
           $text = strtolower($text);
         }
     
         // Remove all none word characters
         $text = preg_replace('/\W/', ' ', $text);
     
         // More stripping. Get rid of all non-alphanumeric.
         $text = strtolower(preg_replace('/[^A-Z^a-z^0-9^\/]+/', '', $text));
     
         return trim($text, '-');
     */
 }
开发者ID:Gula,项目名称:magic,代码行数:28,代码来源:magic.class.php

示例2: analyze

 public function analyze($text, $encoding = null)
 {
     static $stopwords;
     if (!isset($stopwords)) {
         $stopwords = array_flip(self::$_stopwords);
     }
     $text = preg_replace('/[\'`´"]/', '', $text);
     $text = Doctrine_Inflector::unaccent($text);
     $text = preg_replace('/[^A-Za-z0-9]/', ' ', $text);
     $text = str_replace('  ', ' ', $text);
     $terms = explode(' ', $text);
     $ret = array();
     if (!empty($terms)) {
         foreach ($terms as $i => $term) {
             if (empty($term)) {
                 continue;
             }
             $lower = strtolower(trim($term));
             if (isset($stopwords[$lower])) {
                 continue;
             }
             $ret[$i] = $lower;
         }
     }
     return $ret;
 }
开发者ID:sabaki-dev,项目名称:doctrine1,代码行数:26,代码来源:Standard.php

示例3: setQuery

 /**
  * @param  $_query
  * @return Kebab_Controller_Helper_Search
  */
 public function setQuery($_query)
 {
     $_query = strtolower(Doctrine_Inflector::unaccent($_query));
     if ($_query !== false && is_string($_query)) {
         $this->_query = '*' . $_query . '*';
     }
     return $this;
 }
开发者ID:esironal,项目名称:kebab-project,代码行数:12,代码来源:Search.php

示例4: getCleanedString

 /**
  * Return a string with html tags, special charecters and puctuation removed.
  *
  * @param  string $string
  * @return string
  */
 public static function getCleanedString($string)
 {
     $string = strip_tags($string);
     $string = preg_replace('/[\'`�"]/', '', $string);
     $string = Doctrine_Inflector::unaccent($string);
     $string = preg_replace('/[^A-Za-z0-9]/', ' ', $string);
     $string = preg_replace('/\\s\\s+/', ' ', trim($string));
     $string = strtolower($string);
     return $string;
 }
开发者ID:pierswarmers,项目名称:rtCorePlugin,代码行数:16,代码来源:rtIndexToolkit.class.php

示例5: urlize

 static function urlize($text)
 {
     // Remove all non url friendly characters with the unaccent function
     $text = Doctrine_Inflector::unaccent($text);
     $text = str_replace("'", "", $text);
     // Remove all none word characters
     $text = preg_replace('/\\W/', ' ', $text);
     // More stripping. Replace spaces with dashes
     $text = preg_replace('/[^A-Z^a-z^0-9^\\/]+/', '-', preg_replace('/([a-z\\d])([A-Z])/', '\\1_\\2', preg_replace('/([A-Z]+)([A-Z][a-z])/', '\\1_\\2', preg_replace('/::/', '/', $text))));
     return trim($text, '-');
 }
开发者ID:kbond,项目名称:zsUtilPlugin,代码行数:11,代码来源:zsTools.class.php

示例6: getSlugize

 public function getSlugize()
 {
     // Remove all non url friendly characters with the unaccent function
     $text = Doctrine_Inflector::unaccent($this->get('title'));
     if (function_exists('mb_strtolower')) {
         $text = mb_strtolower($text);
     } else {
         $text = strtolower($text);
     }
     // Remove all none word characters
     $text = preg_replace('/\\W/', ' ', $text);
     // More stripping. Get rid of all non-alphanumeric.
     $text = strtolower(preg_replace('/[^A-Z^a-z^0-9^\\/]+/', '', $text));
     return trim($text, '-');
 }
开发者ID:Gula,项目名称:magic,代码行数:15,代码来源:Page.class.php

示例7: analyze

 public function analyze($text)
 {
     $text = preg_replace('/[\'`´"]/', '', $text);
     $text = Doctrine_Inflector::unaccent($text);
     $text = preg_replace('/[^A-Za-z0-9]/', ' ', $text);
     $text = str_replace('  ', ' ', $text);
     $terms = explode(' ', $text);
     $ret = array();
     if (!empty($terms)) {
         foreach ($terms as $i => $term) {
             if (empty($term)) {
                 continue;
             }
             $lower = strtolower(trim($term));
             if (in_array($lower, self::$_stopwords)) {
                 continue;
             }
             $ret[$i] = $lower;
         }
     }
     return $ret;
 }
开发者ID:googlecode-mirror,项目名称:orso,代码行数:22,代码来源:Standard.php


注:本文中的Doctrine_Inflector::unaccent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。