Ticket #12267: wp-post-patch-take-2.diff
File wp-post-patch-take-2.diff, 4.5 KB (added by , 12 years ago) |
---|
-
wp-includes/post.php
403 403 $_post = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->posts WHERE ID = %d LIMIT 1", $post_id)); 404 404 if ( ! $_post ) 405 405 return $null; 406 $_post = WP_Post::get_instance($_post); 406 407 _get_post_ancestors($_post); 407 408 $_post = sanitize_post($_post, 'raw'); 408 409 wp_cache_add($_post->ID, $_post, 'posts'); -
wp-includes/post-template.php
102 102 */ 103 103 function get_the_title( $id = 0 ) { 104 104 $post = &get_post($id); 105 106 $title = isset($post->post_title) ? $post->post_title : ''; 107 $id = isset($post->ID) ? $post->ID : (int) $id; 108 109 if ( !is_admin() ) { 110 if ( !empty($post->post_password) ) { 111 $protected_title_format = apply_filters('protected_title_format', __('Protected: %s')); 112 $title = sprintf($protected_title_format, $title); 113 } else if ( isset($post->post_status) && 'private' == $post->post_status ) { 114 $private_title_format = apply_filters('private_title_format', __('Private: %s')); 115 $title = sprintf($private_title_format, $title); 116 } 117 } 118 return apply_filters( 'the_title', $title, $id ); 105 return $post->get_the_title($id); 119 106 } 120 107 121 108 /** -
wp-includes/class-wp-post.php
1 <?php 2 3 class WP_Post { 4 public $ID; 5 public $post_author; 6 public $post_date; 7 public $post_date_gmt; 8 public $post_content; 9 public $post_title; 10 public $post_excerpt; 11 public $post_status; 12 public $comment_status; 13 public $ping_status; 14 public $post_password; 15 public $post_name; 16 public $to_ping; 17 public $pinged; 18 public $post_modified; 19 public $post_modified_gmt; 20 public $post_content_filtered; 21 public $post_parent; 22 public $guid; 23 public $menu_order; 24 public $post_type; 25 public $post_mime_type; 26 public $comment_count; 27 public $filter; 28 29 public static function get_instance( $post_data ) { 30 $post = new WP_Post(); 31 32 foreach ( $post_data as $k=>$v ) { 33 if ( property_exists('WP_Post', $k) ) { 34 $post->$k = $v; 35 } 36 } 37 38 return $post; 39 } 40 41 public function __set( $name, $value ) { 42 if ( property_exists('WP_Post', $name) ) { 43 $this->$name = $value; 44 return $this->$name; 45 } 46 47 return false; 48 } 49 50 public function get_the_title( $id = 0 ) { 51 $title = isset($this->post_title) ? $this->post_title : ''; 52 $id = isset($this->ID) ? $this->ID : (int) $id; 53 54 if ( !is_admin() ) { 55 if ( !empty($this->post_password) ) { 56 $protected_title_format = apply_filters('protected_title_format', __('Protected: %s')); 57 $title = sprintf($protected_title_format, $title); 58 } else if ( isset($this->post_status) && 'private' == $this->post_status ) { 59 $private_title_format = apply_filters('private_title_format', __('Private: %s')); 60 $title = sprintf($private_title_format, $title); 61 } 62 } 63 return apply_filters( 'the_title', $title, $id ); 64 } 65 } -
wp-includes/query.php
2660 2660 if ( !$q['suppress_filters'] ) 2661 2661 $this->posts = apply_filters_ref_array('posts_results', array( $this->posts, &$this ) ); 2662 2662 2663 // Convert posts to WP_Post objects 2664 if ( is_array($this->posts) ) { 2665 $this->posts = array_map(array( 'WP_Post', 'get_instance' ), $this->posts ); 2666 } 2667 2663 2668 if ( !empty($this->posts) && $this->is_comment_feed && $this->is_singular ) { 2664 2669 $cjoin = apply_filters_ref_array('comment_feed_join', array( '', &$this ) ); 2665 2670 $cwhere = apply_filters_ref_array('comment_feed_where', array( "WHERE comment_post_ID = '{$this->posts[0]->ID}' AND comment_approved = '1'", &$this ) ); -
wp-settings.php
142 142 require( ABSPATH . WPINC . '/nav-menu.php' ); 143 143 require( ABSPATH . WPINC . '/nav-menu-template.php' ); 144 144 require( ABSPATH . WPINC . '/admin-bar.php' ); 145 require( ABSPATH . WPINC . '/class-wp-post.php' ); 145 146 146 147 // Load multisite-specific files. 147 148 if ( is_multisite() ) {