Changeset 2316
- Timestamp:
- 02/14/2005 03:27:50 AM (20 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/feed-functions.php
r2239 r2316 110 110 $link = $file . '?cat=' . $category_id; 111 111 } else { 112 $link = get_category_link( 0, $category_id, $category_nicename);112 $link = get_category_link($category_id); 113 113 $link = $link . "feed/"; 114 114 } -
trunk/wp-includes/template-functions-category.php
r2270 r2316 25 25 } 26 26 27 function get_category_link($ echo = false, $category_id, $category_nicename) {28 global $wpdb, $wp_rewrite, $ post, $cache_categories;29 $cat_ID = $category_id;30 $catlink = $wp_rewrite->get_category_permastruct(); 31 32 if (empty($catlink)) { 33 $file = get_settings('home') . '/';34 $catlink = $file . '?cat=' . $cat_ID; 35 } else { 27 function get_category_link($category_id) { 28 global $wpdb, $wp_rewrite, $querystring_start, $querystring_equal, $cache_categories; 29 $catlink = $wp_rewrite->get_category_permastruct(); 30 31 if ( empty($catlink) ) { 32 $file = get_settings('home') . '/' . get_settings('blogfilename'); 33 $catlink = $file . '?cat=' . $category_ID; 34 } else { 35 if ($cache_categories[$category_id]->category_nicename) 36 36 $category_nicename = $cache_categories[$category_id]->category_nicename; 37 if ($parent=$cache_categories[$category_id]->category_parent) $category_nicename = get_category_parents($parent, FALSE, '/', TRUE) . $category_nicename . '/'; 38 39 $catlink = str_replace('%category%', $category_nicename, $catlink); 40 $catlink = get_settings('home') . trailingslashit($catlink); 41 } 42 $catlink = apply_filters('category_link', $catlink, $category_id, $category_nicename); 43 if ($echo) echo $catlink; 44 return $catlink; 37 else 38 $category_nicename = $wpdb->get_var('SELECT category_nicename FROM ' . $wpdb->categories . ' WHERE cat_ID=' . $category_id); 39 40 if ($parent = $cache_categories[$category_id]->category_parent) 41 $category_nicename = get_category_parents($parent, false, '/', true) . $category_nicename . '/'; 42 43 $catlink = str_replace('%category%', $category_nicename, $catlink); 44 $catlink = get_settings('home') . trailingslashit($catlink); 45 } 46 return $catlink; 45 47 } 46 48 … … 63 65 $thelist .= get_category_parents($category->category_parent, TRUE); 64 66 } 65 $thelist .= '<a href="' . get_category_link( 0, $category->category_id, $category->category_nicename) . '" title="' . sprintf(__("View all posts in %s"), $category->cat_name) . '" rel="category tag">'.$category->cat_name.'</a></li>';67 $thelist .= '<a href="' . get_category_link($category->category_id) . '" title="' . sprintf(__("View all posts in %s"), $category->cat_name) . '" rel="category tag">'.$category->cat_name.'</a></li>'; 66 68 break; 67 69 case 'single': 68 $thelist .= '<a href="' . get_category_link( 0, $category->category_id, $category->category_nicename) . '" title="' . sprintf(__("View all posts in %s"), $category->cat_name) . ' rel="category tag">';70 $thelist .= '<a href="' . get_category_link($category->category_id) . '" title="' . sprintf(__("View all posts in %s"), $category->cat_name) . ' rel="category tag">'; 69 71 if ($category->category_parent) { 70 72 $thelist .= get_category_parents($category->category_parent, FALSE); … … 74 76 case '': 75 77 default: 76 $thelist .= '<a href="' . get_category_link( 0, $category->category_id, $category->category_nicename) . '" title="' . sprintf(__("View all posts in %s"), $category->cat_name) . '" rel="category tag">'.$category->cat_name.'</a></li>';78 $thelist .= '<a href="' . get_category_link($category->category_id) . '" title="' . sprintf(__("View all posts in %s"), $category->cat_name) . '" rel="category tag">'.$category->cat_name.'</a></li>'; 77 79 } 78 80 } … … 86 88 case 'multiple': 87 89 if ($category->category_parent) $thelist .= get_category_parents($category->category_parent, TRUE); 88 $thelist .= '<a href="' . get_category_link( 0, $category->category_id, $category->category_nicename) . '" title="' . sprintf(__("View all posts in %s"), $category->cat_name) . '" rel="category tag">'.$category->cat_name.'</a>';90 $thelist .= '<a href="' . get_category_link($category->category_id) . '" title="' . sprintf(__("View all posts in %s"), $category->cat_name) . '" rel="category tag">'.$category->cat_name.'</a>'; 89 91 break; 90 92 case 'single': 91 $thelist .= '<a href="' . get_category_link( 0, $category->category_id, $category->category_nicename) . '" title="' . sprintf(__("View all posts in %s"), $category->cat_name) . '" rel="category tag">';93 $thelist .= '<a href="' . get_category_link($category->category_id) . '" title="' . sprintf(__("View all posts in %s"), $category->cat_name) . '" rel="category tag">'; 92 94 if ($category->category_parent) $thelist .= get_category_parents($category->category_parent, FALSE); 93 95 $thelist .= "$category->cat_name</a>"; … … 95 97 case '': 96 98 default: 97 $thelist .= '<a href="' . get_category_link( 0, $category->category_id, $category->category_nicename) . '" title="' . sprintf(__("View all posts in %s"), $category->cat_name) . '" rel="category tag">'.$category->cat_name.'</a>';99 $thelist .= '<a href="' . get_category_link($category->category_id) . '" title="' . sprintf(__("View all posts in %s"), $category->cat_name) . '" rel="category tag">'.$category->cat_name.'</a>'; 98 100 } 99 101 ++$i; … … 125 127 if ($parent->category_parent) $chain .= get_category_parents($parent->category_parent, $link, $separator, $nicename); 126 128 if ($link) { 127 $chain .= '<a href="' . get_category_link( 0, $parent->cat_ID, $parent->category_nicename) . '" title="' . sprintf(__("View all posts in %s"), $parent->cat_name) . '">'.$name.'</a>' . $separator;129 $chain .= '<a href="' . get_category_link($parent->cat_ID) . '" title="' . sprintf(__("View all posts in %s"), $parent->cat_name) . '">'.$name.'</a>' . $separator; 128 130 } else { 129 131 $chain .= $name.$separator; … … 315 317 if ((intval($hide_empty) == 0 || isset($category_posts["$category->cat_ID"])) && (!$hierarchical || $category->category_parent == $child_of) ) { 316 318 $num_found++; 317 $link = '<a href="'.get_category_link( 0, $category->cat_ID, $category->category_nicename).'" ';319 $link = '<a href="'.get_category_link($category->cat_ID).'" '; 318 320 if ($use_desc_for_title == 0 || empty($category->category_description)) { 319 321 $link .= 'title="'. sprintf(__("View all posts filed under %s"), wp_specialchars($category->cat_name)) . '"'; -
trunk/xmlrpc.php
r2188 r2316 765 765 $struct['description'] = $cat['cat_name']; 766 766 $struct['categoryName'] = $cat['cat_name']; 767 $struct['htmlUrl'] = wp_specialchars(get_category_link( false, $cat['cat_ID'], $cat['cat_name']));767 $struct['htmlUrl'] = wp_specialchars(get_category_link($cat['cat_ID']); 768 768 $struct['rssUrl'] = wp_specialchars(get_category_rss_link(false, $cat['cat_ID'], $cat['cat_name'])); 769 769
Note: See TracChangeset
for help on using the changeset viewer.