本文整理汇总了PHP中eZURLAliasML::languageScore方法的典型用法代码示例。如果您正苦于以下问题:PHP eZURLAliasML::languageScore方法的具体用法?PHP eZURLAliasML::languageScore怎么用?PHP eZURLAliasML::languageScore使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZURLAliasML
的用法示例。
在下文中一共展示了eZURLAliasML::languageScore方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: choosePrioritizedRow
/**
* Chooses the most prioritized row (based on language) of $rows and returns it.
* @param array $rows
* @return array|false The most prioritized row, or false if no match was found
*/
public static function choosePrioritizedRow($rows)
{
$result = false;
$score = 0;
foreach ($rows as $row) {
if ($result) {
$newScore = eZURLAliasML::languageScore($row['lang_mask']);
if ($newScore > $score) {
$result = $row;
$score = $newScore;
}
} else {
$result = $row;
$score = eZURLAliasML::languageScore($row['lang_mask']);
}
}
// If score is still 0, this means that the objects languages don't
// match the INI settings, and these should be fix according to the doc.
if ($score == 0) {
eZDebug::writeWarning("None of the available languages are prioritized in the SiteLanguageList setting. An arbitrary language will be used.", __METHOD__);
}
return $result;
}