Changeset 27699
- Timestamp:
- 03/25/2014 08:59:55 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/revision.php
r27683 r27699 16 16 * @since 2.6.0 17 17 * @access private 18 *19 * @uses apply_filters() Calls '_wp_post_revision_fields' on 'title', 'content' and 'excerpt' fields.20 18 * 21 19 * @param array $post Optional a post array to be processed for insertion as a post revision. … … 34 32 ); 35 33 36 // Runs only once 34 /** 35 * Filter the list of fields saved in post revisions. 36 * 37 * Included by default: 'post_title', 'post_content' and 'post_excerpt'. 38 * 39 * Disallowed fields: 'ID', 'post_name', 'post_parent', 'post_date', 40 * 'post_date_gmt', 'post_status', 'post_type', 'comment_count', 41 * and 'post_author'. 42 * 43 * @since 2.6.0 44 * 45 * @param array $fields List of fields to revision. Contains 'post_title', 46 * 'post_content', and 'post_excerpt' by default. 47 */ 37 48 $fields = apply_filters( '_wp_post_revision_fields', $fields ); 38 49 … … 100 111 } 101 112 102 if ( isset( $last_revision ) && apply_filters( 'wp_save_post_revision_check_for_changes', true, $last_revision, $post ) ) { 113 /** 114 * Filter whether the post has changed since the last revision. 115 * 116 * By default a revision is saved only if one of the revisioned fields has changed. 117 * This filter can override that so a revision is saved even if nothing has changed. 118 * 119 * @since 3.6.0 120 * 121 * @param bool $check_for_changes Whether to check for changes before saving a new revision. 122 * Default true. 123 * @param int $last_revision ID of the last revision. 124 * @param int $post Post ID. 125 * 126 */ 127 if ( isset( $last_revision ) && apply_filters( 'wp_save_post_revision_check_for_changes', $check_for_changes = true, $last_revision, $post ) ) { 103 128 $post_has_changed = false; 104 129 … … 238 263 return $revision_id; 239 264 240 if ( $revision_id ) 265 if ( $revision_id ) { 266 /** 267 * Fires once a revision has been saved. 268 * 269 * @since 2.6.0 270 * 271 * @param int $revision_id Post revision ID. 272 */ 241 273 do_action( '_wp_put_post_revision', $revision_id ); 274 } 242 275 243 276 return $revision_id; … … 284 317 * @uses wp_get_post_revision() 285 318 * @uses wp_update_post() 286 * @uses do_action() Calls 'wp_restore_post_revision' on post ID and revision ID if wp_update_post()287 * is successful.288 319 * 289 320 * @param int|object $revision_id Revision ID or revision object. … … 325 356 update_post_meta( $post_id, '_edit_last', get_current_user_id() ); 326 357 358 /** 359 * Fires after a post revision has been restored. 360 * 361 * @since 2.6.0 362 * 363 * @param int $post_id Post ID. 364 * @param int $revision_id Post revision ID. 365 */ 327 366 do_action( 'wp_restore_post_revision', $post_id, $revision['ID'] ); 328 367 … … 351 390 return $delete; 352 391 353 if ( $delete ) 392 if ( $delete ) { 393 /** 394 * Fires once a post revision has been deleted. 395 * 396 * @since 2.6.0 397 * 398 * @param int $revision_id Post revision ID. 399 * @param object|array $revision Post revision object or array. 400 */ 354 401 do_action( 'wp_delete_post_revision', $revision->ID, $revision ); 402 } 355 403 356 404 return $delete; … … 407 455 * 408 456 * @uses post_type_supports() 409 * @uses apply_filters() Calls 'wp_revisions_to_keep' hook on the number of revisions.410 457 * 411 458 * @param object $post The post object. … … 423 470 $num = 0; 424 471 472 /** 473 * Filter the number of revisions to save for the given post. 474 * 475 * Overrides the value of WP_POST_REVISIONS. 476 * 477 * @since 3.6.0 478 * 479 * @param int $num Number of revisions to store. 480 * @param WP_Post $post Post object. 481 */ 425 482 return (int) apply_filters( 'wp_revisions_to_keep', $num, $post ); 426 483 }
Note: See TracChangeset
for help on using the changeset viewer.