本文整理汇总了PHP中qtrans_convertURL函数的典型用法代码示例。如果您正苦于以下问题:PHP qtrans_convertURL函数的具体用法?PHP qtrans_convertURL怎么用?PHP qtrans_convertURL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了qtrans_convertURL函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: hw_menu_qtrans_convertHomeURL
/**
* fix home_url
* @param $url
* @param $what
* @return mixed|string
*/
function hw_menu_qtrans_convertHomeURL($url, $what)
{
if (function_exists('qtrans_convertURL') && $what == '/') {
return qtrans_convertURL($url);
}
return $url;
}
示例2: qtrans_convertHomeURL
function qtrans_convertHomeURL($url, $what)
{
if ($what == '/') {
return qtrans_convertURL($url);
}
return $url;
}
示例3: qt_permalink
function qt_permalink($qt, $permalink, $post_content, $modified_time, $change_freq, $priority, &$sitemap)
{
if ($qt["enabled"]) {
// Get modified time
if ($modified_time != 0) {
$modified_time = $sitemap->GetTimestampFromMySql($modified_time);
}
// Get a list of languages
if ($post_content) {
// Get available languages form post
$languages = qtrans_getAvailableLanguages($post_content);
} else {
// Get all available languages
$languages = $qt["enabled_languages"];
}
// Add an extra permalink url for every non-default qTranslate language
foreach ($languages as $language) {
if ($qt["hide_default_language"] == 1 && $qt["default_language"] == $language) {
$sitemap->AddUrl($permalink, $modified_time, $change_freq, $priority);
} else {
$sitemap->AddUrl(qtrans_convertURL($permalink, $language, true), $modified_time, $change_freq, $priority);
}
}
}
}
示例4: qtranslate_menu_item
function qtranslate_menu_item($menu_item)
{
if (stripos($menu_item->url, get_site_url()) !== false) {
$menu_item->url = qtrans_convertURL($menu_item->url);
//echo $menu_item->url;
}
return $menu_item;
}
示例5: catchbase_menuitem
/**
* Template for Converting Home link in Custom Menu
*
* To override this in a child theme
* simply create your own catchbase_menuitem(), and that function will be used instead.
*
* @since Catch Base Pro 3.0
*/
function catchbase_menuitem($menu_item)
{
// convert local URLs in custom menu items
if ($menu_item->type == 'custom' && stripos($menu_item->url, get_site_url()) !== false) {
$menu_item->url = qtrans_convertURL($menu_item->url);
}
return $menu_item;
}
示例6: convertURL
public function convertURL($url, $lang = '')
{
if (function_exists('qtranxf_convertURL')) {
return qtranxf_convertURL($url, $lang);
} else {
return qtrans_convertURL($url, $lang);
}
}
示例7: adventurous_homepage_headline
/**
* Template for Homepage Headline
*
* To override this in a child theme
* simply create your own adventurous_homepage_headline(), and that function will be used instead.
*
* @uses adventurous_before_main action to add it in the header
* @since Adventurous 1.0
*/
function adventurous_homepage_headline()
{
//delete_transient( 'adventurous_homepage_headline' );
global $post, $wp_query, $adventurous_options_settings;
$options = $adventurous_options_settings;
// Getting data from Theme Options
$disable_headline = $options['disable_homepage_headline'];
$disable_subheadline = $options['disable_homepage_subheadline'];
$disable_button = $options['disable_homepage_button'];
$homepage_headline = $options['homepage_headline'];
$homepage_subheadline = $options['homepage_subheadline'];
$homepage_headline_button = $options['homepage_headline_button'];
$homepage_headline_target = $options['homepage_headline_target'];
//support qTranslate plugin
if (function_exists('qtrans_convertURL')) {
$homepage_headline_url = qtrans_convertURL($options['homepage_headline_url']);
} else {
$homepage_headline_url = $options['homepage_headline_url'];
}
// Front page displays in Reading Settings
$page_on_front = get_option('page_on_front');
$page_for_posts = get_option('page_for_posts');
// Get Page ID outside Loop
$page_id = $wp_query->get_queried_object_id();
if (empty($disable_headline) || empty($disable_subheadline) || empty($disable_button)) {
if (!($adventurous_homepage_headline = get_transient('adventurous_homepage_headline'))) {
echo '<!-- refreshing cache -->';
$adventurous_homepage_headline = '<div id="homepage-message"><div class="container"><div class="left-section">';
if ($disable_headline == "0") {
$adventurous_homepage_headline .= '<h2>' . $homepage_headline . '</h2>';
}
if ($disable_subheadline == "0") {
$adventurous_homepage_headline .= '<p>' . $homepage_subheadline . '</p>';
}
$adventurous_homepage_headline .= '</div><!-- .left-section -->';
if (!empty($homepage_headline_url) && $disable_button == "0") {
if (!empty($homepage_headline_target)) {
$headlinetarget = '_blank';
} else {
$headlinetarget = '_self';
}
$adventurous_homepage_headline .= '<div class="right-section"><a href="' . $homepage_headline_url . '" target="' . $headlinetarget . '">' . $homepage_headline_button . '</a></div><!-- .right-section -->';
}
$adventurous_homepage_headline .= '</div><!-- .container --></div><!-- #homepage-message -->';
set_transient('adventurous_homepage_headline', $adventurous_homepage_headline, 86940);
}
echo $adventurous_homepage_headline;
}
}
示例8: showLangSwitcher
/**
* Показывает переключатель языков в виде ненумерованного списка
*
* @param $ulClasses
* @param string $linkActiveClass
* @param bool $echo
*
* @return string
*/
public function showLangSwitcher($ulClasses, $linkActiveClass = 'active', $echo = TRUE)
{
$url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$result = '<ul class="' . $ulClasses . '">';
foreach (qtrans_getSortedLanguages() as $lang) {
$isActive = $lang == $GLOBALS['q_config']['language'] ? ' class="' . $linkActiveClass . '" ' : '';
$result .= '<li><a href="' . qtrans_convertURL($url, $lang) . '" ' . $isActive . '>' . $lang . '</a></li>';
}
$result .= '</ul>';
if ($echo) {
echo $result;
return;
}
return $result;
}
示例9: get_post_knews
function get_post_knews($reply, $id, $type, $lang)
{
if (is_array($reply) && isset($reply['skip'])) {
return $reply;
}
global $post, $Knews_plugin, $knewsOptions;
$post = get_post($id);
$permalink = get_permalink();
if (KNEWS_MULTILANGUAGE && $knewsOptions['multilanguage_knews'] == 'qt' && function_exists('qtrans_convertURL')) {
$post = qtrans_use($lang, $post, false);
$permalink = qtrans_convertURL($permalink, $lang, true);
}
setup_postdata($post);
$excerpt_length = apply_filters('excerpt_length', 55);
$excerpt = (string) get_the_excerpt();
$content = (string) get_the_content();
if ($knewsOptions['apply_filters_on'] == '1') {
$content = apply_filters('the_content', $content);
}
$content = strip_shortcodes($content);
$content = knews_iterative_extract_code('<script', '</script>', $content, true);
$content = knews_iterative_extract_code('<fb:like', '</fb:like>', $content, true);
$content = str_replace(']]>', ']]>', $content);
$content = strip_tags($content);
if ($excerpt == '') {
$excerpt = $content;
}
$words = explode(' ', $content, $excerpt_length + 1);
if (count($words) > $excerpt_length) {
array_pop($words);
//array_push($words, '[...]');
$excerpt = implode(' ', $words) . '...';
}
$content = nl2br($content);
$words = explode(' ', $excerpt, $excerpt_length + 1);
if (count($words) > $excerpt_length) {
array_pop($words);
//array_push($words, '[...]');
$excerpt = implode(' ', $words) . '...';
}
$featimg = '';
if ($Knews_plugin->im_pro()) {
if (has_post_thumbnail($post->ID)) {
$featimg = knews_get_image_path();
}
}
return array('title' => get_the_title(), 'excerpt' => $excerpt, 'content' => $content, 'permalink' => $permalink, 'image' => $featimg);
}
示例10: qtranslate
public static function qtranslate($input)
{
global $q_config;
if (is_array($input)) {
// got an array? return one!
foreach ($input as $url) {
foreach ($q_config['enabled_languages'] as $language) {
$return[] = qtrans_convertURL($url, $language);
}
}
} else {
$return = qtrans_convertURL($input);
// not an array? just convert the string.
}
return $return;
}
示例11: qtrans_getLanguageLinks
function qtrans_getLanguageLinks($style = '', $id = '')
{
if (function_exists('qtrans_init')) {
global $q_config;
if ($style == '') {
$style = 'text';
}
if (is_bool($style) && $style) {
$style = 'image';
}
if (is_404()) {
$url = get_option('home');
} else {
$url = '';
}
if ($id == '') {
$id = 'qtranslate';
}
$id .= '-chooser';
switch ($style) {
case 'image':
case 'text':
case 'dropdown':
echo '<ul class="qtrans_language_chooser" id="' . $id . '">';
foreach (qtrans_getSortedLanguages() as $language) {
echo '<li';
if ($language == $q_config['language']) {
echo ' class="active"';
}
echo '><a href="' . qtrans_convertURL($url, $language) . '"';
// set hreflang
echo ' hreflang="' . $language . '" title="' . $q_config['language_name'][$language] . '"';
echo '><span';
echo '>' . $q_config['language_name'][$language] . '</span></a></li>';
}
echo "</ul><div class=\"qtrans_widget_end\"></div>";
}
}
}
示例12: qtrans_generate_language_list
/**
* Language list Code for non-Widget users
*
* @global array $q_config
* @param string $sep
*/
function qtrans_generate_language_list($sep = " | ")
{
global $q_config;
$languages = qtrans_getSortedLanguages();
$num_langs = count($languages);
$id = 'qtranslate-chooser';
$url = is_404() ? get_option('home') : '';
echo '<div class="qtrans_language_chooser" id="' . $id . '">';
foreach ($languages as $language) {
$classes = array('lang-' . $language);
if ($language == $q_config['language']) {
$classes[] = 'active';
}
echo '<span class="' . implode(' ', $classes) . '"><a href="' . qtrans_convertURL($url, $language) . '"';
echo ' hreflang="' . $language . '" title="' . $q_config['language_name'][$language] . '"';
echo '>' . $q_config['language_name'][$language] . '</a></span>';
if (--$num_langs > 0) {
echo '<span class="qtrans_separator">' . $sep . '</span>';
}
}
echo "</div>";
}
示例13: qtrans_header
function qtrans_header()
{
global $q_config;
echo "\n<meta http-equiv=\"Content-Language\" content=\"" . $q_config['locale'][$q_config['language']] . "\" />\n";
$css = "<style type=\"text/css\" media=\"screen\">\n";
$css .= ".qtrans_flag span { display:none }\n";
$css .= ".qtrans_flag { height:12px; width:18px; display:block }\n";
$css .= ".qtrans_flag_and_text { padding-left:20px }\n";
foreach ($q_config['enabled_languages'] as $language) {
$css .= ".qtrans_flag_" . $language . " { background:url(" . WP_CONTENT_URL . '/' . $q_config['flag_location'] . $q_config['flag'][$language] . ") no-repeat }\n";
}
$css .= "</style>\n";
echo apply_filters('qtranslate_header_css', $css);
// skip the rest if 404
if (is_404()) {
return;
}
// set links to translations of current page
foreach ($q_config['enabled_languages'] as $language) {
if ($language != qtrans_getLanguage()) {
echo '<link hreflang="' . $language . '" href="' . qtrans_convertURL('', $language) . '" rel="alternate" rev="alternate" />' . "\n";
}
}
}
示例14: get_option
</div><!-- end of .widget-wrapper -->
<div class="widget-wrapper">
<div class="widget-title-home"></div>
<div class="textwidget">
<?php
$options = get_option('responsive_theme_options');
echo '<ul class="social-icons-custom">';
if (!empty($options['twitter_uid'])) {
echo '<li class="twitter-icon-custom social-icon"><a target="_blank" href="' . $options['twitter_uid'] . '">' . '<img src="' . get_stylesheet_directory_uri() . '/icons/twitter.png" width="24" height="24" alt="Twitter">' . '</a></li>';
}
if (!empty($options['facebook_uid'])) {
echo '<li class="facebook-icon-custom social-icon"><a target="_blank" href="' . $options['facebook_uid'] . '">' . '<img src="' . get_stylesheet_directory_uri() . '/icons/facebook.png" width="24" height="24" alt="Facebook">' . '</a></li>';
}
echo '<li class="rss-icon-custom social-icon"><a target="_blank" href="' . qtrans_convertURL(get_bloginfo('rss2_url', 'display')) . '">' . '<img src="' . get_stylesheet_directory_uri() . '/icons/rss.png" width="24" height="24" alt="RSS">' . '</a></li>';
echo '</ul><!-- end of .social-icons -->';
?>
</div>
</div><!-- end of .widget-wrapper -->
<?php
if (!dynamic_sidebar('home-widget-3')) {
?>
<div class="widget-wrapper">
<div class="widget-title-home"><h4><?php
示例15: tc_url_lang
function tc_url_lang($url) {
return ( function_exists( 'qtrans_convertURL' ) ) ? qtrans_convertURL($url) : $url;
}