post_type ? get_post( $revision->post_parent ) : get_post( $revision_id ); $left_revision = get_post( $diff ); // Don't allow reverse diffs? if ( strtotime($revision->post_modified_gmt) < strtotime($left_revision->post_modified_gmt) ) { wp_redirect( add_query_arg( array( 'diff' => $revision->ID, 'revision' => $diff ) ) ); exit; } $h2 = __( 'Compare Revisions of “%1$s”' ); $right = $revision->ID; $left = $left_revision->ID; if ( // They're the same $left_revision->ID == $revision->ID || // They don't have a comment parent (and we're not comparing a revision to it's post) ( $left_revision->ID != $revision->post_parent && $left_revision->post_parent != $revision->ID && $left_revision->post_parent != $revision->post_parent ) || // Neither is a revision ( !wp_get_revision( $left_revision->ID ) && !wp_get_revision( $revision->ID ) ) ) { wp_redirect( get_edit_post_link( $revision->ID, 'url' ) ); exit(); } } else { $revision = wp_get_revision( $revision_id ); $post = get_post( $revision->post_parent ); $h2 = __( 'Post Revision for “%1$s” created on %2$s' ); $right = $post->ID; $left = $revision->ID; } if ( !$revision || !$post ) { wp_redirect("edit.php"); exit(); } if ( $restore && current_user_can( 'edit_post', $revision->post_parent ) ) { check_admin_referer( "restore-post_$post->ID|$revision->ID" ); wp_restore_revision( $revision->ID ); wp_redirect( add_query_arg( array( 'message' => 5, 'revision' => $revision->ID ), get_edit_post_link( $post->ID, 'url' ) ) ); exit; } add_filter( '_wp_revision_field_post_author', 'get_author_name' ); $title = __( 'Post Revision' ); require_once( 'admin-header.php' ); $post_title = '' . get_the_title() . ''; $revision_time = wp_post_revision_time( $revision ); ?>

$field_title ) : if ( !$diff ) add_filter( "_wp_revision_field_$field", 'htmlspecialchars' ); $content = apply_filters( "_wp_revision_field_$field", $revision->$field, $field ); if ( $diff ) { $left_content = apply_filters( "_wp_revision_field_$field", $left_revision->$field, $field ); if ( !$content = wp_text_diff( $left_content, $content ) ) continue; } $identical = false; ?>


'form-table', 'exclude' => $revision->ID, 'parent' => true, 'right' => $right, 'left' => $left ) ); require_once( 'admin-footer.php' );