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.



git-svn-id: https://develop.svn.wordpress.org/trunk@24790 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin
2013-07-24 06:08:14 +00:00
parent 2b63b67768
commit 5ca8aa7447
8 changed files with 140 additions and 49 deletions
+19 -1
View File
@@ -9,7 +9,7 @@
*
* @param object $post
*/
function post_submit_meta_box($post) {
function post_submit_meta_box($post, $args = array() ) {
global $action;
$post_type = $post->post_type;
@@ -171,6 +171,24 @@ if ( 0 != $post->ID ) {
$date = date_i18n( $datef, strtotime( current_time('mysql') ) );
}
if ( ! empty( $args['args']['revisions_count'] ) ) :
$revisions_to_keep = wp_revisions_to_keep( $post );
?>
<div class="misc-pub-section num-revisions">
<?php
if ( $revisions_to_keep > 0 && $revisions_to_keep <= $args['args']['revisions_count'] ) {
echo '<span title="' . esc_attr( sprintf( __( 'Your site is configured to keep only the last %s revisions.' ),
number_format_i18n( $revisions_to_keep ) ) ) . '">';
printf( __( 'Revisions: %s' ), '<b>' . number_format_i18n( $args['args']['revisions_count'] ) . '+</b>' );
echo '</span>';
} else {
printf( 'Revisions: %s', '<b>' . number_format_i18n( $args['args']['revisions_count'] ) . '</b>' );
}
?>
<a class="hide-if-no-js" href="<?php echo esc_url( get_edit_post_link( $args['args']['revision_id'] ) ); ?>"><?php _ex( 'Browse', 'revisions' ); ?></a>
</div>
<?php endif;
if ( $can_publish ) : // Contributors don't get to choose the date of publish ?>
<div class="misc-pub-section curtime">
<span id="timestamp">