/** * 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; }