本文整理汇总了PHP中wpml_home_url_ls_hide_check函数的典型用法代码示例。如果您正苦于以下问题:PHP wpml_home_url_ls_hide_check函数的具体用法?PHP wpml_home_url_ls_hide_check怎么用?PHP wpml_home_url_ls_hide_check使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wpml_home_url_ls_hide_check函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: widget
/**
* Outputs the content of the widget
*
* @param array $args
* @param array $instance
*/
public function widget($args, $instance)
{
if (function_exists('wpml_home_url_ls_hide_check') && wpml_home_url_ls_hide_check()) {
return;
}
language_selector_widget($args);
}
示例2: toolset_starter_lang_switcher
/** Hook function */
function toolset_starter_lang_switcher($items, $args)
{
$multilingual = false;
$languages = '';
//Check if we are on multilingual mode
$languages = apply_filters('wpml_active_languages', NULL, array('skip_missing' => 0));
if (!empty($languages) && is_array($languages)) {
//multilingual
global $sitepress_settings;
$multilingual = true;
}
//Let's retrieved languages
if ($multilingual) {
if (empty($languages)) {
//We have empty languages.
//Test for backward compatibility with older WPML versions where active languages API is not yet defined
if (function_exists('icl_get_languages')) {
$languages = icl_get_languages('skip_missing=0');
}
}
//Languages set, implies WPML is active
global $is_lang_selector_dropdown;
if (!empty($sitepress_settings['display_ls_in_menu']) && (!function_exists('wpml_home_url_ls_hide_check') || !wpml_home_url_ls_hide_check()) && $is_lang_selector_dropdown) {
/** We want to display our customized lang switcher ONLY if
/* WPML -> Languages -> Language switcher options -> Language switcher in the WP Menu -> Display the language switcher in the WP Menu is checked
*/
/** TOOLSET STARTER 1.3.4: Add the customized lang switcher to the correct menu set in 'Display the language switcher in the WP Menu' */
/** START */
//Get the menu for WPML language switcher
$menu_match = false;
if (isset($sitepress_settings['menu_for_ls'])) {
$menu_for_ls = $sitepress_settings['menu_for_ls'];
$menu_for_ls = intval($menu_for_ls);
if ($menu_for_ls > 0) {
//menu defined, get the menu slug corresponding this ID
$menu_details = get_term($menu_for_ls, 'nav_menu');
$menu_for_ls_slug_setting = $menu_details->slug;
if (isset($args->menu->slug)) {
$menu_slug_under_process = $args->menu->slug;
if ($menu_slug_under_process == $menu_for_ls_slug_setting) {
$menu_match = true;
}
}
}
}
/** END */
if (1 < count($languages) && $menu_match) {
$ll_flag = $languages[ICL_LANGUAGE_CODE]['country_flag_url'];
$ll_url = $languages[ICL_LANGUAGE_CODE]['url'];
$ll_code = $languages[ICL_LANGUAGE_CODE]['language_code'];
$ll_nname = $languages[ICL_LANGUAGE_CODE]['native_name'];
$ll_tname = $languages[ICL_LANGUAGE_CODE]['translated_name'];
//Flag content
//Check if flags are enabled
$flags_enabled = false;
if (isset($sitepress_settings['icl_lso_flags'])) {
$flag_setting = $sitepress_settings['icl_lso_flags'];
if ($flag_setting) {
$flags_enabled = true;
}
}
//Language name in display language
$lang_name_disp_language_enabled = false;
if (isset($sitepress_settings['icl_lso_display_lang'])) {
$icl_lso_display_lang_setting = $sitepress_settings['icl_lso_display_lang'];
if ($icl_lso_display_lang_setting) {
$lang_name_disp_language_enabled = true;
}
}
//Native language name
$native_lang_name_enabled = false;
if (isset($sitepress_settings['icl_lso_native_lang'])) {
$icl_lso_native_lang_setting = $sitepress_settings['icl_lso_native_lang'];
if ($icl_lso_native_lang_setting) {
$native_lang_name_enabled = true;
}
}
$flag_content_main = '';
if ($flags_enabled) {
$flag_content_main = '<img src="' . $ll_flag . '" height="12" alt="' . $ll_code . '" width="18" />';
}
$native_lang_main = '';
if ($native_lang_name_enabled) {
$native_lang_main = $ll_nname;
}
$show_parenthesis = true;
if (!$native_lang_name_enabled) {
//Native lang off, don't show parenthesis
$show_parenthesis = false;
}
$open_parenthesis = '';
$close_parenthesis = '';
if ($show_parenthesis) {
$open_parenthesis = '(';
$close_parenthesis = ')';
}
$lang_name_display_lang_main = '';
if ($lang_name_disp_language_enabled) {
$lang_name_display_lang_main = $open_parenthesis . $ll_tname . $close_parenthesis;
//.........这里部分代码省略.........
示例3: 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->footer_preview ? icl_get_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'];
if ($sitepress->get_setting('icl_lso_native_lang')) {
$lang_native_hidden = false;
} else {
$lang_native_hidden = true;
}
$lang_translated = $lang['translated_name'];
if ($sitepress->get_setting('icl_lso_display_lang')) {
$lang_translated_hidden = false;
} else {
$lang_translated_hidden = true;
}
} 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;
}
示例4: get_language_selector
function get_language_selector()
{
if (!function_exists('wpml_home_url_ls_hide_check') || !wpml_home_url_ls_hide_check()) {
// Mobile or auto
$type = $this->settings['icl_lang_sel_type'];
$mobile = $this->settings['icl_lang_sel_stype'] === 'mobile' || ($type === 'mobile' || $type === 'mobile-auto' && (!empty($this->is_tablet) || !empty($this->is_mobile)));
global $icl_language_switcher_preview;
if (!$mobile && ($type === 'list' || $icl_language_switcher_preview)) {
global $icl_language_switcher;
$icl_language_switcher->widget_list();
}
return $mobile === true ? $this->get_mobile_language_selector() : (!$icl_language_switcher_preview && $type === 'list' ? '' : $this->get_desktop_language_selector());
} else {
return '';
}
}
示例5:
<?php
/*
* DEPRECATED FILE!
*
* please use $sitepress->get_desktop_language_selector() instead of including this file.
*/
if (function_exists('wpml_home_url_ls_hide_check') && wpml_home_url_ls_hide_check()) {
return;
}
global $w_this_lang;
if ($w_this_lang['code'] == 'all') {
$main_language['native_name'] = __('All languages', 'sitepress');
}
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'];
if ($this->settings['icl_lso_flags'] || $icl_language_switcher_preview) {
$flag = $this->get_flag($w_this_lang['code']);
if ($flag->from_template) {
$wp_upload_dir = wp_upload_dir();
$main_language['country_flag_url'] = $wp_upload_dir['baseurl'] . '/flags/' . $flag->flag;
} else {
$main_language['country_flag_url'] = ICL_PLUGIN_URL . '/res/flags/' . $flag->flag;
}
}
}
?>
<div id="lang_sel"<?php
if ($this->settings['icl_lang_sel_type'] == 'list') {
示例6:
<?php
/*
* DEPRECATED FILE!
*
* please use $sitepress->get_desktop_language_selector() instead of including this file.
*/
global $sitepress;
if ($sitepress === null || function_exists('wpml_home_url_ls_hide_check') && wpml_home_url_ls_hide_check()) {
return;
}
echo $sitepress->get_desktop_language_selector();
示例7: language_selector_footer
function language_selector_footer()
{
global $sitepress;
if (function_exists('wpml_home_url_ls_hide_check') && wpml_home_url_ls_hide_check()) {
return;
}
$languages = $this->footer_preview ? icl_get_languages() : $sitepress->get_ls_languages();
if (!empty($languages)) {
echo '
<div id="lang_sel_footer">
<ul>
';
foreach ($languages as $lang) {
$alt_title_lang = $this->settings['icl_lso_display_lang'] ? esc_attr($lang['translated_name']) : esc_attr($lang['native_name']);
echo ' <li>';
echo '<a href="' . apply_filters('WPML_filter_link', $lang['url'], $lang) . '"';
if ($lang['active']) {
echo ' class="lang_sel_sel"';
}
echo '>';
if ($this->settings['icl_lso_flags'] || $this->footer_preview) {
echo '<img src="' . $lang['country_flag_url'] . '" alt="' . $alt_title_lang . '" class="iclflag" title="' . $alt_title_lang . '" ';
}
if (!$this->settings['icl_lso_flags'] && $this->footer_preview) {
echo ' style="display:none;"';
}
if ($this->settings['icl_lso_flags'] || $this->footer_preview) {
echo ' /> ';
}
//if(!$l['active']) echo '</a>';
//if(!$l['active']) echo '<a href="'.$l['url'].'">';
if ($this->footer_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;
}
$lang_native_hidden = false;
$lang_translated_hidden = false;
}
echo icl_disp_language($lang_native, $lang_translated, $lang_native_hidden, $lang_translated_hidden);
//echo icl_disp_language( $this->settings['icl_lso_native_lang'] ? $l['native_name'] : null, $this->settings['icl_lso_display_lang'] ? $l['translated_name'] : null );
//if(!$l['active']) echo '</a>';
echo '</a>';
echo '</li>
';
}
echo '</ul>
</div>';
}
}