Make WordPress Core


Ignore:
Timestamp:
07/24/2013 06:08:14 AM (11 years ago)
Author:
nacin
Message:

Revisions changes.

  • Eliminates the bloated Revisions meta box in favor of 'Revisions: #' in the publish box.
  • Adds ability to compare autosave to current post, when revisions are disabled.
  • Makes autosaves stand out visually, including "Restore This Autosave".

Also:

  • Adds missing capability check for restoring a revision.
  • When no revision matches the post's current modified time, avoid marking an autosave as 'current'.
  • Fixes wp_get_post_autosave() to return an autosave even when revisions are disabled.
  • Add 'check_enabled' arg to wp_get_post_revisions(); false avoids the wp_revisions_enabled() check.
  • Adds a responsive slider that is narrower for fewer versions. props markjaquith.

see #24804.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/meta-boxes.php

    r24522 r24790  
    1010 * @param object $post
    1111 */
    12 function post_submit_meta_box($post) {
     12function post_submit_meta_box($post, $args = array() ) {
    1313    global $action;
    1414
     
    171171    $date = date_i18n( $datef, strtotime( current_time('mysql') ) );
    172172}
     173
     174if ( ! empty( $args['args']['revisions_count'] ) ) :
     175    $revisions_to_keep = wp_revisions_to_keep( $post );
     176?>
     177<div class="misc-pub-section num-revisions">
     178<?php
     179    if ( $revisions_to_keep > 0 && $revisions_to_keep <= $args['args']['revisions_count'] ) {
     180        echo '<span title="' . esc_attr( sprintf( __( 'Your site is configured to keep only the last %s revisions.' ),
     181            number_format_i18n( $revisions_to_keep ) ) ) . '">';
     182        printf( __( 'Revisions: %s' ), '<b>' . number_format_i18n( $args['args']['revisions_count'] ) . '+</b>' );
     183        echo '</span>';
     184    } else {
     185        printf( 'Revisions: %s', '<b>' . number_format_i18n( $args['args']['revisions_count'] ) . '</b>' );
     186    }
     187?>
     188    <a class="hide-if-no-js" href="<?php echo esc_url( get_edit_post_link( $args['args']['revision_id'] ) ); ?>"><?php _ex( 'Browse', 'revisions' ); ?></a>
     189</div>
     190<?php endif;
    173191
    174192if ( $can_publish ) : // Contributors don't get to choose the date of publish ?>
Note: See TracChangeset for help on using the changeset viewer.