Introduce home_url(). Props Denis-de-Bernardy, hakre. see #9008
git-svn-id: http://svn.automattic.com/wordpress/trunk@12598 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
da89de4958
commit
ec8e347792
|
@ -38,7 +38,7 @@ if ( empty($withcomments) && !is_single() ) {
|
||||||
|
|
||||||
<div id="header" role="banner">
|
<div id="header" role="banner">
|
||||||
<div id="headerimg">
|
<div id="headerimg">
|
||||||
<h1><a href="<?php echo get_option('home'); ?>/"><?php bloginfo('name'); ?></a></h1>
|
<h1><a href="<?php echo home_url(); ?>/"><?php bloginfo('name'); ?></a></h1>
|
||||||
<div class="description"><?php bloginfo('description'); ?></div>
|
<div class="description"><?php bloginfo('description'); ?></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -209,7 +209,7 @@ function get_author_posts_url($author_id, $author_nicename = '') {
|
||||||
$link = $wp_rewrite->get_author_permastruct();
|
$link = $wp_rewrite->get_author_permastruct();
|
||||||
|
|
||||||
if ( empty($link) ) {
|
if ( empty($link) ) {
|
||||||
$file = get_option('home') . '/';
|
$file = home_url() . '/';
|
||||||
$link = $file . '?author=' . $auth_ID;
|
$link = $file . '?author=' . $auth_ID;
|
||||||
} else {
|
} else {
|
||||||
if ( '' == $author_nicename ) {
|
if ( '' == $author_nicename ) {
|
||||||
|
@ -218,7 +218,7 @@ function get_author_posts_url($author_id, $author_nicename = '') {
|
||||||
$author_nicename = $user->user_nicename;
|
$author_nicename = $user->user_nicename;
|
||||||
}
|
}
|
||||||
$link = str_replace('%author%', $author_nicename, $link);
|
$link = str_replace('%author%', $author_nicename, $link);
|
||||||
$link = get_option('home') . trailingslashit($link);
|
$link = home_url() . trailingslashit($link);
|
||||||
}
|
}
|
||||||
|
|
||||||
$link = apply_filters('author_link', $link, $author_id, $author_nicename);
|
$link = apply_filters('author_link', $link, $author_id, $author_nicename);
|
||||||
|
|
|
@ -198,7 +198,7 @@ function redirect_canonical($requested_url=null, $do_redirect=true) {
|
||||||
$redirect = @parse_url($redirect_url);
|
$redirect = @parse_url($redirect_url);
|
||||||
|
|
||||||
// www.example.com vs example.com
|
// www.example.com vs example.com
|
||||||
$user_home = @parse_url(get_option('home'));
|
$user_home = @parse_url(home_url());
|
||||||
if ( !empty($user_home['host']) )
|
if ( !empty($user_home['host']) )
|
||||||
$redirect['host'] = $user_home['host'];
|
$redirect['host'] = $user_home['host'];
|
||||||
if ( empty($user_home['path']) )
|
if ( empty($user_home['path']) )
|
||||||
|
|
|
@ -20,8 +20,7 @@ function get_category_link( $category_id ) {
|
||||||
$catlink = $wp_rewrite->get_category_permastruct();
|
$catlink = $wp_rewrite->get_category_permastruct();
|
||||||
|
|
||||||
if ( empty( $catlink ) ) {
|
if ( empty( $catlink ) ) {
|
||||||
$file = get_option( 'home' ) . '/';
|
$catlink = home_url('?cat=' . $category_id);
|
||||||
$catlink = $file . '?cat=' . $category_id;
|
|
||||||
} else {
|
} else {
|
||||||
$category = &get_category( $category_id );
|
$category = &get_category( $category_id );
|
||||||
if ( is_wp_error( $category ) )
|
if ( is_wp_error( $category ) )
|
||||||
|
@ -34,7 +33,7 @@ function get_category_link( $category_id ) {
|
||||||
$category_nicename = get_category_parents( $category->parent, false, '/', true ) . $category_nicename;
|
$category_nicename = get_category_parents( $category->parent, false, '/', true ) . $category_nicename;
|
||||||
|
|
||||||
$catlink = str_replace( '%category%', $category_nicename, $catlink );
|
$catlink = str_replace( '%category%', $category_nicename, $catlink );
|
||||||
$catlink = get_option( 'home' ) . user_trailingslashit( $catlink, 'category' );
|
$catlink = home_url( user_trailingslashit( $catlink, 'category' ) );
|
||||||
}
|
}
|
||||||
return apply_filters( 'category_link', $catlink, $category_id );
|
return apply_filters( 'category_link', $catlink, $category_id );
|
||||||
}
|
}
|
||||||
|
|
|
@ -159,7 +159,7 @@ class WP {
|
||||||
$req_uri_array = explode('?', $req_uri);
|
$req_uri_array = explode('?', $req_uri);
|
||||||
$req_uri = $req_uri_array[0];
|
$req_uri = $req_uri_array[0];
|
||||||
$self = $_SERVER['PHP_SELF'];
|
$self = $_SERVER['PHP_SELF'];
|
||||||
$home_path = parse_url(get_option('home'));
|
$home_path = parse_url(home_url());
|
||||||
if ( isset($home_path['path']) )
|
if ( isset($home_path['path']) )
|
||||||
$home_path = $home_path['path'];
|
$home_path = $home_path['path'];
|
||||||
else
|
else
|
||||||
|
|
|
@ -967,7 +967,7 @@ function comments_popup_link( $zero = false, $one = false, $more = false, $css_c
|
||||||
echo '<a href="';
|
echo '<a href="';
|
||||||
if ( $wpcommentsjavascript ) {
|
if ( $wpcommentsjavascript ) {
|
||||||
if ( empty( $wpcommentspopupfile ) )
|
if ( empty( $wpcommentspopupfile ) )
|
||||||
$home = get_option('home');
|
$home = home_url();
|
||||||
else
|
else
|
||||||
$home = get_option('siteurl');
|
$home = get_option('siteurl');
|
||||||
echo $home . '/' . $wpcommentspopupfile . '?comments_popup=' . $id;
|
echo $home . '/' . $wpcommentspopupfile . '?comments_popup=' . $id;
|
||||||
|
|
|
@ -78,7 +78,7 @@ function check_comment($author, $email, $url, $comment, $user_ip, $user_agent, $
|
||||||
if ( 'trackback' == $comment_type || 'pingback' == $comment_type ) { // check if domain is in blogroll
|
if ( 'trackback' == $comment_type || 'pingback' == $comment_type ) { // check if domain is in blogroll
|
||||||
$uri = parse_url($url);
|
$uri = parse_url($url);
|
||||||
$domain = $uri['host'];
|
$domain = $uri['host'];
|
||||||
$uri = parse_url( get_option('home') );
|
$uri = parse_url( home_url() );
|
||||||
$home_domain = $uri['host'];
|
$home_domain = $uri['host'];
|
||||||
if ( $wpdb->get_var($wpdb->prepare("SELECT link_id FROM $wpdb->links WHERE link_url LIKE (%s) LIMIT 1", '%'.$domain.'%')) || $domain == $home_domain )
|
if ( $wpdb->get_var($wpdb->prepare("SELECT link_id FROM $wpdb->links WHERE link_url LIKE (%s) LIMIT 1", '%'.$domain.'%')) || $domain == $home_domain )
|
||||||
return true;
|
return true;
|
||||||
|
@ -1819,7 +1819,7 @@ function weblog_ping($server = '', $path = '') {
|
||||||
|
|
||||||
// when set to true, this outputs debug messages by itself
|
// when set to true, this outputs debug messages by itself
|
||||||
$client->debug = false;
|
$client->debug = false;
|
||||||
$home = trailingslashit( get_option('home') );
|
$home = trailingslashit( home_url() );
|
||||||
if ( !$client->query('weblogUpdates.extendedPing', get_option('blogname'), $home, get_bloginfo('rss2_url') ) ) // then try a normal ping
|
if ( !$client->query('weblogUpdates.extendedPing', get_option('blogname'), $home, get_bloginfo('rss2_url') ) ) // then try a normal ping
|
||||||
$client->query('weblogUpdates.ping', get_option('blogname'), $home);
|
$client->query('weblogUpdates.ping', get_option('blogname'), $home);
|
||||||
}
|
}
|
||||||
|
|
|
@ -447,7 +447,7 @@ class WP_Widget_Categories extends WP_Widget {
|
||||||
var dropdown = document.getElementById("cat");
|
var dropdown = document.getElementById("cat");
|
||||||
function onCatChange() {
|
function onCatChange() {
|
||||||
if ( dropdown.options[dropdown.selectedIndex].value > 0 ) {
|
if ( dropdown.options[dropdown.selectedIndex].value > 0 ) {
|
||||||
location.href = "<?php echo get_option('home'); ?>/?cat="+dropdown.options[dropdown.selectedIndex].value;
|
location.href = "<?php echo home_url(); ?>/?cat="+dropdown.options[dropdown.selectedIndex].value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dropdown.onchange = onCatChange;
|
dropdown.onchange = onCatChange;
|
||||||
|
|
|
@ -32,7 +32,7 @@ echo '<?xml version="1.0" encoding="' . get_option('blog_charset') . '" ?' . '>'
|
||||||
<link rel="self" type="application/atom+xml" href="<?php echo get_post_comments_feed_link('', 'atom'); ?>" />
|
<link rel="self" type="application/atom+xml" href="<?php echo get_post_comments_feed_link('', 'atom'); ?>" />
|
||||||
<id><?php echo get_post_comments_feed_link('', 'atom'); ?></id>
|
<id><?php echo get_post_comments_feed_link('', 'atom'); ?></id>
|
||||||
<?php } elseif(is_search()) { ?>
|
<?php } elseif(is_search()) { ?>
|
||||||
<link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" href="<?php echo get_option('home') . '?s=' . esc_attr(get_search_query()); ?>" />
|
<link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" href="<?php echo home_url() . '?s=' . esc_attr(get_search_query()); ?>" />
|
||||||
<link rel="self" type="application/atom+xml" href="<?php echo get_search_comments_feed_link('', 'atom'); ?>" />
|
<link rel="self" type="application/atom+xml" href="<?php echo get_search_comments_feed_link('', 'atom'); ?>" />
|
||||||
<id><?php echo get_search_comments_feed_link('', 'atom'); ?></id>
|
<id><?php echo get_search_comments_feed_link('', 'atom'); ?></id>
|
||||||
<?php } else { ?>
|
<?php } else { ?>
|
||||||
|
|
|
@ -475,7 +475,7 @@ function prep_atom_text_construct($data) {
|
||||||
* @since 2.5
|
* @since 2.5
|
||||||
*/
|
*/
|
||||||
function self_link() {
|
function self_link() {
|
||||||
$host = @parse_url(get_option('home'));
|
$host = @parse_url(home_url());
|
||||||
$host = $host['host'];
|
$host = $host['host'];
|
||||||
echo esc_url(
|
echo esc_url(
|
||||||
'http'
|
'http'
|
||||||
|
|
|
@ -121,7 +121,7 @@ function get_search_form() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$form = '<form role="search" method="get" id="searchform" action="' . get_option('home') . '/" >
|
$form = '<form role="search" method="get" id="searchform" action="' . home_url() . '/" >
|
||||||
<div><label class="screen-reader-text" for="s">' . __('Search for:') . '</label>
|
<div><label class="screen-reader-text" for="s">' . __('Search for:') . '</label>
|
||||||
<input type="text" value="' . esc_attr(apply_filters('the_search_query', get_search_query())) . '" name="s" id="s" />
|
<input type="text" value="' . esc_attr(apply_filters('the_search_query', get_search_query())) . '" name="s" id="s" />
|
||||||
<input type="submit" id="searchsubmit" value="'. esc_attr__('Search') .'" />
|
<input type="submit" id="searchsubmit" value="'. esc_attr__('Search') .'" />
|
||||||
|
@ -301,7 +301,7 @@ function get_bloginfo( $show = '', $filter = 'raw' ) {
|
||||||
case 'siteurl' : // DEPRECATED
|
case 'siteurl' : // DEPRECATED
|
||||||
_deprecated_argument( __FUNCTION__, '2.2', sprintf( __('The \'%1$s\' option is deprecated for the family of bloginfo() functions. Use the \'%2$s\' option instead.'), $show, 'url' ) );
|
_deprecated_argument( __FUNCTION__, '2.2', sprintf( __('The \'%1$s\' option is deprecated for the family of bloginfo() functions. Use the \'%2$s\' option instead.'), $show, 'url' ) );
|
||||||
case 'url' :
|
case 'url' :
|
||||||
$output = get_option('home');
|
$output = home_url();
|
||||||
break;
|
break;
|
||||||
case 'wpurl' :
|
case 'wpurl' :
|
||||||
$output = get_option('siteurl');
|
$output = get_option('siteurl');
|
||||||
|
@ -886,7 +886,7 @@ function wp_get_archives($args = '') {
|
||||||
$arc_week = get_weekstartend($arcresult->yyyymmdd, get_option('start_of_week'));
|
$arc_week = get_weekstartend($arcresult->yyyymmdd, get_option('start_of_week'));
|
||||||
$arc_week_start = date_i18n($archive_week_start_date_format, $arc_week['start']);
|
$arc_week_start = date_i18n($archive_week_start_date_format, $arc_week['start']);
|
||||||
$arc_week_end = date_i18n($archive_week_end_date_format, $arc_week['end']);
|
$arc_week_end = date_i18n($archive_week_end_date_format, $arc_week['end']);
|
||||||
$url = sprintf('%1$s/%2$s%3$sm%4$s%5$s%6$sw%7$s%8$d', get_option('home'), '', '?', '=', $arc_year, '&', '=', $arcresult->week);
|
$url = sprintf('%1$s/%2$s%3$sm%4$s%5$s%6$sw%7$s%8$d', home_url(), '', '?', '=', $arc_year, '&', '=', $arcresult->week);
|
||||||
$text = $arc_week_start . $archive_week_separator . $arc_week_end;
|
$text = $arc_week_start . $archive_week_separator . $arc_week_end;
|
||||||
if ($show_post_count)
|
if ($show_post_count)
|
||||||
$after = ' ('.$arcresult->posts.')'.$afterafter;
|
$after = ' ('.$arcresult->posts.')'.$afterafter;
|
||||||
|
|
|
@ -150,11 +150,11 @@ function get_permalink($id = 0, $leavename = false) {
|
||||||
$author,
|
$author,
|
||||||
$post->post_name,
|
$post->post_name,
|
||||||
);
|
);
|
||||||
$permalink = get_option('home') . str_replace($rewritecode, $rewritereplace, $permalink);
|
$permalink = home_url( str_replace($rewritecode, $rewritereplace, $permalink) );
|
||||||
$permalink = user_trailingslashit($permalink, 'single');
|
$permalink = user_trailingslashit($permalink, 'single');
|
||||||
return apply_filters('post_link', $permalink, $post, $leavename);
|
return apply_filters('post_link', $permalink, $post, $leavename);
|
||||||
} else { // if they're not using the fancy permalink option
|
} else { // if they're not using the fancy permalink option
|
||||||
$permalink = trailingslashit(get_option('home')) . '?p=' . $post->ID;
|
$permalink = home_url('?p=' . $post->ID);
|
||||||
return apply_filters('post_link', $permalink, $post, $leavename);
|
return apply_filters('post_link', $permalink, $post, $leavename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -195,7 +195,7 @@ function get_page_link( $id = false, $leavename = false, $sample = false ) {
|
||||||
$id = (int) $post->ID;
|
$id = (int) $post->ID;
|
||||||
|
|
||||||
if ( 'page' == get_option('show_on_front') && $id == get_option('page_on_front') )
|
if ( 'page' == get_option('show_on_front') && $id == get_option('page_on_front') )
|
||||||
$link = get_option('home');
|
$link = home_url();
|
||||||
else
|
else
|
||||||
$link = _get_page_link( $id , $leavename, $sample );
|
$link = _get_page_link( $id , $leavename, $sample );
|
||||||
|
|
||||||
|
@ -228,10 +228,10 @@ function _get_page_link( $id = false, $leavename = false, $sample = false ) {
|
||||||
if ( '' != $pagestruct && ( ( isset($post->post_status) && 'draft' != $post->post_status && 'pending' != $post->post_status ) || $sample ) ) {
|
if ( '' != $pagestruct && ( ( isset($post->post_status) && 'draft' != $post->post_status && 'pending' != $post->post_status ) || $sample ) ) {
|
||||||
$link = get_page_uri($id);
|
$link = get_page_uri($id);
|
||||||
$link = ( $leavename ) ? $pagestruct : str_replace('%pagename%', $link, $pagestruct);
|
$link = ( $leavename ) ? $pagestruct : str_replace('%pagename%', $link, $pagestruct);
|
||||||
$link = trailingslashit(get_option('home')) . $link;
|
$link = home_url($link);
|
||||||
$link = user_trailingslashit($link, 'page');
|
$link = user_trailingslashit($link, 'page');
|
||||||
} else {
|
} else {
|
||||||
$link = trailingslashit(get_option('home')) . "?page_id=$id";
|
$link = home_url("?page_id=$id");
|
||||||
}
|
}
|
||||||
|
|
||||||
return apply_filters( '_get_page_link', $link, $id );
|
return apply_filters( '_get_page_link', $link, $id );
|
||||||
|
@ -293,9 +293,9 @@ function get_year_link($year) {
|
||||||
$yearlink = $wp_rewrite->get_year_permastruct();
|
$yearlink = $wp_rewrite->get_year_permastruct();
|
||||||
if ( !empty($yearlink) ) {
|
if ( !empty($yearlink) ) {
|
||||||
$yearlink = str_replace('%year%', $year, $yearlink);
|
$yearlink = str_replace('%year%', $year, $yearlink);
|
||||||
return apply_filters('year_link', get_option('home') . user_trailingslashit($yearlink, 'year'), $year);
|
return apply_filters('year_link', home_url( user_trailingslashit($yearlink, 'year') ), $year);
|
||||||
} else {
|
} else {
|
||||||
return apply_filters('year_link', trailingslashit(get_option('home')) . '?m=' . $year, $year);
|
return apply_filters('year_link', home_url('?m=' . $year), $year);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -318,9 +318,9 @@ function get_month_link($year, $month) {
|
||||||
if ( !empty($monthlink) ) {
|
if ( !empty($monthlink) ) {
|
||||||
$monthlink = str_replace('%year%', $year, $monthlink);
|
$monthlink = str_replace('%year%', $year, $monthlink);
|
||||||
$monthlink = str_replace('%monthnum%', zeroise(intval($month), 2), $monthlink);
|
$monthlink = str_replace('%monthnum%', zeroise(intval($month), 2), $monthlink);
|
||||||
return apply_filters('month_link', get_option('home') . user_trailingslashit($monthlink, 'month'), $year, $month);
|
return apply_filters('month_link', home_url( user_trailingslashit($monthlink, 'month') ), $year, $month);
|
||||||
} else {
|
} else {
|
||||||
return apply_filters('month_link', trailingslashit(get_option('home')) . '?m=' . $year . zeroise($month, 2), $year, $month);
|
return apply_filters('month_link', home_url( '?m=' . $year . zeroise($month, 2) ), $year, $month);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -348,9 +348,9 @@ function get_day_link($year, $month, $day) {
|
||||||
$daylink = str_replace('%year%', $year, $daylink);
|
$daylink = str_replace('%year%', $year, $daylink);
|
||||||
$daylink = str_replace('%monthnum%', zeroise(intval($month), 2), $daylink);
|
$daylink = str_replace('%monthnum%', zeroise(intval($month), 2), $daylink);
|
||||||
$daylink = str_replace('%day%', zeroise(intval($day), 2), $daylink);
|
$daylink = str_replace('%day%', zeroise(intval($day), 2), $daylink);
|
||||||
return apply_filters('day_link', get_option('home') . user_trailingslashit($daylink, 'day'), $year, $month, $day);
|
return apply_filters('day_link', home_url( user_trailingslashit($daylink, 'day') ), $year, $month, $day);
|
||||||
} else {
|
} else {
|
||||||
return apply_filters('day_link', trailingslashit(get_option('home')) . '?m=' . $year . zeroise($month, 2) . zeroise($day, 2), $year, $month, $day);
|
return apply_filters('day_link', home_url( '?m=' . $year . zeroise($month, 2) . zeroise($day, 2) ), $year, $month, $day);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -377,7 +377,7 @@ function get_feed_link($feed = '') {
|
||||||
|
|
||||||
$permalink = str_replace('%feed%', $feed, $permalink);
|
$permalink = str_replace('%feed%', $feed, $permalink);
|
||||||
$permalink = preg_replace('#/+#', '/', "/$permalink");
|
$permalink = preg_replace('#/+#', '/', "/$permalink");
|
||||||
$output = get_option('home') . user_trailingslashit($permalink, 'feed');
|
$output = home_url( user_trailingslashit($permalink, 'feed') );
|
||||||
} else {
|
} else {
|
||||||
if ( empty($feed) )
|
if ( empty($feed) )
|
||||||
$feed = get_default_feed();
|
$feed = get_default_feed();
|
||||||
|
@ -385,7 +385,7 @@ function get_feed_link($feed = '') {
|
||||||
if ( false !== strpos($feed, 'comments_') )
|
if ( false !== strpos($feed, 'comments_') )
|
||||||
$feed = str_replace('comments_', 'comments-', $feed);
|
$feed = str_replace('comments_', 'comments-', $feed);
|
||||||
|
|
||||||
$output = trailingslashit(get_option('home')) . "?feed={$feed}";
|
$output = home_url("?feed={$feed}");
|
||||||
}
|
}
|
||||||
|
|
||||||
return apply_filters('feed_link', $output, $feed);
|
return apply_filters('feed_link', $output, $feed);
|
||||||
|
@ -417,9 +417,9 @@ function get_post_comments_feed_link($post_id = '', $feed = '') {
|
||||||
} else {
|
} else {
|
||||||
$type = get_post_field('post_type', $post_id);
|
$type = get_post_field('post_type', $post_id);
|
||||||
if ( 'page' == $type )
|
if ( 'page' == $type )
|
||||||
$url = trailingslashit(get_option('home')) . "?feed=$feed&page_id=$post_id";
|
$url = home_url("?feed=$feed&page_id=$post_id");
|
||||||
else
|
else
|
||||||
$url = trailingslashit(get_option('home')) . "?feed=$feed&p=$post_id";
|
$url = home_url("?feed=$feed&p=$post_id");
|
||||||
}
|
}
|
||||||
|
|
||||||
return apply_filters('post_comments_feed_link', $url);
|
return apply_filters('post_comments_feed_link', $url);
|
||||||
|
@ -471,7 +471,7 @@ function get_author_feed_link( $author_id, $feed = '' ) {
|
||||||
$feed = get_default_feed();
|
$feed = get_default_feed();
|
||||||
|
|
||||||
if ( '' == $permalink_structure ) {
|
if ( '' == $permalink_structure ) {
|
||||||
$link = trailingslashit(get_option('home')) . "?feed=$feed&author=" . $author_id;
|
$link = home_url("?feed=$feed&author=" . $author_id);
|
||||||
} else {
|
} else {
|
||||||
$link = get_author_posts_url($author_id);
|
$link = get_author_posts_url($author_id);
|
||||||
if ( $feed == get_default_feed() )
|
if ( $feed == get_default_feed() )
|
||||||
|
@ -515,7 +515,7 @@ function get_category_feed_link($cat_id, $feed = '') {
|
||||||
$permalink_structure = get_option('permalink_structure');
|
$permalink_structure = get_option('permalink_structure');
|
||||||
|
|
||||||
if ( '' == $permalink_structure ) {
|
if ( '' == $permalink_structure ) {
|
||||||
$link = trailingslashit(get_option('home')) . "?feed=$feed&cat=" . $cat_id;
|
$link = home_url("?feed=$feed&cat=" . $cat_id);
|
||||||
} else {
|
} else {
|
||||||
$link = get_category_link($cat_id);
|
$link = get_category_link($cat_id);
|
||||||
if( $feed == get_default_feed() )
|
if( $feed == get_default_feed() )
|
||||||
|
@ -554,7 +554,7 @@ function get_tag_feed_link($tag_id, $feed = '') {
|
||||||
$feed = get_default_feed();
|
$feed = get_default_feed();
|
||||||
|
|
||||||
if ( '' == $permalink_structure ) {
|
if ( '' == $permalink_structure ) {
|
||||||
$link = trailingslashit(get_option('home')) . "?feed=$feed&tag=" . $tag->slug;
|
$link = home_url("?feed=$feed&tag=" . $tag->slug);
|
||||||
} else {
|
} else {
|
||||||
$link = get_tag_link($tag->term_id);
|
$link = get_tag_link($tag->term_id);
|
||||||
if ( $feed == get_default_feed() )
|
if ( $feed == get_default_feed() )
|
||||||
|
@ -629,7 +629,7 @@ function get_search_feed_link($search_query = '', $feed = '') {
|
||||||
if ( empty($feed) )
|
if ( empty($feed) )
|
||||||
$feed = get_default_feed();
|
$feed = get_default_feed();
|
||||||
|
|
||||||
$link = trailingslashit(get_option('home')) . "?s=$search&feed=$feed";
|
$link = home_url("?s=$search&feed=$feed");
|
||||||
|
|
||||||
$link = apply_filters('search_feed_link', $link);
|
$link = apply_filters('search_feed_link', $link);
|
||||||
|
|
||||||
|
@ -654,7 +654,7 @@ function get_search_comments_feed_link($search_query = '', $feed = '') {
|
||||||
if ( empty($feed) )
|
if ( empty($feed) )
|
||||||
$feed = get_default_feed();
|
$feed = get_default_feed();
|
||||||
|
|
||||||
$link = trailingslashit(get_option('home')) . "?s=$search&feed=comments-$feed";
|
$link = home_url("?s=$search&feed=comments-$feed");
|
||||||
|
|
||||||
$link = apply_filters('search_feed_link', $link);
|
$link = apply_filters('search_feed_link', $link);
|
||||||
|
|
||||||
|
@ -1275,7 +1275,7 @@ function get_pagenum_link($pagenum = 1) {
|
||||||
|
|
||||||
$request = remove_query_arg( 'paged' );
|
$request = remove_query_arg( 'paged' );
|
||||||
|
|
||||||
$home_root = parse_url(get_option('home'));
|
$home_root = parse_url(home_url());
|
||||||
$home_root = ( isset($home_root['path']) ) ? $home_root['path'] : '';
|
$home_root = ( isset($home_root['path']) ) ? $home_root['path'] : '';
|
||||||
$home_root = preg_quote( trailingslashit( $home_root ), '|' );
|
$home_root = preg_quote( trailingslashit( $home_root ), '|' );
|
||||||
|
|
||||||
|
@ -1708,6 +1708,31 @@ function get_shortcut_link() {
|
||||||
return apply_filters('shortcut_link', $link);
|
return apply_filters('shortcut_link', $link);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the home url.
|
||||||
|
*
|
||||||
|
* Returns the 'home' option with the appropriate protocol, 'https' if
|
||||||
|
* is_ssl() and 'http' otherwise. If $scheme is 'http' or 'https', is_ssl() is
|
||||||
|
* overridden.
|
||||||
|
*
|
||||||
|
* @package WordPress
|
||||||
|
* @since 3.0
|
||||||
|
*
|
||||||
|
* @param string $path (optional) Path relative to the home url.
|
||||||
|
* @param string $scheme (optional) Scheme to give the home url context. Currently 'http','https'
|
||||||
|
* @return string Home url link with optional path appended.
|
||||||
|
*/
|
||||||
|
function home_url( $path = '', $scheme = null ) {
|
||||||
|
$orig_scheme = $scheme;
|
||||||
|
$scheme = is_ssl() && !is_admin() ? 'https' : 'http';
|
||||||
|
$url = str_replace( 'http://', "$scheme://", get_option('home') );
|
||||||
|
|
||||||
|
if ( !empty( $path ) && is_string( $path ) && strpos( $path, '..' ) === false )
|
||||||
|
$url .= '/' . ltrim( $path, '/' );
|
||||||
|
|
||||||
|
return apply_filters( 'home_url', $url, $path, $orig_scheme );
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve the site url.
|
* Retrieve the site url.
|
||||||
*
|
*
|
||||||
|
|
|
@ -944,7 +944,7 @@ function wp_validate_redirect($location, $default = '') {
|
||||||
$test = ( $cut = strpos($location, '?') ) ? substr( $location, 0, $cut ) : $location;
|
$test = ( $cut = strpos($location, '?') ) ? substr( $location, 0, $cut ) : $location;
|
||||||
|
|
||||||
$lp = parse_url($test);
|
$lp = parse_url($test);
|
||||||
$wpp = parse_url(get_option('home'));
|
$wpp = parse_url(home_url());
|
||||||
|
|
||||||
$allowed_hosts = (array) apply_filters('allowed_redirect_hosts', array($wpp['host']), isset($lp['host']) ? $lp['host'] : '');
|
$allowed_hosts = (array) apply_filters('allowed_redirect_hosts', array($wpp['host']), isset($lp['host']) ? $lp['host'] : '');
|
||||||
|
|
||||||
|
|
|
@ -822,7 +822,7 @@ function wp_page_menu( $args = array() ) {
|
||||||
$class = '';
|
$class = '';
|
||||||
if ( is_front_page() && !is_paged() )
|
if ( is_front_page() && !is_paged() )
|
||||||
$class = 'class="current_page_item"';
|
$class = 'class="current_page_item"';
|
||||||
$menu .= '<li ' . $class . '><a href="' . get_option('home') . '" title="' . esc_attr($text) . '">' . $args['link_before'] . $text . $args['link_after'] . '</a></li>';
|
$menu .= '<li ' . $class . '><a href="' . home_url() . '" title="' . esc_attr($text) . '">' . $args['link_before'] . $text . $args['link_after'] . '</a></li>';
|
||||||
// If the front page is a page, add it to the exclude list
|
// If the front page is a page, add it to the exclude list
|
||||||
if (get_option('show_on_front') == 'page') {
|
if (get_option('show_on_front') == 'page') {
|
||||||
if ( !empty( $list_args['exclude'] ) ) {
|
if ( !empty( $list_args['exclude'] ) ) {
|
||||||
|
|
|
@ -256,23 +256,23 @@ function url_to_postid($url) {
|
||||||
$url = $url_split[0];
|
$url = $url_split[0];
|
||||||
|
|
||||||
// Add 'www.' if it is absent and should be there
|
// Add 'www.' if it is absent and should be there
|
||||||
if ( false !== strpos(get_option('home'), '://www.') && false === strpos($url, '://www.') )
|
if ( false !== strpos(home_url(), '://www.') && false === strpos($url, '://www.') )
|
||||||
$url = str_replace('://', '://www.', $url);
|
$url = str_replace('://', '://www.', $url);
|
||||||
|
|
||||||
// Strip 'www.' if it is present and shouldn't be
|
// Strip 'www.' if it is present and shouldn't be
|
||||||
if ( false === strpos(get_option('home'), '://www.') )
|
if ( false === strpos(home_url(), '://www.') )
|
||||||
$url = str_replace('://www.', '://', $url);
|
$url = str_replace('://www.', '://', $url);
|
||||||
|
|
||||||
// Strip 'index.php/' if we're not using path info permalinks
|
// Strip 'index.php/' if we're not using path info permalinks
|
||||||
if ( !$wp_rewrite->using_index_permalinks() )
|
if ( !$wp_rewrite->using_index_permalinks() )
|
||||||
$url = str_replace('index.php/', '', $url);
|
$url = str_replace('index.php/', '', $url);
|
||||||
|
|
||||||
if ( false !== strpos($url, get_option('home')) ) {
|
if ( false !== strpos($url, home_url()) ) {
|
||||||
// Chop off http://domain.com
|
// Chop off http://domain.com
|
||||||
$url = str_replace(get_option('home'), '', $url);
|
$url = str_replace(home_url(), '', $url);
|
||||||
} else {
|
} else {
|
||||||
// Chop off /path/to/blog
|
// Chop off /path/to/blog
|
||||||
$home_path = parse_url(get_option('home'));
|
$home_path = parse_url(home_url());
|
||||||
$home_path = $home_path['path'];
|
$home_path = $home_path['path'];
|
||||||
$url = str_replace($home_path, '', $url);
|
$url = str_replace($home_path, '', $url);
|
||||||
}
|
}
|
||||||
|
@ -1645,7 +1645,7 @@ class WP_Rewrite {
|
||||||
$site_root = trailingslashit($site_root['path']);
|
$site_root = trailingslashit($site_root['path']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$home_root = parse_url(get_option('home'));
|
$home_root = parse_url(home_url());
|
||||||
if ( isset( $home_root['path'] ) ) {
|
if ( isset( $home_root['path'] ) ) {
|
||||||
$home_root = trailingslashit($home_root['path']);
|
$home_root = trailingslashit($home_root['path']);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -2246,15 +2246,15 @@ function get_term_link( $term, $taxonomy ) {
|
||||||
$slug = $term->slug;
|
$slug = $term->slug;
|
||||||
|
|
||||||
if ( empty($termlink) ) {
|
if ( empty($termlink) ) {
|
||||||
$file = trailingslashit( get_option('home') );
|
|
||||||
$t = get_taxonomy($taxonomy);
|
$t = get_taxonomy($taxonomy);
|
||||||
if ( $t->query_var )
|
if ( $t->query_var )
|
||||||
$termlink = "$file?$t->query_var=$slug";
|
$termlink = "?$t->query_var=$slug";
|
||||||
else
|
else
|
||||||
$termlink = "$file?taxonomy=$taxonomy&term=$slug";
|
$termlink = "?taxonomy=$taxonomy&term=$slug";
|
||||||
|
$termlink = home_url($termlink);
|
||||||
} else {
|
} else {
|
||||||
$termlink = str_replace("%$taxonomy%", $slug, $termlink);
|
$termlink = str_replace("%$taxonomy%", $slug, $termlink);
|
||||||
$termlink = get_option('home') . user_trailingslashit($termlink, 'category');
|
$termlink = home_url( user_trailingslashit($termlink, 'category') );
|
||||||
}
|
}
|
||||||
return apply_filters('term_link', $termlink, $term, $taxonomy);
|
return apply_filters('term_link', $termlink, $term, $taxonomy);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1098,7 +1098,7 @@ function preview_theme_ob_filter_callback( $matches ) {
|
||||||
if (
|
if (
|
||||||
( false !== strpos($matches[3], '/wp-admin/') )
|
( false !== strpos($matches[3], '/wp-admin/') )
|
||||||
||
|
||
|
||||||
( false !== strpos($matches[3], '://') && 0 !== strpos($matches[3], get_option('home')) )
|
( false !== strpos( $matches[3], '://' ) && 0 !== strpos( $matches[3], home_url() ) )
|
||||||
||
|
||
|
||||||
( false !== strpos($matches[3], '/feed/') )
|
( false !== strpos($matches[3], '/feed/') )
|
||||||
||
|
||
|
||||||
|
|
Loading…
Reference in New Issue