當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。