From a2b53e290915ff39801758be946e5d687be41891 Mon Sep 17 00:00:00 2001 From: matt Date: Tue, 19 Apr 2005 17:17:36 +0000 Subject: [PATCH] More consistent use of cat_ID vs category_id git-svn-id: http://svn.automattic.com/wordpress/trunk@2551 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/feed-functions.php | 3 +-- wp-includes/functions.php | 7 +++---- wp-includes/template-functions-category.php | 20 ++++++++++---------- 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/wp-includes/feed-functions.php b/wp-includes/feed-functions.php index de43e650b7..34c3e130ed 100644 --- a/wp-includes/feed-functions.php +++ b/wp-includes/feed-functions.php @@ -106,8 +106,7 @@ function get_author_rss_link($echo = false, $author_id, $author_nicename) { return $link; } -function get_category_rss_link($echo = false, $category_id, $category_nicename) { - $cat_ID = $category_id; +function get_category_rss_link($echo = false, $cat_ID, $category_nicename) { $permalink_structure = get_settings('permalink_structure'); if ('' == $permalink_structure) { diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 8069c47ab1..2fe04162fc 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -591,7 +591,6 @@ function &get_category(&$category, $output = OBJECT) { } else { if ( !isset($cache_categories[$category]) ) { $category = $wpdb->get_row("SELECT * FROM $wpdb->categories WHERE cat_ID = $category"); - $category->category_id = $category->cat_ID; // Alias. $cache_categories[$category->cat_ID] = & $category; } else { $category = & $cache_categories[$category]; @@ -1123,7 +1122,7 @@ function update_post_category_cache($post_ids) { $post_ids = implode(',', $post_ids); $dogs = $wpdb->get_results("SELECT DISTINCT - post_id, category_id FROM $wpdb->categories, $wpdb->post2cat + post_id, cat_ID FROM $wpdb->categories, $wpdb->post2cat WHERE category_id = cat_ID AND post_id IN ($post_ids)"); if (! isset($cache_categories)) @@ -1131,7 +1130,7 @@ function update_post_category_cache($post_ids) { if ( !empty($dogs) ) { foreach ($dogs as $catt) { - $category_cache[$catt->post_id][$catt->category_id] = &$cache_categories[$catt->category_id]; + $category_cache[$catt->post_id][$catt->cat_ID] = &$cache_categories[$catt->cat_ID]; } } } @@ -1189,7 +1188,7 @@ function update_post_caches(&$posts) { function update_category_cache() { global $cache_categories, $wpdb; - $dogs = $wpdb->get_results("SELECT *, cat_ID as category_id FROM $wpdb->categories"); + $dogs = $wpdb->get_results("SELECT * FROM $wpdb->categories"); foreach ($dogs as $catt) $cache_categories[$catt->cat_ID] = $catt; } diff --git a/wp-includes/template-functions-category.php b/wp-includes/template-functions-category.php index d81ebd02ba..48242d8d19 100644 --- a/wp-includes/template-functions-category.php +++ b/wp-includes/template-functions-category.php @@ -56,10 +56,10 @@ function get_the_category_list($separator = '', $parents='') { if ($category->category_parent) { $thelist .= get_category_parents($category->category_parent, TRUE); } - $thelist .= 'cat_name) . '" rel="category tag">'.$category->cat_name.''; + $thelist .= 'cat_name) . '" rel="category tag">'.$category->cat_name.''; break; case 'single': - $thelist .= 'cat_name) . ' rel="category tag">'; + $thelist .= 'cat_name) . ' rel="category tag">'; if ($category->category_parent) { $thelist .= get_category_parents($category->category_parent, FALSE); } @@ -67,7 +67,7 @@ function get_the_category_list($separator = '', $parents='') { break; case '': default: - $thelist .= 'cat_name) . '" rel="category tag">'.$category->cat_name.''; + $thelist .= 'cat_name) . '" rel="category tag">'.$category->cat_name.''; } } $thelist .= ''; @@ -79,16 +79,16 @@ function get_the_category_list($separator = '', $parents='') { switch(strtolower($parents)) { case 'multiple': if ($category->category_parent) $thelist .= get_category_parents($category->category_parent, TRUE); - $thelist .= 'cat_name) . '" rel="category tag">'.$category->cat_name.''; + $thelist .= 'cat_name) . '" rel="category tag">'.$category->cat_name.''; break; case 'single': - $thelist .= 'cat_name) . '" rel="category tag">'; + $thelist .= 'cat_name) . '" rel="category tag">'; if ($category->category_parent) $thelist .= get_category_parents($category->category_parent, FALSE); $thelist .= "$category->cat_name"; break; case '': default: - $thelist .= 'cat_name) . '" rel="category tag">'.$category->cat_name.''; + $thelist .= 'cat_name) . '" rel="category tag">'.$category->cat_name.''; } ++$i; } @@ -139,7 +139,7 @@ function get_category_children($id, $before = '/', $after = '') { function the_category_ID($echo = true) { // Grab the first cat in the list. $categories = get_the_category(); - $cat = $categories[0]->category_id; + $cat = $categories[0]->cat_ID; if ($echo) echo $cat; @@ -288,13 +288,13 @@ function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_orde } if ( $optiondates ) { - $cat_dates = $wpdb->get_results(" SELECT category_id, + $cat_dates = $wpdb->get_results(" SELECT cat_ID, UNIX_TIMESTAMP( MAX(post_date) ) AS ts FROM $wpdb->posts, $wpdb->post2cat WHERE post_status = 'publish' AND post_id = ID $exclusions GROUP BY category_id"); foreach ($cat_dates as $cat_date) { - $category_timestamp["$cat_date->category_id"] = $cat_date->ts; + $category_timestamp["$cat_date->cat_ID"] = $cat_date->ts; } } @@ -386,7 +386,7 @@ function in_category($category) { // Check if the current post is in the given c global $post, $category_cache; $cats = ''; foreach ($category_cache[$post->ID] as $cat) : - $cats[] = $cat->category_id; + $cats[] = $cat->cat_ID; endforeach; if ( in_array($category, $cats) )