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