当前位置: 首页>>代码示例>>PHP>>正文


PHP qtranxf_getLanguage函数代码示例

本文整理汇总了PHP中qtranxf_getLanguage函数的典型用法代码示例。如果您正苦于以下问题:PHP qtranxf_getLanguage函数的具体用法?PHP qtranxf_getLanguage怎么用?PHP qtranxf_getLanguage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了qtranxf_getLanguage函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: qtranxf_collect_translations_posted

function qtranxf_collect_translations_posted()
{
    //qtranxf_dbg_log('qtranxf_collect_translations_posted: REQUEST: ', $_REQUEST);
    //qtranxf_dbg_log('qtranxf_collect_translations_posted: POST: ', $_POST);
    //qtranxf_dbg_log('qtranxf_collect_translations_posted: count(REQUEST): ', count($_REQUEST, COUNT_RECURSIVE));
    $edit_lang = null;
    if (isset($_REQUEST['qtranslate-fields'])) {
        //$edit_lang = isset($_COOKIE['qtrans_edit_language']) ? $_COOKIE['qtrans_edit_language'] : qtranxf_getLanguage();
        $edit_lang = qtranxf_getLanguageEdit();
        foreach ($_REQUEST['qtranslate-fields'] as $nm => &$qfields) {
            //qtranxf_dbg_log('qtranxf_collect_translations_posted: REQUEST[qtranslate-fields]['.$nm.']: ',$qfields);
            qtranxf_collect_translations($qfields, $_REQUEST[$nm], $edit_lang);
            //qtranxf_dbg_log('qtranxf_collect_translations_posted: collected REQUEST['.$nm.']: ',$_REQUEST[$nm]);
            if (isset($_POST[$nm])) {
                $_POST[$nm] = $_REQUEST[$nm];
            }
            if (isset($_GET[$nm])) {
                $_GET[$nm] = $_REQUEST[$nm];
            }
        }
        unset($_REQUEST['qtranslate-fields']);
        unset($_POST['qtranslate-fields']);
        unset($_GET['qtranslate-fields']);
    }
    if (defined('DOING_AJAX') && DOING_AJAX) {
        //parse variables collected as a query string in an option
        foreach ($_REQUEST as $nm => $val) {
            if (!is_string($val)) {
                continue;
            }
            if (strpos($val, 'qtranslate-fields') === FALSE) {
                continue;
            }
            $r;
            parse_str($val, $r);
            //qtranxf_dbg_log('qtranxf_collect_translations_posted: REQUEST['.$nm.'] $r: ', $r);
            //qtranxf_dbg_log('qtranxf_collect_translations_posted: REQUEST['.$nm.']: ', $val);
            if (empty($r['qtranslate-fields'])) {
                continue;
            }
            if (!$edit_lang) {
                $edit_lang = qtranxf_getLanguageEdit();
            }
            qtranxf_collect_translations($r['qtranslate-fields'], $r, $edit_lang);
            unset($r['qtranslate-fields']);
            //qtranxf_dbg_log('qtranxf_collect_translations_posted: $r parsed: ', $r);
            $q = http_build_query($r);
            //qtranxf_dbg_log('qtranxf_collect_translations_posted: $q: ', $q);
            //qtranxf_dbg_log('qtranxf_collect_translations_posted: $v: ', $val);
            $_REQUEST[$nm] = $q;
            if (isset($_POST[$nm])) {
                $_POST[$nm] = $q;
            }
            if (isset($_GET[$nm])) {
                $_GET[$nm] = $q;
            }
        }
    }
    if (isset($_REQUEST['qtranslate-slugs']) || isset($_REQUEST['qtranslate-terms'])) {
        //ensure REQUEST has the value of the default language
        //multilingual slug/term values will be processed later
        if (!$edit_lang) {
            $edit_lang = qtranxf_getLanguageEdit();
        }
        global $q_config;
        $default_language = $q_config['default_language'];
        $default_lang = qtranxf_getLanguage();
        qtranxf_regroup_translations_for('qtranslate-terms', $edit_lang, $default_lang);
        qtranxf_regroup_translations_for('qtranslate-slugs', $edit_lang, $default_lang);
    }
}
开发者ID:AndreyLanko,项目名称:perevorot-prozorro-wp,代码行数:71,代码来源:qtx_admin.php

示例2: hocwp_get_current_language

function hocwp_get_current_language()
{
    if (function_exists('qtranxf_getLanguage')) {
        return qtranxf_getLanguage();
    }
    return hocwp_get_language();
}
开发者ID:skylarkcob,项目名称:hocwp-projects,代码行数:7,代码来源:utils.php

示例3: get_context_data

 /**
  * Get data from context
  * 
  * @since  1.0
  * @return array
  */
 public function get_context_data()
 {
     $data = array($this->id);
     if (function_exists('qtranxf_getLanguage')) {
         $data[] = qtranxf_getLanguage();
     }
     return $data;
 }
开发者ID:sc0ttkclark,项目名称:wp-content-aware-engine,代码行数:14,代码来源:qtranslate.php

示例4: dsq_qtrans_get_lang

function dsq_qtrans_get_lang()
{
    if (function_exists('qtranxf_getLanguage')) {
        return qtranxf_getLanguage($text);
    } else {
        return qtrans_getLanguage($text);
    }
}
开发者ID:grishka,项目名称:wp-disqus-qtranslate,代码行数:8,代码来源:disqus-qtranslate.php

示例5: detectLanguage

 public static function detectLanguage()
 {
     $DW =& $GLOBALS['DW'];
     if (self::detect(FALSE)) {
         $qtlang = get_option('qtranslate_default_language');
         $curlang = qtranxf_getLanguage();
         $DW->message('QT language: ' . $curlang);
         if ($qtlang != $curlang) {
             $DW->qt = TRUE;
             $DW->message('QT enabled');
         }
         return $curlang;
     }
 }
开发者ID:Gerdie,项目名称:dreamy-wedding-company,代码行数:14,代码来源:qt_module.php

示例6: hocwp_text

function hocwp_text($vi, $en, $echo = true)
{
    $lang = hocwp_get_language();
    if (function_exists('qtranxf_getLanguage')) {
        $lang = qtranxf_getLanguage();
    }
    if ('vi' == $lang) {
        $text = $vi;
    } else {
        $text = $en;
    }
    $text = apply_filters('hocwp_text', $text, $vi, $en, $echo);
    if ($echo) {
        echo $text;
    }
    return $text;
}
开发者ID:skylarkcob,项目名称:hocwp-projects,代码行数:17,代码来源:text.php

示例7: qtranxf_run_tests_convertURL

function qtranxf_run_tests_convertURL()
{
    global $q_config;
    $lang = qtranxf_getLanguage();
    foreach ($q_config['enabled_languages'] as $lng) {
        if ($lng == $q_config['default_language']) {
            continue;
        }
        $lang = $lng;
        break;
    }
    $url_mode = $q_config['url_mode'];
    qtranxf_run_test_convertURL($url_mode, $lang);
    //cache breaks tests, need to run one at a time
    //qtranxf_run_test_convertURL(QTX_URL_QUERY, $lang);
    //qtranxf_run_test_convertURL(QTX_URL_PATH, $lang);
    //qtranxf_run_test_convertURL(QTX_URL_DOMAIN, $lang);
    //qtranxf_run_test_convertURL(QTX_URL_DOMAINS, $lang);
    $q_config['url_mode'] = $url_mode;
}
开发者ID:vinnygats,项目名称:qtranslate-x,代码行数:20,代码来源:qtx-test-convertURL.php

示例8: get_posts

      </div>
<?php 
        }
        $books = get_posts(array('category' => $category->term_taxonomy_id));
        if ($books) {
            ?>
       <div class="col col-4">
        <h2><?php 
            echo __('[:es]Títulos[:en]Titles');
            ?>
</h2>
<?php 
            foreach ($books as $book) {
                $releaseDate = get_post_meta($book->ID, '_igv_release_date');
                if (!empty($releaseDate)) {
                    if (qtranxf_getLanguage() == 'es') {
                        $locale = 'es_ES';
                    } else {
                        $locale = 'en_US';
                    }
                    \Moment\Moment::setLocale($locale);
                    $m = new \Moment\Moment($releaseDate[0]);
                    ?>

            <div class="collection-book font-mono u-cf">
              <div class="book-image"><a href="<?php 
                    echo get_permalink($book->ID);
                    ?>
"><?php 
                    echo get_the_post_thumbnail($book->ID, 'book-cover');
                    ?>
开发者ID:interglobalvision,项目名称:e-mp-mx,代码行数:31,代码来源:page-colecciones.php

示例9: qtranxf_slug_update_translations_left

function qtranxf_slug_update_translations_left()
{
    if (!isset($_REQUEST['qtranslate-slugs'])) {
        return;
    }
    $default_lang = qtranxf_getLanguage();
    foreach ($_REQUEST['qtranslate-slugs'] as $name => &$qfields) {
        qtranxf_slug_update_translations_for($name, $qfields, $default_lang);
        qtranxf_slug_clean_request($name);
    }
}
开发者ID:vallsargente,项目名称:qtranslate-x,代码行数:11,代码来源:qtx_admin_slug.php

示例10:

	<div class="main-content" style="padding:20px 0;background-color:#fff;">
		<div style="clear: both"></div>
		<div class="left-menu" style="float:left;width:310px;padding-top: 10px;">	
			<div style="clear:both;"></div>
			<div>
				<aside class="blog-owner">
					<h3><?php 
echo $owner_info_title[qtranxf_getLanguage()];
?>
</h3>
					<div class="staff-image"><img src="<?php 
echo $owner_infos[$cat_id]['picture'];
?>
" /></div>
					<div class="informations"><?php 
echo $owner_infos[$cat_id][qtranxf_getLanguage()]['name'];
?>
</div>
				</aside>
			</div>
			<?php 
get_sidebar('staff');
?>
			<div style="clear:both;"></div>
			<div>
				<aside class="older-post">
					<h3>Older posts</h3>
					<?php 
query_posts("cat={$cat_id}&post_status=publish,future");
?>
					<ul>
开发者ID:bomcpe11,项目名称:bauhinia,代码行数:31,代码来源:page-staffblog.php

示例11: qtranxf_conf

function qtranxf_conf()
{
    global $q_config, $wpdb;
    //qtranxf_dbg_log('qtranxf_conf: POST: ',$_POST);
    // do redirection for dashboard
    if (isset($_GET['godashboard'])) {
        echo '<h2>' . __('Switching Language', 'qtranslate') . '</h2>' . sprintf(__('Switching language to %1$s... If the Dashboard isn\'t loading, use this <a href="%2$s" title="Dashboard">link</a>.', 'qtranslate'), $q_config['language_name'][qtranxf_getLanguage()], admin_url()) . '<script type="text/javascript">document.location="' . admin_url() . '";</script>';
        exit;
    }
    // init some needed variables
    $error = '';
    $original_lang = '';
    $language_code = '';
    $language_name = '';
    $language_locale = '';
    $language_date_format = '';
    $language_time_format = '';
    $language_na_message = '';
    $language_flag = '';
    $language_default = '';
    $altered_table = false;
    $message = apply_filters('qtranslate_configuration_pre', array());
    // check for action
    if (isset($_POST['qtranslate_reset']) && isset($_POST['qtranslate_reset2'])) {
        $message[] = __('qTranslate has been reset.', 'qtranslate');
    } elseif (isset($_POST['default_language'])) {
        qtranxf_updateSettings();
        //execute actions
        if (isset($_POST['update_mo_now']) && $_POST['update_mo_now'] == '1') {
            $result = qtranxf_updateGettextDatabases(true);
            if ($result === true) {
                $message[] = __('Gettext databases updated.', 'qtranslate');
            } elseif (is_wp_error($result)) {
                $message[] = __('Gettext databases <strong>not</strong> updated:', 'qtranslate') . ' ' . $result->get_error_message();
            }
        }
        foreach ($_POST as $key => $value) {
            if (!is_string($value)) {
                continue;
            }
            if (!qtranxf_endsWith($key, '-migration')) {
                continue;
            }
            $plugin = substr($key, 0, -strlen('-migration'));
            if ($value == 'import') {
                $nm = '<span style="color:blue"><strong>' . qtranxf_get_plugin_name($plugin) . '</strong></span>';
                $message[] = sprintf(__('Applicable options and taxonomy names from plugin %s have been imported. Note that the multilingual content of posts, pages and other objects has not been altered during this operation. There is no additional operation needed to import content, since its format is compatible with %s.', 'qtranslate'), $nm, 'qTranslate&#8209;X') . ' ' . sprintf(__('It might be a good idea to review %smigration instructions%s, if you have not yet done so.', 'qtranslate'), '<a href="https://qtranslatexteam.wordpress.com/2015/02/24/migration-from-other-multilingual-plugins/" target="_blank">', '</a>');
                $message[] = sprintf(__('%sImportant%s: Before you start making edits to post and pages, please, make sure that both, your front site and admin back-end, work under this configuration. It may help to review "%s" and see if any of conflicting plugins mentioned there are used here. While the current content, coming from %s, is compatible with this plugin, the newly modified posts and pages will be saved with a new square-bracket-only encoding, which has a number of advantages comparing to former %s encoding. However, the new encoding is not straightforwardly compatible with %s and you will need an additional step available under "%s" option if you ever decide to go back to %s. Even with this additional conversion step, the 3rd-party plugins custom-stored data will not be auto-converted, but manual editing will still work. That is why it is advisable to create a test-copy of your site before making any further changes. In case you encounter a problem, please give us a chance to improve %s, send the login information to the test-copy of your site to %s along with a detailed step-by-step description of what is not working, and continue using your main site with %s meanwhile. It would also help, if you share a success story as well, either on %sthe forum%s, or via the same e-mail as mentioned above. Thank you very much for trying %s.', 'qtranslate'), '<span style="color:red">', '</span>', '<a href="https://wordpress.org/plugins/qtranslate-x/other_notes/" target="_blank">' . 'Known Issues' . '</a>', $nm, 'qTranslate', $nm, '<span style="color:magenta">' . __('Convert Database', 'qtranslate') . '</span>', $nm, 'qTranslate&#8209;X', '<a href="mailto:qtranslateteam@gmail.com">qtranslateteam@gmail.com</a>', $nm, '<a href="https://wordpress.org/support/plugin/qtranslate-x">', '</a>', 'qTranslate&#8209;X') . '<br/><small>' . __('This is a one-time message, which you will not see again, unless the same import is repeated.', 'qtranslate') . '</small>';
                if ($plugin == 'mqtranslate') {
                    $message[] = sprintf(__('Option "%s" has also been turned on, as the most common case for importing configuration from %s. You may turn it off manually if your setup does not require it. Refer to %sFAQ%s for more information.', 'qtranslate'), '<span style="color:magenta">' . __('Compatibility Functions', 'qtranslate') . '</span>', $nm, '<a href="https://wordpress.org/plugins/qtranslate-x/faq/" target="_blank">', '</a>');
                }
            } elseif ($value == 'export') {
                $nm = '<span style="color:blue"><strong>' . qtranxf_get_plugin_name($plugin) . '</strong></span>';
                $message[] = sprintf(__('Applicable options have been exported to plugin %s. If you have done some post or page updates after migrating from %s, then "%s" operation is also required to convert the content to "dual language tag" style in order for plugin %s to function.', 'qtranslate'), $nm, $nm, '<span style="color:magenta">' . __('Convert Database', 'qtranslate') . '</span>', $nm);
            }
        }
        if (isset($_POST['convert_database'])) {
            $msg = qtranxf_convert_database($_POST['convert_database']);
            if ($msg) {
                $message[] = $msg;
            }
        }
    }
    if (isset($_POST['original_lang'])) {
        // validate form input
        $lang = sanitize_text_field($_POST['language_code']);
        if ($_POST['language_na_message'] == '') {
            $error = __('The Language must have a Not-Available Message!', 'qtranslate');
        }
        if (strlen($_POST['language_locale']) < 2) {
            $error = __('The Language must have a Locale!', 'qtranslate');
        }
        if ($_POST['language_name'] == '') {
            $error = __('The Language must have a name!', 'qtranslate');
        }
        if (strlen($lang) != 2) {
            $error = __('Language Code has to be 2 characters long!', 'qtranslate');
        }
        //$lang = strtolower($lang);
        //$language_names = qtranxf_language_configured('language_name');
        $langs = array();
        qtranxf_load_languages($langs);
        $language_names = $langs['language_name'];
        if ($_POST['original_lang'] == '' && $error == '') {
            // new language
            if (isset($language_names[$lang])) {
                $error = __('There is already a language with the same Language Code!', 'qtranslate');
            }
        }
        if ($_POST['original_lang'] != '' && $error == '') {
            // language update
            if ($lang != $_POST['original_lang'] && isset($language_names[$lang])) {
                $error = __('There is already a language with the same Language Code!', 'qtranslate');
            } else {
                if ($lang != $_POST['original_lang']) {
                    // remove old language
                    qtranxf_unsetLanguage($langs, $_POST['original_lang']);
                    qtranxf_unsetLanguage($q_config, $_POST['original_lang']);
                }
                if (in_array($_POST['original_lang'], $q_config['enabled_languages'])) {
//.........这里部分代码省略.........
开发者ID:ycms,项目名称:framework,代码行数:101,代码来源:qtx_configuration.php

示例12: new_body_classes

function new_body_classes($classes)
{
    if (is_page()) {
        global $post;
        $temp = get_page_template();
        if ($temp != null) {
            $path = pathinfo($temp);
            $tmp = $path['filename'] . "." . $path['extension'];
            $tn = str_replace(".php", "", $tmp);
            $classes[] = $tn;
        }
        if (is_active_sidebar('sidebar')) {
            $classes[] = 'with_sidebar';
        }
        foreach ($classes as $k => $v) {
            if ($v == 'page-template' || $v == 'page-id-' . $post->ID || $v == 'page-template-default' || $v == 'woocommerce-page' || ($temp != null ? $v == 'page-template-' . $tn . '-php' || $v == 'page-template-' . $tn : '')) {
                unset($classes[$k]);
            }
        }
    }
    if (is_single()) {
        global $post;
        $f = get_post_format($post->ID);
        foreach ($classes as $k => $v) {
            if ($v == 'postid-' . $post->ID || $v == 'single-format-' . (!$f ? 'standard' : $f)) {
                unset($classes[$k]);
            }
        }
    }
    global $is_lynx, $is_gecko, $is_IE, $is_opera, $is_NS4, $is_safari, $is_chrome, $is_iphone;
    $browser = $_SERVER['HTTP_USER_AGENT'];
    // Mac, PC ...or Linux
    if (preg_match("/Mac/", $browser)) {
        $classes[] = 'macos';
    } elseif (preg_match("/Windows/", $browser)) {
        $classes[] = 'windows';
    } elseif (preg_match("/Linux/", $browser)) {
        $classes[] = 'linux';
    } else {
        $classes[] = 'unknown-os';
    }
    // Checks browsers in this order: Chrome, Safari, Opera, MSIE, FF
    if (preg_match("/Chrome/", $browser)) {
        $classes[] = 'chrome';
        preg_match("/Chrome\\/(\\d.\\d)/si", $browser, $matches);
        @($classesh_version = 'ch' . str_replace('.', '-', $matches[1]));
        $classes[] = $classesh_version;
    } elseif (preg_match("/Safari/", $browser)) {
        $classes[] = 'safari';
        preg_match("/Version\\/(\\d.\\d)/si", $browser, $matches);
        $sf_version = 'sf' . str_replace('.', '-', $matches[1]);
        $classes[] = $sf_version;
    } elseif (preg_match("/Opera/", $browser)) {
        $classes[] = 'opera';
        preg_match("/Opera\\/(\\d.\\d)/si", $browser, $matches);
        $op_version = 'op' . str_replace('.', '-', $matches[1]);
        $classes[] = $op_version;
    } elseif (preg_match("/MSIE/", $browser)) {
        $classes[] = 'msie';
        if (preg_match("/MSIE 6.0/", $browser)) {
            $classes[] = 'ie6';
        } elseif (preg_match("/MSIE 7.0/", $browser)) {
            $classes[] = 'ie7';
        } elseif (preg_match("/MSIE 8.0/", $browser)) {
            $classes[] = 'ie8';
        } elseif (preg_match("/MSIE 9.0/", $browser)) {
            $classes[] = 'ie9';
        }
    } elseif (preg_match("/Firefox/", $browser) && preg_match("/Gecko/", $browser)) {
        $classes[] = 'firefox';
        preg_match("/Firefox\\/(\\d)/si", $browser, $matches);
        $ff_version = 'ff' . str_replace('.', '-', $matches[1]);
        $classes[] = $ff_version;
    } else {
        $classes[] = 'unknown-browser';
    }
    //qtranslate classes
    if (defined('QTX_VERSION')) {
        $classes[] = 'qtrans-' . qtranxf_getLanguage();
    }
    return $classes;
}
开发者ID:iceanothers,项目名称:wp-skillet,代码行数:82,代码来源:functions.php

示例13: check_multilingual_code

 /**
  * If a multilingual plugin like WPML or qTranslate X is active
  * we return the active language code.
  * 
  * @since 2.0.0
  * @return string Empty or the current language code
  */
 public function check_multilingual_code()
 {
     $language_code = '';
     if ($this->wpml_exists()) {
         $language_code = '_' . ICL_LANGUAGE_CODE;
     } else {
         if ($this->qtrans_exists()) {
             if (function_exists('qtranxf_getLanguage')) {
                 $language_code = '_' . qtranxf_getLanguage();
             } else {
                 if (function_exists('qtrans_getLanguage')) {
                     $language_code = '_' . qtrans_getLanguage();
                 }
             }
         }
     }
     return $language_code;
 }
开发者ID:taeche,项目名称:SoDoEx,代码行数:25,代码来源:class-i18n.php

示例14: apply_filters

<?php

if (!function_exists('add_filter')) {
    exit;
}
$use = apply_filters('hocwp_admin_translation', false);
if (!$use && is_admin()) {
    return;
}
if (function_exists('qtranxf_getLanguage')) {
    $lang = qtranxf_getLanguage();
    if ('vi' != $lang) {
        return;
    }
}
$use = apply_filters('hocwp_translate_theme_into_vietnamese', true);
if (!$use) {
    return;
}
global $pagenow;
if ('wp-login.php' == $pagenow) {
    return;
}
function hocwp_theme_translation_comments_title_text()
{
    return 'Gửi bình luận của bạn';
}
add_filter('hocwp_comments_title_text', 'hocwp_theme_translation_comments_title_text');
function hocwp_theme_translation_comments_title_count($text, $comments_number)
{
    if ($comments_number > 1) {
开发者ID:skylarkcob,项目名称:hocwp-projects,代码行数:31,代码来源:theme-translation.php

示例15: while

?>
</span></a></li>
				<li style="background-color:#fff7d8;"><a pagename="staff4"><span><?php 
echo $staff_menu['accounting'][qtranxf_getLanguage()];
?>
</span></a></li>
				<li style="background-color:#C6DDF2;"><a pagename="staff5"><span><?php 
echo $staff_menu['finance'][qtranxf_getLanguage()];
?>
</span></a></li>
				<li style="background-color:#ECBEFF;"><a pagename="staff6"><span><?php 
echo $staff_menu['marketing'][qtranxf_getLanguage()];
?>
</span></a></li>
				<li style="background-color:#d3f9d7;" class='last'><a pagename="staff7"><span><?php 
echo $staff_menu['tourism'][qtranxf_getLanguage()];
?>
</span></a></li>
			</ul>
			
			<?php 
//query_posts('category_name=chinnawat-b');
?>
		</div>
	    <div class="subcontent1" style="float:left;min-width:300px;width:75%;padding: 0 0 0 20px;">
	    	
	    	 <?php 
if (have_posts()) {
    while (have_posts()) {
        the_post();
        ?>
开发者ID:bomcpe11,项目名称:bauhinia,代码行数:31,代码来源:page-staff.php


注:本文中的qtranxf_getLanguage函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。