本文整理汇总了PHP中TranslateUtils::normaliseKey方法的典型用法代码示例。如果您正苦于以下问题:PHP TranslateUtils::normaliseKey方法的具体用法?PHP TranslateUtils::normaliseKey怎么用?PHP TranslateUtils::normaliseKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TranslateUtils
的用法示例。
在下文中一共展示了TranslateUtils::normaliseKey方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkAndAdd
/**
* @param $hugearray array
* @param $g
* @param $ignore bool
*/
protected function checkAndAdd(&$hugearray, $g, $ignore = false)
{
if ($g instanceof MessageGroupBase) {
$cache = new MessageGroupCache($g);
if ($cache->exists()) {
$keys = $cache->getKeys();
} else {
$keys = array_keys($g->getDefinitions());
}
} else {
$messages = $g->getDefinitions();
if (!is_array($messages)) {
return;
}
$keys = array_keys($messages);
}
$id = $g->getId();
STDOUT("{$id} ", 'main');
$namespace = $g->getNamespace();
foreach ($keys as $key) {
# Force all keys to lower case, because the case doesn't matter and it is
# easier to do comparing when the case of first letter is unknown, because
# mediawiki forces it to upper case
$key = TranslateUtils::normaliseKey($namespace, $key);
if (isset($hugearray[$key])) {
if (!$ignore) {
$to = implode(', ', (array) $hugearray[$key]);
STDERR("Key {$key} already belongs to {$to}, conflict with {$id}");
}
if (is_array($hugearray[$key])) {
// Hard work is already done, just add a new reference
$hugearray[$key][] =& $id;
} else {
// Store the actual reference, then remove it from array, to not
// replace the references value, but to store a array of new
// references instead. References are hard!
$value =& $hugearray[$key];
unset($hugearray[$key]);
$hugearray[$key] = array(&$value, &$id);
}
} else {
$hugearray[$key] =& $id;
}
}
unset($id);
// Disconnect the previous references to this $id
}