mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-22 17:18:32 +01:00
Revisions: compare revisions by date in wp_ajax_revisions_data(), deprecate the $parent arg in wp_list_post_revisions() as now revisions always include a copy of the current post, props adamsilverstein, see #23901
git-svn-id: http://core.svn.wordpress.org/trunk@23975 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
003941b2e7
commit
44752d0dad
@ -2129,7 +2129,7 @@ function wp_ajax_revisions_data() {
|
||||
$left_revision = get_post( $post_id );
|
||||
|
||||
// make sure the right revision is the most recent
|
||||
if ( $compare_two_mode && $right_revision->ID < $left_revision->ID ) {
|
||||
if ( $compare_two_mode && $right_revision->post_date < $left_revision->post_date ) {
|
||||
$temp = $left_revision;
|
||||
$left_revision = $right_revision;
|
||||
$right_revision = $temp;
|
||||
|
@ -1387,6 +1387,8 @@ function wp_post_revision_title_expanded( $revision, $link = true ) {
|
||||
*
|
||||
* Second argument controls parameters:
|
||||
* (bool) parent : include the parent (the "Current Revision") in the list.
|
||||
* Deprecated (ignored), since 3.6 the revisions always include
|
||||
* a copy of the current post.
|
||||
* (string) format : 'list' or 'form-table'. 'list' outputs UL, 'form-table'
|
||||
* outputs TABLE with UI.
|
||||
* (int) right : what revision is currently being viewed - used in
|
||||
@ -1413,7 +1415,7 @@ function wp_list_post_revisions( $post_id = 0, $args = null ) {
|
||||
if ( !$post = get_post( $post_id ) )
|
||||
return;
|
||||
|
||||
$defaults = array( 'parent' => false, 'right' => false, 'left' => false, 'format' => 'list', 'type' => 'all' );
|
||||
$defaults = array( 'right' => false, 'left' => false, 'format' => 'list', 'type' => 'all' );
|
||||
extract( wp_parse_args( $args, $defaults ), EXTR_SKIP );
|
||||
|
||||
if ( !$revisions = wp_get_post_revisions( $post->ID ) )
|
||||
@ -1422,14 +1424,6 @@ function wp_list_post_revisions( $post_id = 0, $args = null ) {
|
||||
/* translators: post revision: 1: when, 2: author name */
|
||||
$titlef = _x( '%1$s', 'post revision' );
|
||||
|
||||
// Since 3.6 revisions include a copy of the current post data as a revision.
|
||||
// The following removes that revision when $parent == false
|
||||
$parent_included = _wp_get_post_revision_version( reset( $revisions ) ) > 0;
|
||||
if ( $parent_included && ! $parent )
|
||||
array_shift( $revisions );
|
||||
elseif ( ! $parent_included && $parent )
|
||||
array_unshift( $revisions, $post );
|
||||
|
||||
$rows = $right_checked = '';
|
||||
$class = false;
|
||||
$can_edit_post = current_user_can( 'edit_post', $post->ID );
|
||||
|
Loading…
Reference in New Issue
Block a user