wp/wp-admin/revision.php
changeset 7 cf61fcea0001
parent 5 5e2f62d02dcd
child 9 177826044cd9
equal deleted inserted replaced
6:490d5cc509ed 7:cf61fcea0001
    38 		break;
    38 		break;
    39 
    39 
    40 	if ( ! $post = get_post( $revision->post_parent ) )
    40 	if ( ! $post = get_post( $revision->post_parent ) )
    41 		break;
    41 		break;
    42 
    42 
    43 	// Revisions disabled (previously checked autosaves && ! wp_is_post_autosave( $revision ))
    43 	// Restore if revisions are enabled or this is an autosave.
    44 	if ( ! wp_revisions_enabled( $post ) ) {
    44 	if ( ! wp_revisions_enabled( $post ) && ! wp_is_post_autosave( $revision ) ) {
    45 		$redirect = 'edit.php?post_type=' . $post->post_type;
    45 		$redirect = 'edit.php?post_type=' . $post->post_type;
    46 		break;
    46 		break;
    47 	}
    47 	}
    48 
    48 
    49 	// Don't allow revision restore when post is locked
    49 	// Don't allow revision restore when post is locked
    61 	if ( ! $revision = wp_get_post_revision( $revision_id ) )
    61 	if ( ! $revision = wp_get_post_revision( $revision_id ) )
    62 		break;
    62 		break;
    63 	if ( ! $post = get_post( $revision->post_parent ) )
    63 	if ( ! $post = get_post( $revision->post_parent ) )
    64 		break;
    64 		break;
    65 
    65 
    66 	if ( ! current_user_can( 'read_post', $revision->ID ) || ! current_user_can( 'read_post', $post->ID ) )
    66 	if ( ! current_user_can( 'read_post', $revision->ID ) || ! current_user_can( 'edit_post', $revision->post_parent ) )
    67 		break;
    67 		break;
    68 
    68 
    69 	// Revisions disabled and we're not looking at an autosave
    69 	// Revisions disabled and we're not looking at an autosave
    70 	if ( ! wp_revisions_enabled( $post ) && ! wp_is_post_autosave( $revision ) ) {
    70 	if ( ! wp_revisions_enabled( $post ) && ! wp_is_post_autosave( $revision ) ) {
    71 		$redirect = 'edit.php?post_type=' . $post->post_type;
    71 		$redirect = 'edit.php?post_type=' . $post->post_type;
    72 		break;
    72 		break;
    73 	}
    73 	}
    74 
    74 
    75 	$post_edit_link = get_edit_post_link();
    75 	$post_edit_link = get_edit_post_link();
    76 	$post_title     = '<a href="' . $post_edit_link . '">' . _draft_or_post_title() . '</a>';
    76 	$post_title     = '<a href="' . $post_edit_link . '">' . _draft_or_post_title() . '</a>';
    77 	$h2             = sprintf( __( 'Compare Revisions of &#8220;%1$s&#8221;' ), $post_title );
    77 	/* translators: 1: Post title */
    78 	$return_to_post = '<a href="' . $post_edit_link . '">' . __( '&larr; Return to post editor' ) . '</a>';
    78 	$h1             = sprintf( __( 'Compare Revisions of &#8220;%1$s&#8221;' ), $post_title );
       
    79 	$return_to_post = '<a href="' . $post_edit_link . '">' . __( '&larr; Return to editor' ) . '</a>';
    79 	$title          = __( 'Revisions' );
    80 	$title          = __( 'Revisions' );
    80 
    81 
    81 	$redirect = false;
    82 	$redirect = false;
    82 	break;
    83 	break;
    83 }
    84 }
   114 	'title'   => __( 'Overview' ),
   115 	'title'   => __( 'Overview' ),
   115 	'content' => $revisions_overview
   116 	'content' => $revisions_overview
   116 ) );
   117 ) );
   117 
   118 
   118 $revisions_sidebar  = '<p><strong>' . __( 'For more information:' ) . '</strong></p>';
   119 $revisions_sidebar  = '<p><strong>' . __( 'For more information:' ) . '</strong></p>';
   119 $revisions_sidebar .= '<p>' . __( '<a href="https://codex.wordpress.org/Revision_Management" target="_blank">Revisions Management</a>' ) . '</p>';
   120 $revisions_sidebar .= '<p>' . __( '<a href="https://codex.wordpress.org/Revision_Management">Revisions Management</a>' ) . '</p>';
   120 $revisions_sidebar .= '<p>' . __( '<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>';
   121 $revisions_sidebar .= '<p>' . __( '<a href="https://wordpress.org/support/">Support Forums</a>' ) . '</p>';
   121 
   122 
   122 get_current_screen()->set_help_sidebar( $revisions_sidebar );
   123 get_current_screen()->set_help_sidebar( $revisions_sidebar );
   123 
   124 
   124 require_once( ABSPATH . 'wp-admin/admin-header.php' );
   125 require_once( ABSPATH . 'wp-admin/admin-header.php' );
   125 
   126 
   126 ?>
   127 ?>
   127 
   128 
   128 <div class="wrap">
   129 <div class="wrap">
   129 	<h2 class="long-header"><?php echo $h2; ?></h2>
   130 	<h1 class="long-header"><?php echo $h1; ?></h1>
   130 	<?php echo $return_to_post; ?>
   131 	<?php echo $return_to_post; ?>
   131 </div>
   132 </div>
   132 <?php
   133 <?php
   133 wp_print_revision_templates();
   134 wp_print_revision_templates();
   134 
   135