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


PHP ZLanguage::languageMap方法代码示例

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


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

示例1: smarty_function_html_select_languages

/**
 * Zikula_View function to display a drop down list of languages
 *
 * Available parameters:
 *   - assign:   If set, the results are assigned to the corresponding variable instead of printed out
 *   - name:     Name for the control
 *   - id:       ID for the control
 *   - selected: Selected value
 *   - installed: if set only show languages existing in languages folder
 *   - all:      show dummy entry '_ALL' on top of the list with empty value
 *
 * Example
 *   {html_select_languages name=language selected=en}
 *
 * @param array       $params All attributes passed to this function from the template.
 * @param Zikula_View $view   Reference to the Zikula_View object.
 *
 * @deprecated smarty_function_html_select_locales()
 * @return string The value of the last status message posted, or void if no status message exists.
 */
function smarty_function_html_select_languages($params, Zikula_View $view)
{
    if (!isset($params['name']) || empty($params['name'])) {
        $view->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('html_select_languages', 'name')));
        return false;
    }
    require_once $view->_get_plugin_filepath('function', 'html_options');
    $params['output'] = array();
    $params['values'] = array();
    if (isset($params['all']) && $params['all']) {
        $params['values'][] = '';
        $params['output'][] = DataUtil::formatForDisplay(__('All'));
        unset($params['all']);
    }
    if (isset($params['installed']) && $params['installed']) {
        $languagelist = ZLanguage::getInstalledLanguageNames();
        unset($params['installed']);
    } else {
        $languagelist = ZLanguage::languageMap();
    }
    $params['output'] = array_merge($params['output'], DataUtil::formatForDisplay(array_values($languagelist)));
    $params['values'] = array_merge($params['values'], DataUtil::formatForDisplay(array_keys($languagelist)));
    $assign = isset($params['assign']) ? $params['assign'] : null;
    unset($params['assign']);
    $html_result = smarty_function_html_options($params, $view);
    if (!empty($assign)) {
        $view->assign($assign, $html_result);
    } else {
        return $html_result;
    }
}
开发者ID:Silwereth,项目名称:core,代码行数:51,代码来源:function.html_select_languages.php

示例2: load

 /**
  * Load event handler.
  *
  * @param Zikula_Form_View $view Reference to Zikula_Form_View object.
  * @param array            &$params Parameters passed from the Smarty plugin function.
  *
  * @return void
  */
 public function load(Zikula_Form_View $view, &$params)
 {
     if ($this->mandatory) {
         $this->addItem('---', null);
     }
     if ($this->addAllOption) {
         $this->addItem(DataUtil::formatForDisplay(__('All')), '');
     }
     if ($this->onlyInstalledLanguages) {
         $langList = ZLanguage::getInstalledLanguageNames();
         foreach ($langList as $code => $name) {
             $this->addItem($name, $code);
         }
     } else {
         $langList = ZLanguage::languageMap();
         foreach ($langList as $code => $name) {
             $this->addItem($name, $code);
         }
     }
     parent::load($view, $params);
 }
开发者ID:Silwereth,项目名称:core,代码行数:29,代码来源:LanguageSelector.php

示例3: getAddLanguageSelectData

 public function getAddLanguageSelectData($all = false)
 {
     $languages_map = \ZLanguage::languageMap();
     if ($all) {
         return $languages_map;
     } else {
         return array_diff_key($languages_map, $this->installed);
     }
 }
开发者ID:Kaik,项目名称:ZikulaLanguagesModule,代码行数:9,代码来源:Languages.php

示例4: isValidLanguage

 /**
  * Checks if string field value is a valid language code.
  *
  * @param string  $fieldName     The name of the property to be checked
  * @param boolean $onlyInstalled Whether to accept only installed languages (default false)
  * @return boolean result of this check
  */
 public function isValidLanguage($fieldName, $onlyInstalled = false)
 {
     $languageMap = ZLanguage::languageMap();
     $result = in_array($this->entity[$fieldName], array_keys($languageMap));
     if (!$result || !$onlyInstalled) {
         return $result;
     }
     $available = ZLanguage::getInstalledLanguages();
     return in_array($this->entity[$fieldName], $available);
 }
开发者ID:rmaiwald,项目名称:MUBoard,代码行数:17,代码来源:Validator.php


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