Ticket #21309: 21309.8.diff
File 21309.8.diff, 2.2 KB (added by , 12 years ago) |
---|
-
wp-includes/post.php
377 377 * @param string $filter Optional, default is raw. 378 378 * @return mixed Post data or null on failure 379 379 */ 380 function &get_post( &$post, $output = OBJECT, $filter = 'raw' ) { 381 $null = null; 380 function get_post( $post, $output = OBJECT, $filter = 'raw' ) { 381 if ( empty( $post ) && isset( $GLOBALS['post'] ) ) 382 $post = $GLOBALS['post']; 382 383 383 if ( empty( $post ) && isset( $GLOBALS['post'] ) ) { 384 $_post = & $GLOBALS['post']; 385 } elseif ( is_a( $post, 'WP_Post' ) ) { 384 if ( is_a( $post, 'WP_Post' ) ) { 386 385 $_post = $post; 387 386 } elseif ( is_object( $post ) ) { 388 387 if ( empty( $post->filter ) ) { … … 398 397 $_post = WP_Post::get_instance( $post ); 399 398 } 400 399 401 if ( ! $_post )402 return $null;400 if ( ! $_post ) 401 return null; 403 402 404 403 $_post = $_post->filter( $filter ); 405 404 406 if ( $output == ARRAY_A ) { 407 $__post = $_post->to_array(); 408 return $__post; 409 } elseif ( $output == ARRAY_N ) { 410 $__post = array_values( $_post->to_array() ); 411 return $__post; 412 } 405 if ( $output == ARRAY_A ) 406 return $_post->to_array(); 407 elseif ( $output == ARRAY_N ) 408 return array_values( $_post->to_array() ); 413 409 414 410 return $_post; 415 411 } … … 3299 3295 * @param string $filter How the return value should be filtered. 3300 3296 * @return mixed Page data. 3301 3297 */ 3302 function &get_page(&$page, $output = OBJECT, $filter = 'raw') { 3303 $p = get_post($page, $output, $filter); 3304 return $p; 3298 function get_page( $page, $output = OBJECT, $filter = 'raw') { 3299 return get_post( $page, $output, $filter ); 3305 3300 } 3306 3301 3307 3302 /** -
wp-includes/query.php
2750 2750 // Ignore sticky posts the current user cannot read or are not published. 2751 2751 if ( 'publish' != $sticky_post->post_status ) 2752 2752 continue; 2753 array_splice($this->posts, $sticky_offset, 0, array( $sticky_post));2753 array_splice($this->posts, $sticky_offset, 0, array( get_post( $sticky_post ) ) ); 2754 2754 $sticky_offset++; 2755 2755 } 2756 2756 }