Changeset 23639 for trunk/wp-admin/revision.php
- Timestamp:
- 03/07/2013 03:32:26 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/revision.php
r23581 r23639 11 11 wp_reset_vars( array( 'revision', 'action' ) ); 12 12 13 $revision_id = absint( $revision);13 $revision_id = absint( $revision ); 14 14 $redirect = 'edit.php'; 15 15 16 16 switch ( $action ) : 17 17 case 'restore' : 18 if ( ! $revision = wp_get_post_revision( $revision_id ) )18 if ( ! $revision = wp_get_post_revision( $revision_id ) ) 19 19 break; 20 if ( ! current_user_can( 'edit_post', $revision->post_parent ) )20 if ( ! current_user_can( 'edit_post', $revision->post_parent ) ) 21 21 break; 22 if ( ! $post = get_post( $revision->post_parent ) )22 if ( ! $post = get_post( $revision->post_parent ) ) 23 23 break; 24 24 25 25 // Revisions disabled and we're not looking at an autosave 26 if ( ( ! WP_POST_REVISIONS || ! post_type_supports($post->post_type, 'revisions') ) && !wp_is_post_autosave( $revision ) ) {26 if ( ( ! WP_POST_REVISIONS || ! post_type_supports( $post->post_type, 'revisions' ) ) && ! wp_is_post_autosave( $revision ) ) { 27 27 $redirect = 'edit.php?post_type=' . $post->post_type; 28 28 break; 29 29 } 30 30 check_admin_referer( "restore-post_{$post->ID}|{$revision->ID}" ); 31 32 //store revision event in post meta 33 $restore_details = array( 34 'restored_revision_id' => $revision->ID, 35 'restored_by_user' => get_current_user_id(), 36 'restored_time' => time() 37 ); 38 update_post_meta( $post->ID, '_post_restored_from', $restore_details ); 31 39 32 40 wp_restore_post_revision( $revision->ID ); … … 36 44 case 'edit' : 37 45 default : 38 if ( ! $revision = wp_get_post_revision( $revision_id ) )46 if ( ! $revision = wp_get_post_revision( $revision_id ) ) 39 47 break; 40 if ( ! $post = get_post( $revision->post_parent ) )48 if ( ! $post = get_post( $revision->post_parent ) ) 41 49 break; 42 50 43 if ( ! current_user_can( 'read_post', $revision->ID ) || !current_user_can( 'read_post', $post->ID ) )51 if ( ! current_user_can( 'read_post', $revision->ID ) || ! current_user_can( 'read_post', $post->ID ) ) 44 52 break; 45 53 … … 60 68 61 69 // Empty post_type means either malformed object found, or no valid parent was found. 62 if ( ! $redirect && empty($post->post_type) )70 if ( ! $redirect && empty( $post->post_type ) ) 63 71 $redirect = 'edit.php'; 64 72 65 if ( ! empty($redirect) ) {73 if ( ! empty( $redirect ) ) { 66 74 wp_redirect( $redirect ); 67 75 exit; … … 69 77 70 78 // This is so that the correct "Edit" menu item is selected. 71 if ( ! empty($post->post_type) && 'post' != $post->post_type )79 if ( ! empty( $post->post_type ) && 'post' != $post->post_type ) 72 80 $parent_file = $submenu_file = 'edit.php?post_type=' . $post->post_type; 73 81 else … … 84 92 var wpRevisionsSettings = <?php echo json_encode( array( 'post_id' => $post->ID, 'nonce' => wp_create_nonce( 'revisions-ajax-nonce' ) ) ); ?>; 85 93 </script> 94 <?php 95 $comparetworevisionslink = get_edit_post_link( $revision->ID ); 96 ?> 86 97 87 98 <div id="backbonerevisionsoptions"></div> 88 89 <br class="clear"/>90 99 <div class="wrap"> 91 100 <div class="icon32 icon32-posts-post" id="icon-edit"><br></div> … … 95 104 <div id="backbonerevisionsinteract"></div> 96 105 <div id="backbonerevisionsdiff"></div> 97 <hr /> 98 <?php 99 $comparetworevisionslink = get_edit_post_link( $revision->ID ); 100 ?> 106 <hr /> 101 107 </div> 102 108 </div> … … 108 114 <div id="difftitle">{{{ data.revision_date_author }}}</div> 109 115 <div id="diffcancel"><input class="button" onClick="document.location='<?php echo get_edit_post_link( $post->ID ); ?>'" type="submit" id="cancel" value="<?php esc_attr_e( 'Cancel' )?>" /></div> 110 <div id="diffrestore"><input class="button button-primary" onClick="document.location='{{{ data.restoreaction }}}'" type="submit" id="restore" value="<?php esc_attr_e( 'Restore' )?>" /></div> 111 <div id="comparetworevisions"><input type="checkbox" id="comparetwo" value="comparetwo" {{{ data.comparetwochecked }}} name="comparetwo"/> <?php esc_attr_e( 'Compare two revisions' )?></div> 112 </div> 116 <div id="diffrestore"><input class="button button-primary" onClick="document.location='{{{ data.restoreaction }}}'" type="submit" id="restore" value="<?php esc_attr_e( 'Restore revision ID' )?>" /></div> 117 <div id="comparetworevisions"><input type="checkbox" id="comparetwo" value="comparetwo" {{{ data.comparetwochecked }}} name="comparetwo"/> <label for="comparetwo"><?php esc_attr_e( 'Compare two revisions' ); ?></a></div> </div> 113 118 <div id="removedandadded"> 114 119 <div id="removed"><?php _e( 'Removed -' ); ?></div> … … 120 125 <script id="tmpl-revisionvinteract" type="text/html"> 121 126 <div id="diffheader"> 122 <div id="diffprevious"><input class="button" type="submit" id="previous" value=" Previous" /></div>123 <div id="diffnext"><input class="button" type="submit" id="next" value=" Next" /></div>127 <div id="diffprevious"><input class="button" type="submit" id="previous" value="<?php esc_attr_e( 'Previous' ); ?>" /></div> 128 <div id="diffnext"><input class="button" type="submit" id="next" value="<?php esc_attr_e( 'Next' ); ?>" /></div> 124 129 <div id="diffslider"> 125 130 <div id="revisioncount">
Note: See TracChangeset
for help on using the changeset viewer.