Ticket #13382: 13382.diff
File 13382.diff, 4.5 KB (added by , 9 years ago) |
---|
-
wp-admin/edit-form-advanced.php
178 178 179 179 // Detect if there exists an autosave newer than the post and if that autosave is different than the post 180 180 if ( $autosave && mysql2date( 'U', $autosave->post_modified_gmt, false ) > mysql2date( 'U', $post->post_modified_gmt, false ) ) { 181 foreach ( _wp_post_revision_fields( ) as $autosave_field => $_autosave_field ) {181 foreach ( _wp_post_revision_fields( $post ) as $autosave_field => $_autosave_field ) { 182 182 if ( normalize_whitespace( $autosave->$autosave_field ) != normalize_whitespace( $post->$autosave_field ) ) { 183 183 $notice = sprintf( __( 'There is an autosave of this post that is more recent than the version below. <a href="%s">View the autosave</a>' ), get_edit_post_link( $autosave->ID ) ); 184 184 break; -
wp-admin/includes/post.php
1642 1642 // If the new autosave has the same content as the post, delete the autosave. 1643 1643 $post = get_post( $post_id ); 1644 1644 $autosave_is_different = false; 1645 foreach ( array_intersect( array_keys( $new_autosave ), array_keys( _wp_post_revision_fields( ) ) ) as $field ) {1645 foreach ( array_intersect( array_keys( $new_autosave ), array_keys( _wp_post_revision_fields( $post ) ) ) as $field ) { 1646 1646 if ( normalize_whitespace( $new_autosave[ $field ] ) != normalize_whitespace( $post->$field ) ) { 1647 1647 $autosave_is_different = true; 1648 1648 break; -
wp-admin/includes/revision.php
54 54 55 55 $return = array(); 56 56 57 foreach ( _wp_post_revision_fields( ) as $field => $name ) {57 foreach ( _wp_post_revision_fields( $post ) as $field => $name ) { 58 58 /** 59 59 * Contextually filter a post revision field. 60 60 * -
wp-includes/revision.php
18 18 * 19 19 * @staticvar array $fields 20 20 * 21 * @param array $post Optional. A post arrayto be processed for insertion as a post revision.22 * @param bool $autosave Optional. Is the revision an autosave?21 * @param array|object $post Optional. A post array, or a WP_Post Object to be processed for insertion as a post revision. 22 * @param bool $autosave Optional. Is the revision an autosave? 23 23 * @return array Post array ready to be inserted as a post revision or array of fields that can be versioned. 24 24 */ 25 25 function _wp_post_revision_fields( $post = null, $autosave = false ) { 26 26 static $fields = null; 27 27 28 if ( is_object( $post ) ) { 29 $post = get_post( $post, ARRAY_A ); 30 } 31 28 32 if ( is_null( $fields ) ) { 29 33 // Allow these to be versioned 30 34 $fields = array( … … 46 50 * 47 51 * @param array $fields List of fields to revision. Contains 'post_title', 48 52 * 'post_content', and 'post_excerpt' by default. 53 * @param array $post A post array being processed for insertion as a post revision. 49 54 */ 50 $fields = apply_filters( '_wp_post_revision_fields', $fields );55 $fields = apply_filters( '_wp_post_revision_fields', $fields, $post ); 51 56 52 57 // WP uses these internally either in versioning or elsewhere - they cannot be versioned 53 58 foreach ( array( 'ID', 'post_name', 'post_parent', 'post_date', 'post_date_gmt', 'post_status', 'post_type', 'comment_count', 'post_author' ) as $protect ) … … 127 132 if ( isset( $last_revision ) && apply_filters( 'wp_save_post_revision_check_for_changes', $check_for_changes = true, $last_revision, $post ) ) { 128 133 $post_has_changed = false; 129 134 130 foreach ( array_keys( _wp_post_revision_fields( ) ) as $field ) {135 foreach ( array_keys( _wp_post_revision_fields( $post ) ) as $field ) { 131 136 if ( normalize_whitespace( $post->$field ) != normalize_whitespace( $last_revision->$field ) ) { 132 137 $post_has_changed = true; 133 138 break; … … 333 338 return $revision; 334 339 335 340 if ( !is_array( $fields ) ) 336 $fields = array_keys( _wp_post_revision_fields( ) );341 $fields = array_keys( _wp_post_revision_fields( $revision ) ); 337 342 338 343 $update = array(); 339 344 foreach ( array_intersect( array_keys( $revision ), $fields ) as $field ) {