mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-12 12:50:28 +00:00
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:
@@ -109,13 +109,30 @@ $post_type_object = get_post_type_object($post_type);
|
||||
// All meta boxes should be defined and added before the first do_meta_boxes() call (or potentially during the do_meta_boxes action).
|
||||
require_once('./includes/meta-boxes.php');
|
||||
|
||||
|
||||
$publish_callback_args = null;
|
||||
if ( post_type_supports($post_type, 'revisions') && 'auto-draft' != $post->post_status ) {
|
||||
$revisions = wp_get_post_revisions( $post_ID );
|
||||
|
||||
// Check if the revisions have been upgraded
|
||||
if ( ! empty( $revisions ) && _wp_get_post_revision_version( end( $revisions ) ) < 1 )
|
||||
_wp_upgrade_revisions_of_post( $post, $revisions );
|
||||
|
||||
// We should aim to show the revisions metabox only when there are revisions.
|
||||
if ( count( $revisions ) > 1 ) {
|
||||
reset( $revisions ); // Reset pointer for key()
|
||||
$publish_callback_args = array( 'revisions_count' => count( $revisions ), 'revision_id' => key( $revisions ) );
|
||||
// add_meta_box('revisionsdiv', __('Revisions'), 'post_revisions_meta_box', null, 'normal', 'core');
|
||||
}
|
||||
}
|
||||
|
||||
if ( 'attachment' == $post_type ) {
|
||||
wp_enqueue_script( 'image-edit' );
|
||||
wp_enqueue_style( 'imgareaselect' );
|
||||
add_meta_box( 'submitdiv', __('Save'), 'attachment_submit_meta_box', null, 'side', 'core' );
|
||||
add_action( 'edit_form_after_title', 'edit_form_image_editor' );
|
||||
} else {
|
||||
add_meta_box( 'submitdiv', __( 'Publish' ), 'post_submit_meta_box', null, 'side', 'core' );
|
||||
add_meta_box( 'submitdiv', __( 'Publish' ), 'post_submit_meta_box', null, 'side', 'core', $publish_callback_args );
|
||||
}
|
||||
|
||||
if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post_type, 'post-formats' ) )
|
||||
@@ -172,18 +189,6 @@ if ( post_type_supports($post_type, 'author') ) {
|
||||
add_meta_box('authordiv', __('Author'), 'post_author_meta_box', null, 'normal', 'core');
|
||||
}
|
||||
|
||||
if ( post_type_supports($post_type, 'revisions') && 'auto-draft' != $post->post_status ) {
|
||||
$revisions = wp_get_post_revisions( $post_ID );
|
||||
|
||||
// Check if the revisions have been upgraded
|
||||
if ( ! empty( $revisions ) && _wp_get_post_revision_version( end( $revisions ) ) < 1 )
|
||||
_wp_upgrade_revisions_of_post( $post, $revisions );
|
||||
|
||||
// We should aim to show the revisions metabox only when there are revisions.
|
||||
if ( count( $revisions ) > 1 )
|
||||
add_meta_box('revisionsdiv', __('Revisions'), 'post_revisions_meta_box', null, 'normal', 'core');
|
||||
}
|
||||
|
||||
do_action('add_meta_boxes', $post_type, $post);
|
||||
do_action('add_meta_boxes_' . $post_type, $post);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user