當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。