Ticket #1485: user-trail.diff
File user-trail.diff, 10.7 KB (added by , 20 years ago) |
---|
-
wp-includes/template-functions-general.php
301 301 if ($arcresults) { 302 302 $afterafter = $after; 303 303 foreach ($arcresults as $arcresult) { 304 $url = get_month_link($arcresult->year,$arcresult->month);304 $url = get_month_link($arcresult->year, $arcresult->month); 305 305 if ($show_post_count) { 306 306 $text = sprintf('%s %d', $month[zeroise($arcresult->month,2)], $arcresult->year); 307 $after = ' (' .$arcresult->posts.')' . $afterafter;307 $after = ' (' . $arcresult->posts . ')' . $afterafter; 308 308 } else { 309 $text = sprintf('%s %d', $month[zeroise($arcresult->month, 2)], $arcresult->year);309 $text = sprintf('%s %d', $month[zeroise($arcresult->month, 2)], $arcresult->year); 310 310 } 311 311 echo get_archives_link($url, $text, $format, $before, $after); 312 312 } -
wp-includes/template-functions-category.php
21 21 22 22 function get_category_link($category_id) { 23 23 global $wp_rewrite; 24 $catlink = $wp_rewrite->get_category_permastruct();24 $catlink = user_trailing_slash($wp_rewrite->get_category_permastruct()); 25 25 26 26 if ( empty($catlink) ) { 27 27 $file = get_settings('home') . '/' . get_settings('blogfilename'); … … 34 34 $category_nicename = get_category_parents($parent, false, '/', true) . $category_nicename . '/'; 35 35 36 36 $catlink = str_replace('%category%', $category_nicename, $catlink); 37 $catlink = get_settings('home') . trailingslashit($catlink);37 $catlink = get_settings('home') . $catlink; 38 38 } 39 39 return apply_filters('category_link', $catlink, $category_id); 40 40 } -
wp-includes/classes.php
813 813 } 814 814 815 815 function using_index_permalinks() { 816 816 if (empty($this->permalink_structure)) { 817 817 return false; 818 818 } 819 819 820 820 // If the index is not in the permalink, we're using mod_rewrite. 821 821 if (preg_match('#^/*' . $this->index . '#', $this->permalink_structure)) { … … 833 833 } 834 834 835 835 function preg_index($number) { 836 837 836 $match_prefix = '$'; 837 $match_suffix = ''; 838 838 839 839 if (! empty($this->matches)) { 840 840 $match_prefix = '$' . $this->matches . '['; 841 841 $match_suffix = ']'; 842 } 842 } 843 843 844 return "$match_prefix$number$match_suffix"; 844 return "$match_prefix$number$match_suffix"; 845 845 } 846 846 847 847 function page_rewrite_rules() { … … 849 849 850 850 $rewrite_rules = array(); 851 851 $page_structure = $this->get_page_permastruct(); 852 if( is_array( $uris ) ) 853 { 852 if( is_array( $uris ) ) { 854 853 foreach ($uris as $uri => $pagename) { 855 854 $this->add_rewrite_tag('%pagename%', "($uri)", 'pagename='); 856 855 $rewrite_rules += $this->generate_rewrite_rules($page_structure); … … 910 909 return false; 911 910 } 912 911 913 $structure = str_replace(' %monthnum%', '', $structure);914 $structure = str_replace(' %day%', '', $structure);912 $structure = str_replace('/%monthnum%', '', $structure); 913 $structure = str_replace('/%day%', '', $structure); 915 914 916 915 $structure = preg_replace('#/+#', '/', $structure); 917 916 … … 925 924 return false; 926 925 } 927 926 928 $structure = str_replace(' %day%', '', $structure);927 $structure = str_replace('/%day%', '', $structure); 929 928 930 929 $structure = preg_replace('#/+#', '/', $structure); 931 930 … … 941 940 return $this->category_structure; 942 941 } 943 942 944 943 if (empty($this->permalink_structure)) { 945 944 $this->category_structure = ''; 946 945 return false; 947 946 } -
wp-includes/template-functions-links.php
89 89 if ('' != $pagestruct) { 90 90 $link = get_page_uri($id); 91 91 $link = str_replace('%pagename%', $link, $pagestruct); 92 $link = get_settings('home') . "/$link/";92 $link = user_trailing_slash(get_settings('home') . '/' . $link); 93 93 } else { 94 $link = get_settings('home') . "/?page_id=$id";94 $link = get_settings('home') . '/?page_id=' . $id; 95 95 } 96 96 97 97 return apply_filters('page_link', $link, $id); … … 103 103 $yearlink = $wp_rewrite->get_year_permastruct(); 104 104 if (!empty($yearlink)) { 105 105 $yearlink = str_replace('%year%', $year, $yearlink); 106 return apply_filters('year_link', get_settings('home') . trailingslashit($yearlink), $year);106 return apply_filters('year_link', get_settings('home') . $yearlink, $year); 107 107 } else { 108 108 return apply_filters('year_link', get_settings('home') . '/?m=' . $year, $year); 109 109 } … … 111 111 112 112 function get_month_link($year, $month) { 113 113 global $wp_rewrite; 114 if (!$year) $year = gmdate('Y', time() +(get_settings('gmt_offset') * 3600));115 if (!$month) $month = gmdate('m', time() +(get_settings('gmt_offset') * 3600));114 if (!$year) $year = gmdate('Y', time() + (get_settings('gmt_offset') * 3600)); 115 if (!$month) $month = gmdate('m', time() + (get_settings('gmt_offset') * 3600)); 116 116 $monthlink = $wp_rewrite->get_month_permastruct(); 117 117 if (!empty($monthlink)) { 118 118 $monthlink = str_replace('%year%', $year, $monthlink); 119 119 $monthlink = str_replace('%monthnum%', zeroise(intval($month), 2), $monthlink); 120 return apply_filters('month_link', get_settings('home') . trailingslashit($monthlink), $year, $month);120 return apply_filters('month_link', get_settings('home') . $monthlink, $year, $month); 121 121 } else { 122 122 return apply_filters('month_link', get_settings('home') . '/?m=' . $year . zeroise($month, 2), $year, $month); 123 123 } … … 134 134 $daylink = str_replace('%year%', $year, $daylink); 135 135 $daylink = str_replace('%monthnum%', zeroise(intval($month), 2), $daylink); 136 136 $daylink = str_replace('%day%', zeroise(intval($day), 2), $daylink); 137 return apply_filters('day_link', get_settings('home') . trailingslashit($daylink), $year, $month, $day);137 return apply_filters('day_link', get_settings('home') . $daylink, $year, $month, $day); 138 138 } else { 139 139 return apply_filters('day_link', get_settings('home') . '/?m=' . $year . zeroise($month, 2) . zeroise($day, 2), $year, $month, $day); 140 140 } … … 157 157 $feed = ''; 158 158 159 159 $permalink = str_replace('%feed%', $feed, $permalink); 160 $permalink = preg_replace('#/+#', '/', "/$permalink /");160 $permalink = preg_replace('#/+#', '/', "/$permalink"); 161 161 $output = get_settings('home') . $permalink; 162 162 } else { 163 163 if ( false !== strpos($feed, 'comments_') ) -
wp-includes/template-functions-post.php
289 289 } 290 290 291 291 $pages = $wpdb->get_results("SELECT * " . 292 293 294 295 292 "FROM $wpdb->posts " . 293 "WHERE post_status = 'static' " . 294 "$exclusions " . 295 "ORDER BY " . $r['sort_column'] . " " . $r['sort_order']); 296 296 297 297 if ( empty($pages) ) 298 298 return array(); … … 373 373 374 374 if($depth) 375 375 $indent = str_repeat("\t", $depth); 376 //$indent = join('', array_fill(0, $depth,"\t"));376 //$indent = join('', array_fill(0, $depth, "\t")); 377 377 378 378 foreach($page_tree[$parent]['children'] as $page_id) { 379 379 $cur_page = $page_tree[$page_id]; -
wp-includes/comment-functions.php
307 307 $tb_url = get_settings('siteurl') . '/wp-trackback.php?p=' . $id; 308 308 309 309 if ( '' != get_settings('permalink_structure') ) 310 $tb_url = trailingslashit(get_permalink()) . 'trackback/';310 $tb_url = user_trailing_slash(trailingslashit(get_permalink()) . 'trackback'); 311 311 312 312 return $tb_url; 313 313 } -
wp-includes/feed-functions.php
82 82 global $id; 83 83 84 84 if ('' != get_settings('permalink_structure')) 85 $url = trailingslashit( get_permalink() ) . 'feed/';85 $url = user_trailing_slash(trailingslashit(get_permalink()) . 'feed'); 86 86 else 87 87 $url = get_settings('home') . "/$commentsrssfilename?feed=rss2&p=$id"; 88 88 … … 97 97 $link = get_settings('home') . '?feed=rss2&author=' . $author_id; 98 98 } else { 99 99 $link = get_author_link(0, $author_id, $author_nicename); 100 $link = $link . "feed/";100 $link = user_trailing_slash($link . 'feed'); 101 101 } 102 102 103 103 $link = apply_filters('author_feed_link', $link); … … 113 113 $link = get_settings('home') . '?feed=rss2&cat=' . $cat_ID; 114 114 } else { 115 115 $link = get_category_link($cat_ID); 116 $link = $link . "feed/";116 $link = user_trailing_slash($link . 'feed'); 117 117 } 118 118 119 119 $link = apply_filters('category_feed_link', $link); -
wp-includes/functions-formatting.php
515 515 return $string; 516 516 } 517 517 518 function trailingslashit($ string) {519 if ( '/' != substr($string, -1)) {520 $string.= '/';521 522 return $string;518 function trailingslashit($iri) { 519 if ('/' != substr($iri, -1)) { 520 $iri .= '/'; 521 } 522 return $iri; 523 523 } 524 524 525 function user_trailing_slash($iri) { 526 if (('/' == substr(get_settings('permalink_structure'), -1)) && ('/' != substr($iri, -1))) { 527 $iri .= '/'; 528 } 529 return $iri; 530 } 531 525 532 function addslashes_gpc($gpc) { 526 533 if (!get_magic_quotes_gpc()) { 527 534 $gpc = addslashes($gpc);