本文整理汇总了PHP中icl_disp_language函数的典型用法代码示例。如果您正苦于以下问题:PHP icl_disp_language函数的具体用法?PHP icl_disp_language怎么用?PHP icl_disp_language使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了icl_disp_language函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mbdmaster_languages_list
function mbdmaster_languages_list()
{
if (function_exists(icl_get_languages)) {
$languages = icl_get_languages('skip_missing=0&orderby=code');
if (!empty($languages)) {
echo '<div id="language-selector"><ul>';
foreach ($languages as $l) {
if (!$l['active']) {
echo '<li class="active">';
} else {
echo '<li class="inactive">';
}
if (!$l['active']) {
echo '<a href="' . $l['url'] . '">';
}
echo icl_disp_language($l['native_name'], $l['translated_name']);
if (!$l['active']) {
echo '</a>';
}
echo '</li>';
}
echo '</ul></div>';
}
}
}
示例2: display_language_menu_accordion
function display_language_menu_accordion()
{
$menu = "";
$languages = icl_get_languages('skip_missing=0&orderby=code');
if (!empty($languages)) {
$menu .= '<div class="ui inverted accordion">';
$menu .= '<div class="active title">';
$menu .= '<i class="dropdown icon"></i>';
$menu .= __('Languages', 'sage');
$menu .= '<i class="translate icon"></i>';
$menu .= '</div>';
$menu .= '<div class="active content">';
foreach ($languages as $l) {
if (!$l['active']) {
$menu .= "<a class=\"item\" href=\"" . $l['url'] . "\">";
$menu .= icl_disp_language($l['native_name'], $l['translated_name']);
$menu .= '</a>';
} else {
$menu .= "<a class=\"item\" href=\"#\">";
$menu .= icl_disp_language($l['native_name'], $l['translated_name']);
$menu .= '</a>';
}
}
$menu .= "</div>";
$menu .= "</div>";
}
echo $menu;
}
示例3: add_language_switcher
function add_language_switcher($items, $args)
{
if ($args->theme_location == 'main') {
$languages = icl_get_languages('skip_missing=0&orderby=code');
if (!empty($languages)) {
foreach ($languages as $l) {
$li = '<li class="language">';
if ($l['country_flag_url']) {
if (!$l['active']) {
$li .= '<a href="' . $l['url'] . '">';
$li .= icl_disp_language($l['native_name']);
$li .= '</a>';
}
$li .= '</li>';
}
}
}
$items .= $li;
}
return $items;
}
示例4: icl_disp_language
} else {
$lang_translated_hidden = true;
}
} else {
if ($this->settings['icl_lso_native_lang']) {
$lang_native = $lang['native_name'];
} else {
$lang_native = false;
}
if ($this->settings['icl_lso_display_lang']) {
$lang_translated = $lang['translated_name'];
} else {
$lang_translated = false;
}
}
echo icl_disp_language($lang_native, $lang_translated, $lang_native_hidden, $lang_translated_hidden);
?>
</a>
</li>
<?php
}
?>
</ul>
<?php
if (isset($ie_ver) && $ie_ver <= 6) {
?>
</td></tr></table></a><?php
}
?>
<?php
示例5: get_desktop_language_selector
function get_desktop_language_selector()
{
$active_languages = $this->get_ls_languages();
if ($active_languages) {
/**
* @var $main_language bool|string
* @used_by menu/language-selector.php
*/
foreach ($active_languages as $k => $al) {
if ($al['active'] == 1) {
unset($active_languages[$k]);
break;
}
}
} else {
return '';
}
global $w_this_lang;
global $icl_language_switcher_preview;
if ($w_this_lang['code'] == 'all') {
$main_language['native_name'] = __('All languages', 'sitepress');
$main_language['translated_name'] = $main_language['native_name'];
$main_language['language_code'] = 'all';
}
if (empty($main_language)) {
$main_language['native_name'] = $w_this_lang['display_name'];
$main_language['translated_name'] = $w_this_lang['display_name'];
$main_language['language_code'] = $w_this_lang['code'];
}
$style_display_none_icl_lang_sel_type = $this->settings['icl_lang_sel_type'] == 'list' ? ' style="display:none;"' : '';
$class_icl_rtl = $this->is_rtl() ? 'class="icl_rtl"' : '';
$language_selector = '<div id="lang_sel" ' . $style_display_none_icl_lang_sel_type . ' ' . $class_icl_rtl . ' >
<ul>
<li><a href="#" class="lang_sel_sel icl-' . $w_this_lang['code'] . '">';
if ($this->settings['icl_lso_flags'] || $icl_language_switcher_preview) {
$flag = $this->get_flag($w_this_lang['code']);
if (isset($flag->from_template) && $flag->from_template && isset($flag->flag)) {
$wp_upload_dir = wp_upload_dir();
$main_language['country_flag_url'] = $wp_upload_dir['baseurl'] . '/flags/' . $flag->flag;
} else {
if (isset($flag->flag)) {
$main_language['country_flag_url'] = ICL_PLUGIN_URL . '/res/flags/' . $flag->flag;
} else {
$main_language['country_flag_url'] = ICL_PLUGIN_URL . '/res/img/icon16.png';
}
}
$language_selector .= '<img ' . (!$this->settings['icl_lso_flags'] ? 'style="display:none"' : '') . ' class="iclflag" ' . 'src="' . $main_language['country_flag_url'] . '" ' . 'alt="' . $main_language['language_code'] . '" ' . 'title="' . ($this->settings['icl_lso_display_lang'] ? esc_attr($main_language['translated_name']) : esc_attr($main_language['native_name'])) . '" />
';
}
if ($icl_language_switcher_preview) {
$lang_native = $main_language['native_name'];
if ($this->settings['icl_lso_native_lang']) {
$lang_native_hidden = false;
} else {
$lang_native_hidden = true;
}
$lang_translated = $main_language['translated_name'];
if ($this->settings['icl_lso_display_lang']) {
$lang_translated_hidden = false;
} else {
$lang_translated_hidden = true;
}
} else {
if ($this->settings['icl_lso_native_lang']) {
$lang_native = $main_language['native_name'];
} else {
$lang_native = false;
}
if ($this->settings['icl_lso_display_lang']) {
$lang_translated = $main_language['translated_name'];
} else {
$lang_translated = false;
}
$lang_native_hidden = false;
$lang_translated_hidden = false;
}
$language_selector .= icl_disp_language($lang_native, $lang_translated, $lang_native_hidden, $lang_translated_hidden);
if (!isset($ie_ver) || $ie_ver > 6) {
$language_selector .= '</a> ';
}
if (!empty($active_languages)) {
if (isset($ie_ver) && $ie_ver <= 6) {
$language_selector .= '<table><tr><td>';
}
$language_selector .= '<ul>';
$active_languages_ordered = $this->order_languages($active_languages);
foreach ($active_languages_ordered as $lang) {
$language_selector .= '<li class="icl-' . $lang['language_code'] . '">
<a href="' . apply_filters('WPML_filter_link', $lang['url'], $lang) . '">';
if ($this->settings['icl_lso_flags'] || $icl_language_switcher_preview) {
$language_selector .= '<img ' . (!$this->settings['icl_lso_flags'] ? 'style="display:none"' : '') . ' class="iclflag" ' . 'src="' . $lang['country_flag_url'] . '" ' . 'alt="' . $lang['language_code'] . '" ' . 'title="' . ($this->settings['icl_lso_display_lang'] ? esc_attr($lang['translated_name']) : esc_attr($lang['native_name'])) . '" /> ';
}
if ($icl_language_switcher_preview) {
$lang_native = $lang['native_name'];
if ($this->settings['icl_lso_native_lang']) {
$lang_native_hidden = false;
} else {
$lang_native_hidden = true;
}
$lang_translated = $lang['translated_name'];
//.........这里部分代码省略.........
示例6: widget_list
function widget_list()
{
global $sitepress, $w_this_lang, $icl_language_switcher_preview;
if ($w_this_lang['code'] == 'all') {
$main_language['native_name'] = __('All languages', 'sitepress');
}
$active_languages = icl_get_languages('orderby=id&order=asc&skip_missing=0');
if (empty($active_languages)) {
return;
}
?>
<div id="lang_sel_list"<?php
if (empty($this->settings['icl_lang_sel_type']) || $this->settings['icl_lang_sel_type'] == 'dropdown') {
echo ' style="display:none;"';
}
?>
>
<ul>
<?php
foreach ($active_languages as $lang) {
?>
<li class="icl-<?php
echo $lang['language_code'];
?>
">
<a href="<?php
echo apply_filters('WPML_filter_link', $lang['url'], $lang);
?>
"<?php
if ($lang['language_code'] == $sitepress->get_current_language()) {
echo ' class="lang_sel_sel"';
} else {
echo ' class="lang_sel_other"';
}
?>
>
<?php
if ($this->settings['icl_lso_flags'] || $icl_language_switcher_preview) {
?>
<img <?php
if (!$this->settings['icl_lso_flags']) {
?>
style="display:none"<?php
}
?>
class="iclflag" src="<?php
echo $lang['country_flag_url'];
?>
" alt="<?php
echo $lang['language_code'];
?>
" />
<?php
}
?>
<?php
if ($icl_language_switcher_preview) {
$lang_native = $lang['native_name'];
if ($this->settings['icl_lso_native_lang']) {
$lang_native_hidden = false;
} else {
$lang_native_hidden = true;
}
$lang_translated = $lang['translated_name'];
if ($this->settings['icl_lso_display_lang']) {
$lang_translated_hidden = false;
} else {
$lang_translated_hidden = true;
}
} else {
if ($this->settings['icl_lso_native_lang']) {
$lang_native = $lang['native_name'];
} else {
$lang_native = false;
}
if ($this->settings['icl_lso_display_lang']) {
$lang_translated = $lang['translated_name'];
} else {
$lang_translated = false;
}
}
echo @icl_disp_language($lang_native, $lang_translated, $lang_native_hidden, $lang_translated_hidden);
?>
</a>
</li>
<?php
}
?>
</ul>
</div>
<?php
}
示例7: languages_list_header
function languages_list_header()
{
$languages = icl_get_languages('skip_missing=0&orderby=code');
$selector = "";
$separator = " | ";
if (!empty($languages)) {
foreach ($languages as $l) {
if (!$l['active']) {
$selector .= '<a href="' . $l['url'] . '">';
}
$selector .= icl_disp_language($l['native_name'], $l['translated_name']);
if (!$l['active']) {
$selector .= '</a>';
}
$selector .= $separator;
}
$selector = substr($selector, 0, -strlen($separator));
echo $selector;
}
}
示例8: icl_get_languages
?>
<?php
if (!empty($options_alice['global_menu_language_button']) && $options_alice['global_menu_language_button'] == 'enable') {
?>
<?php
if (class_exists('SitePress')) {
if (function_exists('icl_get_languages')) {
$languages = icl_get_languages('skip_missing=0&orderby=code');
if (!empty($languages)) {
echo '<div id="az_header_language_list">';
foreach ($languages as $l) {
echo '<span class="lang">';
if (!$l['active']) {
echo '<a href="' . $l['url'] . '">';
}
echo icl_disp_language($l['language_code'], 0);
if (!$l['active']) {
echo '</a>';
}
echo '</span>';
}
echo '</div>';
}
}
}
?>
<?php
}
?>
</div>
<!-- End Search/Share Menu -->
示例9: render_ls_li_item
public function render_ls_li_item($lang, $lang_native_hidden = false, $lang_translated_hidden = false, $language_selected = "")
{
global $icl_language_switcher_preview;
$country_flag_url = $lang['country_flag_url'];
$language_url = apply_filters('WPML_filter_link', $lang['url'], $lang);
$language_flag_title = $this->settings['icl_lso_display_lang'] ? esc_attr($lang['translated_name']) : esc_attr($lang['native_name']);
$ls_settings = $this->get_ls_settings($lang, $lang_native_hidden, $lang_translated_hidden);
if (is_wp_error($language_url)) {
return '';
}
$language_selector = '<li class="icl-' . $lang['language_code'] . '"><a href="' . $language_url . '" ' . $language_selected . '>';
if ($this->settings['icl_lso_flags'] || $icl_language_switcher_preview) {
$language_selector .= '<img ' . (!$this->settings['icl_lso_flags'] ? 'style="display:none"' : '') . ' class="iclflag" ' . 'src="' . $country_flag_url . '" ' . 'alt="' . $lang['language_code'] . '" ' . 'title="' . $language_flag_title . '" /> ';
}
$ls_settings = $this->get_ls_settings($lang, $ls_settings['lang_native_hidden'], $ls_settings['lang_translated_hidden']);
$language_selector .= icl_disp_language($ls_settings['lang_native'], $ls_settings['lang_translated'], $ls_settings['lang_native_hidden'], $ls_settings['lang_translated_hidden']);
$language_selector .= '</a></li>';
return $language_selector;
}
示例10: porto_mobile_view_switcher
function porto_mobile_view_switcher()
{
global $porto_settings;
ob_start();
if (!$porto_settings['wpml-switcher'] && has_nav_menu('view_switcher')) {
wp_nav_menu(array('theme_location' => 'view_switcher', 'container' => '', 'menu_class' => 'view-switcher accordion-menu show-arrow', 'before' => '', 'after' => '', 'depth' => 2, 'link_before' => '', 'link_after' => '', 'fallback_cb' => false, 'walker' => new porto_accordion_navwalker()));
}
if ($porto_settings['wpml-switcher'] && function_exists('icl_get_languages')) {
$languages = icl_get_languages('skip_missing=0&orderby=code');
if (!empty($languages)) {
$active_lang = '';
$other_langs = '';
foreach ($languages as $l) {
if (!$l['active']) {
$other_langs .= '<li class="menu-item"><a href="' . esc_url($l['url']) . '">';
}
if ($l['country_flag_url']) {
if ($l['active']) {
$active_lang .= '<span class="flag"><img src="' . esc_url($l['country_flag_url']) . '" height="12" alt="' . esc_attr($l['language_code']) . '" width="18" /></span>';
} else {
$other_langs .= '<span class="flag"><img src="' . esc_url($l['country_flag_url']) . '" height="12" alt="' . esc_attr($l['language_code']) . '" width="18" /></span>';
}
}
if ($l['active']) {
$active_lang .= icl_disp_language($l['native_name'], $l['translated_name']);
} else {
$other_langs .= icl_disp_language($l['native_name'], $l['translated_name']);
}
if (!$l['active']) {
$other_langs .= '</a></li>';
}
}
?>
<ul id="menu-view-switcher" class="view-switcher accordion-menu show-arrow">
<li class="menu-item<?php
if ($other_langs) {
echo ' has-sub';
}
?>
narrow">
<h5><?php
echo $active_lang;
?>
</h5>
<?php
if ($other_langs) {
?>
<span class="arrow"></span>
<ul class="sub-menu">
<?php
echo $other_langs;
?>
</ul>
<?php
}
?>
</li>
</ul>
<?php
}
}
return apply_filters('porto_mobile_view_switcher', str_replace(' ', '', ob_get_clean()));
}
示例11: language_selector_footer
function language_selector_footer()
{
if ($this->settings['footer_skip_languages'] == 'checked') {
$this->settings['footer_skip_languages'] = 1;
}
$skip = is_singular() ? intval($this->settings['footer_skip_languages']) : 0;
$languages = icl_get_languages('skip_missing=' . $skip);
if (!empty($languages)) {
global $sitepress_settings;
echo '
<div id="icl_lang_selector_footer">
<ul>
';
foreach ($languages as $l) {
echo '<li>';
if (!$l['active']) {
echo '<a href="' . $l['url'] . '">';
}
if ($sitepress_settings['icl_lso_flags']) {
echo '<img src="' . $l['country_flag_url'] . '" alt="' . $l['language_code'] . '" /> ';
}
if (!$l['active']) {
echo '</a>';
}
if (!$l['active']) {
echo '<a href="' . $l['url'] . '">';
}
echo icl_disp_language($sitepress_settings['icl_lso_native_lang'] ? $l['native_name'] : null, $sitepress_settings['icl_lso_display_lang'] ? $l['translated_name'] : null);
if (!$l['active']) {
echo '</a>';
}
echo '</li>
';
}
echo '
</ul>
</div>';
}
}
示例12: get_language_selector_footer
static function get_language_selector_footer()
{
global $sitepress;
$language_selector_footer = '';
$languages = array();
if (!function_exists('wpml_home_url_ls_hide_check') || !wpml_home_url_ls_hide_check()) {
$languages = $sitepress->get_ls_languages();
}
if (!empty($languages)) {
$language_selector_footer = '
<div id="lang_sel_footer">
<ul>
';
foreach ($languages as $lang) {
$alt_title_lang = $sitepress->get_setting('icl_lso_display_lang') ? esc_attr($lang['translated_name']) : esc_attr($lang['native_name']);
$language_selector_footer .= ' <li>';
$language_selector_footer .= '<a href="' . apply_filters('WPML_filter_link', $lang['url'], $lang) . '"';
if ($lang['active']) {
$language_selector_footer .= ' class="lang_sel_sel"';
}
$language_selector_footer .= '>';
if ($sitepress->get_setting('icl_lso_flags') || $sitepress->footer_preview) {
$language_selector_footer .= '<img src="' . $lang['country_flag_url'] . '" alt="' . $alt_title_lang . '" class="iclflag" title="' . $alt_title_lang . '" ';
}
if (!$sitepress->get_setting('icl_lso_flags') && $sitepress->footer_preview) {
$language_selector_footer .= ' style="display:none;"';
}
if ($sitepress->get_setting('icl_lso_flags') || $sitepress->footer_preview) {
$language_selector_footer .= ' /> ';
}
if ($sitepress->footer_preview) {
$lang_native = $lang['native_name'];
$lang_native_hidden = false;
$lang_translated = $lang['translated_name'];
$lang_translated_hidden = false;
} else {
if ($sitepress->get_setting('icl_lso_native_lang')) {
$lang_native = $lang['native_name'];
} else {
$lang_native = false;
}
if ($sitepress->get_setting('icl_lso_display_lang')) {
$lang_translated = $lang['translated_name'];
} else {
$lang_translated = false;
}
$lang_native_hidden = false;
$lang_translated_hidden = false;
}
$language_selector_footer .= icl_disp_language($lang_native, $lang_translated, $lang_native_hidden, $lang_translated_hidden);
$language_selector_footer .= '</a>';
$language_selector_footer .= '</li>
';
}
$language_selector_footer .= '</ul>
</div>';
}
return $language_selector_footer;
}
示例13: languages_list_header
function languages_list_header()
{
//cf. http://wpml.org/documentation/getting-started-guide/language-setup/custom-language-switcher/
$languages = icl_get_languages('skip_missing=0&orderby=code');
if (!empty($languages)) {
echo '<div id="header_language_list"><ul>';
foreach ($languages as $l) {
$class = $l['active'] ? 'class="active"' : '';
echo '<li ' . $class . '>';
if (!$l['active']) {
echo '<a href="' . $l['url'] . '">';
}
//echo icl_disp_language($l['native_name'], $l['translated_name']);
echo icl_disp_language($l['language_code'], '');
if (!$l['active']) {
echo '</a>';
}
echo '</li>';
}
echo '</ul></div>';
}
}
示例14: icl_get_languages
if (!empty($options_alice['global_menu_search_button']) && $options_alice['global_menu_search_button'] == 'enable') {
$search_btn = '<li><a class="menu-search open-modal-search"><i class="font-icon-search"></i></a></li>';
}
// Language Switcher
if (!empty($options_alice['global_menu_language_button']) && $options_alice['global_menu_language_button'] == 'enable') {
if (class_exists('SitePress')) {
if (function_exists('icl_get_languages')) {
$languages = icl_get_languages('skip_missing=0&orderby=code');
if (!empty($languages)) {
$lang_switch .= '<li class="lang_switch"><div id="az_header_language_list">';
foreach ($languages as $l) {
$lang_switch .= '<span class="lang">';
if (!$l['active']) {
$lang_switch .= '<a href="' . $l['url'] . '">';
}
$lang_switch .= icl_disp_language($l['language_code'], 0);
if (!$l['active']) {
$lang_switch .= '</a>';
}
$lang_switch .= '</span>';
}
$lang_switch .= '</div></li>';
}
}
}
}
}
?>
<!-- Start Menu Panel -->
<nav class="mm-classic-panel">