Changeset 32621
- Timestamp:
- 05/27/2015 06:37:29 PM (9 years ago)
- Location:
- trunk/src/wp-includes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/post.php
r32619 r32621 2609 2609 2610 2610 if ( !$force_delete && ( $post->post_type == 'post' || $post->post_type == 'page') && get_post_status( $postid ) != 'trash' && EMPTY_TRASH_DAYS ) 2611 return wp_trash_post($postid);2611 return wp_trash_post( $postid ); 2612 2612 2613 2613 if ( $post->post_type == 'attachment' ) -
trunk/src/wp-includes/revision.php
r32477 r32621 17 17 * @access private 18 18 * 19 * @param array $post Optional a post array to be processed for insertion as a post revision. 20 * @param bool $autosave optional Is the revision an autosave? 19 * @staticvar array|false $fields 20 * 21 * @param array $post Optional. A post array to be processed for insertion as a post revision. 22 * @param bool $autosave Optional. Is the revision an autosave? 21 23 * @return array Post array ready to be inserted as a post revision or array of fields that can be versioned. 22 24 */ … … 78 80 * @since 2.6.0 79 81 * 80 * @param 81 * @return null|int Nullor 0 if error, new revision ID, if success.82 * @param int $post_id The ID of the post to save as a revision. 83 * @return int|WP_Error|void Void or 0 if error, new revision ID, if success. 82 84 */ 83 85 function wp_save_post_revision( $post_id ) { … … 193 195 * 194 196 * @param int $post_id The post ID. 195 * @param int $user_id optional The post author ID.196 * @return object|boolThe autosaved data or false on failure or when no autosave exists.197 * @param int $user_id Optional The post author ID. 198 * @return WP_Post|false The autosaved data or false on failure or when no autosave exists. 197 199 */ 198 200 function wp_get_post_autosave( $post_id, $user_id = 0 ) { … … 216 218 * @since 2.6.0 217 219 * 218 * @param int| object $post Post ID or post object.219 * @return bool|int False if not a revision, ID of revision's parent otherwise.220 * @param int|WP_Post $post Post ID or post object. 221 * @return false|int False if not a revision, ID of revision's parent otherwise. 220 222 */ 221 223 function wp_is_post_revision( $post ) { … … 231 233 * @since 2.6.0 232 234 * 233 * @param int| object $post Post ID or post object.234 * @return bool|int False if not a revision, ID of autosave's parent otherwise235 * @param int|WP_Post $post Post ID or post object. 236 * @return false|int False if not a revision, ID of autosave's parent otherwise 235 237 */ 236 238 function wp_is_post_autosave( $post ) { … … 250 252 * @access private 251 253 * 252 * @param int| object|array $postPost ID, post object OR post array.253 * @param bool $autosave Optional. Is the revision an autosave?254 * @return mixedWP_Error or 0 if error, new revision ID if success.254 * @param int|WP_Post|array|null $post Post ID, post object OR post array. 255 * @param bool $autosave Optional. Is the revision an autosave? 256 * @return int|WP_Error WP_Error or 0 if error, new revision ID if success. 255 257 */ 256 258 function _wp_put_post_revision( $post = null, $autosave = false ) { … … 292 294 * @since 2.6.0 293 295 * 294 * @param int| object $postThe post ID or object.295 * @param string $output Optional. OBJECT, ARRAY_A, or ARRAY_N.296 * @param string $filter Optional sanitation filter. @see sanitize_post().297 * @return mixedNull if error or post object if success.296 * @param int|WP_Post $post The post ID or object. 297 * @param string $output Optional. OBJECT, ARRAY_A, or ARRAY_N. 298 * @param string $filter Optional sanitation filter. @see sanitize_post(). 299 * @return WP_Post|array|null Null if error or post object if success. 298 300 */ 299 301 function wp_get_post_revision(&$post, $output = OBJECT, $filter = 'raw') { … … 323 325 * @since 2.6.0 324 326 * 325 * @param int| object $revision_id Revision ID or revision object.326 * @param array $fieldsOptional. What fields to restore from. Defaults to all.327 * @return mixedNull if error, false if no fields to restore, (int) post ID if success.327 * @param int|WP_Post $revision_id Revision ID or revision object. 328 * @param array $fields Optional. What fields to restore from. Defaults to all. 329 * @return int|false|null Null if error, false if no fields to restore, (int) post ID if success. 328 330 */ 329 331 function wp_restore_post_revision( $revision_id, $fields = null ) { … … 381 383 * @since 2.6.0 382 384 * 383 * @param int| object $revision_id Revision ID or revision object.384 * @return mixedNull or WP_Error if error, deleted post if success.385 * @param int|WP_Post $revision_id Revision ID or revision object. 386 * @return array|false|WP_Post|WP_Error|null Null or WP_Error if error, deleted post if success. 385 387 */ 386 388 function wp_delete_post_revision( $revision_id ) { 387 if ( ! $revision = wp_get_post_revision( $revision_id ) )389 if ( ! $revision = wp_get_post_revision( $revision_id ) ) { 388 390 return $revision; 391 } 389 392 390 393 $delete = wp_delete_post( $revision->ID ); 391 if ( is_wp_error( $delete ) )392 return $delete;393 394 394 if ( $delete ) { 395 395 /** … … 443 443 */ 444 444 function wp_revisions_enabled( $post ) { 445 return wp_revisions_to_keep( $post ) != 0;445 return wp_revisions_to_keep( $post ) !== 0; 446 446 } 447 447 … … 488 488 * @since 2.7.0 489 489 * @access private 490 */ 491 function _set_preview($post) { 492 493 if ( ! is_object($post) ) 490 * 491 * @param WP_Post $post 492 * @return WP_Post|false 493 */ 494 function _set_preview( $post ) { 495 if ( ! is_object( $post ) ) { 494 496 return $post; 495 496 $preview = wp_get_post_autosave($post->ID); 497 498 if ( ! is_object( $preview) )497 } 498 499 $preview = wp_get_post_autosave( $post->ID ); 500 if ( ! is_object( $preview ) ) { 499 501 return $post; 500 501 $preview = sanitize_post($preview); 502 } 503 504 $preview = sanitize_post( $preview ); 502 505 503 506 $post->post_content = $preview->post_content; … … 517 520 */ 518 521 function _show_post_preview() { 519 520 522 if ( isset($_GET['preview_id']) && isset($_GET['preview_nonce']) ) { 521 523 $id = (int) $_GET['preview_id']; … … 533 535 * @since 3.6.0 534 536 * @access private 537 * 538 * @param array $terms 539 * @param int $post_id 540 * @param string $taxonomy 541 * @return array 535 542 */ 536 543 function _wp_preview_terms_filter( $terms, $post_id, $taxonomy ) { … … 554 561 * @since 3.6.0 555 562 * @access private 556 */ 563 * 564 * @param WP_Post $revision 565 * @return int|false 566 */ 557 567 function _wp_get_post_revision_version( $revision ) { 558 568 if ( is_object( $revision ) ) … … 573 583 * @access private 574 584 * 575 * @param WP_Post $post Post object 576 * @param array $revisions Current revisions of the post 585 * @global wpdb $wpdb 586 * 587 * @param WP_Post $post Post object 588 * @param array $revisions Current revisions of the post 577 589 * @return bool true if the revisions were upgraded, false if problems 578 590 */
Note: See TracChangeset
for help on using the changeset viewer.