Changeset 21651
- Timestamp:
- 08/28/2012 07:08:28 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/deprecated.php
r21413 r21651 944 944 /** 945 945 * This was once used to display an 'Insert into Post' button. Now it is deprecated and stubbed. 946 * 946 * 947 947 * @deprecated 3.5.0 948 948 */ … … 953 953 /** 954 954 * This was once used to display a media button. Now it is deprecated and stubbed. 955 * 955 * 956 956 * @deprecated 3.5.0 957 957 */ … … 959 959 _deprecated_function( __FUNCTION__, '3.5' ); 960 960 } 961 962 /** 963 * Get an existing post and format it for editing. 964 * 965 * @since 2.0.0 966 * @deprecated 3.5.0 967 * 968 * @param int $id 969 * @return object 970 */ 971 function get_post_to_edit( $id ) { 972 _deprecated_function( __FUNCTION__, '3.5', 'get_post()' ); 973 974 return get_post( $id, OBJECT, 'edit' ); 975 } 976 -
trunk/wp-admin/includes/post.php
r21598 r21651 465 465 466 466 /** 467 * Get an existing post and format it for editing.468 *469 * @since 2.0.0470 *471 * @param int $id472 * @return WP_Post473 */474 function get_post_to_edit( $id ) {475 476 $post = get_post( $id, OBJECT, 'edit' );477 478 if ( $post->post_type == 'page' )479 $post->page_template = get_post_meta( $id, '_wp_page_template', true );480 481 return $post;482 }483 484 /**485 467 * Determine if a post exists based on title, content, and date 486 468 * … … 929 911 * Executes a query for attachments. An array of WP_Query arguments 930 912 * can be passed in, which will override the arguments set by this function. 931 * 913 * 932 914 * @since 2.5.0 933 915 * @uses apply_filters() Calls 'upload_per_page' on posts_per_page argument -
trunk/wp-admin/post.php
r21597 r21651 166 166 167 167 $title = $post_type_object->labels->edit_item; 168 $post = get_post _to_edit($post_id);168 $post = get_post($post_id, OBJECT, 'edit'); 169 169 170 170 if ( post_type_supports($post_type, 'comments') ) { -
trunk/wp-includes/class-wp-atom-server.php
r20715 r21651 914 914 } 915 915 916 $entry = wp_get_single_post($postID,ARRAY_A);916 $entry = get_post($postID,ARRAY_A); 917 917 918 918 if (!isset($entry) || !isset($entry['ID'])) … … 1411 1411 case $this->ENTRY_PATH: 1412 1412 global $post; 1413 $post = wp_get_single_post($this->params[1]);1413 $post = get_post($this->params[1]); 1414 1414 $wp_last_modified = get_post_modified_time('D, d M Y H:i:s', true); 1415 1415 $post = null; -
trunk/wp-includes/class-wp-xmlrpc-server.php
r21597 r21651 1257 1257 do_action( 'xmlrpc_call', 'wp.deletePost' ); 1258 1258 1259 $post = wp_get_single_post( $post_id, ARRAY_A );1259 $post = get_post( $post_id, ARRAY_A ); 1260 1260 if ( empty( $post['ID'] ) ) 1261 1261 return new IXR_Error( 404, __( 'Invalid post ID.' ) ); … … 1287 1287 * and 'enclosure'. 1288 1288 * 1289 * @uses wp_get_single_post()1289 * @uses get_post() 1290 1290 * @param array $args Method parameters. Contains: 1291 1291 * - int $post_id … … 1338 1338 do_action( 'xmlrpc_call', 'wp.getPost' ); 1339 1339 1340 $post = wp_get_single_post( $post_id, ARRAY_A );1340 $post = get_post( $post_id, ARRAY_A ); 1341 1341 1342 1342 if ( empty( $post['ID'] ) ) … … 2061 2061 // Get the current page based on the page_id and 2062 2062 // make sure it is a page and not a post. 2063 $actual_page = wp_get_single_post($page_id, ARRAY_A);2063 $actual_page = get_post($page_id, ARRAY_A); 2064 2064 if ( !$actual_page || ($actual_page['post_type'] != 'page') ) 2065 2065 return(new IXR_Error(404, __('Sorry, no such page.'))); … … 2102 2102 2103 2103 // Get the page data and make sure it is a page. 2104 $actual_page = wp_get_single_post($page_id, ARRAY_A);2104 $actual_page = get_post($page_id, ARRAY_A); 2105 2105 if ( !$actual_page || ($actual_page['post_type'] != 'page') ) 2106 2106 return(new IXR_Error(404, __('Sorry, no such page.'))); … … 3297 3297 return $this->error; 3298 3298 3299 $post_data = wp_get_single_post($post_ID, ARRAY_A);3299 $post_data = get_post($post_ID, ARRAY_A); 3300 3300 if ( ! $post_data ) 3301 3301 return new IXR_Error( 404, __( 'Invalid post ID.' ) ); … … 3539 3539 do_action('xmlrpc_call', 'blogger.editPost'); 3540 3540 3541 $actual_post = wp_get_single_post($post_ID,ARRAY_A);3541 $actual_post = get_post($post_ID,ARRAY_A); 3542 3542 3543 3543 if ( !$actual_post || $actual_post['post_type'] != 'post' ) … … 3593 3593 do_action('xmlrpc_call', 'blogger.deletePost'); 3594 3594 3595 $actual_post = wp_get_single_post($post_ID,ARRAY_A);3595 $actual_post = get_post($post_ID,ARRAY_A); 3596 3596 3597 3597 if ( !$actual_post || $actual_post['post_type'] != 'post' ) … … 3983 3983 do_action('xmlrpc_call', 'metaWeblog.editPost'); 3984 3984 3985 $postdata = wp_get_single_post( $post_ID, ARRAY_A );3985 $postdata = get_post( $post_ID, ARRAY_A ); 3986 3986 3987 3987 // If there is no post data for the give post id, stop … … 4248 4248 return $this->error; 4249 4249 4250 $postdata = wp_get_single_post($post_ID, ARRAY_A);4250 $postdata = get_post($post_ID, ARRAY_A); 4251 4251 if ( ! $postdata ) 4252 4252 return new IXR_Error( 404, __( 'Invalid post ID.' ) ); … … 4828 4828 do_action('xmlrpc_call', 'mt.getTrackbackPings'); 4829 4829 4830 $actual_post = wp_get_single_post($post_ID, ARRAY_A);4830 $actual_post = get_post($post_ID, ARRAY_A); 4831 4831 4832 4832 if ( !$actual_post ) … … 4875 4875 do_action('xmlrpc_call', 'mt.publishPost'); 4876 4876 4877 $postdata = wp_get_single_post($post_ID, ARRAY_A);4877 $postdata = get_post($post_ID, ARRAY_A); 4878 4878 if ( ! $postdata ) 4879 4879 return new IXR_Error( 404, __( 'Invalid post ID.' ) ); … … 5089 5089 } 5090 5090 5091 $actual_post = wp_get_single_post($post_ID, ARRAY_A);5091 $actual_post = get_post($post_ID, ARRAY_A); 5092 5092 5093 5093 if ( !$actual_post ) { -
trunk/wp-includes/deprecated.php
r21597 r21651 3205 3205 _deprecated_function( __FUNCTION__, '3.5' ); 3206 3206 } 3207 3208 /** 3209 * Retrieve a single post, based on post ID. 3210 * 3211 * Has categories in 'post_category' property or key. Has tags in 'tags_input' 3212 * property or key. 3213 * 3214 * @since 1.0.0 3215 * @deprecated 3.5.0 3216 * @see get_post() 3217 * 3218 * @param int $postid Post ID. 3219 * @param string $mode How to return result, either OBJECT, ARRAY_N, or ARRAY_A. 3220 * @return object|array Post object or array holding post contents and information 3221 */ 3222 function wp_get_single_post( $postid = 0, $mode = OBJECT ) { 3223 _deprecated_function( __FUNCTION__, '3.5', 'get_post()' ); 3224 return get_post( $postid, $mode, 'edit' ); 3225 } 3226 -
trunk/wp-includes/post.php
r21628 r21651 476 476 return true; 477 477 478 if ( 'page_template' == $key ) 479 return ( 'page' == $this->post_type ); 480 481 if ( 'post_category' == $key ) 482 return true; 483 484 if ( 'tags_input' == $key ) 485 return true; 486 478 487 return metadata_exists( 'post', $this->ID, $key ); 479 488 } 480 489 481 490 public function &__get( $key ) { 491 if ( 'page_template' == $key && $this->__isset( $key ) ) { 492 $_ref = get_post_meta( $this->ID, '_wp_page_template', true ); 493 } 494 495 if ( 'post_category' == $key ) { 496 if ( is_object_in_taxonomy( $this->post_type, 'category' ) ) { 497 $_ref = wp_get_post_categories( $this->ID ); 498 } else { 499 $_ref = array(); 500 } 501 } 502 503 if ( 'tags_input' == $key ) { 504 if ( is_object_in_taxonomy( $this->post_type, 'post_tag' ) ) { 505 $_ref = wp_get_post_tags( $this->ID, array( 'fields' => 'names' ) ); 506 } else { 507 $_ref = array(); 508 } 509 } 510 511 if ( isset( $_ref ) ) 512 return $_ref; 513 514 // Rest of the values need filtering 515 482 516 if ( 'ancestors' == $key ) { 483 517 $value = get_post_ancestors( $this ); … … 505 539 public function to_array() { 506 540 $post = get_object_vars( $this ); 507 $post['ancestors'] = array(); 541 542 foreach ( array( 'ancestors', 'page_template', 'post_category', 'tags_input' ) as $key ) { 543 if ( $this->__isset( $key ) ) 544 $post[ $key ] = $this->__get( $key ); 545 } 508 546 509 547 return $post; … … 2227 2265 return wp_delete_post($post_id, true); 2228 2266 2229 if ( !$post = wp_get_single_post($post_id, ARRAY_A) )2267 if ( !$post = get_post($post_id, ARRAY_A) ) 2230 2268 return $post; 2231 2269 … … 2259 2297 */ 2260 2298 function wp_untrash_post($post_id = 0) { 2261 if ( !$post = wp_get_single_post($post_id, ARRAY_A) )2299 if ( !$post = get_post($post_id, ARRAY_A) ) 2262 2300 return $post; 2263 2301 … … 2487 2525 return $results ? $results : false; 2488 2526 2489 }2490 2491 /**2492 * Retrieve a single post, based on post ID.2493 *2494 * Has categories in 'post_category' property or key. Has tags in 'tags_input'2495 * property or key.2496 *2497 * @since 1.0.02498 *2499 * @param int $postid Post ID.2500 * @param string $mode How to return result, either OBJECT, ARRAY_N, or ARRAY_A.2501 * @return WP_Post|array WP_Post object or array holding post contents and information2502 */2503 function wp_get_single_post($postid = 0, $mode = OBJECT) {2504 $postid = (int) $postid;2505 2506 $post = get_post($postid, $mode);2507 2508 if (2509 ( OBJECT == $mode && empty( $post->ID ) ) ||2510 ( OBJECT != $mode && empty( $post['ID'] ) )2511 )2512 return ( OBJECT == $mode ? null : array() );2513 2514 // Set categories and tags2515 if ( $mode == OBJECT ) {2516 $post->post_category = array();2517 if ( is_object_in_taxonomy($post->post_type, 'category') )2518 $post->post_category = wp_get_post_categories($postid);2519 $post->tags_input = array();2520 if ( is_object_in_taxonomy($post->post_type, 'post_tag') )2521 $post->tags_input = wp_get_post_tags($postid, array('fields' => 'names'));2522 } else {2523 $post['post_category'] = array();2524 if ( is_object_in_taxonomy($post['post_type'], 'category') )2525 $post['post_category'] = wp_get_post_categories($postid);2526 $post['tags_input'] = array();2527 if ( is_object_in_taxonomy($post['post_type'], 'post_tag') )2528 $post['tags_input'] = wp_get_post_tags($postid, array('fields' => 'names'));2529 }2530 2531 return $post;2532 2527 } 2533 2528 … … 2833 2828 2834 2829 // First, get all of the original fields 2835 $post = wp_get_single_post($postarr['ID'], ARRAY_A);2830 $post = get_post($postarr['ID'], ARRAY_A); 2836 2831 2837 2832 // Escape data pulled from DB. … … 3242 3237 if ( ! empty( $tb_list ) ) { 3243 3238 // get post data 3244 $postdata = wp_get_single_post($post_id, ARRAY_A);3239 $postdata = get_post($post_id, ARRAY_A); 3245 3240 3246 3241 // import postdata as variables
Note: See TracChangeset
for help on using the changeset viewer.