More consistent use of cat_ID vs category_id
git-svn-id: http://svn.automattic.com/wordpress/trunk@2551 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
74b400f3d3
commit
a2b53e2909
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -56,10 +56,10 @@ function get_the_category_list($separator = '', $parents='') {
|
|||
if ($category->category_parent) {
|
||||
$thelist .= get_category_parents($category->category_parent, TRUE);
|
||||
}
|
||||
$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>';
|
||||
$thelist .= '<a href="' . get_category_link($category->cat_ID) . '" title="' . sprintf(__("View all posts in %s"), $category->cat_name) . '" rel="category tag">'.$category->cat_name.'</a></li>';
|
||||
break;
|
||||
case 'single':
|
||||
$thelist .= '<a href="' . get_category_link($category->category_id) . '" title="' . sprintf(__("View all posts in %s"), $category->cat_name) . ' rel="category tag">';
|
||||
$thelist .= '<a href="' . get_category_link($category->cat_ID) . '" title="' . sprintf(__("View all posts in %s"), $category->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 .= '<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>';
|
||||
$thelist .= '<a href="' . get_category_link($category->cat_ID) . '" title="' . sprintf(__("View all posts in %s"), $category->cat_name) . '" rel="category tag">'.$category->cat_name.'</a></li>';
|
||||
}
|
||||
}
|
||||
$thelist .= '</ul>';
|
||||
|
@ -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 .= '<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>';
|
||||
$thelist .= '<a href="' . get_category_link($category->cat_ID) . '" title="' . sprintf(__("View all posts in %s"), $category->cat_name) . '" rel="category tag">'.$category->cat_name.'</a>';
|
||||
break;
|
||||
case 'single':
|
||||
$thelist .= '<a href="' . get_category_link($category->category_id) . '" title="' . sprintf(__("View all posts in %s"), $category->cat_name) . '" rel="category tag">';
|
||||
$thelist .= '<a href="' . get_category_link($category->cat_ID) . '" title="' . sprintf(__("View all posts in %s"), $category->cat_name) . '" rel="category tag">';
|
||||
if ($category->category_parent) $thelist .= get_category_parents($category->category_parent, FALSE);
|
||||
$thelist .= "$category->cat_name</a>";
|
||||
break;
|
||||
case '':
|
||||
default:
|
||||
$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>';
|
||||
$thelist .= '<a href="' . get_category_link($category->cat_ID) . '" title="' . sprintf(__("View all posts in %s"), $category->cat_name) . '" rel="category tag">'.$category->cat_name.'</a>';
|
||||
}
|
||||
++$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) )
|
||||
|
|
Loading…
Reference in New Issue