Changeset 1355 for trunk/wp-admin/admin-functions.php
- Timestamp:
- 05/24/2004 08:22:18 AM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/admin-functions.php
r1340 r1355 20 20 21 21 function get_nested_categories($default = 0) { 22 global $post_ID, $ tablecategories, $tablepost2cat, $mode, $wpdb;22 global $post_ID, $mode, $wpdb; 23 23 24 24 if ($post_ID) { 25 25 $checked_categories = $wpdb->get_col(" 26 26 SELECT category_id 27 FROM $ tablecategories, $tablepost2cat28 WHERE $ tablepost2cat.category_id = cat_ID AND $tablepost2cat.post_id = '$post_ID'27 FROM $wpdb->categories, $wpdb->post2cat 28 WHERE $wpdb->post2cat.category_id = cat_ID AND $wpdb->post2cat.post_id = '$post_ID' 29 29 "); 30 30 } else { … … 32 32 } 33 33 34 $categories = $wpdb->get_results("SELECT * FROM $ tablecategories ORDER BY category_parent DESC, cat_name ASC");34 $categories = $wpdb->get_results("SELECT * FROM $wpdb->categories ORDER BY category_parent DESC, cat_name ASC"); 35 35 $result = array(); 36 36 foreach($categories as $category) { … … 67 67 // Dandy new recursive multiple category stuff. 68 68 function cat_rows($parent = 0, $level = 0, $categories = 0) { 69 global $wpdb, $ tablecategories, $tablepost2cat, $bgcolor;69 global $wpdb, $bgcolor; 70 70 if (!$categories) { 71 $categories = $wpdb->get_results("SELECT * FROM $ tablecategories ORDER BY cat_name");71 $categories = $wpdb->get_results("SELECT * FROM $wpdb->categories ORDER BY cat_name"); 72 72 } 73 73 if ($categories) { 74 74 foreach ($categories as $category) { 75 75 if ($category->category_parent == $parent) { 76 $count = $wpdb->get_var("SELECT COUNT(post_id) FROM $ tablepost2cat WHERE category_id = $category->cat_ID");76 $count = $wpdb->get_var("SELECT COUNT(post_id) FROM $wpdb->post2cat WHERE category_id = $category->cat_ID"); 77 77 $pad = str_repeat('— ', $level); 78 78 … … 92 92 93 93 function wp_dropdown_cats($currentcat, $currentparent = 0, $parent = 0, $level = 0, $categories = 0) { 94 global $wpdb, $ tablecategories, $tablepost2cat, $bgcolor;94 global $wpdb, $bgcolor; 95 95 if (!$categories) { 96 $categories = $wpdb->get_results("SELECT * FROM $ tablecategories ORDER BY cat_name");96 $categories = $wpdb->get_results("SELECT * FROM $wpdb->categories ORDER BY cat_name"); 97 97 } 98 98 if ($categories) { 99 99 foreach ($categories as $category) { if ($currentcat != $category->cat_ID && $parent == $category->category_parent) { 100 $count = $wpdb->get_var("SELECT COUNT(post_id) FROM $ tablepost2cat WHERE category_id = $category->cat_ID");100 $count = $wpdb->get_var("SELECT COUNT(post_id) FROM $wpdb->post2cat WHERE category_id = $category->cat_ID"); 101 101 $pad = str_repeat('– ', $level); 102 102 echo "\n\t<option value='$category->cat_ID'"; … … 200 200 // Some postmeta stuff 201 201 function has_meta($postid) { 202 global $wpdb , $tablepostmeta;202 global $wpdb; 203 203 204 204 return $wpdb->get_results(" 205 205 SELECT meta_key, meta_value, meta_id, post_id 206 FROM $ tablepostmeta206 FROM $wpdb->postmeta 207 207 WHERE post_id = '$postid' 208 208 ORDER BY meta_key,meta_id",ARRAY_A); … … 241 241 // Get a list of previously defined keys 242 242 function get_meta_keys() { 243 global $wpdb , $tablepostmeta;243 global $wpdb; 244 244 245 245 $keys = $wpdb->get_col(" 246 246 SELECT meta_key 247 FROM $ tablepostmeta247 FROM $wpdb->postmeta 248 248 GROUP BY meta_key 249 249 ORDER BY meta_key"); … … 253 253 254 254 function meta_form() { 255 global $wpdb , $tablepostmeta;255 global $wpdb; 256 256 $keys = $wpdb->get_col(" 257 257 SELECT meta_key 258 FROM $ tablepostmeta258 FROM $wpdb->postmeta 259 259 GROUP BY meta_key 260 260 ORDER BY meta_id DESC … … 290 290 291 291 function add_meta($post_ID) { 292 global $wpdb , $tablepostmeta;292 global $wpdb; 293 293 294 294 $metakeyselect = $wpdb->escape( stripslashes( trim($_POST['metakeyselect']) ) ); … … 307 307 308 308 $result = $wpdb->query(" 309 INSERT INTO $ tablepostmeta309 INSERT INTO $wpdb->postmeta 310 310 (post_id,meta_key,meta_value) 311 311 VALUES ('$post_ID','$metakey','$metavalue') … … 315 315 316 316 function delete_meta($mid) { 317 global $wpdb , $tablepostmeta;318 319 $result = $wpdb->query("DELETE FROM $ tablepostmeta WHERE meta_id = '$mid'");317 global $wpdb; 318 319 $result = $wpdb->query("DELETE FROM $wpdb->postmeta WHERE meta_id = '$mid'"); 320 320 } 321 321 322 322 function update_meta($mid, $mkey, $mvalue) { 323 global $wpdb , $tablepostmeta;324 325 return $wpdb->query("UPDATE $ tablepostmeta SET meta_key = '$mkey', meta_value = '$mvalue' WHERE meta_id = '$mid'");323 global $wpdb; 324 325 return $wpdb->query("UPDATE $wpdb->postmeta SET meta_key = '$mkey', meta_value = '$mvalue' WHERE meta_id = '$mid'"); 326 326 } 327 327
Note: See TracChangeset
for help on using the changeset viewer.