Ticket #11082: 11082.2.diff

File 11082.2.diff, 3.8 KB (added by duck_, 3 years ago)
Line 
1Index: wp-admin/edit-form-advanced.php
2===================================================================
3--- wp-admin/edit-form-advanced.php     (revision 14011)
4+++ wp-admin/edit-form-advanced.php     (working copy)
5@@ -35,7 +35,8 @@
6        sprintf( __('Post scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview post</a>'),
7                // translators: Publish box date format, see http://php.net/date
8                date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ), get_permalink($post_ID) ),
9-       sprintf( __('Post draft updated. <a target="_blank" href="%s">Preview post</a>'), add_query_arg( 'preview', 'true', get_permalink($post_ID) ) )
10+       sprintf( __('Post draft updated. <a target="_blank" href="%s">Preview post</a>'), add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ),
11+       __('You attempted to save or publish an empty post. Provide some content before saving.')
12 );
13 $messages['page'] = array(
14        '',
15@@ -48,7 +49,8 @@
16        __('Page saved.'),
17        sprintf( __('Page submitted. <a target="_blank" href="%s">Preview page</a>'), add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ),
18        sprintf( __('Page scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview page</a>'), date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ), get_permalink($post_ID) ),
19-       sprintf( __('Page draft updated. <a target="_blank" href="%s">Preview page</a>'), add_query_arg( 'preview', 'true', get_permalink($post_ID) ) )
20+       sprintf( __('Page draft updated. <a target="_blank" href="%s">Preview page</a>'), add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ),
21+       __('You attempted to save or publish an empty page. Provide some content before saving.')
22 );
23 
24 $message = false;
25Index: wp-admin/post.php
26===================================================================
27--- wp-admin/post.php   (revision 14011)
28+++ wp-admin/post.php   (working copy)
29@@ -57,24 +57,33 @@
30                elseif ( isset($_POST['publish']) )
31                        $location = 'sidebar.php?a=b';
32        } elseif ( isset($_POST['save']) || isset($_POST['publish']) ) {
33-               $status = get_post_status( $post_id );
34-
35-               if ( isset( $_POST['publish'] ) ) {
36-                       switch ( $status ) {
37-                               case 'pending':
38-                                       $message = 8;
39-                                       break;
40-                               case 'future':
41-                                       $message = 9;
42-                                       break;
43-                               default:
44-                                       $message = 6;
45+               if ( isset( $_POST['auto_draft'] ) && '1' == $_POST['auto_draft'] ) {
46+                       $location = 'post-new.php?message=11';
47+                       if ( isset($_POST['post_type']) ) {
48+                               $post_type_object = get_post_type_object($_POST['post_type']);
49+                               if ( $post_type_object && 'post' != $post_type_object->name )
50+                                       $location = add_query_arg( 'post_type', $post_type_object->name, $location );
51                        }
52                } else {
53+                       $status = get_post_status( $post_id );
54+               
55+                       if ( isset( $_POST['publish'] ) ) {
56+                               switch ( $status ) {
57+                                       case 'pending':
58+                                               $message = 8;
59+                                               break;
60+                                       case 'future':
61+                                               $message = 9;
62+                                               break;
63+                                       default:
64+                                               $message = 6;
65+                               }
66+                       } else {
67                                $message = 'draft' == $status ? 10 : 1;
68+                       }
69+                       
70+                       $location = add_query_arg( 'message', $message, get_edit_post_link( $post_id, 'url' ) );
71                }
72-
73-               $location = add_query_arg( 'message', $message, get_edit_post_link( $post_id, 'url' ) );
74        } elseif ( isset($_POST['addmeta']) && $_POST['addmeta'] ) {
75                $location = add_query_arg( 'message', 2, wp_get_referer() );
76                $location = explode('#', $location);
77Index: wp-includes/js/autosave.dev.js
78===================================================================
79--- wp-includes/js/autosave.dev.js      (revision 14011)
80+++ wp-includes/js/autosave.dev.js      (working copy)
81@@ -144,7 +144,6 @@
82 
83 function autosave_update_post_ID( postID ) {
84        if ( !isNaN(postID) && postID > 0 ) {
85-               if ( postID == parseInt(jQuery('#post_ID').val(), 10) ) { return; } // no need to do this more than once
86                notSaved = false;
87                autosave_enable_buttons();
88                jQuery('#delete-action a.submitdelete').fadeIn();