Changeset 12987 for trunk/wp-admin/edit-form-advanced.php
- Timestamp:
- 02/06/2010 10:07:57 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/edit-form-advanced.php
r12937 r12987 61 61 62 62 $notice = false; 63 if ( 0 == $post_ID ) { 64 $form_action = 'post'; 65 $nonce_action = 'add-' . $post_type; 66 $temp_ID = -1 * time(); // don't change this formula without looking at wp_write_post() 67 $form_extra = "<input type='hidden' id='post_ID' name='temp_ID' value='" . esc_attr($temp_ID) . "' />"; 63 $form_extra = ''; 64 if ( 'auto-draft' == $post->post_status ) { 65 if ( 'edit' == $action ) 66 $post->post_title = ''; 68 67 $autosave = false; 68 $form_extra .= "<input type='hidden' id='auto_draft' name='auto_draft' value='1' />"; 69 69 } else { 70 $form_action = 'editpost';71 $nonce_action = 'update-' . $post_type . '_' . $post_ID;72 $form_extra = "<input type='hidden' id='post_ID' name='post_ID' value='" . esc_attr($post_ID) . "' />";73 70 $autosave = wp_get_post_autosave( $post_ID ); 74 75 // Detect if there exists an autosave newer than the post and if that autosave is different than the post 76 if ( $autosave && mysql2date( 'U', $autosave->post_modified_gmt, false ) > mysql2date( 'U', $post->post_modified_gmt, false ) ) { 77 foreach ( _wp_post_revision_fields() as $autosave_field => $_autosave_field ) { 78 if ( normalize_whitespace( $autosave->$autosave_field ) != normalize_whitespace( $post->$autosave_field ) ) { 79 $notice = sprintf( __( 'There is an autosave of this post that is more recent than the version below. <a href="%s">View the autosave</a>' ), get_edit_post_link( $autosave->ID ) ); 80 break; 81 } 71 } 72 73 $form_action = 'editpost'; 74 $nonce_action = 'update-' . $post_type . '_' . $post_ID; 75 $form_extra .= "<input type='hidden' id='post_ID' name='post_ID' value='" . esc_attr($post_ID) . "' />"; 76 77 // Detect if there exists an autosave newer than the post and if that autosave is different than the post 78 if ( $autosave && mysql2date( 'U', $autosave->post_modified_gmt, false ) > mysql2date( 'U', $post->post_modified_gmt, false ) ) { 79 foreach ( _wp_post_revision_fields() as $autosave_field => $_autosave_field ) { 80 if ( normalize_whitespace( $autosave->$autosave_field ) != normalize_whitespace( $post->$autosave_field ) ) { 81 $notice = sprintf( __( 'There is an autosave of this post that is more recent than the version below. <a href="%s">View the autosave</a>' ), get_edit_post_link( $autosave->ID ) ); 82 break; 82 83 } 83 unset($autosave_field, $_autosave_field);84 84 } 85 unset($autosave_field, $_autosave_field); 85 86 } 86 87 … … 198 199 <div id="edit-slug-box"> 199 200 <?php 200 if ( ! empty($post->ID) && ! empty($sample_permalink_html) ) :201 if ( ! empty($post->ID) && ! empty($sample_permalink_html) && 'auto-draft' != $post->post_status ) : 201 202 echo $sample_permalink_html; 202 203 endif; ?> … … 216 217 <span id="autosave"> </span> 217 218 <?php 218 if ( $post_ID) {219 if ( 'auto-draft' != $post->post_status ) { 219 220 echo '<span id="last-edit">'; 220 221 if ( $last_id = get_post_meta($post_ID, '_edit_last', true) ) {
Note: See TracChangeset
for help on using the changeset viewer.