当前位置: 首页>>代码示例>>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;未经允许,请勿转载。