Changeset 23885
- Timestamp:
- 04/02/2013 07:39:48 PM (11 years ago)
- Location:
- trunk/wp-includes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/post-template.php
r23872 r23885 1425 1425 // Since 3.6 revisions include a copy of the current post data as a revision. 1426 1426 // The following removes that revision when $parent == false 1427 $parent_included = _wp_ last_revision_matches_current_post( $post_id );1427 $parent_included = _wp_get_post_revision_version( reset( $revisions ) ) > 0; 1428 1428 if ( $parent_included && ! $parent ) 1429 1429 array_shift( $revisions ); -
trunk/wp-includes/revision.php
r23867 r23885 659 659 660 660 /** 661 * Determines if the specified post's most recent revision matches the post (by checking post_modified).662 *663 * @package WordPress664 * @subpackage Post_Revisions665 * @since 3.6.0666 *667 * @param int|object $post Post ID or post object.668 * @return bool false if not a match, otherwise true.669 */670 function _wp_last_revision_matches_current_post( $post ) {671 if ( ! $post = get_post( $post ) )672 return false;673 674 if ( ! $revisions = wp_get_post_revisions( $post->ID ) )675 return false;676 677 foreach ( $revisions as $revision ) {678 if ( false !== strpos( $revision->post_name, "{$revision->post_parent}-revision" ) ) {679 $last_revision = $revision;680 break;681 }682 }683 684 // No revisions yet, only autosaves685 if ( ! isset( $last_revision ) )686 return false;687 688 $post_has_changed = false;689 if ( $last_revision->post_modified == $post->post_modified ) {690 foreach ( array_keys( _wp_post_revision_fields() ) as $field ) {691 if ( normalize_whitespace( $post->$field ) != normalize_whitespace( $last_revision->$field ) ) {692 $post_has_changed = true;693 break;694 }695 }696 } else {697 return false;698 }699 700 return ! $post_has_changed;701 }702 703 /**704 661 * Displays a human readable HTML representation of the difference between two strings. 705 662 * similar to wp_text_diff, but tracks and returns could of lines added and removed
Note: See TracChangeset
for help on using the changeset viewer.