本文整理汇总了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, '-');
*/
}
示例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;
}
示例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;
}
示例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;
}
示例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, '-');
}
示例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, '-');
}
示例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;
}