當前位置: 首頁>>代碼示例>>PHP>>正文


PHP qtranxf_get_url_for_language函數代碼示例

本文整理匯總了PHP中qtranxf_get_url_for_language函數的典型用法代碼示例。如果您正苦於以下問題:PHP qtranxf_get_url_for_language函數的具體用法?PHP qtranxf_get_url_for_language怎麽用?PHP qtranxf_get_url_for_language使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了qtranxf_get_url_for_language函數的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: translate_url

 public function translate_url($url, $lang = null)
 {
     global $q_config;
     if ($lang) {
         $showLanguage = true;
     } else {
         $lang = $q_config['language'];
         $showLanguage = !$q_config['hide_default_language'] || $lang != $q_config['default_language'];
     }
     return qtranxf_get_url_for_language($url, $lang, $showLanguage);
 }
開發者ID:AndreyLanko,項目名稱:perevorot-prozorro-wp,代碼行數:11,代碼來源:qtx_class_translator.php

示例2: qtranxf_test_convertURL

function qtranxf_test_convertURL($url_mode_name, $urls, $lang, $showLanguage)
{
    $cnt = 0;
    foreach ($urls as $url => $url_expected) {
        //$url_converted = qtranxf_convertURL($url, false, true);
        $url_converted = qtranxf_get_url_for_language($url, $lang, $showLanguage);
        //qtranxf_tst_log('test convertURL('.$url.'): ', $url_converted);
        if (!qtranxf_check_url($url_converted, $url_expected)) {
            ++$cnt;
            qtranxf_tst_log('qtranxf_test_convertURL(' . $url_mode_name . '): exit on the first error for url: ', $url);
            exit;
        }
    }
    //qtranxf_tst_log('qtranxf_test_convertURL('.$url_mode_name.'): '.($showLanguage?'show':'hide').' language lang='.$lang.'; #errors=', $cnt);
    return $cnt;
}
開發者ID:vinnygats,項目名稱:qtranslate-x,代碼行數:16,代碼來源:qtx-test-convertURL.php

示例3: qtranxf_home_url

function qtranxf_home_url($url, $path, $orig_scheme, $blog_id)
{
    global $q_config;
    $lang = $q_config['language'];
    //qtranxf_dbg_log('qtranxf_home_url: url='.$url.'; path='.$path.'; orig_scheme='.$orig_scheme);
    $url = qtranxf_get_url_for_language($url, $lang, !$q_config['hide_default_language'] || $lang != $q_config['default_language']);
    //qtranxf_dbg_log('qtranxf_home_url: url='.$url.'; lang='.$lang);
    return $url;
}
開發者ID:AndreyLanko,項目名稱:perevorot-prozorro-wp,代碼行數:9,代碼來源:qtranslate_frontend.php

示例4: qtranxf_convertURL

/**
 * Encode URL $url with language $lang.
 * @param (string) $url URL to be converted.
 * @param (string) $lang two-letter language code of the language to convert $url to.
 * @param (bool) $forceadmin $url is not converted on admin side, unless $forceadmin is set to true.
 * @param (bool) $showDefaultLanguage When set to true, $url is always encoded with a language, otherwise it senses option "Hide URL language information for default language" to keep $url consistent with the currently active language.
 *
 * If you need a URL to switch the language, set $showDefaultLanguage=true, if you need a URL to keep the current language, set it to false.
 */
function qtranxf_convertURL($url = '', $lang = '', $forceadmin = false, $showDefaultLanguage = false)
{
    global $q_config;
    if (empty($lang)) {
        $lang = $q_config['language'];
    }
    if (empty($url)) {
        if ($q_config['url_info']['doing_front_end'] && defined('QTS_VERSION') && $q_config['url_mode'] != QTX_URL_QUERY) {
            //quick workaround, but need a permanent solution
            $url = qts_get_url($lang);
            //qtranxf_dbg_log('qtranxf_convertURL: qts_get_url: url=', $url);
            if (!empty($url)) {
                if ($showDefaultLanguage && $q_config['hide_default_language'] && $lang == $q_config['default_language']) {
                    $url = qtranxf_convertURL($url, $lang, $forceadmin, true);
                }
                return $url;
            }
        }
        //$url = esc_url($q_config['url_info']['url']);
    }
    if (!$q_config['url_info']['doing_front_end'] && !$forceadmin) {
        return $url;
    }
    if (!qtranxf_isEnabled($lang)) {
        return '';
    }
    if (!$showDefaultLanguage) {
        $showDefaultLanguage = !$q_config['hide_default_language'];
    }
    $showLanguage = $showDefaultLanguage || $lang != $q_config['default_language'];
    //qtranxf_dbg_log('qtranxf_convertURL('.$url.','.$lang.'): showLanguage=',$showLanguage);
    $complete = qtranxf_get_url_for_language($url, $lang, $showLanguage);
    //qtranxf_dbg_log('qtranxf_convertURL: complete: ',$complete);
    return $complete;
}
開發者ID:raxdev,項目名稱:qtranslate-x,代碼行數:44,代碼來源:qtranslate_core.php

示例5: qtranxf_admin_home_url

/**
 * Encode front end language on home_url, since, on admin side, it is mostly in use to create links to a preview pages.
 * @since 3.4.5
*/
function qtranxf_admin_home_url($url, $path, $orig_scheme, $blog_id)
{
    global $q_config;
    //qtranxf_dbg_log('qtranxf_admin_home_url: $_COOKIE: ', $_COOKIE);
    if (isset($_COOKIE[QTX_COOKIE_NAME_FRONT])) {
        $lang = $_COOKIE[QTX_COOKIE_NAME_FRONT];
    } else {
        $lang = $q_config['default_language'];
    }
    //qtranxf_dbg_log('qtranxf_admin_home_url: url='.$url.'; path='.$path.'; orig_scheme='.$orig_scheme);
    $url = qtranxf_get_url_for_language($url, $lang, !$q_config['hide_default_language'] || $lang != $q_config['default_language']);
    //qtranxf_dbg_log('qtranxf_admin_home_url: url='.$url.'; lang='.$lang);
    return $url;
}
開發者ID:AndreyLanko,項目名稱:perevorot-prozorro-wp,代碼行數:18,代碼來源:qtx_admin.php


注:本文中的qtranxf_get_url_for_language函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。