當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。