Changeset 1355 for trunk/wp-includes/template-functions-category.php
- Timestamp:
- 05/24/2004 08:22:18 AM (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/template-functions-category.php
r1328 r1355 2 2 3 3 function get_the_category() { 4 global $post, $ tablecategories, $tablepost2cat, $wpdb, $category_cache;4 global $post, $wpdb, $category_cache; 5 5 if ($category_cache[$post->ID]) { 6 6 return $category_cache[$post->ID]; … … 8 8 $categories = $wpdb->get_results(" 9 9 SELECT category_id, cat_name, category_nicename, category_description, category_parent 10 FROM $ tablecategories, $tablepost2cat11 WHERE $ tablepost2cat.category_id = cat_ID AND $tablepost2cat.post_id = $post->ID10 FROM $wpdb->categories, $wpdb->post2cat 11 WHERE $wpdb->post2cat.category_id = cat_ID AND $wpdb->post2cat.post_id = $post->ID 12 12 "); 13 13 … … 17 17 18 18 function get_category_link($echo = false, $category_id, $category_nicename) { 19 global $wpdb, $ tablecategories, $post, $querystring_start, $querystring_equal, $cache_categories;19 global $wpdb, $post, $querystring_start, $querystring_equal, $cache_categories; 20 20 $cat_ID = $category_id; 21 21 $permalink_structure = get_settings('permalink_structure'); … … 124 124 125 125 function get_the_category_by_ID($cat_ID) { 126 global $ tablecategories, $cache_categories, $wpdb;126 global $cache_categories, $wpdb; 127 127 if ( !$cache_categories[$cat_ID] ) { 128 $cat_name = $wpdb->get_var("SELECT cat_name FROM $ tablecategories WHERE cat_ID = '$cat_ID'");128 $cat_name = $wpdb->get_var("SELECT cat_name FROM $wpdb->categories WHERE cat_ID = '$cat_ID'"); 129 129 $cache_categories[$cat_ID]->cat_name = $cat_name; 130 130 } else { … … 135 135 136 136 function get_category_parents($id, $link = FALSE, $separator = '/', $nicename = FALSE){ 137 global $ tablecategories, $cache_categories;138 $chain = "";137 global $cache_categories; 138 $chain = ''; 139 139 $parent = $cache_categories[$id]; 140 140 if ($nicename) { … … 153 153 154 154 function get_category_children($id, $before = '/', $after = '') { 155 global $ tablecategories, $cache_categories;155 global $cache_categories; 156 156 $c_cache = $cache_categories; // Can't do recursive foreach on a global, have to make a copy 157 157 $chain = ''; … … 185 185 186 186 function category_description($category = 0) { 187 global $cat, $wpdb, $ tablecategories, $cache_categories;187 global $cat, $wpdb, $cache_categories; 188 188 if (!$category) $category = $cat; 189 189 $category_description = $cache_categories[$category]->category_description; … … 196 196 $optiondates = 0, $optioncount = 0, $hide_empty = 1, $optionnone=FALSE, 197 197 $selected=0, $hide=0) { 198 global $ tablecategories, $tableposts, $tablepost2cat, $wpdb;198 global $wpdb; 199 199 global $querystring_start, $querystring_equal, $querystring_separator; 200 200 if (($file == 'blah') || ($file == '')) $file = get_settings('home') . '/' . get_settings('blogfilename'); … … 204 204 $query = " 205 205 SELECT cat_ID, cat_name, category_nicename,category_parent, 206 COUNT($ tablepost2cat.post_id) AS cat_count,206 COUNT($wpdb->post2cat.post_id) AS cat_count, 207 207 DAYOFMONTH(MAX(post_date)) AS lastday, MONTH(MAX(post_date)) AS lastmonth 208 FROM $ tablecategories LEFT JOIN $tablepost2cat ON (cat_ID = category_id)209 LEFT JOIN $ tableposts ON (ID = post_id)208 FROM $wpdb->categories LEFT JOIN $wpdb->post2cat ON (cat_ID = category_id) 209 LEFT JOIN $wpdb->posts ON (ID = post_id) 210 210 WHERE cat_ID > 0 211 211 "; … … 266 266 267 267 function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_order = 'asc', $file = '', $list = true, $optiondates = 0, $optioncount = 0, $hide_empty = 1, $use_desc_for_title = 1, $children=FALSE, $child_of=0, $categories=0, $recurse=0, $feed = '', $feed_image = '', $exclude = '') { 268 global $ tablecategories, $tableposts, $tablepost2cat, $wpdb, $category_posts;268 global $wpdb, $category_posts; 269 269 global $querystring_start, $querystring_equal, $querystring_separator; 270 270 // Optiondates now works … … 288 288 $query = " 289 289 SELECT cat_ID, cat_name, category_nicename, category_description, category_parent 290 FROM $ tablecategories290 FROM $wpdb->categories 291 291 WHERE cat_ID > 0 $exclusions 292 292 ORDER BY $sort_column $sort_order"; … … 296 296 if (!count($category_posts)) { 297 297 $cat_counts = $wpdb->get_results(" SELECT cat_ID, 298 COUNT($ tablepost2cat.post_id) AS cat_count299 FROM $ tablecategories300 INNER JOIN $ tablepost2cat ON (cat_ID = category_id)301 INNER JOIN $ tableposts ON (ID = post_id)298 COUNT($wpdb->post2cat.post_id) AS cat_count 299 FROM $wpdb->categories 300 INNER JOIN $wpdb->post2cat ON (cat_ID = category_id) 301 INNER JOIN $wpdb->posts ON (ID = post_id) 302 302 WHERE post_status = 'publish' $exclusions 303 303 GROUP BY category_id"); … … 312 312 $cat_dates = $wpdb->get_results(" SELECT cat_ID, 313 313 DAYOFMONTH(MAX(post_date)) AS lastday, MONTH(MAX(post_date)) AS lastmonth 314 FROM $ tablecategories315 LEFT JOIN $ tablepost2cat ON (cat_ID = category_id)316 LEFT JOIN $ tableposts ON (ID = post_id)314 FROM $wpdb->categories 315 LEFT JOIN $wpdb->post2cat ON (cat_ID = category_id) 316 LEFT JOIN $wpdb->posts ON (ID = post_id) 317 317 WHERE post_status = 'publish' $exclusions 318 318 GROUP BY category_id");
Note: See TracChangeset
for help on using the changeset viewer.