本文整理汇总了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;
}
}
示例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);
}
示例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));
}