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


PHP Language::getActiveLanguages方法代码示例

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


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

示例1: getInfo

 /**
  * Get info about the site.
  *
  * @return array
  */
 public static function getInfo()
 {
     if (BaseAPI::isAuthorized()) {
         $info = array();
         // get all languages
         $languages = Language::getActiveLanguages();
         $default = Model::get('fork.settings')->get('Core', 'default_language', SITE_DEFAULT_LANGUAGE);
         // loop languages
         foreach ($languages as $language) {
             // create array
             $var = array();
             // set attributes
             $var['language']['@attributes']['language'] = $language;
             if ($language == $default) {
                 $var['language']['@attributes']['is_default'] = 'true';
             }
             // set attributes
             $var['language']['title'] = Model::get('fork.settings')->get('Core', 'site_title_' . $language);
             $var['language']['url'] = SITE_URL . '/' . $language;
             // add
             $info['languages'][] = $var;
         }
         return $info;
     }
 }
开发者ID:newaltcoin,项目名称:forkcms,代码行数:30,代码来源:Api.php

示例2: checkForGroups

 /**
  * Checks if any groups are made yet. Depending on the client that is linked to Fork, it will
  * create default groups if none were found in CampaignMonitor. If they were, the user is
  * presented with an overview to import all groups and their subscribers in Fork.
  */
 private function checkForGroups()
 {
     // groups are already set
     if ($this->get('fork.settings')->get('Mailmotor', 'cm_groups_set')) {
         return false;
     }
     // no CM data found
     if (!BackendMailmotorCMHelper::checkAccount()) {
         return false;
     }
     // check if there are external groups present in CampaignMonitor
     if ($this->checkForExternalGroups()) {
         $this->redirect(BackendModel::createURLForAction('ImportGroups', 'Mailmotor'));
     }
     // fetch the default groups, language abbreviation is the array key
     $groups = BackendMailmotorModel::getDefaultGroups();
     // loop languages
     foreach (BL::getActiveLanguages() as $language) {
         // this language does not have a default group set
         if (!isset($groups[$language])) {
             // set group record
             $group['name'] = 'Website (' . strtoupper($language) . ')';
             $group['language'] = $language;
             $group['is_default'] = 'Y';
             $group['created_on'] = date('Y-m-d H:i:s');
             try {
                 // insert the group in CampaignMonitor
                 BackendMailmotorCMHelper::insertGroup($group);
             } catch (\CampaignMonitorException $e) {
                 // ignore
             }
         }
     }
     // we have groups set, and default groups chosen
     $this->get('fork.settings')->set('Mailmotor', 'cm_groups_set', true);
     $this->get('fork.settings')->set('Mailmotor', 'cm_groups_defaults_set', true);
 }
开发者ID:newaltcoin,项目名称:forkcms,代码行数:42,代码来源:Config.php

示例3: installModule

 /**
  * Install a module.
  *
  * @param string $module   The name of the module to be installed.
  */
 public static function installModule($module)
 {
     $class = 'Backend\\Modules\\' . $module . '\\Installer\\Installer';
     $variables = array();
     // run installer
     $installer = new $class(BackendModel::getContainer()->get('database'), BL::getActiveLanguages(), array_keys(BL::getInterfaceLanguages()), false, $variables);
     $installer->install();
     // clear the cache so locale (and so much more) gets rebuilt
     self::clearCache();
 }
开发者ID:newaltcoin,项目名称:forkcms,代码行数:15,代码来源:Model.php

示例4: getLanguagesForCheckboxes

 /**
  * Get all active languages in a format acceptable for SpoonForm::addRadioButton() and SpoonForm::addMultiCheckbox()
  *
  * @return array
  */
 public static function getLanguagesForCheckboxes()
 {
     // get the active languages
     $languages = BL::getActiveLanguages();
     // no languages found
     if (empty($languages)) {
         return array();
     }
     // init results
     $results = array();
     // loop the languages
     foreach ($languages as $abbreviation) {
         // build new value
         $results[] = array('value' => $abbreviation, 'label' => BL::lbl(strtoupper($abbreviation)));
     }
     return $results;
 }
开发者ID:newaltcoin,项目名称:forkcms,代码行数:22,代码来源:Model.php


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