本文整理汇总了PHP中XoopsLocale::asort方法的典型用法代码示例。如果您正苦于以下问题:PHP XoopsLocale::asort方法的具体用法?PHP XoopsLocale::asort怎么用?PHP XoopsLocale::asort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XoopsLocale
的用法示例。
在下文中一共展示了XoopsLocale::asort方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getList
/**
* Get a list of localized timezone names
*
* @return array
*/
public static function getList()
{
$xoops = \Xoops::getInstance();
$locale = \Xoops\Locale::getCurrent();
$key = ['system', 'lists', 'timezone', $locale];
//$xoops->cache()->delete($key);
$timeZones = $xoops->cache()->cacheRead($key, function () {
$timeZones = array();
$territories = Territory::getContinentsAndCountries();
$maxLen = 0;
$utcDtz = new \DateTimeZone('UTC');
foreach ($territories as $byContinent) {
$continent = $byContinent['name'];
foreach ($byContinent['children'] as $cCode => $cName) {
$allZones = $utcDtz->listIdentifiers(\DateTimeZone::PER_COUNTRY, $cCode);
foreach ($allZones as $zone) {
$maxLen = max(strlen($zone), $maxLen);
$name = Calendar::getTimezoneExemplarCity($zone);
if (!isset($timeZones[$zone]) && !empty($name)) {
$timeZones[$zone] = $continent . '/' . $name;
}
}
}
}
\XoopsLocale::asort($timeZones);
$default = array('UTC' => Calendar::getTimezoneNameNoLocationSpecific(new \DateTimeZone('GMT')));
$timeZones = array_merge($default, $timeZones);
return $timeZones;
});
return $timeZones;
}
示例2: getList
/**
* gets list of locales
*
* @param boolean $showInCodeLanguage true to show a code's name in the language the code represents
*
* @return array
*/
public static function getList($showInCodeLanguage = false)
{
$locales = Data::getAvailableLocales();
$languages = array();
foreach ($locales as $locale) {
$key = \Xoops\Locale::normalizeLocale($locale);
$languages[$key] = Language::getName($locale, $showInCodeLanguage ? $locale : null);
}
\XoopsLocale::asort($languages);
return $languages;
}
示例3: getList
/**
* gets list of image file names in a directory
*
* @param string $path filesystem path
* @param string $prefix prefix added to file names
*
* @return array
*/
public static function getList($path = null, $prefix = '')
{
$fileList = array();
if (is_dir($path) && ($handle = opendir($path))) {
while (false !== ($file = readdir($handle))) {
if (preg_match('/\\.(gif|jpg|jpeg|png|swf)$/i', $file)) {
$file = $prefix . $file;
$fileList[$file] = $file;
}
}
closedir($handle);
\XoopsLocale::asort($fileList);
reset($fileList);
}
return $fileList;
}
示例4: getList
/**
* Get a list of localized country names
*
* @return array
*/
public static function getList()
{
$countryList = Territory::getCountries();
\XoopsLocale::asort($countryList);
return $countryList;
}