本文整理匯總了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;
}