Changeset 14749
- Timestamp:
- 05/19/2010 06:36:52 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/revision.php
r14139 r14749 12 12 wp_enqueue_script('list-revisions'); 13 13 14 wp_reset_vars(array('revision', 'left', 'right', ' diff', 'action'));14 wp_reset_vars(array('revision', 'left', 'right', 'action')); 15 15 16 16 $revision_id = absint($revision); 17 $diff = absint($diff);18 17 $left = absint($left); 19 18 $right = absint($right); … … 30 29 break; 31 30 32 if ( ! WP_POST_REVISIONS && !wp_is_post_autosave( $revision ) ) // Revisions disabled and we're not looking at an autosave 33 break; 31 // Revisions disabled and we're not looking at an autosave 32 if ( ( ! WP_POST_REVISIONS || !post_type_supports($post->post_type, 'revisions') ) && !wp_is_post_autosave( $revision ) ) { 33 $redirect = 'edit.php?post_type=' . $post->post_type; 34 break; 35 } 34 36 35 37 check_admin_referer( "restore-post_$post->ID|$revision->ID" ); … … 69 71 break; // Don't diff two unrelated revisions 70 72 71 if ( ! WP_POST_REVISIONS ) { // Revisions disabled73 if ( ! WP_POST_REVISIONS || !post_type_supports($post->post_type, 'revisions') ) { // Revisions disabled 72 74 if ( 73 75 // we're not looking at an autosave … … 76 78 // we're not comparing an autosave to the current post 77 79 ( $post->ID !== $left_revision->ID && $post->ID !== $right_revision->ID ) 78 ) 80 ) { 81 $redirect = 'edit.php?post_type=' . $post->post_type; 79 82 break; 83 } 80 84 } 81 85 … … 91 95 $post_title = '<a href="' . get_edit_post_link() . '">' . get_the_title() . '</a>'; 92 96 $h2 = sprintf( __( 'Compare Revisions of “%1$s”' ), $post_title ); 97 $title = __( 'Revisions' ); 93 98 94 99 $left = $left_revision->ID; … … 107 112 break; 108 113 109 if ( ! WP_POST_REVISIONS && !wp_is_post_autosave( $revision ) ) // Revisions disabled and we're not looking at an autosave 110 break; 111 112 $post_type_object = get_post_type_object($post->post_type); 114 // Revisions disabled and we're not looking at an autosave 115 if ( ( ! WP_POST_REVISIONS || !post_type_supports($post->post_type, 'revisions') ) && !wp_is_post_autosave( $revision ) ) { 116 $redirect = 'edit.php?post_type=' . $post->post_type; 117 break; 118 } 113 119 114 120 $post_title = '<a href="' . get_edit_post_link() . '">' . get_the_title() . '</a>'; … … 125 131 endswitch; 126 132 127 if ( !$redirect ) { 128 if ( empty($post->post_type) ) // Empty post_type means either malformed object found, or no valid parent was found. 129 $redirect = 'edit.php'; 130 elseif ( !post_type_supports($post->post_type, 'revisions') ) 131 $redirect = 'edit.php?post_type=' . $post->post_type; 132 } 133 // Empty post_type means either malformed object found, or no valid parent was found. 134 if ( !$redirect && empty($post->post_type) ) 135 $redirect = 'edit.php'; 133 136 134 137 if ( !empty($redirect) ) { … … 208 211 209 212 $args = array( 'format' => 'form-table', 'parent' => true, 'right' => $right, 'left' => $left ); 210 if ( ! WP_POST_REVISIONS )213 if ( ! WP_POST_REVISIONS || !post_type_supports($post->post_type, 'revisions') ) 211 214 $args['type'] = 'autosave'; 212 215 … … 218 221 219 222 <?php 220 221 223 require_once( './admin-footer.php' ); -
trunk/wp-includes/post-template.php
r14687 r14749 1170 1170 1171 1171 if ( $post->ID != $revision->ID && $can_edit_post ) 1172 $actions = '<a href="' . wp_nonce_url( add_query_arg( array( 'revision' => $revision->ID, ' diff' => false, 'action' => 'restore' ) ), "restore-post_$post->ID|$revision->ID" ) . '">' . __( 'Restore' ) . '</a>';1172 $actions = '<a href="' . wp_nonce_url( add_query_arg( array( 'revision' => $revision->ID, 'action' => 'restore' ) ), "restore-post_$post->ID|$revision->ID" ) . '">' . __( 'Restore' ) . '</a>'; 1173 1173 else 1174 1174 $actions = ''; 1175 1175 1176 1176 $rows .= "<tr$class>\n"; 1177 $rows .= "\t<th style='white-space: nowrap' scope='row'><input type='radio' name='left' value='$revision->ID'$left_checked /> \n";1177 $rows .= "\t<th style='white-space: nowrap' scope='row'><input type='radio' name='left' value='$revision->ID'$left_checked /></th>\n"; 1178 1178 $rows .= "\t<th style='white-space: nowrap' scope='row'><input type='radio' name='right' value='$revision->ID'$right_checked /></th>\n"; 1179 1179 $rows .= "\t<td>$date</td>\n";
Note: See TracChangeset
for help on using the changeset viewer.