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


PHP ZLanguage::countryMap方法代码示例

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


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

示例1: smarty_function_get_country_name_for_country_code

/**
 * Zikula_View function to get a country name from a given country name.
 *
 * Available parameters:
 *   - assign:   If set, the results are assigned to the corresponding variable instead of printed out
 *   - code:     Country code to get the corresponding name for
 *
 * Example
 *   {get_country_name_for_country_code  code=ZZ}
 *
 * @param array       $params All attributes passed to this function from the template.
 * @param Zikula_View $view   Reference to the Zikula_View object.
 *
 * @return string The value of the last status message posted, or void if no status message exists.
 */
function smarty_function_get_country_name_for_country_code($params, Zikula_View $view)
{
    $code = strtolower(isset($params['code']) ? $params['code'] : 'ZZ');
    $assign = isset($params['assign']) ? $params['assign'] : null;
    $countries = ZLanguage::countryMap();
    if (isset($countries[$code])) {
        $result = $countries[$code];
    } else {
        $result = $countries['ZZ'];
    }
    if ($assign) {
        $view->assign($assign, $result);
    } else {
        return $result;
    }
}
开发者ID:rmaiwald,项目名称:core,代码行数:31,代码来源:function.get_country_name_for_country_code.php

示例2: getSelector_Countries

 /**
  * Return the HTML for the country selector.
  *
  * @param string  $name          The name of the generated selector (default='countries') (optional).
  * @param string  $selectedValue The value which is currently selected (default='') (optional).
  * @param string  $defaultValue  The default value to select (default='') (optional).
  * @param string  $defaultText   The text for the default value (default='') (optional).
  * @param integer $allValue      The value to assign for the "All" choice (optional) (default=0).
  * @param string  $allText       The text to display for the "All" choice (optional) (default='').
  * @param boolean $submit        Whether or not to auto-submit the selector.
  * @param boolean $disabled      Whether or not to disable selector (optional) (default=false).
  * @param integer $multipleSize  The size to use for a multiple selector, 1 produces a normal/single selector (optional (default=1).
  *
  * @return The generated HTML for the selector.
  */
 public static function getSelector_Countries($name = 'countries', $selectedValue = '', $defaultValue = 0, $defaultText = '', $allValue = 0, $allText = '', $submit = false, $disabled = false, $multipleSize = 1)
 {
     $countries = ZLanguage::countryMap();
     asort($countries);
     return self::getSelector_Generic($name, $countries, $selectedValue, $defaultValue, $defaultText, $allValue, $allText, $submit, $disabled, $multipleSize);
 }
开发者ID:rtznprmpftl,项目名称:Zikulacore,代码行数:21,代码来源:HtmlUtil.php

示例3: isValidCountry

 /**
  * Checks if string field value is a valid country code.
  *
  * @param string  $fieldName     The name of the property to be checked
  * @return boolean result of this check
  */
 public function isValidCountry($fieldName)
 {
     $countryMap = ZLanguage::countryMap();
     return in_array($this->entity[$fieldName], array_keys($countryMap));
 }
开发者ID:rmaiwald,项目名称:MUBoard,代码行数:11,代码来源:Validator.php


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