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


PHP qtranxf_get_home_info函数代码示例

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


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

示例1: qtranxf_run_test_convertURL

function qtranxf_run_test_convertURL($url_mode, $lang)
{
    global $q_config;
    $homeinfo = qtranxf_get_home_info();
    $p = $homeinfo['path'];
    $h = $homeinfo['scheme'] . '://' . $homeinfo['host'] . $p;
    $b = trailingslashit($p);
    //$lang = qtranxf_getLanguage();
    //common tests
    $urls = array('#' => '#', '#tag' => '#tag', 'http://external.domain.com' => 'http://external.domain.com', 'http://external.domain.com/' => 'http://external.domain.com/', 'http://external.domain.com?tr=123#tag' => 'http://external.domain.com?tr=123#tag', 'http://external.domain.com/?tr=123#tag' => 'http://external.domain.com/?tr=123#tag', 'http://external.domain.com?tr=123' => 'http://external.domain.com?tr=123', 'http://external.domain.com/?tr=123' => 'http://external.domain.com/?tr=123', 'http://external.domain.com#tag' => 'http://external.domain.com#tag', 'http://external.domain.com/#tag' => 'http://external.domain.com/#tag');
    $cnt = qtranxf_test_convertURL('Common', $urls, $lang, true);
    $cnt = qtranxf_test_convertURL('Common', $urls, $lang, false);
    $q_config['url_mode'] = $url_mode;
    switch ($url_mode) {
        case QTX_URL_QUERY:
            //qtranxf_tst_log('qtx-test-convertURL: $url_mode=QTX_URL_QUERY: $p=',$p);
            $urls = array($b . '?lang=fr' => $h . '/?lang=' . $lang, $b . '#' => $h . '/?lang=' . $lang, $b . '#tag' => $h . '/?lang=' . $lang . '#tag', $h . '#tag' => $h . '?lang=' . $lang . '#tag', $h . '?lang=fr#tag' => $h . '?lang=' . $lang . '#tag', $b . '?lang=fr&page_id=123#tag' => $h . '/?page_id=123&lang=' . $lang . '#tag', $h . '?page_id=123&lang=fr' => $h . '?page_id=123&lang=' . $lang . '', $h . '?page_id=123&lang=fr#tag' => $h . '?page_id=123&lang=' . $lang . '#tag', $b . '?page_id=123&lang=fr&tab=tab3' => $h . '/?page_id=123&tab=tab3&lang=' . $lang . '', $h . '?page_id=123&lang=fr&tab=tab3#tag' => $h . '?page_id=123&tab=tab3&lang=' . $lang . '#tag');
            $cnt = qtranxf_test_convertURL('QTX_URL_QUERY', $urls, $lang, true);
            $urls = array($b . '?lang=fr' => $h . '/', $b . '#' => $h . '/', $b . '#tag' => $h . '/#tag', $h . '#tag' => $h . '#tag', $h . '?lang=fr#tag' => $h . '#tag', $b . '?lang=fr&page_id=123#tag' => $h . '/?page_id=123#tag', $h . '?page_id=123&lang=fr' => $h . '?page_id=123', $h . '?page_id=123&lang=fr#tag' => $h . '?page_id=123#tag', $b . '?page_id=123&lang=fr&tab=tab3' => $h . '/?page_id=123&tab=tab3', $h . '?page_id=123&lang=fr&tab=tab3#tag' => $h . '?page_id=123&tab=tab3#tag');
            $cnt = qtranxf_test_convertURL('QTX_URL_QUERY', $urls, $lang, false);
            break;
        case QTX_URL_PATH:
            //qtranxf_tst_log('qtx-test-convertURL: $url_mode=QTX_URL_PATH');
            $hp = $h . '/' . $lang;
            $urls = array($b . 'fr' => $hp . '', $h . '/fr' => $hp . '', $b . 'fr/' => $hp . '/', $h . '/fr/' => $hp . '/', $b . '#' => $hp . '/', $b . '#tag' => $hp . '/#tag', $h . '#tag' => $hp . '#tag', $b . 'fr/?lang=fr' => $hp . '/', $h . '/fr?lang=fr#tag' => $hp . '#tag', $b . 'fr/?lang=fr&page_id=123#tag' => $hp . '/?page_id=123#tag', $h . '?page_id=123&lang=fr' => $hp . '?page_id=123', $h . '/fr?page_id=123&lang=fr#tag' => $hp . '?page_id=123#tag', $b . '?page_id=123&lang=fr&tab=tab3' => $hp . '/?page_id=123&tab=tab3', $h . '/fr/?page_id=123&lang=fr&lang=xx&tab=tab3#tag' => $hp . '/?page_id=123&tab=tab3#tag');
            $cnt = qtranxf_test_convertURL('QTX_URL_PATH', $urls, $lang, true);
            $urls = array($b . 'fr' => $h . '', $h . '/fr' => $h . '', $b . 'fr/' => $h . '/', $h . '/fr/' => $h . '/', $b . '#' => $h . '/', $b . '#tag' => $h . '/#tag', $h . '#tag' => $h . '#tag', $b . '?lang=fr' => $h . '/', $h . '?lang=fr' => $h . '', $h . '/fr?lang=fr#tag' => $h . '#tag', $b . 'fr/?lang=fr&page_id=123#tag' => $h . '/?page_id=123#tag', $h . '?page_id=123&lang=fr' => $h . '?page_id=123', $h . '?page_id=123&lang=fr#tag' => $h . '?page_id=123#tag', $b . 'fr/?page_id=123&lang=fr&tab=tab3' => $h . '/?page_id=123&tab=tab3', $h . '/fr/?page_id=123&lang=fr&tab=tab3#tag' => $h . '/?page_id=123&tab=tab3#tag');
            $cnt = qtranxf_test_convertURL('QTX_URL_PATH', $urls, $lang, false);
            break;
        case QTX_URL_DOMAIN:
            //qtranxf_tst_log('qtx-test-convertURL: $url_mode=QTX_URL_DOMAIN');
            $hp = $homeinfo['scheme'] . '://' . $lang . '.' . $homeinfo['host'] . $p;
            $urls = array($b . '?lang=fr' => $hp . '/', $b . '#' => $hp . '/', $h . '?lang=fr#tag' => $hp . '#tag', $b . '?lang=fr&page_id=123#tag' => $hp . '/?page_id=123#tag', $h . '?page_id=123&lang=fr' => $hp . '?page_id=123', $h . '?page_id=123&lang=fr#tag' => $hp . '?page_id=123#tag', $b . '?page_id=123&lang=fr&tab=tab3' => $hp . '/?page_id=123&tab=tab3', $h . '?page_id=123&lang=fr&tab=tab3#tag' => $hp . '?page_id=123&tab=tab3#tag');
            $cnt = qtranxf_test_convertURL('QTX_URL_DOMAIN', $urls, $lang, true);
            $urls = array($b . '?lang=fr' => $h . '/', $b . '#' => $h . '/', $h . '?lang=fr#tag' => $h . '#tag', $b . '?lang=fr&page_id=123#tag' => $h . '/?page_id=123#tag', $h . '?page_id=123&lang=fr' => $h . '?page_id=123', $h . '?page_id=123&lang=fr#tag' => $h . '?page_id=123#tag', $b . '?page_id=123&lang=fr&tab=tab3' => $h . '/?page_id=123&tab=tab3', $h . '?page_id=123&lang=fr&tab=tab3#tag' => $h . '?page_id=123&tab=tab3#tag');
            $cnt = qtranxf_test_convertURL('QTX_URL_DOMAIN', $urls, $lang, false);
            break;
        case QTX_URL_DOMAINS:
            //qtranxf_tst_log('qtx-test-convertURL: $url_mode=QTX_URL_DOMAINS');
            $h = $homeinfo['scheme'] . '://' . $q_config['domains'][$q_config['default_language']] . $p;
            $hp = $homeinfo['scheme'] . '://' . $q_config['domains'][$lang] . $p;
            $urls = array($b . '?lang=fr' => $hp . '/', $b . '#' => $hp . '/', $h . '?lang=fr#tag' => $hp . '#tag', $b . '?lang=fr&page_id=123#tag' => $hp . '/?page_id=123#tag', $h . '?page_id=123&lang=fr' => $hp . '?page_id=123', $h . '?page_id=123&lang=fr#tag' => $hp . '?page_id=123#tag', $b . '?page_id=123&lang=fr&tab=tab3' => $hp . '/?page_id=123&tab=tab3', $h . '?page_id=123&lang=fr&tab=tab3#tag' => $hp . '?page_id=123&tab=tab3#tag');
            $cnt = qtranxf_test_convertURL('QTX_URL_DOMAINS', $urls, $lang, true);
            $urls = array($b . '?lang=fr' => $h . '/', $b . '#' => $h . '/', $h . '?lang=fr#tag' => $h . '#tag', $b . '?lang=fr&page_id=123#tag' => $h . '/?page_id=123#tag', $h . '?page_id=123&lang=fr' => $h . '?page_id=123', $h . '?page_id=123&lang=fr#tag' => $h . '?page_id=123#tag', $b . '?page_id=123&lang=fr&tab=tab3' => $h . '/?page_id=123&tab=tab3', $h . '?page_id=123&lang=fr&tab=tab3#tag' => $h . '?page_id=123&tab=tab3#tag');
            $cnt = qtranxf_test_convertURL('QTX_URL_DOMAINS', $urls, $lang, false);
            break;
        default:
            qtranxf_tst_log('qtx-test-convertURL: unknown $url_mode=', $url_mode);
            return;
    }
}
开发者ID:vinnygats,项目名称:qtranslate-x,代码行数:51,代码来源:qtx-test-convertURL.php

示例2: qtranxf_external_host

function qtranxf_external_host($host)
{
    $homeinfo = qtranxf_get_home_info();
    return qtranxf_external_host_ex($host, $homeinfo);
}
开发者ID:antigenius,项目名称:qtranslate-x,代码行数:5,代码来源:qtranslate_utils.php

示例3: qtranxf_get_url_for_language

function qtranxf_get_url_for_language($url, $lang, $showLanguage = true)
{
    global $q_config;
    static $url_cache = array();
    //qtranxf_dbg_log('qtranxf_get_url_for_language: $url_cache:',$url_cache);
    if (!isset($url_cache[$url])) {
        $url_cache[$url] = array();
    }
    $urlinfo =& $url_cache[$url];
    //$urlinfo = apply_filters('qtranslate_url_for_language_pre', $urlinfo, $url, $lang, $showLanguage);
    if ($showLanguage) {
        if (isset($urlinfo[$lang])) {
            //qtranxf_dbg_log('qtranxf_get_url_for_language: cached: lang='.$lang.': ',$urlinfo);
            return $urlinfo[$lang];
        }
    } else {
        if (isset($urlinfo['bare'])) {
            //qtranxf_dbg_log('qtranxf_get_url_for_language: cached: bare: ',$urlinfo);
            return $urlinfo['bare'];
        }
    }
    if (isset($urlinfo['language_neutral'])) {
        //qtranxf_dbg_log('qtranxf_get_url_for_language: cached: language_neutral: ',$urlinfo);
        return $urlinfo['language_neutral'];
    }
    $homeinfo = qtranxf_get_home_info();
    if (!isset($urlinfo['url_parsed'])) {
        if (empty($url)) {
            $urlinfo = qtranxf_copy_url_info($q_config['url_info']);
            if (isset($urlinfo['wp-path']) && qtranxf_language_neutral_path($urlinfo['wp-path'])) {
                //qtranxf_dbg_log('qtranxf_get_url_for_language: language_neutral: wp-path: url='.$url.':',$urlinfo);
                $complete = qtranxf_buildURL($urlinfo, $homeinfo);
                if (!isset($url_cache[$complete])) {
                    $url_cache[$complete] = $urlinfo;
                }
                $urlinfo['language_neutral'] = $complete;
                return $complete;
            }
        } else {
            $urlinfo = qtranxf_get_url_info($url);
            // check if it's an external link
            if (!isset($urlinfo['wp-path'])) {
                $urlinfo['language_neutral'] = $url;
                //qtranxf_dbg_log('qtranxf_get_url_for_language: language_neutral: external path: ',$urlinfo);
                return $url;
            }
            if (empty($urlinfo['host'])) {
                if (empty($urlinfo['wp-path'])) {
                    if (empty($urlinfo['query'])) {
                        $urlinfo['language_neutral'] = $url;
                        //qtranxf_dbg_log('qtranxf_get_url_for_language: language_neutral: relative path: ',$urlinfo);
                        return $url;
                    }
                } else {
                    switch ($urlinfo['wp-path'][0]) {
                        case '/':
                            break;
                        case '#':
                            $urlinfo['language_neutral'] = $url;
                            //qtranxf_dbg_log('qtranxf_get_url_for_language: language_neutral: relative hash: ',$urlinfo);
                            return $url;
                        default:
                            $urlinfo['wp-path'] = trailingslashit($q_config['url_info']['wp-path']) . $urlinfo['wp-path'];
                            break;
                    }
                }
            } elseif (qtranxf_external_host_ex($urlinfo['host'], $homeinfo)) {
                $urlinfo['language_neutral'] = $url;
                //qtranxf_dbg_log('qtranxf_get_url_for_language: language_neutral: external host: ',$urlinfo);
                return $url;
            }
            if (qtranxf_language_neutral_path($urlinfo['wp-path'])) {
                $urlinfo['language_neutral'] = $url;
                //qtranxf_dbg_log('qtranxf_get_url_for_language: language_neutral: wp-path: ',$urlinfo);
                return $url;
            }
            qtranxf_url_del_language($urlinfo);
        }
        $urlinfo['url_parsed'] = $url;
    }
    $urlinfo_lang = qtranxf_url_set_language($urlinfo, $lang, $showLanguage);
    $complete = qtranxf_buildURL($urlinfo_lang, $homeinfo);
    //$complete = apply_filters('qtranslate_url_for_language',$complete,$lang,$urlinfo_lang,$homeinfo);
    if ($showLanguage) {
        $urlinfo[$lang] = $complete;
    } else {
        $urlinfo['bare'] = $complete;
    }
    if (!isset($url_cache[$complete])) {
        $url_cache[$complete] = $urlinfo;
    }
    //qtranxf_dbg_log('done: qtranxf_get_url_for_language('.$lang.($showLanguage?', true':', false').'): $urlinfo=',$urlinfo,false);
    return $complete;
}
开发者ID:raxdev,项目名称:qtranslate-x,代码行数:94,代码来源:qtranslate_core.php

示例4: qtranxf_conf


//.........这里部分代码省略.........
						<small><?php 
        _e('This is only applicable to Pre-Path and Pre-Domain mode.', 'qtranslate');
        ?>
</small><br/><br/>
					<?php 
        //if(!$permalink_is_query) {
        do_action('qtranslate_url_mode_choices', $permalink_is_query);
        ?>
						<label title="Per-Domain Mode"><input type="radio" name="url_mode" value="<?php 
        echo QTX_URL_DOMAINS;
        ?>
" <?php 
        checked($url_mode, QTX_URL_DOMAINS);
        ?>
 /> <?php 
        echo __('Use Per-Domain mode: specify separate user-defined domain for each language.', 'qtranslate');
        ?>
</label>
					<?php 
        //}
        ?>
					</fieldset>
				</td>
			</tr>
	<?php 
        /*
        			<tr valign="top">
        				<td style="text-align: right"><?php echo __('Hide Default Language', 'qtranslate').':'; ?></td>
        				<td>
        				</td>
        			</tr>
        */
        if ($url_mode == QTX_URL_DOMAINS) {
            $homeinfo = qtranxf_get_home_info();
            $home_host = $homeinfo['host'];
            //parse_url(get_option('home'),PHP_URL_HOST);
            foreach ($q_config['enabled_languages'] as $lang) {
                $id = 'language_domain_' . $lang;
                $domain = isset($q_config['domains'][$lang]) ? $q_config['domains'][$lang] : $lang . '.' . $home_host;
                echo '<tr><td style="text-align: right">' . __('Domain for', 'qtranslate') . ' <a href="' . $clean_uri . '&edit=' . $lang . '">' . $q_config['language_name'][$lang] . '</a>&nbsp;(' . $lang . '):</td><td><input type="text" name="' . $id . '" id="' . $id . '" value="' . $domain . '" style="width:100%"/></td></tr>' . PHP_EOL;
            }
        }
        ?>
			<tr valign="top">
				<th scope="row"><?php 
        _e('Post Types', 'qtranslate');
        ?>
</th>
				<td>
					<label for="post_types"><?php 
        _e('Post types enabled for translation:', 'qtranslate');
        ?>
</label><p>
					<?php 
        $post_types = get_post_types();
        foreach ($post_types as $post_type) {
            if (!qtranxf_post_type_optional($post_type)) {
                continue;
            }
            $post_type_off = isset($q_config['post_type_excluded']) && in_array($post_type, $q_config['post_type_excluded']);
            ?>
					<span style="margin-right: 12pt"><input type="checkbox" name="post_types[<?php 
            echo $post_type;
            ?>
]" id="post_type_<?php 
            echo $post_type;
开发者ID:ycms,项目名称:framework,代码行数:67,代码来源:qtx_configuration.php

示例5: qtranxf_add_admin_footer_js

function qtranxf_add_admin_footer_js($enqueue_script = false)
{
    global $q_config;
    $post_type = qtranxf_post_type();
    $page_config = qtranxf_get_admin_page_config_post_type($post_type);
    //qtranxf_dbg_log('qtranxf_add_admin_footer_js: $page_config: ',$page_config);
    if (empty($page_config)) {
        return;
    }
    wp_dequeue_script('autosave');
    wp_deregister_script('autosave');
    //autosave script saves the active language only and messes it up later in a hard way
    $config = array();
    // since 3.2.9.9.0 'enabled_languages' is replaced with 'language_config' structure
    $keys = array('default_language', 'language', 'url_mode', 'lsb_style_wrap_class', 'lsb_style_active_class', 'hide_default_language');
    // ,'term_name'
    foreach ($keys as $key) {
        $config[$key] = $q_config[$key];
    }
    $config['custom_fields'] = apply_filters('qtranslate_custom_fields', $q_config['custom_fields']);
    $config['custom_field_classes'] = apply_filters('qtranslate_custom_field_classes', $q_config['custom_field_classes']);
    if ($q_config['url_mode'] == QTX_URL_DOMAINS) {
        $config['domains'] = $q_config['domains'];
    }
    $homeinfo = qtranxf_get_home_info();
    $config['homeinfo_path'] = trailingslashit($homeinfo['path']);
    $config['home_url_path'] = parse_url(home_url('/'), PHP_URL_PATH);
    //todo optimize
    $config['flag_location'] = qtranxf_flag_location();
    $config['js'] = array();
    //$config['flag']=array();//deprecated since 3.2.9.9.0
    //$config['language_name']=array();//deprecated since 3.2.9.9.0
    $config['language_config'] = array();
    foreach ($q_config['enabled_languages'] as $lang) {
        //$config['flag'][$lang]=$q_config['flag'][$lang];
        //$config['language_name'][$lang]=$q_config['language_name'][$lang];
        $config['language_config'][$lang] = array();
        $config['language_config'][$lang]['flag'] = $q_config['flag'][$lang];
        $config['language_config'][$lang]['name'] = $q_config['language_name'][$lang];
        $config['language_config'][$lang]['locale'] = $q_config['locale'][$lang];
        $config['language_config'][$lang]['locale_html'] = !empty($q_config['locale_html'][$lang]) ? $q_config['locale_html'][$lang] : $lang;
    }
    if (!empty($page_config)) {
        $config['page_config'] = $page_config;
        //no need for javascript:
        unset($config['page_config']['js']);
        //unset($config['page_config']['js-conf']);
        //unset($config['page_config']['js-exec']);
    }
    $config['LSB'] = $q_config['editor_mode'] == QTX_EDITOR_MODE_LSB;
    /**
     * Last chance to customize Java script variable qTranslateConfig.
     */
    $config = apply_filters('qtranslate_admin_page_config', $config);
    ?>
<script type="text/javascript">
// <![CDATA[
<?php 
    echo 'var qTranslateConfig=' . json_encode($config) . ';' . PHP_EOL;
    qtranxf_loadfiles_js($page_config['js'], $enqueue_script);
    if ($q_config['qtrans_compatibility']) {
        echo 'qtrans_use = function(lang, text) { var result = qtranxj_split(text); return result[lang]; }' . PHP_EOL;
    }
    do_action('qtranslate_add_admin_footer_js');
    ?>
//]]>
</script>
<?php 
}
开发者ID:AndreyLanko,项目名称:perevorot-prozorro-wp,代码行数:69,代码来源:qtx_admin.php

示例6: qtranxf_conf


//.........这里部分代码省略.........
						<label for="hide_default_language">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" name="hide_default_language" id="hide_default_language" value="1"<?php 
            checked($q_config['hide_default_language']);
            ?>
/> <?php 
            _e('Hide URL language information for default language.', 'qtranslate');
            ?>
</label>
						<p class="qtranxs_notes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php 
            _e('This is only applicable to Pre-Path and Pre-Domain mode.', 'qtranslate');
            ?>
</p><br>
					<?php 
            //if(!$permalink_is_query) {
            do_action('qtranslate_url_mode_choices', $permalink_is_query, $url_mode);
            ?>
						<label title="Per-Domain Mode"><input type="radio" name="url_mode" value="<?php 
            echo QTX_URL_DOMAINS;
            ?>
" <?php 
            checked($url_mode, QTX_URL_DOMAINS);
            ?>
 /> <?php 
            echo __('Use Per-Domain mode: specify separate user-defined domain for each language.', 'qtranslate');
            ?>
</label>
					<?php 
            //}
            ?>
					</fieldset>
				</td>
			</tr>
	<?php 
            if ($url_mode == QTX_URL_DOMAINS) {
                $homeinfo = qtranxf_get_home_info();
                $home_host = $homeinfo['host'];
                //parse_url(get_option('home'),PHP_URL_HOST);
                foreach ($q_config['enabled_languages'] as $lang) {
                    $id = 'language_domain_' . $lang;
                    $domain = isset($q_config['domains'][$lang]) ? $q_config['domains'][$lang] : $lang . '.' . $home_host;
                    echo '<tr><td style="text-align: right">' . __('Domain for', 'qtranslate') . ' <a href="' . $clean_uri . '&edit=' . $lang . '">' . $q_config['language_name'][$lang] . '</a>&nbsp;(' . $lang . '):</td><td><input type="text" name="' . $id . '" id="' . $id . '" value="' . $domain . '" style="width:100%"/></td></tr>' . PHP_EOL;
                }
            }
            ?>
			<tr valign="top">
				<th scope="row"><?php 
            _e('Untranslated Content', 'qtranslate');
            ?>
</th>
				<td>
					<p class="qtranxs_explanation"><?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 
            _e('Hide Content which is not available for the selected language.', 'qtranslate');
            ?>
</label>
					<br/>
					<p class="qtranxs_notes"><?php 
            _e('When checked, posts will be hidden if the content is not available for the selected language. If unchecked, a message will appear showing all the languages the content is available in.', 'qtranslate');
            ?>
					<?php 
开发者ID:Krishan19,项目名称:qtranslate-x,代码行数:67,代码来源:qtx_configuration.php


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