Make WordPress Core


Ignore:
Timestamp:
03/07/2013 03:32:26 PM (12 years ago)
Author:
westi
Message:

Revisions: Updates to the new Revisions UI.

Various Updates including:

  • i18n fixes
  • Added tracking of what revision ID was restored
  • async fetching of diffs so that slider works sooner even with many revisions

See #23497 props adamsilverstein, ethitter

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/post-template.php

    r23594 r23639  
    14691469        echo "<ul class='post-revisions'>\n";
    14701470        echo $rows;
     1471
     1472        //
     1473        // if the post was previously restored from a revision
     1474        // show the restore event details
     1475        //
     1476        if ( $restored_from_meta = get_post_meta( $post->ID, '_post_restored_from', true ) ) {
     1477            $author = get_the_author_meta( 'display_name', $restored_from_meta[ 'restored_by_user' ] );
     1478            /* translators: revision date format, see http://php.net/date */
     1479            $datef = _x( 'j F, Y @ G:i:s', 'revision date format');
     1480            $date = date_i18n( $datef, strtotime( $restored_from_meta[ 'restored_time' ] ) );
     1481            $timesince = human_time_diff( $restored_from_meta[ 'restored_time' ], current_time( 'timestamp' ) ) . __( ' ago ' );
     1482            ?>
     1483            <hr />
     1484            <div id="revisions-meta-restored">
     1485                <?php
     1486                printf( 'Previously restored from Revision ID %d, %s by %s (%s)',
     1487                $restored_from_meta[ 'restored_revision_id'],
     1488                $timesince,
     1489                $author,
     1490                $date );
     1491                ?>
     1492            </div>
     1493            <?php
    14711494        echo "</ul>";
     1495        }
     1496
    14721497    endif;
    14731498
Note: See TracChangeset for help on using the changeset viewer.