Changeset 4495 for trunk/wp-includes/post.php
- Timestamp:
- 11/19/2006 07:56:05 AM (19 years ago)
- File:
-
- 1 edited
-
trunk/wp-includes/post.php (modified) (15 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/post.php
r4425 r4495 167 167 if ( !empty($include) ) { 168 168 $offset = 0; //ignore offset, category, exclude, meta_key, and meta_value params if using include 169 $category = ''; 170 $exclude = ''; 169 $category = ''; 170 $exclude = ''; 171 171 $meta_key = ''; 172 172 $meta_value = ''; … … 182 182 } 183 183 } 184 if (!empty($inclusions)) 185 $inclusions .= ')'; 184 if (!empty($inclusions)) 185 $inclusions .= ')'; 186 186 187 187 $exclusions = ''; … … 197 197 } 198 198 } 199 if (!empty($exclusions)) 199 if (!empty($exclusions)) 200 200 $exclusions .= ')'; 201 201 202 202 $query ="SELECT DISTINCT * FROM $wpdb->posts " ; 203 $query .= ( empty( $category ) ? "" : ", $wpdb->post2cat " ) ; 204 $query .= ( empty( $meta_key ) ? "" : ", $wpdb->postmeta " ) ; 203 $query .= ( empty( $category ) ? "" : ", $wpdb->post2cat " ) ; 204 $query .= ( empty( $meta_key ) ? "" : ", $wpdb->postmeta " ) ; 205 205 $query .= " WHERE (post_type = 'post' AND post_status = 'publish') $exclusions $inclusions " ; 206 206 $query .= ( empty( $category ) ? "" : "AND ($wpdb->posts.ID = $wpdb->post2cat.post_id AND $wpdb->post2cat.category_id = " . $category. ") " ) ; … … 401 401 $post_ID = (int) $post_ID; 402 402 403 $sql = "SELECT category_id 404 FROM $wpdb->post2cat 405 WHERE post_id = '$post_ID' 403 $sql = "SELECT category_id 404 FROM $wpdb->post2cat 405 WHERE post_id = '$post_ID' 406 406 ORDER BY category_id"; 407 407 … … 436 436 if($mode == OBJECT) { 437 437 $post->post_category = wp_get_post_categories($postid); 438 } 438 } 439 439 else { 440 440 $post['post_category'] = wp_get_post_categories($postid); … … 636 636 if ( $post_pingback ) 637 637 $result = $wpdb->query(" 638 INSERT INTO $wpdb->postmeta 639 (post_id,meta_key,meta_value) 638 INSERT INTO $wpdb->postmeta 639 (post_id,meta_key,meta_value) 640 640 VALUES ('$post_ID','_pingme','1') 641 641 "); 642 642 $result = $wpdb->query(" 643 INSERT INTO $wpdb->postmeta 644 (post_id,meta_key,meta_value) 643 INSERT INTO $wpdb->postmeta 644 (post_id,meta_key,meta_value) 645 645 VALUES ('$post_ID','_encloseme','1') 646 646 "); … … 654 654 if ( ! update_post_meta($post_ID, '_wp_page_template', $page_template)) 655 655 add_post_meta($post_ID, '_wp_page_template', $page_template, true); 656 656 657 657 if ( $post_status == 'publish' ) 658 658 do_action('publish_page', $post_ID); … … 685 685 686 686 // Passed post category list overwrites existing category list if not empty. 687 if ( isset($postarr['post_category']) && is_array($postarr['post_category'])687 if ( isset($postarr['post_category']) && is_array($postarr['post_category']) 688 688 && 0 != count($postarr['post_category']) ) 689 $post_cats = $postarr['post_category'];690 else 691 $post_cats = $post['post_category'];689 $post_cats = $postarr['post_category']; 690 else 691 $post_cats = $post['post_category']; 692 692 693 693 // Drafts shouldn't be assigned a date unless explicitly done so by the user 694 if ( 'draft' == $post['post_status'] && empty($postarr['edit_date']) && empty($postarr['post_date']) && 695 ('0000-00-00 00:00:00' == $post['post_date']) )694 if ( 'draft' == $post['post_status'] && empty($postarr['edit_date']) && empty($postarr['post_date']) && 695 ('0000-00-00 00:00:00' == $post['post_date']) ) 696 696 $clear_date = true; 697 697 else 698 698 $clear_date = false; 699 699 700 // Merge old and new fields with new fields overwriting old ones.701 $postarr = array_merge($post, $postarr);702 $postarr['post_category'] = $post_cats;700 // Merge old and new fields with new fields overwriting old ones. 701 $postarr = array_merge($post, $postarr); 702 $postarr['post_category'] = $post_cats; 703 703 if ( $clear_date ) { 704 704 $postarr['post_date'] = ''; … … 734 734 // First the old categories 735 735 $old_categories = $wpdb->get_col(" 736 SELECT category_id 737 FROM $wpdb->post2cat 736 SELECT category_id 737 FROM $wpdb->post2cat 738 738 WHERE post_id = $post_ID"); 739 739 … … 750 750 foreach ($delete_cats as $del) { 751 751 $wpdb->query(" 752 DELETE FROM $wpdb->post2cat 753 WHERE category_id = $del 754 AND post_id = $post_ID 752 DELETE FROM $wpdb->post2cat 753 WHERE category_id = $del 754 AND post_id = $post_ID 755 755 "); 756 756 } … … 849 849 $trackback_urls = explode(',', $tb_list); 850 850 foreach($trackback_urls as $tb_url) { 851 $tb_url = trim($tb_url);852 trackback($tb_url, stripslashes($post_title), $excerpt, $post_id);853 } 854 }851 $tb_url = trim($tb_url); 852 trackback($tb_url, stripslashes($post_title), $excerpt, $post_id); 853 } 854 } 855 855 } 856 856 … … 929 929 $pages = $wpdb->get_results("SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE post_name = '$leaf_path' AND post_type='page'"); 930 930 931 if ( empty($pages) ) 931 if ( empty($pages) ) 932 932 return NULL; 933 933 … … 1019 1019 $inclusions = ''; 1020 1020 if ( !empty($include) ) { 1021 $child_of = 0; //ignore child_of, exclude, meta_key, and meta_value params if using include 1022 $exclude = ''; 1021 $child_of = 0; //ignore child_of, exclude, meta_key, and meta_value params if using include 1022 $exclude = ''; 1023 1023 $meta_key = ''; 1024 1024 $meta_value = ''; … … 1033 1033 } 1034 1034 } 1035 if (!empty($inclusions)) 1036 $inclusions .= ')'; 1035 if (!empty($inclusions)) 1036 $inclusions .= ')'; 1037 1037 1038 1038 $exclusions = ''; … … 1197 1197 if (empty($post_date)) 1198 1198 $post_date = current_time('mysql'); 1199 if (empty($post_date_gmt)) 1199 if (empty($post_date_gmt)) 1200 1200 $post_date_gmt = current_time('mysql', 1); 1201 1201
Note: See TracChangeset
for help on using the changeset viewer.