本文整理汇总了PHP中qtranxf_flag_location函数的典型用法代码示例。如果您正苦于以下问题:PHP qtranxf_flag_location函数的具体用法?PHP qtranxf_flag_location怎么用?PHP qtranxf_flag_location使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了qtranxf_flag_location函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: qtranxf_front_header_css_default
function qtranxf_front_header_css_default()
{
global $q_config;
$flag_location = qtranxf_flag_location();
$css = '';
foreach ($q_config['enabled_languages'] as $lang) {
$css .= '.qtranxs_flag_' . $lang . ' {background-image: url(' . $flag_location . $q_config['flag'][$lang] . '); background-repeat: no-repeat;}' . PHP_EOL;
}
return $css;
}
示例2: qtranxf_add_language_menu_item
function qtranxf_add_language_menu_item(&$items, &$menu_order, &$itemid, $key, $language)
{
global $q_config;
//qtranxf_dbg_log('qtranxf_add_language_menu_item: $key: ',$key);
$item = $items[$key];
$flag_location = qtranxf_flag_location();
$altlang = null;
$url = '';
//options
$type = 'LM';
//[LM|AL]
$title = 'Language';
//[none|Language|Current]
$current = true;
//[shown|hidden]
$flags = true;
//[none|all|items]
$lang_names = true;
//names=[shown|hidden]
$colon = true;
//[shown|hidden]
$topflag = true;
$p = strpos($item->url, '?');
if ($p !== FALSE) {
$qs = substr($item->url, $p + 1);
$qs = str_replace('#', '', $qs);
$pars = array();
parse_str($qs, $pars);
if (isset($pars['type']) && stripos($pars['type'], 'AL') !== FALSE) {
$type = 'AL';
}
if (isset($pars['flags'])) {
$flags = stripos($pars['flags'], 'no') === FALSE;
if ($flags) {
$topflag = stripos($pars['flags'], 'items') === FALSE;
} else {
$topflag = false;
}
}
if (isset($pars['names'])) {
$lang_names = stripos($pars['names'], 'hid') === FALSE;
}
if (isset($pars['title'])) {
$title = $pars['title'];
if (stripos($pars['title'], 'no') !== FALSE) {
$title = '';
}
if (!$topflag && empty($title)) {
$title = 'Language';
}
}
if (isset($pars['colon'])) {
$colon = stripos($pars['colon'], 'hid') === FALSE;
}
if (isset($pars['current'])) {
$current = stripos($pars['current'], 'hid') === FALSE;
}
if (!$lang_names && !$flags) {
$flags = true;
}
}
if ($type == 'AL') {
foreach ($q_config['enabled_languages'] as $lang) {
if ($lang == $language) {
continue;
}
$toplang = $lang;
$altlang = $lang;
break;
}
$item->title = empty($title) ? '' : $q_config['language_name'][$toplang];
$item->url = qtranxf_convertURL($url, $altlang, false, true);
} else {
$toplang = $language;
if (empty($title)) {
$item->title = '';
} elseif (stripos($title, 'Current') !== FALSE) {
$item->title = $q_config['language_name'][$toplang];
} else {
$blocks = qtranxf_get_language_blocks($item->title);
if (count($blocks) <= 1) {
//no customization is done
$item->title = qtranxf_translate('Language');
} else {
$item->title = qtranxf_use_block($language, $blocks);
}
}
$item->url = '#';
//qtranxf_convertURL($url, $language, false, true);
}
if ($topflag) {
if (!empty($item->title)) {
if ($colon) {
$item->title .= _x(':', 'Colon after a title. For example, in top item of Language Menu.', 'qtranslate');
}
$item->title .= ' ';
}
$item->title .= '<img src="' . $flag_location . $q_config['flag'][$toplang] . '" alt="' . $q_config['language_name'][$toplang] . '" />';
//.' '.__('Flag', 'qtranslate')
}
//.........这里部分代码省略.........
示例3: qtranxf_conf
//.........这里部分代码省略.........
</div>
<?php
} else {
?>
<div class="wrap">
<h2><?php
_e('Language Management (qTranslate Configuration)', 'qtranslate');
?>
</h2>
<small><?php
printf(__('For help on how to configure qTranslate correctly, take a look at the <a href="%1$s">qTranslate FAQ</a> and the <a href="%2$s">Support Forum</a>.', 'qtranslate'), 'https://qtranslatexteam.wordpress.com/faq/', 'https://wordpress.org/support/plugin/qtranslate-x');
?>
</small>
<form action="<?php
echo $clean_uri;
?>
" method="post">
<?php
qtranxf_admin_section_start(__('General Settings', 'qtranslate'), 'general');
//id="qtranslate-admin-general"
?>
<table class="form-table">
<tr>
<th scope="row"><?php
_e('Default Language / Order', 'qtranslate');
?>
</th>
<td>
<fieldset id="qtranxs-languages-menu"><legend class="hidden"><?php
_e('Default Language', 'qtranslate');
?>
</legend>
<?php
$flag_location = qtranxf_flag_location();
foreach (qtranxf_getSortedLanguages() as $key => $language) {
echo '<label title="' . $q_config['language_name'][$language] . '"><input type="radio" name="default_language" value="' . $language . '"';
checked($language, $q_config['default_language']);
echo ' />';
echo ' <a href="' . add_query_arg('moveup', $language, $clean_uri) . '"><img src="' . $pluginurl . '/arrowup.png" alt="up" /></a>';
echo ' <a href="' . add_query_arg('movedown', $language, $clean_uri) . '"><img src="' . $pluginurl . '/arrowdown.png" alt="down" /></a>';
echo ' <img src="' . $flag_location . $q_config['flag'][$language] . '" alt="' . $q_config['language_name'][$language] . '" /> ';
echo ' ' . $q_config['language_name'][$language] . '</label><br/>' . PHP_EOL;
}
?>
<small><?php
printf(__('Choose the default language of your blog. This is the language which will be shown on %s. You can also change the order the languages by clicking on the arrows above.', 'qtranslate'), get_bloginfo('url'));
?>
</small>
</fieldset>
</td>
</tr>
<tr valign="top">
<th scope="row"><?php
_e('Untranslated Content', 'qtranslate');
?>
</th>
<td>
<p><?php
printf(__('The choices below define how to handle untranslated content at front-end of the site. A content of a page or a post is considered untranslated if the main text (%s) is empty for a given language, regardless of other fields like title, excerpt, etc. All three options are independent of each other.', 'qtranslate'), 'post_content');
?>
</p>
<br/>
<label for="hide_untranslated"><input type="checkbox" name="hide_untranslated" id="hide_untranslated" value="1"<?php
checked($q_config['hide_untranslated']);
?>
/> <?php
示例4: qtranxf_wp_get_nav_menu_items
function qtranxf_wp_get_nav_menu_items($items, $menu, $args)
{
global $q_config;
$language = $q_config['language'];
$flag_location = qtranxf_flag_location();
$itemid = 0;
$menu_order = 0;
$qtransmenu = null;
$altlang = null;
$url = '';
//options
$type = 'LM';
//[LM|AL]
$title = 'Language';
//[none|Language|Current]
$current = true;
//[shown|hidden]
$flags = true;
//[none|all|items]
$lang_names = true;
//names=[shown|hidden]
$colon = true;
//[shown|hidden]
$topflag = true;
$itemsmodified = false;
foreach ($items as $key => $item) {
//qtranxf_dbg_log('qtranxf_wp_get_nav_menu_items: $item->url: ',$item->url);
//qtranxf_dbg_log('qtranxf_wp_get_nav_menu_items: $item: ',$item);
//qtranxf_dbg_log('qtranxf_wp_get_nav_menu_items: item: '.$item->title.'; p='.$item->menu_item_parent.'; ID='.$item->ID);
$qtransLangSw = isset($item->url) && stristr($item->url, 'qtransLangSw') !== FALSE;
if (!$qtransLangSw) {
$item_title = qtranxf_use_language($language, $item->title, false, true);
if (empty($item_title)) {
//qtranxf_dbg_echo('removed item: '.$item->title.'; p='.$item->menu_item_parent);
unset($items[$key]);
//remove menu item with empty title for this language
$itemsmodified = true;
continue;
}
$item->title = $item_title;
if ($item->object == 'custom' && !empty($item->url)) {
if (strpos($item->url, 'setlang=no') === FALSE) {
$item->url = qtranxf_convertURL($item->url, $language);
} else {
$item->url = remove_query_arg('setlang', $item->url);
}
}
}
$item->post_content = qtranxf_use_language($language, $item->post_content, false, true);
$item->post_title = qtranxf_use_language($language, $item->post_title, false, true);
$item->post_excerpt = qtranxf_use_language($language, $item->post_excerpt, false, true);
$item->description = qtranxf_use_language($language, $item->description, false, true);
if (isset($item->attr_title)) {
$item->attr_title = qtranxf_use_language($language, $item->attr_title, false, true);
}
if ($itemid < $item->ID) {
$itemid = $item->ID;
}
if ($menu_order < $item->menu_order) {
$menu_order = $item->menu_order;
}
if (!$qtransLangSw) {
continue;
}
$p = strpos($item->url, '?');
if ($p !== FALSE) {
$qs = substr($item->url, $p + 1);
$qs = str_replace('#', '', $qs);
$pars = array();
parse_str($qs, $pars);
if (isset($pars['type']) && stripos($pars['type'], 'AL') !== FALSE) {
$type = 'AL';
}
if (isset($pars['flags'])) {
$flags = stripos($pars['flags'], 'no') === FALSE;
if ($flags) {
$topflag = stripos($pars['flags'], 'items') === FALSE;
} else {
$topflag = false;
}
}
if (isset($pars['names'])) {
$lang_names = stripos($pars['names'], 'hid') === FALSE;
}
if (isset($pars['title'])) {
$title = $pars['title'];
if (stripos($pars['title'], 'no') !== FALSE) {
$title = '';
}
if (!$topflag && empty($title)) {
$title = 'Language';
}
}
if (isset($pars['colon'])) {
$colon = stripos($pars['colon'], 'hid') === FALSE;
}
if (isset($pars['current'])) {
$current = stripos($pars['current'], 'hid') === FALSE;
}
if (!$lang_names && !$flags) {
//.........这里部分代码省略.........
示例5: qtranxf_generateLanguageSelectCode
/**
* Language Select Code for non-Widget users
* @args is a hash array of options, which accepts the following keys:
* ‘type’ – one of the values: ‘text’, ‘image’, ‘both’, ‘dropdown’ and ‘custom’, which match the choices on widget admin page.
* ‘format’ – needs to be provided if ‘type’ is ‘custom’. Read help text to this option on widget admin page.
* ‘id’ – id of widget, which is used as a distinctive string to create CSS entities.
* @since 3.4.5 type of argument is changed, compatibility with old way is preserved.
*/
function qtranxf_generateLanguageSelectCode($args = array(), $id = '')
{
global $q_config;
if (is_string($args)) {
$type = $args;
} elseif (is_bool($args) && $args) {
$type = 'image';
} elseif (is_array($args)) {
if (!empty($args['type'])) {
$type = $args['type'];
}
if (empty($id) && !empty($args['id'])) {
$id = $args['id'];
}
}
if (empty($type)) {
$type = 'text';
} else {
switch ($type) {
case 'text':
case 'image':
case 'both':
case 'short':
case 'css_only':
case 'custom':
case 'dropdown':
break;
default:
$type = 'text';
}
}
if (empty($id)) {
$id = 'qtranslate';
}
$id .= '-chooser';
if (is_404()) {
$url = get_option('home');
} else {
$url = '';
}
$flag_location = qtranxf_flag_location();
echo PHP_EOL . '<ul class="language-chooser language-chooser-' . $type . ' qtranxs_language_chooser" id="' . $id . '">' . PHP_EOL;
switch ($type) {
case 'image':
case 'text':
case 'css_only':
case 'dropdown':
foreach (qtranxf_getSortedLanguages() as $language) {
$alt = $q_config['language_name'][$language] . ' (' . $language . ')';
$classes = array('lang-' . $language);
if ($language == $q_config['language']) {
$classes[] = 'active';
}
echo '<li class="' . implode(' ', $classes) . '"><a href="' . qtranxf_convertURL($url, $language, false, true) . '"';
// set hreflang
echo ' hreflang="' . $language . '"';
echo ' title="' . $alt . '"';
if ($type == 'image') {
echo ' class="qtranxs_image qtranxs_image_' . $language . '"';
} elseif ($type == 'text') {
echo ' class="qtranxs_text qtranxs_text_' . $language . '"';
} elseif ($type == 'css_only') {
// to be removed
echo ' class="qtranxs_css qtranxs_css_' . $language . '"';
}
echo '>';
if ($type == 'image') {
echo '<img src="' . $flag_location . $q_config['flag'][$language] . '" alt="' . $alt . '" />';
}
echo '<span';
if ($type == 'image' || $type == 'css_only') {
echo ' style="display:none"';
}
echo '>' . $q_config['language_name'][$language] . '</span>';
echo '</a></li>' . PHP_EOL;
}
//echo '</ul><div class="qtranxs_widget_end"></div>'.PHP_EOL;
if ($type == 'dropdown') {
echo '<script type="text/javascript">' . PHP_EOL . '// <![CDATA[' . PHP_EOL;
echo "var lc = document.getElementById('" . $id . "');" . PHP_EOL;
echo "var s = document.createElement('select');" . PHP_EOL;
echo "s.id = 'qtranxs_select_" . $id . "';" . PHP_EOL;
echo "lc.parentNode.insertBefore(s,lc);" . PHP_EOL;
// create dropdown fields for each language
foreach (qtranxf_getSortedLanguages() as $language) {
echo qtranxf_insertDropDownElement($language, qtranxf_convertURL($url, $language, false, true), $id);
}
// hide html language chooser text
echo "s.onchange = function() { document.location.href = this.value;}" . PHP_EOL;
echo "lc.style.display='none';" . PHP_EOL;
echo '// ]]>' . PHP_EOL . '</script>' . PHP_EOL;
}
//.........这里部分代码省略.........
示例6: qtranxf_add_admin_lang_icons
function qtranxf_add_admin_lang_icons()
{
global $q_config;
$flag_location = qtranxf_flag_location();
echo '<style type="text/css">' . PHP_EOL;
echo "#wpadminbar #wp-admin-bar-language>div.ab-item{ background-size: 0;";
echo 'background-image: url(' . $flag_location . $q_config['flag'][$q_config['language']] . ');}' . PHP_EOL;
foreach ($q_config['enabled_languages'] as $language) {
echo '#wpadminbar ul li#wp-admin-bar-' . $language . ' {background-size: 0; background-image: url(' . $flag_location . $q_config['flag'][$language] . '); margin-right: 5px; }' . PHP_EOL;
}
echo '</style>' . PHP_EOL;
}
示例7: qtranxf_add_language_menu_item
function qtranxf_add_language_menu_item(&$items, &$menu_order, &$itemid, $key, $language)
{
global $q_config;
$item = $items[$key];
$flag_location = qtranxf_flag_location();
$altlang = null;
$url = '';
//options
$type = 'LM';
//[LM|AL]
$title = 'Language';
//[none|Language|Current]
$current = true;
//[shown|hidden]
$flags = true;
//[none|all|items]
$lang_names = true;
//names=[shown|hidden]
$colon = true;
//[shown|hidden]
$topflag = true;
$p = strpos($item->url, '?');
if ($p !== FALSE) {
$qs = substr($item->url, $p + 1);
$qs = str_replace('#', '', $qs);
$pars = array();
parse_str($qs, $pars);
if (isset($pars['type']) && stripos($pars['type'], 'AL') !== FALSE) {
$type = 'AL';
}
if (isset($pars['flags'])) {
$flags = stripos($pars['flags'], 'no') === FALSE;
if ($flags) {
$topflag = stripos($pars['flags'], 'items') === FALSE;
} else {
$topflag = false;
}
}
if (isset($pars['names'])) {
$lang_names = stripos($pars['names'], 'hid') === FALSE;
}
if (isset($pars['title'])) {
$title = $pars['title'];
if (stripos($pars['title'], 'no') !== FALSE) {
$title = '';
}
if (!$topflag && empty($title)) {
$title = 'Language';
}
}
if (isset($pars['colon'])) {
$colon = stripos($pars['colon'], 'hid') === FALSE;
}
if (isset($pars['current'])) {
$current = stripos($pars['current'], 'hid') === FALSE;
}
if (!$lang_names && !$flags) {
$flags = true;
}
}
if ($type == 'AL') {
foreach ($q_config['enabled_languages'] as $lang) {
if ($lang == $language) {
continue;
}
$toplang = $lang;
$altlang = $lang;
break;
}
$item->title = empty($title) ? '' : $q_config['language_name'][$toplang];
$item->url = qtranxf_convertURL($url, $altlang, false, true);
} else {
$toplang = $language;
if (empty($title)) {
$item->title = '';
} elseif (stripos($title, 'Current') !== FALSE) {
$item->title = $q_config['language_name'][$toplang];
} else {
$blocks = qtranxf_get_language_blocks($item->title);
if (count($blocks) <= 1) {
//no customization is done
$item->title = __('Language', 'qtranslate');
if ($item->title == 'Language') {
$item->title = qtranxf_translate_wp('Language');
}
} else {
$item->title = qtranxf_use_block($toplang, $blocks);
}
}
$item->url = null;
}
if ($topflag) {
if (!empty($item->title)) {
if ($colon) {
$item->title .= ':';
}
$item->title .= ' ';
}
$item->title .= '<img src="' . $flag_location . $q_config['flag'][$toplang] . '" alt="' . $q_config['language_name'][$toplang] . '" />';
//.' '.__('Flag', 'qtranslate')
//.........这里部分代码省略.........
示例8: qtranxf_add_admin_lang_icons
function qtranxf_add_admin_lang_icons()
{
global $q_config;
echo '<style type="text/css">' . PHP_EOL;
echo "#wpadminbar #wp-admin-bar-language>div.ab-item{ background-size: 0;";
echo "background-image: url(" . qtranxf_flag_location() . $q_config['flag'][$q_config['language']] . ");}\n";
foreach ($q_config['enabled_languages'] as $language) {
echo "#wpadminbar ul li#wp-admin-bar-" . $language . " {background-size: 0; background-image: url(" . qtranxf_flag_location() . $q_config['flag'][$language] . ");}\n";
}
echo '</style>' . PHP_EOL;
}
示例9: qtrans_copy_default_theme_option
/**
* from 1.1.7
*/
function qtrans_copy_default_theme_option()
{
if (!$this->check_qtrans) {
return;
}
global $q_config;
$locale_list = $q_config['locale'];
$option_name = 'option_tree';
if ($this->check_qtrans) {
$options = get_option($option_name);
//$st_plugin_list_lang = icl_get_languages('skip_missing=0&orderby=custom');
$st_plugin_list_lang = array();
$qtrans_list = qtranxf_getSortedLanguages();
$flags = qtranxf_language_configured('flag');
if (!empty($qtrans_list) and is_array($qtrans_list)) {
foreach ($qtrans_list as $key => $value) {
$lang_name = $q_config['language_name'][$value];
$array = array('id' => $key, 'active' => $value == $q_config['language'] ? 1 : 0, 'encode_url' => 0, 'default_locale' => $locale_list[$value], 'tag' => '', 'native_name' => $lang_name, 'language_code' => $value, 'translated_name' => $lang_name, 'url' => qtranxf_convertURL(admin_url(), $value, true, true), 'country_flag_url' => qtranxf_flag_location() . $flags[$value]);
$st_plugin_list_lang[$value] = $array;
}
}
if (is_array($st_plugin_list_lang) && !empty($st_plugin_list_lang)) {
foreach ($st_plugin_list_lang as $lang) {
$lang_option = get_option($option_name . '_' . $lang['language_code']);
if ($lang_option == '') {
update_option($option_name . '_' . $lang['language_code'], $options);
}
}
}
}
}
示例10: prepare_items
public function prepare_items()
{
global $q_config;
$flags = qtranxf_language_configured('flag');
$languages_stored = get_option('qtranslate_language_names', array());
$languages_predef = qtranxf_default_language_name();
$flag_location_url = qtranxf_flag_location();
$flag_location_dir = trailingslashit(WP_CONTENT_DIR) . $q_config['flag_location'];
$flag_location_url_def = content_url(qtranxf_flag_location_default());
//trailingslashit(content_url()).'/plugins/'.basename(dirname(QTRANSLATE_FILE)).'/flags/';
$clean_uri = $this->_clean_uri;
$data = array();
foreach ($this->_language_names as $lang => $language) {
if ($lang == 'code') {
continue;
}
$flag = $flags[$lang];
if (file_exists($flag_location_dir . $flag)) {
$flag_url = $flag_location_url . $flag;
} else {
$flag_url = $flag_location_url_def . $flag;
}
$data[] = array('code' => $lang, 'flag' => '<img src="' . $flag_url . '" alt="' . sprintf(__('%s Flag', 'qtranslate'), $language) . '">', 'name' => $language, 'action' => in_array($lang, $q_config['enabled_languages']) ? $q_config['default_language'] == $lang ? __('Default', 'qtranslate') : '<a class="edit" href="' . $clean_uri . '&disable=' . $lang . '#languages">' . __('Disable', 'qtranslate') . '</a>' : '<a class="edit" href="' . $clean_uri . '&enable=' . $lang . '#languages">' . __('Enable', 'qtranslate') . '</a>', 'edit' => '<a class="edit" href="' . $clean_uri . '&edit=' . $lang . '">' . __('Edit', 'qtranslate') . '</a>', 'stored' => !isset($languages_stored[$lang]) ? __('Pre-Defined', 'qtranslate') : '<a class="delete" href="' . $clean_uri . '&delete=' . $lang . '#languages">' . (isset($languages_predef[$lang]) ? __('Reset', 'qtranslate') : __('Delete', 'qtranslate')) . '</a>');
}
$this->items = $data;
}
示例11: prepare_items
public function prepare_items()
{
global $q_config;
if (isset($_GET['orderby'])) {
$this->_orderby = $_GET['orderby'];
} else {
$this->_orderby = $_GET['orderby'] = 'name';
}
$langs_preset = qtranxf_langs_preset();
$langs_stored = qtranxf_langs_stored($langs_preset);
$langs_config = qtranxf_langs_config($langs_preset, $langs_stored);
$this->_order = isset($_GET['order']) && 'desc' == $_GET['order'] ? -1 : +1;
$flag_location_url = qtranxf_flag_location();
$flag_location_dir = trailingslashit(WP_CONTENT_DIR) . $q_config['flag_location'];
$flag_location_url_def = content_url(qtranxf_flag_location_default());
$clean_uri = $this->_clean_uri;
$data = array();
foreach ($langs_config as $lang => $props) {
$locale = $props['locale'];
$flag = $props['flag'];
//$flags[$lang];
if (file_exists($flag_location_dir . $flag)) {
$flag_url = $flag_location_url . $flag;
} else {
$flag_url = $flag_location_url_def . $flag;
}
$lang_name = $props['language_name'];
//native name
$admin_name = qtranxf_getLanguageName($lang, $locale, $lang_name);
//name translated to admin language
$action = qtranxf_isEnabled($lang) ? $q_config['default_language'] == $lang ? __('Default', 'qtranslate') : __('Disable', 'qtranslate') : __('Enable', 'qtranslate');
$stored = empty($props['stored']) ? __('Pre-Defined', 'qtranslate') : (isset($langs_preset[$lang]) ? __('Reset', 'qtranslate') : __('Delete', 'qtranslate'));
switch ($this->_orderby) {
default:
case 'locale':
$orderby = $locale;
break;
case 'code':
$orderby = $lang;
break;
case 'flag':
$orderby = $lang_name;
break;
case 'name':
$orderby = $admin_name;
break;
case 'action':
$orderby = $action;
break;
case 'stored':
$orderby = $stored;
break;
}
$edit_url = $clean_uri . '&edit=' . $lang;
$atitle = __('Edit', 'qtranslate') . ' ' . $lang_name . ' (' . $locale . ')';
$data[] = array('locale' => $locale, 'code' => $lang, 'flag' => '<a href="' . $edit_url . '" title="' . $atitle . '"><img src="' . $flag_url . '" alt="' . sprintf(__('%s Flag', 'qtranslate'), $lang_name) . '"></a>', 'name' => '<a href="' . $edit_url . '" title="' . $atitle . '">' . $admin_name . '</a>', 'action' => qtranxf_isEnabled($lang) ? $q_config['default_language'] == $lang ? $action : '<a class="edit" href="' . $clean_uri . '&disable=' . $lang . '#languages">' . $action . '</a>' : '<a class="edit" href="' . $clean_uri . '&enable=' . $lang . '#languages">' . $action . '</a>', 'stored' => empty($props['stored']) ? $stored : '<a class="delete" href="' . $clean_uri . '&delete=' . $lang . '#languages">' . $stored . '</a>', 'admin_name' => $admin_name, 'orderby' => $orderby);
}
uasort($data, array($this, 'compare_items'));
$this->items = $data;
}
示例12: balanceTags
</span>
</a>
</li>
<?php
}
echo '</ul></' . $container . '>';
}
?>
<?php
if (function_exists('qtranxf_init_language') and !function_exists('icl_get_languages')) {
echo balanceTags('<' . $container . ' class="' . $class . ' qtranslate">');
global $q_config;
global $pagenow;
$flags = qtranxf_language_configured('flag');
$flag_dir = qtranxf_flag_location();
$current_language = $q_config['language'];
$lang_name = $q_config['language_name'][$current_language];
?>
<a class="image_prites_<?php
echo esc_attr($current_language);
?>
" href="#" >
<img height='12px' width= '18px' src="<?php
echo esc_attr($flag_dir . $flags[$current_language]);
?>
" alt="<?php
echo esc_attr($lang_name);
?>
" title="<?php
echo esc_attr($lang_name);
示例13: qtranxf_generateLanguageSelectCode
function qtranxf_generateLanguageSelectCode($style = '', $id = '')
{
global $q_config;
if ($style == '') {
$style = 'text';
}
if (is_bool($style) && $style) {
$style = 'image';
}
if (is_404()) {
$url = get_option('home');
} else {
$url = '';
}
if ($id == '') {
$id = 'qtranslate';
}
$id .= '-chooser';
$flag_location = qtranxf_flag_location();
switch ($style) {
case 'image':
case 'text':
case 'dropdown':
echo PHP_EOL . '<ul class="qtranxs_language_chooser" id="' . $id . '">' . PHP_EOL;
foreach (qtranxf_getSortedLanguages() as $language) {
$classes = array('lang-' . $language);
if ($language == $q_config['language']) {
$classes[] = 'active';
}
echo '<li class="' . implode(' ', $classes) . '"><a href="' . qtranxf_convertURL($url, $language, false, true) . '"';
//echo '<li'; if($language == $q_config['language']) echo ' class="active"';
//echo '><a href="'.qtranxf_convertURL($url, $language, false, true).'"';
// set hreflang
echo ' hreflang="' . $language . '"';
echo ' title="' . $q_config['language_name'][$language] . '"';
if ($style == 'image') {
echo ' class="qtranxs_image qtranxs_image_' . $language . '"';
} elseif ($style == 'text') {
echo ' class="qtranxs_text qtranxs_text_' . $language . '"';
}
echo '>';
if ($style == 'image') {
echo '<img src="' . $flag_location . $q_config['flag'][$language] . '" alt="' . $q_config['language_name'][$language] . '" />';
}
echo '<span';
if ($style == 'image') {
echo ' style="display:none"';
}
echo '>' . $q_config['language_name'][$language] . '</span>';
echo '</a></li>' . PHP_EOL;
}
echo '</ul><div class="qtranxs_widget_end"></div>' . PHP_EOL;
if ($style == 'dropdown') {
echo '<script type="text/javascript">' . PHP_EOL . '// <![CDATA[' . PHP_EOL;
echo "var lc = document.getElementById('" . $id . "');" . PHP_EOL;
echo "var s = document.createElement('select');" . PHP_EOL;
echo "s.id = 'qtranxs_select_" . $id . "';" . PHP_EOL;
echo "lc.parentNode.insertBefore(s,lc);" . PHP_EOL;
// create dropdown fields for each language
foreach (qtranxf_getSortedLanguages() as $language) {
echo qtranxf_insertDropDownElement($language, qtranxf_convertURL($url, $language, false, true), $id);
}
// hide html language chooser text
echo "s.onchange = function() { document.location.href = this.value;}" . PHP_EOL;
echo "lc.style.display='none';" . PHP_EOL;
echo '// ]]>' . PHP_EOL . '</script>' . PHP_EOL;
}
break;
case 'both':
echo PHP_EOL . '<ul class="qtranxs_language_chooser" id="' . $id . '">' . PHP_EOL;
foreach (qtranxf_getSortedLanguages() as $language) {
echo '<li';
if ($language == $q_config['language']) {
echo ' class="active"';
}
echo '><a href="' . qtranxf_convertURL($url, $language, false, true) . '"';
echo ' class="qtranxs_flag_' . $language . ' qtranxs_flag_and_text" title="' . $q_config['language_name'][$language] . '">';
//echo '<img src="'.$flag_location.$q_config['flag'][$language].'"></img>';
echo '<span>' . $q_config['language_name'][$language] . '</span></a></li>' . PHP_EOL;
}
echo '</ul><div class="qtranxs_widget_end"></div>' . PHP_EOL;
break;
}
}
示例14: qts_translate_box
function qts_translate_box($post)
{
global $q_config;
$languages = qtranxf_getSortedLanguages();
?>
<ul>
<?php
$from = $q_config['default_language'];
$to = '';
foreach ($languages as $language) {
if ($language != $from) {
$to = $language;
}
if (isset($_REQUEST['post'])) {
?>
<li><img src="<?php
echo qtranxf_flag_location() . $q_config['flag'][$language];
?>
" alt="<?php
echo $q_config['language_name'][$language];
?>
"> <a href="edit.php?page=qtranslate_services&post=<?php
echo intval($_REQUEST['post']);
?>
&target_language=<?php
echo $language;
?>
"><?php
echo $q_config['language_name'][$language];
?>
<span class="qsprice"></span></a></li>
<?php
} else {
echo '<li>' . __('Please save your post first.', 'qtranslate') . '</li>';
break;
}
}
?>
</ul>
<script type="text/javascript">
// <![CDATA[
jQuery(document).ready(function() {
jQuery.post(ajaxurl, {
action: 'qts_quote',
mode: 'price_only',
translate_from: '<?php
echo $from;
?>
',
translate_to: '<?php
echo $to;
?>
',
service_id: 5,
post_id: '<?php
echo intval($_REQUEST['post']);
?>
'},
function(response) {
eval(response);
})
});
// ]]>
</script>
<?php
}
示例15: qtranxf_conf
//.........这里部分代码省略.........
?>
<form id="qtranxs-configuration-form" action="<?php
echo $clean_uri;
?>
" method="post">
<div class="tabs-content"><?php
//<!-- tabs-container -->
?>
<?php
qtranxf_admin_section_start('general');
$permalink_is_query = qtranxf_is_permalink_structure_query();
//qtranxf_dbg_echo('$permalink_is_query: ',$permalink_is_query);
$url_mode = $q_config['url_mode'];
?>
<table class="form-table">
<tr valign="top">
<th scope="row"><?php
_e('Default Language / Order', 'qtranslate');
?>
</th>
<td><p class="qtranxs_explanation"><?php
echo __('Every multilingual field is expected to have a meaningful content in the "Default Language". Usually, it is the language of your site before it became multilingual.', 'qtranslate');
echo ' ';
echo __('Order of languages defines in which order they are listed, when languages need to be listed, otherwise it is not important.', 'qtranslate');
?>
</p>
<fieldset id="qtranxs-languages-menu">
<legend class="hidden"><?php
_e('Default Language', 'qtranslate');
?>
</legend>
<table id="qtranxs-enabled-languages">
<?php
$flag_location = qtranxf_flag_location();
foreach (qtranxf_getSortedLanguages() as $key => $language) {
echo '<tr>';
echo '<td><label title="' . $q_config['language_name'][$language] . '"><input type="radio" name="default_language" value="' . $language . '"';
checked($language, $q_config['default_language']);
echo ' />';
echo ' <a href="' . add_query_arg('moveup', $language, $clean_uri) . '"><img src="' . $pluginurl . 'arrowup.png" alt="up" /></a>';
echo ' <a href="' . add_query_arg('movedown', $language, $clean_uri) . '"><img src="' . $pluginurl . 'arrowdown.png" alt="down" /></a>';
echo ' <img src="' . $flag_location . $q_config['flag'][$language] . '" alt="' . $q_config['language_name'][$language] . '" /> ';
echo ' ' . $q_config['language_name'][$language];
echo '</label></td>';
echo '<td>[:' . $language . ']</td><td><a href="' . $clean_uri . '&edit=' . $language . '">' . __('Edit', 'qtranslate') . '</a></td><td><a href="' . $clean_uri . '&disable=' . $language . '">' . __('Disable', 'qtranslate') . '</a></td>';
echo '</tr>' . PHP_EOL;
}
?>
</table>
<p class="qtranxs_notes"><?php
printf(__('Choose the default language of your blog. This is the language which will be shown on %s. You can also change the order the languages by clicking on the arrows above.', 'qtranslate'), get_bloginfo('url'));
?>
</p>
</fieldset>
</td>
</tr>
<tr valign="top">
<th scope="row"><?php
_e('URL Modification Mode', 'qtranslate');
?>
</th>
<td>
<fieldset><legend class="hidden"><?php
_e('URL Modification Mode', 'qtranslate');
?>
</legend>