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


PHP AppLocale::getLocalePrecedence方法代码示例

本文整理汇总了PHP中AppLocale::getLocalePrecedence方法的典型用法代码示例。如果您正苦于以下问题:PHP AppLocale::getLocalePrecedence方法的具体用法?PHP AppLocale::getLocalePrecedence怎么用?PHP AppLocale::getLocalePrecedence使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AppLocale的用法示例。


在下文中一共展示了AppLocale::getLocalePrecedence方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: foreach

 /**
  * Get a piece of data for this object, localized to the current
  * locale if possible.
  * @param $key string
  * @return mixed
  */
 function &getLocalizedData($key)
 {
     $localePrecedence = AppLocale::getLocalePrecedence();
     foreach ($localePrecedence as $locale) {
         $value =& $this->getData($key, $locale);
         if (!empty($value)) {
             return $value;
         }
         unset($value);
     }
     // Fallback: Get the first available piece of data.
     $data =& $this->getData($key, null);
     if (is_string($data)) {
         return $data;
     } else {
         if (is_array($data)) {
             // WARNING: Collapsing the following into a single line causes PHP 5.0.5 to die.
             $locales = array_keys($data);
             $firstLocale = array_shift($locales);
             return $data[$firstLocale];
         }
     }
     // No data available; return null.
     unset($data);
     $data = null;
     return $data;
 }
开发者ID:farhanabbas1983,项目名称:ojs-1,代码行数:33,代码来源:DataObject.inc.php

示例2: foreach

 function &getLocalizedData($key)
 {
     $localePrecedence = AppLocale::getLocalePrecedence();
     foreach ($localePrecedence as $locale) {
         $value =& $this->getData($key, $locale);
         if (!empty($value)) {
             return $value;
         }
         unset($value);
     }
     // Fallback: Get the first available piece of data.
     $data =& $this->getData($key, null);
     if (!empty($data)) {
         return $data[array_shift(array_keys($data))];
     }
     // No data available; return null.
     unset($data);
     $data = null;
     return $data;
 }
开发者ID:sedici,项目名称:ocs,代码行数:20,代码来源:DataObject.inc.php

示例3: TemplateManager

 /**
  * Return an instance of the template manager.
  * @param $request PKPRequest FIXME: is optional for backwards compatibility only - make mandatory
  * @return TemplateManager the template manager object
  */
 function &getManager($request = null)
 {
     $instance =& Registry::get('templateManager', true, null);
     if ($instance === null) {
         $instance = new TemplateManager($request);
     }
     $supportedLocales = AppLocale::getSupportedLocales();
     $instance->assign('supportedLocales', $supportedLocales);
     $instance->assign('localePrecedence', AppLocale::getLocalePrecedence());
     $instance->assign('requestedPage', Request::getRequestedPage());
     $instance->assign('requestedOp', Request::getRequestedOp());
     $conference =& Request::getConference();
     if (isset($conference)) {
         $instance->assign('conferenceId', $conference->getId());
         $instance->assign('isConferenceManager', Validation::isConferenceManager($conference->getId()));
         $instance->assign('analyticsTrackingID', $conference->getSetting('analyticsTrackingID'));
         $schedConf =& Request::getSchedConf();
         if (isset($schedConf)) {
             $instance->assign('isDirector', Validation::isDirector($conference->getId(), $schedConf->getId()));
             $instance->assign('isTrackDirector', Validation::isTrackDirector($conference->getId(), $schedConf->getId()));
             $instance->assign('isAuthor', Validation::isAuthor($conference->getId(), $schedConf->getId()));
             $registrationDao =& DAORegistry::getDAO('RegistrationDAO');
             $user = Request::getUser();
             if (isset($user)) {
                 $instance->assign('isRegistrationUser', $registrationDao->isValidRegistrationByUser($user->getUserId(), $schedConf->getId()));
             }
         }
     }
     AppLocale::requireComponents(array(LOCALE_COMPONENT_OCS_MANAGER, LOCALE_COMPONENT_OCS_ADMIN, LOCALE_COMPONENT_OCS_DIRECTOR, LOCALE_COMPONENT_PKP_MANAGER, LOCALE_COMPONENT_PKP_SUBMISSION));
     // FIXME: For timeline constants
     return $instance;
 }
开发者ID:pulipulichen,项目名称:ocs,代码行数:37,代码来源:PKPTemplateManager.inc.php

示例4: getLocalizedCopyrightHolder

 /**
  * Get the localized copyright holder for this article.
  */
 function getLocalizedCopyrightHolder()
 {
     $copyrightHolders = (array) $this->getCopyrightHolder(null);
     foreach (AppLocale::getLocalePrecedence() as $locale) {
         if (isset($copyrightHolders[$locale])) {
             return $copyrightHolders[$locale];
         }
     }
     // Fallback: return anything available
     return array_shift($copyrightHolders);
 }
开发者ID:jasonzou,项目名称:OJS-2.4.6,代码行数:14,代码来源:Article.inc.php


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