Ticket #12590: scripts.2.diff

File scripts.2.diff, 2.4 KB (added by scribu, 3 years ago)

Take #12792 into account

Line 
1Index: wp-admin/post-new.php
2===================================================================
3--- wp-admin/post-new.php       (revision 13988)
4+++ wp-admin/post-new.php       (working copy)
5@@ -29,16 +29,9 @@
6 $title = sprintf(__('Add New %s'), $post_type_object->singular_label);
7 
8 $editing = true;
9-wp_enqueue_script('autosave');
10-wp_enqueue_script('post');
11-if ( user_can_richedit() )
12-       wp_enqueue_script('editor');
13-add_thickbox();
14-wp_enqueue_script('media-upload');
15-wp_enqueue_script('word-count');
16 
17 if ( 'post' == $post_type && !current_user_can('edit_posts') ) {
18-       require_once ('./admin-header.php'); ?>
19+       include('admin-header.php'); ?>
20 <div class="wrap">
21 <p><?php printf(__('Since you&#8217;re a newcomer, you&#8217;ll have to wait for an admin to add the <code>edit_posts</code> capability to your user, in order to be authorized to post.<br />
22 You can also <a href="mailto:%s?subject=Promotion?">e-mail the admin</a> to ask for a promotion.<br />
23@@ -58,4 +51,4 @@
24 }
25 
26 include('admin-footer.php');
27-?>
28+
29Index: wp-admin/post.php
30===================================================================
31--- wp-admin/post.php   (revision 13988)
32+++ wp-admin/post.php   (working copy)
33@@ -170,15 +170,6 @@
34                $submenu_file = "edit.php?post_type=$post_type";
35        }
36 
37-       wp_enqueue_script('post');
38-       if ( user_can_richedit() )
39-               wp_enqueue_script('editor');
40-       add_thickbox();
41-       wp_enqueue_script('media-upload');
42-       wp_enqueue_script('word-count');
43-       wp_enqueue_script( 'admin-comments' );
44-       enqueue_comment_hotkeys_js();
45-
46        if ( $last = wp_check_post_lock( $post->ID ) ) {
47                add_action('admin_notices', '_admin_notice_post_locked' );
48        } else {
49Index: wp-admin/edit-form-advanced.php
50===================================================================
51--- wp-admin/edit-form-advanced.php     (revision 13988)
52+++ wp-admin/edit-form-advanced.php     (working copy)
53@@ -10,6 +10,24 @@
54 if ( !defined('ABSPATH') )
55        die('-1');
56 
57+// load required scripts
58+wp_enqueue_script('post');
59+if ( post_type_supports($post_type, 'editor') ) {
60+       if ( user_can_richedit() )
61+               wp_enqueue_script('editor');
62+       wp_enqueue_script('word-count');
63+}
64+
65+if ( post_type_supports($post_type, 'editor') || post_type_supports($post_type, 'thumbnail') ) {
66+       add_thickbox();
67+       wp_enqueue_script('media-upload');
68+}
69+
70+if ( post_type_supports($post_type, 'comments') ) {
71+       wp_enqueue_script( 'admin-comments' );
72+       enqueue_comment_hotkeys_js();
73+}
74+
75 /**
76  * Post ID global
77  * @name $post_ID