当前位置: 首页>>代码示例>>PHP>>正文


PHP XoopsLocale::asort方法代码示例

本文整理汇总了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;
 }
开发者ID:ming-hai,项目名称:XoopsCore,代码行数:36,代码来源:TimeZone.php

示例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;
 }
开发者ID:elitet,项目名称:XoopsCore,代码行数:18,代码来源:Locale.php

示例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;
 }
开发者ID:ming-hai,项目名称:XoopsCore,代码行数:24,代码来源:ImageFile.php

示例4: getList

 /**
  * Get a list of localized country names
  *
  * @return array
  */
 public static function getList()
 {
     $countryList = Territory::getCountries();
     \XoopsLocale::asort($countryList);
     return $countryList;
 }
开发者ID:ming-hai,项目名称:XoopsCore,代码行数:11,代码来源:Country.php


注:本文中的XoopsLocale::asort方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。