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


PHP ca_locales::numErrors方法代码示例

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


在下文中一共展示了ca_locales::numErrors方法的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::numErrors方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。