本文整理汇总了PHP中URLify::language方法的典型用法代码示例。如果您正苦于以下问题:PHP URLify::language方法的具体用法?PHP URLify::language怎么用?PHP URLify::language使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类URLify
的用法示例。
在下文中一共展示了URLify::language方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
/**
* 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: init
/**
* 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;
}