Changeset 12598 for trunk/wp-includes/link-template.php
- Timestamp:
- 01/04/2010 05:23:29 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/link-template.php
r12597 r12598 151 151 $post->post_name, 152 152 ); 153 $permalink = get_option('home') . str_replace($rewritecode, $rewritereplace, $permalink);153 $permalink = home_url( str_replace($rewritecode, $rewritereplace, $permalink) ); 154 154 $permalink = user_trailingslashit($permalink, 'single'); 155 155 return apply_filters('post_link', $permalink, $post, $leavename); 156 156 } else { // if they're not using the fancy permalink option 157 $permalink = trailingslashit(get_option('home')) . '?p=' . $post->ID;157 $permalink = home_url('?p=' . $post->ID); 158 158 return apply_filters('post_link', $permalink, $post, $leavename); 159 159 } … … 196 196 197 197 if ( 'page' == get_option('show_on_front') && $id == get_option('page_on_front') ) 198 $link = get_option('home');198 $link = home_url(); 199 199 else 200 200 $link = _get_page_link( $id , $leavename, $sample ); … … 229 229 $link = get_page_uri($id); 230 230 $link = ( $leavename ) ? $pagestruct : str_replace('%pagename%', $link, $pagestruct); 231 $link = trailingslashit(get_option('home')) . $link;231 $link = home_url($link); 232 232 $link = user_trailingslashit($link, 'page'); 233 233 } else { 234 $link = trailingslashit(get_option('home')) . "?page_id=$id";234 $link = home_url("?page_id=$id"); 235 235 } 236 236 … … 294 294 if ( !empty($yearlink) ) { 295 295 $yearlink = str_replace('%year%', $year, $yearlink); 296 return apply_filters('year_link', get_option('home') . user_trailingslashit($yearlink, 'year'), $year);296 return apply_filters('year_link', home_url( user_trailingslashit($yearlink, 'year') ), $year); 297 297 } else { 298 return apply_filters('year_link', trailingslashit(get_option('home')) . '?m=' . $year, $year);298 return apply_filters('year_link', home_url('?m=' . $year), $year); 299 299 } 300 300 } … … 319 319 $monthlink = str_replace('%year%', $year, $monthlink); 320 320 $monthlink = str_replace('%monthnum%', zeroise(intval($month), 2), $monthlink); 321 return apply_filters('month_link', get_option('home') . user_trailingslashit($monthlink, 'month'), $year, $month);321 return apply_filters('month_link', home_url( user_trailingslashit($monthlink, 'month') ), $year, $month); 322 322 } else { 323 return apply_filters('month_link', trailingslashit(get_option('home')) . '?m=' . $year . zeroise($month, 2), $year, $month);323 return apply_filters('month_link', home_url( '?m=' . $year . zeroise($month, 2) ), $year, $month); 324 324 } 325 325 } … … 349 349 $daylink = str_replace('%monthnum%', zeroise(intval($month), 2), $daylink); 350 350 $daylink = str_replace('%day%', zeroise(intval($day), 2), $daylink); 351 return apply_filters('day_link', get_option('home') . user_trailingslashit($daylink, 'day'), $year, $month, $day);351 return apply_filters('day_link', home_url( user_trailingslashit($daylink, 'day') ), $year, $month, $day); 352 352 } else { 353 return apply_filters('day_link', trailingslashit(get_option('home')) . '?m=' . $year . zeroise($month, 2) . zeroise($day, 2), $year, $month, $day);353 return apply_filters('day_link', home_url( '?m=' . $year . zeroise($month, 2) . zeroise($day, 2) ), $year, $month, $day); 354 354 } 355 355 } … … 378 378 $permalink = str_replace('%feed%', $feed, $permalink); 379 379 $permalink = preg_replace('#/+#', '/', "/$permalink"); 380 $output = get_option('home') . user_trailingslashit($permalink, 'feed');380 $output = home_url( user_trailingslashit($permalink, 'feed') ); 381 381 } else { 382 382 if ( empty($feed) ) … … 386 386 $feed = str_replace('comments_', 'comments-', $feed); 387 387 388 $output = trailingslashit(get_option('home')) . "?feed={$feed}";388 $output = home_url("?feed={$feed}"); 389 389 } 390 390 … … 418 418 $type = get_post_field('post_type', $post_id); 419 419 if ( 'page' == $type ) 420 $url = trailingslashit(get_option('home')) . "?feed=$feed&page_id=$post_id";420 $url = home_url("?feed=$feed&page_id=$post_id"); 421 421 else 422 $url = trailingslashit(get_option('home')) . "?feed=$feed&p=$post_id";422 $url = home_url("?feed=$feed&p=$post_id"); 423 423 } 424 424 … … 472 472 473 473 if ( '' == $permalink_structure ) { 474 $link = trailingslashit(get_option('home')) . "?feed=$feed&author=" . $author_id;474 $link = home_url("?feed=$feed&author=" . $author_id); 475 475 } else { 476 476 $link = get_author_posts_url($author_id); … … 516 516 517 517 if ( '' == $permalink_structure ) { 518 $link = trailingslashit(get_option('home')) . "?feed=$feed&cat=" . $cat_id;518 $link = home_url("?feed=$feed&cat=" . $cat_id); 519 519 } else { 520 520 $link = get_category_link($cat_id); … … 555 555 556 556 if ( '' == $permalink_structure ) { 557 $link = trailingslashit(get_option('home')) . "?feed=$feed&tag=" . $tag->slug;557 $link = home_url("?feed=$feed&tag=" . $tag->slug); 558 558 } else { 559 559 $link = get_tag_link($tag->term_id); … … 630 630 $feed = get_default_feed(); 631 631 632 $link = trailingslashit(get_option('home')) . "?s=$search&feed=$feed";632 $link = home_url("?s=$search&feed=$feed"); 633 633 634 634 $link = apply_filters('search_feed_link', $link); … … 655 655 $feed = get_default_feed(); 656 656 657 $link = trailingslashit(get_option('home')) . "?s=$search&feed=comments-$feed";657 $link = home_url("?s=$search&feed=comments-$feed"); 658 658 659 659 $link = apply_filters('search_feed_link', $link); … … 1276 1276 $request = remove_query_arg( 'paged' ); 1277 1277 1278 $home_root = parse_url( get_option('home'));1278 $home_root = parse_url(home_url()); 1279 1279 $home_root = ( isset($home_root['path']) ) ? $home_root['path'] : ''; 1280 1280 $home_root = preg_quote( trailingslashit( $home_root ), '|' ); … … 1707 1707 1708 1708 return apply_filters('shortcut_link', $link); 1709 } 1710 1711 /** 1712 * Retrieve the home url. 1713 * 1714 * Returns the 'home' option with the appropriate protocol, 'https' if 1715 * is_ssl() and 'http' otherwise. If $scheme is 'http' or 'https', is_ssl() is 1716 * overridden. 1717 * 1718 * @package WordPress 1719 * @since 3.0 1720 * 1721 * @param string $path (optional) Path relative to the home url. 1722 * @param string $scheme (optional) Scheme to give the home url context. Currently 'http','https' 1723 * @return string Home url link with optional path appended. 1724 */ 1725 function home_url( $path = '', $scheme = null ) { 1726 $orig_scheme = $scheme; 1727 $scheme = is_ssl() && !is_admin() ? 'https' : 'http'; 1728 $url = str_replace( 'http://', "$scheme://", get_option('home') ); 1729 1730 if ( !empty( $path ) && is_string( $path ) && strpos( $path, '..' ) === false ) 1731 $url .= '/' . ltrim( $path, '/' ); 1732 1733 return apply_filters( 'home_url', $url, $path, $orig_scheme ); 1709 1734 } 1710 1735
Note: See TracChangeset
for help on using the changeset viewer.