本文整理汇总了PHP中Codes::languageCode2CountryCode方法的典型用法代码示例。如果您正苦于以下问题:PHP Codes::languageCode2CountryCode方法的具体用法?PHP Codes::languageCode2CountryCode怎么用?PHP Codes::languageCode2CountryCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Codes
的用法示例。
在下文中一共展示了Codes::languageCode2CountryCode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: uls_get_post_translation_id
$hasTranslation = uls_get_post_translation_id($postId, $value) !== false;
$grayClass = $hasTranslation ? '' : 'uls-grayscale';
}
// if the user load a specific img for a language load it and add its configuration
if (isset($new_img_file[$key]) && !empty($new_img_file[$key])) {
// get width and height from image loaded
list($width, $height) = getimagesize($new_img_file[$key]['file']);
// this rule is for div content "tab_flag"
$content_style = 'width:' . $width . 'px; height:' . $height . 'px;';
// create css rules
$new_style = '';
$new_style .= 'margin-right:5px;';
$new_style .= 'background-image: none;';
$new_style .= $content_style;
// create html tag for show this image
$tagHtml = ' <img src="' . $new_img_file[$key]['url'] . '" style="' . $new_style . '" class="flag_32x32 flag-' . Codes::languageCode2CountryCode($value) . '" alt="' . $value . '" title="' . $key . '" /> ';
}
?>
<div class="tab_flag <?php
echo $grayClass;
?>
" style="<?php
echo $content_style;
?>
"><?php
echo uls_get_link($postId, $value, $tagHtml);
?>
</div>
<?php
}
?>
示例2: create_table_available_language
static function create_table_available_language($options)
{
$languages = uls_get_available_languages(false);
// get the all languages available in the wp
$options = get_option('uls_settings');
// get information from DB
$available_language = isset($options['available_language']) ? $options['available_language'] : uls_get_available_languages(false);
// get the information that actually is in the DB
wp_enqueue_script('uls_languages_js', plugins_url('js/uls-languages-tap.js', __FILE__), array('jquery'));
?>
<table id="menu-locations-table" class="">
<thead>
<tr>
<th>Enable</th>
<th>Language</th>
<th>Frontend flag optional</th>
<th>Optional flag</th>
<th>Remove</th>
</tr>
</thead>
<tbody>
<?php
foreach ($languages as $lang_name => $lang_code) {
?>
<tr>
<?php
$checked = isset($available_language[$lang_name]) ? 'checked' : '';
?>
<td>
<input type="checkbox" name="uls_available_language[<?php
echo $lang_name;
?>
]" value="<?php
echo $lang_code;
?>
" <?php
echo $checked;
?>
/>
</td>
<td>
<!--img src="<?php
echo plugins_url("css/blank.gif", __FILE__);
?>
" style="margin-right:5px;" class="flag_16x11 flag-<?php
echo strtolower(substr($lang_code, -2));
?>
" alt="<?php
echo $lang_name;
?>
" title="<?php
echo $lang_name;
?>
" /-->
<img src="<?php
echo plugins_url("css/blank.gif", __FILE__);
?>
" style="margin-right:5px;" class="flag_16x11 flag-<?php
echo Codes::languageCode2CountryCode($lang_code);
?>
" alt="<?php
echo $lang_name;
?>
" title="<?php
echo $lang_name;
?>
" />
<span><?php
echo $lang_name;
?>
</span>
</td>
<td>
<input type="file" name="uls_available_language_new_flags[<?php
echo $lang_name;
?>
]" value="" title="<?php
echo __("the default dimension is 32x32 px, it is neccessary to keep the aesthetics");
?>
" />
</td>
<td>
<?php
if (isset($options['uls_available_language_new_flags']) && isset($options['uls_available_language_new_flags'][$lang_name])) {
?>
<img src="<?php
echo $options['uls_available_language_new_flags'][$lang_name]['url'];
?>
" class="optional_flag" alt="<?php
echo $lang_name;
?>
" title="<?php
echo $lang_name;
?>
" ></img>
<?php
}
?>
</td>
<td>
//.........这里部分代码省略.........
示例3: webilop_show_pages_columns
function webilop_show_pages_columns($name)
{
global $post;
$string = "";
switch ($name) {
case 'language':
$views = get_post_meta($post->ID, 'uls_language', true);
$printFlag = '<img src="' . plugins_url("css/blank.gif", __FILE__) . '"';
$printFlag .= 'style="margin-right:5px;"';
$printFlag .= 'class="flag_16x11 flag-' . Codes::languageCode2CountryCode($views) . '"';
$printFlag .= 'alt="' . $views . '" title="' . $views . '" />';
echo $printFlag;
break;
case 'translation':
$string = "";
$views = get_post_meta($post->ID);
foreach ($views as $key => $value) {
if (strpos($key, 'uls_translation_') !== false) {
$string[$key] = $value[0];
// get the ids to after get_post_meta with the uls_language
}
}
$views = get_post_meta($post->ID, 'uls_language', true);
if ($string != "") {
unset($string[$views]);
foreach ($string as $key => $value) {
$language_code = get_post_meta($value, 'uls_language', true);
$printFlag = '<a href="' . get_edit_post_link($value) . '">';
$printFlag .= '<img src="' . plugins_url("css/blank.gif", __FILE__) . '"';
$printFlag .= 'style="margin-right:5px;"';
$printFlag .= 'class="flag_16x11 flag-' . Codes::languageCode2CountryCode($language_code) . '"';
$printFlag .= 'alt="' . $views . '" title="' . $language_code . '" />';
$printFlag .= '</a>';
echo $printFlag;
}
} else {
echo $string;
}
break;
}
}