Ticket #20564: 20564+16215.diff
File 20564+16215.diff, 24.3 KB (added by , 11 years ago) |
---|
-
wp-includes/default-filters.php
250 250 add_action( 'plugins_loaded', 'wp_maybe_load_widgets', 0 ); 251 251 add_action( 'plugins_loaded', 'wp_maybe_load_embeds', 0 ); 252 252 add_action( 'shutdown', 'wp_ob_end_flush_all', 1 ); 253 add_action( 'pre_post_update', 'wp_save_post_revision', 10, 2 ); 253 add_action( 'pre_post_update', '_wp_upgrade_revisions_of_post', 11, 1 ); 254 add_action( 'pre_post_update', 'wp_save_post_revision', 10, 1 ); 255 add_action( 'post_updated', 'wp_save_post_revision', 10, 1 ); 254 256 add_action( 'publish_post', '_publish_post_hook', 5, 1 ); 255 257 add_action( 'transition_post_status', '_transition_post_status', 5, 3 ); 256 258 add_action( 'transition_post_status', '_update_term_count_on_transition_post_status', 10, 3 ); -
wp-includes/post-template.php
1345 1345 if ( !in_array( $revision->post_type, array( 'post', 'page', 'revision' ) ) ) 1346 1346 return false; 1347 1347 1348 $author = get_the_ author_meta( 'display_name', $revision->post_author);1348 $author = get_the_corrected_modified_author( $revision->ID ); 1349 1349 /* translators: revision date format, see http://php.net/date */ 1350 1350 $datef = _x( 'j F, Y @ G:i:s', 'revision date format'); 1351 1351 1352 $gravatar = get_avatar( $ revision->post_author, 24 );1352 $gravatar = get_avatar( $author['modified_author_id'], 24 ); 1353 1353 1354 1354 $date = date_i18n( $datef, strtotime( $revision->post_modified ) ); 1355 1355 if ( $link && current_user_can( 'edit_post', $revision->ID ) && $link = get_edit_post_link( $revision->ID ) ) … … 1359 1359 /* translators: post revision title: 1: author avatar, 2: author name, 3: time ago, 4: date */ 1360 1360 _x( '%1$s %2$s, %3$s ago (%4$s)', 'post revision title' ), 1361 1361 $gravatar, 1362 $author ,1362 $author['modified_author_display_name'], 1363 1363 human_time_diff( strtotime( $revision->post_modified ), current_time( 'timestamp' ) ), 1364 1364 $date 1365 1365 ); … … 1455 1455 1456 1456 } 1457 1457 1458 if ( 'form-table' == $format ) : ?>1459 1460 <form action="revision.php" method="get">1461 1462 <div class="tablenav">1463 <div class="alignleft">1464 <input type="submit" class="button-secondary" value="<?php esc_attr_e( 'Compare Revisions' ); ?>" />1465 <input type="hidden" name="action" value="diff" />1466 <input type="hidden" name="post_type" value="<?php echo esc_attr($post->post_type); ?>" />1467 </div>1468 </div>1469 1470 <br class="clear" />1471 1472 <table class="widefat post-revisions" cellspacing="0" id="post-revisions">1473 <col />1474 <col />1475 <col style="width: 33%" />1476 <col style="width: 33%" />1477 <col style="width: 33%" />1478 <thead>1479 <tr>1480 <th scope="col"><?php /* translators: column name in revisions */ _ex( 'Old', 'revisions column name' ); ?></th>1481 <th scope="col"><?php /* translators: column name in revisions */ _ex( 'New', 'revisions column name' ); ?></th>1482 <th scope="col"><?php /* translators: column name in revisions */ _ex( 'Date Created', 'revisions column name' ); ?></th>1483 <th scope="col"><?php _e( 'Author' ); ?></th>1484 <th scope="col" class="action-links"><?php _e( 'Actions' ); ?></th>1485 </tr>1486 </thead>1487 <tbody>1488 1489 <?php echo $rows; ?>1490 1491 </tbody>1492 </table>1493 1494 </form>1495 1496 <?php1497 else :1498 1458 echo "<ul class='post-revisions'>\n"; 1499 1459 echo $rows; 1500 1460 … … 1524 1484 echo "</ul>"; 1525 1485 } 1526 1486 1527 endif;1528 1529 1487 } -
wp-includes/post.php
1734 1734 * @return bool False on failure, true if success. 1735 1735 */ 1736 1736 function update_post_meta($post_id, $meta_key, $meta_value, $prev_value = '') { 1737 // make sure meta is added to the post, not a revision 1738 if ( $the_post = wp_is_post_revision($post_id) ) 1739 $post_id = $the_post; 1737 if ( ! apply_filters( 'wp_revisions_keep_meta', true ) ) { 1738 // make sure meta is added to the post, not a revision 1739 if ( $the_post = wp_is_post_revision($post_id) ) 1740 $post_id = $the_post; 1741 } 1740 1742 1741 1743 return update_metadata('post', $post_id, $meta_key, $meta_value, $prev_value); 1742 1744 } … … 1768 1770 */ 1769 1771 function get_post_custom( $post_id = 0 ) { 1770 1772 $post_id = absint( $post_id ); 1771 if ( ! $post_id ) 1772 $post_id = get_the_ID(); 1773 if ( ! apply_filters( 'wp_revisions_keep_meta', true ) ) { 1774 if ( ! $post_id ) 1775 $post_id = get_the_ID(); 1776 } 1773 1777 1774 1778 return get_post_meta( $post_id ); 1775 1779 } … … 2822 2826 $wpdb->update( $wpdb->posts, array( 'post_name' => $data['post_name'] ), $where ); 2823 2827 } 2824 2828 2829 if ( 'revision' !== $post_type ) 2830 update_post_meta( $post_ID, '_edit_last', $user_ID ); 2831 2825 2832 if ( is_object_in_taxonomy($post_type, 'category') ) 2826 2833 wp_set_post_categories( $post_ID, $post_category ); 2827 2834 -
wp-includes/revision.php
52 52 $return['post_parent'] = $post['ID']; 53 53 $return['post_status'] = 'inherit'; 54 54 $return['post_type'] = 'revision'; 55 $return['post_name'] = $autosave ? "$post[ID]- autosave" : "$post[ID]-revision";55 $return['post_name'] = $autosave ? "$post[ID]-1-autosave" : "$post[ID]-1-revision"; // "1" is the revisioning system version 56 56 $return['post_date'] = isset($post['post_modified']) ? $post['post_modified'] : ''; 57 57 $return['post_date_gmt'] = isset($post['post_modified_gmt']) ? $post['post_modified_gmt'] : ''; 58 $return['post_author'] = get_post_meta( $post['ID'], '_edit_last', true ); 58 59 59 60 return $return; 60 61 } 61 62 62 63 /** 64 * Saves post meta as part of a revision. 65 * 66 * Called immedately after revision restore, with wp_restore_post_revision hook 67 * 68 * @package WordPress 69 * @subpackage Post_Revisions 70 * @since 3.6.0 71 * 72 * 73 * @param int $post_id The ID of the post saved as a revision. 74 * @param int $revision_id The ID of the revision. 75 * @return false error, true if success. 76 */ 77 function wp_restore_post_revision_meta( $post_id, $revision_id ) { 78 if ( ! apply_filters( 'wp_revisions_keep_meta', true ) ) 79 return false; 80 81 //revision the post format 82 $format = get_post_meta( $revision_id, '_revisioned_post_format', true); 83 if ( '' !== $format ) { 84 set_post_format( $post_id, $format ); 85 error_log('restoring ' . $format ); 86 error_log('from ' . $revision_id); 87 88 } 89 90 $current_meta = get_post_meta( $revision_id ); 91 if ( is_array( $current_meta ) ) { 92 foreach ( $current_meta as $meta_key => $meta_value ) { 93 update_post_meta( $post_id, $meta_key, $meta_value[0] ); 94 } 95 } 96 return true; 97 98 } 99 100 /** 101 * Saves post meta as part of a revision. 102 * 103 * Called immedately after revision storage 104 * 105 * @package WordPress 106 * @subpackage Post_Revisions 107 * @since 3.6.0 108 * 109 * 110 * @param int $post_id The ID of the post saved as a revision. 111 * @param int $revision_id The ID of the revision. 112 * @return false error, true if success. 113 */ 114 function wp_save_post_revision_meta( $post_id, $revision_id ) { 115 // hook for 'wp_revisions_keep_meta', return false to disable revisioning for post met 116 if ( ! apply_filters( 'wp_revisions_keep_meta', true ) ) 117 return false; 118 119 if ( ! wp_first_revision_matches_current_version( $post_id ) ) 120 return false; 121 122 // list of post meta that should be excluded from revisioning 123 // filter 'revision_meta_do_not_copy' to allow exclusion of specific meta from revisioning 124 $exclude_meta_keys = apply_filters( 'revision_meta_do_not_copy', array( 125 '_encloseme', 126 '_pingme', 127 '_edit_last', 128 '_edit_lock', 129 '_revisioned_post_format', 130 ) ); 131 132 //revision the post format 133 if ( '' !== get_post_format( $post_id ) ) 134 update_post_meta( $revision_id, '_revisioned_post_format', get_post_format( $post_id ) ); 135 136 error_log('storing ' . get_post_format( $post_id ) ); 137 error_log('on ' . $revision_id); 138 139 $current_meta = get_post_meta( $post_id ); 140 141 if ( is_array( $current_meta ) ) { 142 foreach ( $current_meta as $meta_key => $meta_value ) { 143 if ( in_array( $meta_key, $exclude_meta_keys ) ) 144 continue; 145 146 update_post_meta( $revision_id, $meta_key, $meta_value[0]); 147 } 148 149 } 150 return true; 151 } 152 153 /** 63 154 * Saves an already existing post as a post revision. 64 155 * 65 * Typically used immediately prior to post updates. 156 * Typically used immediately prior and after post updates. 157 * Prior to update checks for old revision data (latest revision != current post before update) and adds a copy of the current post as a revision if missing 158 * After update adds a copy of the current post as a revision, so latest revision always matches current post 66 159 * 67 160 * @package WordPress 68 161 * @subpackage Post_Revisions 69 162 * @since 2.6.0 70 163 * 71 164 * @uses _wp_put_post_revision() 165 * @uses wp_first_revision_matches_current_version() 72 166 * 73 167 * @param int $post_id The ID of the post to save as a revision. 74 168 * @return mixed Null or 0 if error, new revision ID, if success. 75 169 */ 76 function wp_save_post_revision( $post_id, $new_data = null ) { 77 // We do autosaves manually with wp_create_post_autosave() 170 function wp_save_post_revision( $post_id ) { 171 //check to see if the post's first revision already matches the post data 172 //should be true before post update, _except_ for old data which 173 //doesn't include a copy of the current post data in revisions 174 if ( wp_first_revision_matches_current_version( $post_id ) ) 175 return; 176 78 177 if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) 79 178 return; 80 179 … … 82 181 if ( ! WP_POST_REVISIONS ) 83 182 return; 84 183 85 if ( ! $post = get_post( $post_id, ARRAY_A ) )184 if ( ! $post = get_post( $post_id, ARRAY_A ) ) 86 185 return; 87 186 88 187 if ( 'auto-draft' == $post['post_status'] ) 89 188 return; 90 189 91 if ( ! post_type_supports($post['post_type'], 'revisions') )190 if ( ! post_type_supports( $post['post_type'], 'revisions' ) ) 92 191 return; 93 192 94 // if new data is supplied, check that it is different from last saved revision, unless a plugin tells us to always save regardless 95 if ( apply_filters( 'wp_save_post_revision_check_for_changes', true, $post, $new_data ) && is_array( $new_data ) ) { 96 $post_has_changed = false; 97 foreach ( array_keys( _wp_post_revision_fields() ) as $field ) { 98 if ( normalize_whitespace( $new_data[ $field ] ) != normalize_whitespace( $post[ $field ] ) ) { 99 $post_has_changed = true; 100 break; 193 // compare the proposed update with the last stored revision, verify 194 // different, unless a plugin tells us to always save regardless 195 if ( $revisions = wp_get_post_revisions( $post_id ) ) { // grab the last revision 196 $last_revision = array_shift( $revisions ); 197 198 if ( $last_revision_array = get_post( $last_revision->ID, ARRAY_A ) ) { //if no previous revisions, save one for sure 199 200 if ( apply_filters( 'wp_save_post_revision_check_for_changes', true, $last_revision_array, $post ) && is_array( $post ) ) { 201 $post_has_changed = false; 202 203 foreach ( array_keys( _wp_post_revision_fields() ) as $field ) { 204 205 if ( normalize_whitespace( $post[ $field ] ) != normalize_whitespace( $last_revision_array[ $field ] ) ) { 206 $post_has_changed = true; 207 break; 208 209 } 210 } 211 212 //don't save revision if post unchanged 213 if( ! $post_has_changed ) 214 return; 101 215 } 102 216 } 103 //don't save revision if post unchanged104 if( ! $post_has_changed )105 return;106 217 } 107 218 108 219 $return = _wp_put_post_revision( $post ); 109 220 110 221 // WP_POST_REVISIONS = true (default), -1 111 if ( ! is_numeric( WP_POST_REVISIONS ) || WP_POST_REVISIONS < 0 )222 if ( ! is_numeric( WP_POST_REVISIONS ) || WP_POST_REVISIONS < 0 ) 112 223 return $return; 113 224 114 225 // all revisions and (possibly) one autosave 115 226 $revisions = wp_get_post_revisions( $post_id, array( 'order' => 'ASC' ) ); 116 227 117 228 // WP_POST_REVISIONS = (int) (# of autosaves to save) 118 $delete = count( $revisions) - WP_POST_REVISIONS;229 $delete = count( $revisions ) - WP_POST_REVISIONS; 119 230 120 231 if ( $delete < 1 ) 121 232 return $return; … … 123 234 $revisions = array_slice( $revisions, 0, $delete ); 124 235 125 236 for ( $i = 0; isset($revisions[$i]); $i++ ) { 126 if ( false !== strpos( $revisions[ $i]->post_name, 'autosave' ) )237 if ( false !== strpos( $revisions[ $i ]->post_name, 'autosave' ) ) 127 238 continue; 128 wp_delete_post_revision( $revisions[ $i]->ID );239 wp_delete_post_revision( $revisions[ $i ]->ID ); 129 240 } 130 241 131 242 return $return; … … 142 253 * @subpackage Post_Revisions 143 254 * @since 2.6.0 144 255 * @uses wp_get_post_revisions() 145 * 256 * 146 257 * @param int $post_id The post ID. 147 258 * @param int $user_id optional The post author ID. 148 259 * @return object|bool The autosaved data or false on failure or when no autosave exists. … … 201 312 } 202 313 203 314 /** 204 * Inserts post data into the posts table as a post revision. 315 * Inserts post data into the posts table as a post revision. Since 3.6 also stores post meta. 205 316 * 206 317 * @package WordPress 207 318 * @subpackage Post_Revisions 208 319 * @since 2.6.0 209 320 * 210 321 * @uses wp_insert_post() 322 * @uses wp_save_post_revision_meta() 211 323 * 212 324 * @param int|object|array $post Post ID, post object OR post array. 213 325 * @param bool $autosave Optional. Is the revision an autosave? … … 222 334 if ( !$post || empty($post['ID']) ) 223 335 return; 224 336 337 $post_id = $post['ID']; 338 225 339 if ( isset($post['post_type']) && 'revision' == $post['post_type'] ) 226 340 return new WP_Error( 'post_type', __( 'Cannot create a revision of a revision' ) ); 227 341 … … 229 343 $post = wp_slash($post); //since data is from db 230 344 231 345 $revision_id = wp_insert_post( $post ); 346 if ( wp_first_revision_matches_current_version( $post_id ) ) 347 wp_save_post_revision_meta($post_id, $revision_id ); 348 232 349 if ( is_wp_error($revision_id) ) 233 350 return $revision_id; 234 351 … … 393 510 return $post; 394 511 } 395 512 513 function _wp_get_post_revision_version( $post ) { 514 if ( is_array( $post ) ) { 515 if ( ! isset( $post['post_name'] ) ) { 516 return false; 517 } 518 519 $name = $post['post_name']; 520 } elseif ( is_object( $post ) ) { 521 if ( ! isset( $post->post_name ) ) { 522 return false; 523 } 524 525 $name = $post->post_name; 526 } else { 527 return false; 528 } 529 530 if ( ! preg_match( '/^([\d-]+)(?:autosave|revision)(?:-\d+)*$/', $name, $matches ) ) { 531 return false; 532 } 533 534 $parts = explode( '-', trim( $matches[1], '-' ) ); 535 536 if ( 2 !== count( $parts ) ) { 537 return 0; 538 } 539 540 return (int) $parts[1]; 541 } 542 543 /** 544 * Upgrade the data 545 * 546 * @package WordPress 547 * @subpackage Post_Revisions 548 * @since 3.6.0 549 * 550 * @uses get_post() 551 * @uses post_type_supports() 552 * @uses wp_get_post_revisions() 553 * 554 * @param int|object $post_id Post ID or post object 555 * @return true if success, false if problems 556 */ 557 function _wp_upgrade_revisions_of_post( $post ) { 558 global $wpdb; 559 560 $post = get_post( $post ); 561 if ( ! $post ) 562 return false; 563 564 if ( ! post_type_supports( $post->post_type, 'revisions' ) ) 565 return false; 566 567 $revisions = wp_get_post_revisions( $post->ID ); // array( 'order' => 'DESC', 'orderby' => 'date' ); // Always work from most recent to oldest 568 569 if ( ! $revisions ) 570 return true; 571 572 // Add post option exclusively 573 $lock = "revision-upgrade-{$post->ID}"; 574 $locked_at = time(); 575 $result = $wpdb->query( $wpdb->prepare( "INSERT IGNORE INTO `$wpdb->options` (`option_name`, `option_value`, `autoload`) VALUES (%s, %s, 'no') /* LOCK */", $lock, $locked_at ) ); 576 if ( ! $result ) { 577 // If we couldn't get a lock, see how old the previous lock is 578 $locked_at = get_option( $lock ); 579 if ( !$locked_at ) { 580 // Can't write to the lock, and can't read the lock. 581 // Something broken has happened 582 return false; 583 } 584 585 if ( $lock_at < time() - 3600 ) { 586 // Lock is too old - try again 587 delete_option( $lock ); 588 return wp_upgrade_revisions_of_post( $post ); 589 } 590 591 // Lock is not too old: some other process may be upgrading this post. Bail. 592 return; 593 } else { 594 // If we could get a lock, re-"add" the option to fire all the correct filters. 595 add_option( $lock, $locked_at ); 596 } 597 598 $success = true; 599 600 reset( $revisions ); 601 do { 602 $this_revision = current( $revisions ); 603 $prev_revision = next( $revisions ); 604 605 $this_revision_version = _wp_get_post_revision_version( $this_revision ); 606 607 // Something terrible happened 608 if ( false === $this_revision_version ) 609 continue; 610 611 // 1 is the latest revision version, so we're already up to date 612 if ( 0 < $this_revision_version ) 613 continue; 614 615 // This revision is the oldest revision of the post. 616 // The correct post_author is probably $post->post_author, but that's only a good guess. 617 // Leave un-upgraded. Will be caught by get_modified_post_author() on display. 618 if ( ! $prev_revision ) { 619 continue; 620 } 621 622 $prev_revision_version = _wp_get_post_revision_version( $prev_revision ); 623 624 // If the previous revision is already up to date, it no longer has the information we need :( 625 if ( 0 < $prev_revision_version ) { 626 continue; 627 } 628 629 // Upgrade this revision 630 631 // Cast as object so that wp_update_post() handles slashing for us 632 $update = (object) array( 633 'ID' => $this_revision->ID, 634 'post_name' => preg_replace( '/^(\d+)(?:-0)?-/', '\\1-1-', $this_revision->post_name ), 635 'post_author' => $prev_revision->post_author, 636 ); 637 638 $result = wp_update_post( $update ); 639 if ( ! $result || is_wp_error( $result ) ) { 640 // Wilhelm! 641 $success = false; 642 break; 643 } 644 } while ( $prev_revision ); 645 646 delete_option( $lock ); 647 return true; 648 } 649 650 396 651 function _show_post_preview() { 397 652 398 653 if ( isset($_GET['preview_id']) && isset($_GET['preview_nonce']) ) { -
wp-includes/author-template.php
76 76 } 77 77 78 78 /** 79 * Retrieve the author who last edited the current post. 80 * 81 * As of WordPress 3.6, returns the corrected display name and ID of the user who created the revision if called on a revision object. 82 * 83 * @since 3.6 84 * @uses get_post_meta() Retrieves the ID of the author who last edited the current post. 85 * @uses get_userdata() Retrieves the author's DB object. 86 * @uses apply_filters() Calls 'the_modified_author' hook on the author display name. 87 * 88 * @param mixed $post_id Post ID, WP_Post, or falsey to use the current post. 89 * @return array modified_author_display_name => The author's display name, modified_author_id => The author's user ID; empty if problems 90 */ 91 function get_the_corrected_modified_author( $post_id = 0 ) { 92 93 if ( ! $post = get_post( $post_id ) ) 94 return; 95 96 $unknown = false; 97 98 if ( 'revision' === $post->post_type ) { 99 // _wp_get_post_revision_version() can return false 100 $revision_version = _wp_get_post_revision_version( $post ); 101 if ( false === $revision_version ) { 102 // False means something horrible happened. Just return something. 103 $modified_author_id = $post->post_author; 104 } elseif ( 0 === $revision_version ) { 105 // Set as fallback 106 $modified_author_id = $post->post_author; 107 108 $revisions = wp_get_post_revisions( $post->post_parent ); 109 reset( $revisions ); 110 do { 111 $this_revision = current( $revisions ); 112 $prev_revision = next( $revisions ); // Ordered DESC 113 114 if ( $post->ID == $this_revision->ID && $prev_revision ) { 115 $prev_revision_version = _wp_get_post_revision_version( $prev_revision ); 116 if ( 0 === $prev_revision_version ) { 117 $modified_author_id = $prev_revision->post_author; 118 } else { 119 $unknown = true; 120 } 121 break; 122 } 123 } while ( $prev_revision ); 124 } else { 125 // Everything is up to date 126 $modified_author_id = $post->post_author; 127 } 128 } else { 129 $modified_author_id = get_post_meta( $post->ID, '_edit_last', true ); 130 } 131 132 if ( ! $modified_author_id ) 133 return; 134 135 $modified_author = get_userdata( $modified_author_id ); 136 137 $display_name = $modified_author->display_name; 138 if ( $unknown ) { 139 $display_name = sprintf( _x( '%1$s?', 'Unknown revision author name: %1$s = display_name of best guess at author' ), $display_name ); 140 } 141 142 $toreturn = array ( 143 'modified_author_display_name' => apply_filters( 'the_modified_author', $display_name ), 144 'modified_author_id' => $modified_author_id, 145 ); 146 147 return $toreturn; 148 } 149 150 151 152 /** 79 153 * Display the name of the author who last edited the current post. 80 154 * 81 155 * @since 2.8 -
wp-admin/includes/ajax-actions.php
2214 2214 } 2215 2215 2216 2216 if ( $compare_two_mode ) { 2217 $compare_to_ gravatar = get_avatar( $left_revision->post_author, 24);2218 $compare_to_ author = get_the_author_meta( 'display_name', $left_revision->post_author);2217 $compare_to_author = get_the_corrected_modified_author( $left_revision->ID ); 2218 $compare_to_gravatar = get_avatar( $compare_to_author['modified_author_id'], 24 ); 2219 2219 $compare_to_date = date_i18n( $datef, strtotime( $left_revision->post_modified ) ); 2220 2220 2221 2221 $revision_from_date_author = sprintf( 2222 2222 /* translators: post revision title: 1: author avatar, 2: author name, 3: time ago, 4: date */ 2223 2223 _x( '%1$s %2$s, %3$s ago (%4$s)', 'post revision title' ), 2224 2224 $compare_to_gravatar, 2225 $compare_to_author ,2225 $compare_to_author['modified_author_display_name'], 2226 2226 human_time_diff( strtotime( $left_revision->post_modified ), current_time( 'timestamp' ) ), 2227 2227 $compare_to_date 2228 2228 ); 2229 2229 } 2230 2230 2231 $ gravatar = get_avatar( $revision->post_author, 24);2232 $ author = get_the_author_meta( 'display_name', $revision->post_author);2231 $author = $author = get_the_corrected_modified_author( $revision->ID ); 2232 $gravatar = get_avatar( $author['modified_author_id'], 24 ); 2233 2233 $date = date_i18n( $datef, strtotime( $revision->post_modified ) ); 2234 2234 $revision_date_author = sprintf( 2235 2235 /* translators: post revision title: 1: author avatar, 2: author name, 3: time ago, 4: date */ 2236 2236 _x( '%1$s %2$s, %3$s ago (%4$s)', 'post revision title' ), 2237 2237 $gravatar, 2238 $author ,2238 $author['modified_author_display_name'], 2239 2239 human_time_diff( strtotime( $revision->post_modified ), current_time( 'timestamp' ) ), 2240 2240 $date 2241 2241 ); … … 2262 2262 $revision_date_author_short = sprintf( 2263 2263 '%s <strong>%s</strong><br />%s', 2264 2264 $gravatar, 2265 $author ,2265 $author['modified_author_display_name'], 2266 2266 $date_short 2267 2267 ); 2268 2268 -
wp-admin/includes/post.php
249 249 250 250 add_meta( $post_ID ); 251 251 252 update_post_meta( $post_ID, '_edit_last', $GLOBALS['current_user']->ID );253 254 252 wp_update_post( $post_data ); 255 253 256 254 // Now that we have an ID we can fix any attachment anchor hrefs … … 565 563 566 564 add_meta( $post_ID ); 567 565 568 add_post_meta( $post_ID, '_edit_last', $GLOBALS['current_user']->ID );569 570 566 // Now that we have an ID we can fix any attachment anchor hrefs 571 567 _fix_attachment_links( $post_ID ); 572 568 -
wp-admin/js/revisions.js
479 479 ( REVAPP._right_diff >= REVAPP._revisions.length ) ? '' : REVAPP._revisions.at( REVAPP._right_diff ).get( 'revision_date_author_short' ) ); 480 480 } else { 481 481 REVAPP.addTooltip ( $( 'a.ui-slider-handle' ), 482 ( REVAPP._right_diff > = REVAPP._revisions.length ) ? '' : REVAPP._revisions.at( REVAPP._right_diff).get( 'revision_date_author_short' ) );482 ( REVAPP._right_diff > REVAPP._revisions.length ) ? '' : REVAPP._revisions.at( REVAPP._right_diff - 1 ).get( 'revision_date_author_short' ) ); 483 483 } 484 484 485 485 // -
wp-admin/revision.php
21 21 if ( ! current_user_can( 'edit_post', $revision->post_parent ) ) 22 22 break; 23 23 24 25 24 if ( ! $post = get_post( $revision->post_parent ) ) 26 25 break; 27 26 … … 33 32 34 33 check_admin_referer( "restore-post_{$revision->ID}" ); 35 34 35 wp_restore_post_revision_meta( $post->ID, $revision->ID ); 36 36 wp_restore_post_revision( $revision->ID ); 37 37 $redirect = add_query_arg( array( 'message' => 5, 'revision' => $revision->ID ), get_edit_post_link( $post->ID, 'url' ) ); 38 38 break;