當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ca_locales::getErrors方法代碼示例

本文整理匯總了PHP中ca_locales::getErrors方法的典型用法代碼示例。如果您正苦於以下問題:PHP ca_locales::getErrors方法的具體用法?PHP ca_locales::getErrors怎麽用?PHP ca_locales::getErrors使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ca_locales的用法示例。


在下文中一共展示了ca_locales::getErrors方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: processLocales

 public function processLocales()
 {
     require_once __CA_MODELS_DIR__ . "/ca_locales.php";
     $t_locale = new ca_locales();
     $t_locale->setMode(ACCESS_WRITE);
     // Find any existing locales
     $va_locales = $t_locale->getLocaleList(array('index_by_code' => true));
     foreach ($va_locales as $vs_code => $va_locale) {
         $this->opa_locales[$vs_code] = $va_locale['locale_id'];
     }
     if ($this->ops_base_name) {
         $va_locales = array();
         foreach ($this->opo_profile->locales->children() as $vo_locale) {
             $va_locales[] = $vo_locale;
         }
         foreach ($this->opo_base->locales->children() as $vo_locale) {
             $va_locales[] = $vo_locale;
         }
     } else {
         $va_locales = $this->opo_profile->locales->children();
     }
     foreach ($va_locales as $vo_locale) {
         $vs_language = self::getAttribute($vo_locale, "lang");
         $vs_dialect = self::getAttribute($vo_locale, "dialect");
         $vs_country = self::getAttribute($vo_locale, "country");
         $vb_dont_use_for_cataloguing = self::getAttribute($vo_locale, "dontUseForCataloguing");
         if (isset($this->opa_locales[$vs_language . "_" . $vs_country])) {
             // don't insert duplicate locales
             continue;
         }
         $t_locale->set('name', (string) $vo_locale);
         $t_locale->set('country', $vs_country);
         $t_locale->set('language', $vs_language);
         if ($vs_dialect) {
             $t_locale->set('dialect', $vs_dialect);
         }
         $t_locale->set('dont_use_for_cataloguing', (bool) $vb_dont_use_for_cataloguing);
         $t_locale->insert();
         if ($t_locale->numErrors()) {
             $this->addError("There was an error while inserting locale {$vs_language}_{$vs_country}: " . join(" ", $t_locale->getErrors()));
         }
         $this->opa_locales[$vs_language . "_" . $vs_country] = $t_locale->getPrimaryKey();
     }
     $va_locales = $t_locale->getAppConfig()->getList('locale_defaults');
     $vn_locale_id = $t_locale->localeCodeToID($va_locales[0]);
     if (!$vn_locale_id) {
         throw new Exception("The locale default is set to a non-existing locale. Try adding '" . $va_locales[0] . "' to your profile.");
     }
     return true;
 }
開發者ID:idiscussforum,項目名稱:providence,代碼行數:50,代碼來源:Installer.php


注:本文中的ca_locales::getErrors方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。