Changeset 8011 for trunk/wp-admin/revision.php
- Timestamp:
- 05/29/2008 10:21:36 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/revision.php
r7913 r8011 2 2 3 3 require_once('admin.php'); 4 5 if ( !constant('WP_POST_REVISIONS') ) {6 wp_redirect( 'edit.php' );7 exit;8 }9 4 10 5 wp_reset_vars(array('revision', 'left', 'right', 'action')); … … 19 14 case 'delete' : // stubs 20 15 case 'edit' : 21 $redirect = remove_query_arg( 'action' ); 16 if ( constant('WP_POST_REVISIONS') ) // stub 17 $redirect = remove_query_arg( 'action' ); 18 else // Revisions disabled 19 $redirect = 'edit.php'; 22 20 break; 23 21 case 'restore' : 22 if ( !$revision = wp_get_post_revision( $revision_id ) ) 23 break; 24 24 if ( !current_user_can( 'edit_post', $revision->post_parent ) ) 25 25 break; 26 if ( !$revision = wp_get_revision( $revision_id ) )27 break;28 26 if ( !$post = get_post( $revision->post_parent ) ) 29 27 break; 30 28 29 if ( !constant('WP_POST_REVISIONS') && !wp_is_post_autosave( $revision ) ) // Revisions disabled and we're not looking at an autosave 30 break; 31 31 32 check_admin_referer( "restore-post_$post->ID|$revision->ID" ); 32 33 33 wp_restore_ revision( $revision->ID );34 wp_restore_post_revision( $revision->ID ); 34 35 $redirect = add_query_arg( array( 'message' => 5, 'revision' => $revision->ID ), get_edit_post_link( $post->ID, 'url' ) ); 35 36 break; … … 58 59 break; // Don't diff two unrelated revisions 59 60 61 if ( !constant('WP_POST_REVISIONS') ) { // Revisions disabled 62 if ( 63 // we're not looking at an autosave 64 ( !wp_is_post_autosave( $left_revision ) && !wp_is_post_autosave( $right_revision ) ) 65 || 66 // we're not comparing an autosave to the current post 67 ( $post->ID !== $left_revision->ID && $post->ID !== $right_revision->ID ) 68 ) 69 break; 70 } 71 60 72 if ( 61 73 // They're the same … … 63 75 || 64 76 // Neither is a revision 65 ( !wp_get_ revision( $left_revision->ID ) && !wp_get_revision( $right_revision->ID ) )77 ( !wp_get_post_revision( $left_revision->ID ) && !wp_get_post_revision( $right_revision->ID ) ) 66 78 ) 67 79 break; … … 77 89 case 'view' : 78 90 default : 79 if ( !$revision = wp_get_ revision( $revision_id ) )91 if ( !$revision = wp_get_post_revision( $revision_id ) ) 80 92 break; 81 93 if ( !$post = get_post( $revision->post_parent ) ) … … 83 95 84 96 if ( !current_user_can( 'read_post', $revision->ID ) || !current_user_can( 'read_post', $post->ID ) ) 97 break; 98 99 if ( !constant('WP_POST_REVISIONS') && !wp_is_post_autosave( $revision ) ) // Revisions disabled and we're not looking at an autosave 85 100 break; 86 101 … … 114 129 115 130 // Converts post_author ID# into name 116 add_filter( '_wp_ revision_field_post_author', 'get_author_name' );131 add_filter( '_wp_post_revision_field_post_author', 'get_author_name' ); 117 132 118 133 require_once( 'admin-header.php' ); … … 138 153 // use get_post_to_edit filters? 139 154 $identical = true; 140 foreach ( _wp_ revision_fields() as $field => $field_title ) :155 foreach ( _wp_post_revision_fields() as $field => $field_title ) : 141 156 if ( 'diff' == $action ) { 142 $left_content = apply_filters( "_wp_ revision_field_$field", $left_revision->$field, $field );143 $right_content = apply_filters( "_wp_ revision_field_$field", $right_revision->$field, $field );157 $left_content = apply_filters( "_wp_post_revision_field_$field", $left_revision->$field, $field ); 158 $right_content = apply_filters( "_wp_post_revision_field_$field", $right_revision->$field, $field ); 144 159 if ( !$content = wp_text_diff( $left_content, $right_content ) ) 145 160 continue; // There is no difference between left and right 146 161 $identical = false; 147 162 } else { 148 add_filter( "_wp_ revision_field_$field", 'htmlspecialchars' );149 $content = apply_filters( "_wp_ revision_field_$field", $revision->$field, $field );163 add_filter( "_wp_post_revision_field_$field", 'htmlspecialchars' ); 164 $content = apply_filters( "_wp_post_revision_field_$field", $revision->$field, $field ); 150 165 } 151 166 ?> … … 180 195 <?php 181 196 182 wp_list_post_revisions( $post, array( 'format' => 'form-table', 'parent' => true, 'right' => $right, 'left' => $left ) ); 197 $args = array( 'format' => 'form-table', 'parent' => true, 'right' => $right, 'left' => $left ); 198 if ( !constant( 'WP_POST_REVISIONS' ) ) 199 $args['type'] = 'autosave'; 200 201 wp_list_post_revisions( $post, $args ); 183 202 184 203 require_once( 'admin-footer.php' );
Note: See TracChangeset
for help on using the changeset viewer.