@@ -64,137 +64,137 @@ |
||
64 | 64 | |
65 | 65 | switch ( $wp_list_table->current_action() ) { |
66 | 66 | |
67 | -case 'add-tag': |
|
67 | + case 'add-tag': |
|
68 | 68 | |
69 | - check_admin_referer( 'add-tag', '_wpnonce_add-tag' ); |
|
69 | + check_admin_referer( 'add-tag', '_wpnonce_add-tag' ); |
|
70 | 70 | |
71 | - if ( ! current_user_can( $tax->cap->edit_terms ) ) { |
|
72 | - wp_die( |
|
73 | - '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . |
|
74 | - '<p>' . __( 'Sorry, you are not allowed to add this item.' ) . '</p>', |
|
75 | - 403 |
|
76 | - ); |
|
77 | - } |
|
71 | + if ( ! current_user_can( $tax->cap->edit_terms ) ) { |
|
72 | + wp_die( |
|
73 | + '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . |
|
74 | + '<p>' . __( 'Sorry, you are not allowed to add this item.' ) . '</p>', |
|
75 | + 403 |
|
76 | + ); |
|
77 | + } |
|
78 | 78 | |
79 | - $ret = wp_insert_term( $_POST['tag-name'], $taxonomy, $_POST ); |
|
80 | - $location = 'edit-tags.php?taxonomy=' . $taxonomy; |
|
81 | - if ( 'post' != $post_type ) |
|
82 | - $location .= '&post_type=' . $post_type; |
|
79 | + $ret = wp_insert_term( $_POST['tag-name'], $taxonomy, $_POST ); |
|
80 | + $location = 'edit-tags.php?taxonomy=' . $taxonomy; |
|
81 | + if ( 'post' != $post_type ) |
|
82 | + $location .= '&post_type=' . $post_type; |
|
83 | 83 | |
84 | - if ( $referer && false !== strpos( $referer, 'edit-tags.php' ) ) { |
|
85 | - $location = $referer; |
|
86 | - } |
|
84 | + if ( $referer && false !== strpos( $referer, 'edit-tags.php' ) ) { |
|
85 | + $location = $referer; |
|
86 | + } |
|
87 | 87 | |
88 | - if ( $ret && !is_wp_error( $ret ) ) |
|
89 | - $location = add_query_arg( 'message', 1, $location ); |
|
90 | - else |
|
91 | - $location = add_query_arg( array( 'error' => true, 'message' => 4 ), $location ); |
|
88 | + if ( $ret && !is_wp_error( $ret ) ) |
|
89 | + $location = add_query_arg( 'message', 1, $location ); |
|
90 | + else |
|
91 | + $location = add_query_arg( array( 'error' => true, 'message' => 4 ), $location ); |
|
92 | 92 | |
93 | - break; |
|
93 | + break; |
|
94 | 94 | |
95 | -case 'delete': |
|
96 | - $location = 'edit-tags.php?taxonomy=' . $taxonomy; |
|
97 | - if ( 'post' != $post_type ) |
|
98 | - $location .= '&post_type=' . $post_type; |
|
95 | + case 'delete': |
|
96 | + $location = 'edit-tags.php?taxonomy=' . $taxonomy; |
|
97 | + if ( 'post' != $post_type ) |
|
98 | + $location .= '&post_type=' . $post_type; |
|
99 | 99 | |
100 | - if ( $referer && false !== strpos( $referer, 'edit-tags.php' ) ) { |
|
101 | - $location = $referer; |
|
102 | - } |
|
100 | + if ( $referer && false !== strpos( $referer, 'edit-tags.php' ) ) { |
|
101 | + $location = $referer; |
|
102 | + } |
|
103 | 103 | |
104 | - if ( ! isset( $_REQUEST['tag_ID'] ) ) { |
|
105 | - break; |
|
106 | - } |
|
104 | + if ( ! isset( $_REQUEST['tag_ID'] ) ) { |
|
105 | + break; |
|
106 | + } |
|
107 | 107 | |
108 | - $tag_ID = (int) $_REQUEST['tag_ID']; |
|
109 | - check_admin_referer( 'delete-tag_' . $tag_ID ); |
|
108 | + $tag_ID = (int) $_REQUEST['tag_ID']; |
|
109 | + check_admin_referer( 'delete-tag_' . $tag_ID ); |
|
110 | 110 | |
111 | - if ( ! current_user_can( $tax->cap->delete_terms ) ) { |
|
112 | - wp_die( |
|
113 | - '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . |
|
114 | - '<p>' . __( 'Sorry, you are not allowed to delete this item.' ) . '</p>', |
|
115 | - 403 |
|
116 | - ); |
|
117 | - } |
|
111 | + if ( ! current_user_can( $tax->cap->delete_terms ) ) { |
|
112 | + wp_die( |
|
113 | + '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . |
|
114 | + '<p>' . __( 'Sorry, you are not allowed to delete this item.' ) . '</p>', |
|
115 | + 403 |
|
116 | + ); |
|
117 | + } |
|
118 | 118 | |
119 | - wp_delete_term( $tag_ID, $taxonomy ); |
|
119 | + wp_delete_term( $tag_ID, $taxonomy ); |
|
120 | 120 | |
121 | - $location = add_query_arg( 'message', 2, $location ); |
|
121 | + $location = add_query_arg( 'message', 2, $location ); |
|
122 | 122 | |
123 | - break; |
|
123 | + break; |
|
124 | 124 | |
125 | -case 'bulk-delete': |
|
126 | - check_admin_referer( 'bulk-tags' ); |
|
125 | + case 'bulk-delete': |
|
126 | + check_admin_referer( 'bulk-tags' ); |
|
127 | 127 | |
128 | - if ( ! current_user_can( $tax->cap->delete_terms ) ) { |
|
129 | - wp_die( |
|
130 | - '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . |
|
131 | - '<p>' . __( 'Sorry, you are not allowed to delete these items.' ) . '</p>', |
|
132 | - 403 |
|
133 | - ); |
|
134 | - } |
|
128 | + if ( ! current_user_can( $tax->cap->delete_terms ) ) { |
|
129 | + wp_die( |
|
130 | + '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . |
|
131 | + '<p>' . __( 'Sorry, you are not allowed to delete these items.' ) . '</p>', |
|
132 | + 403 |
|
133 | + ); |
|
134 | + } |
|
135 | 135 | |
136 | - $tags = (array) $_REQUEST['delete_tags']; |
|
137 | - foreach ( $tags as $tag_ID ) { |
|
138 | - wp_delete_term( $tag_ID, $taxonomy ); |
|
139 | - } |
|
140 | - |
|
141 | - $location = 'edit-tags.php?taxonomy=' . $taxonomy; |
|
142 | - if ( 'post' != $post_type ) |
|
143 | - $location .= '&post_type=' . $post_type; |
|
144 | - if ( $referer && false !== strpos( $referer, 'edit-tags.php' ) ) { |
|
145 | - $location = $referer; |
|
146 | - } |
|
136 | + $tags = (array) $_REQUEST['delete_tags']; |
|
137 | + foreach ( $tags as $tag_ID ) { |
|
138 | + wp_delete_term( $tag_ID, $taxonomy ); |
|
139 | + } |
|
147 | 140 | |
148 | - $location = add_query_arg( 'message', 6, $location ); |
|
141 | + $location = 'edit-tags.php?taxonomy=' . $taxonomy; |
|
142 | + if ( 'post' != $post_type ) |
|
143 | + $location .= '&post_type=' . $post_type; |
|
144 | + if ( $referer && false !== strpos( $referer, 'edit-tags.php' ) ) { |
|
145 | + $location = $referer; |
|
146 | + } |
|
149 | 147 | |
150 | - break; |
|
148 | + $location = add_query_arg( 'message', 6, $location ); |
|
151 | 149 | |
152 | -case 'edit': |
|
153 | - if ( ! isset( $_REQUEST['tag_ID'] ) ) { |
|
154 | 150 | break; |
155 | - } |
|
156 | 151 | |
157 | - $term_id = (int) $_REQUEST['tag_ID']; |
|
158 | - $term = get_term( $term_id ); |
|
152 | + case 'edit': |
|
153 | + if ( ! isset( $_REQUEST['tag_ID'] ) ) { |
|
154 | + break; |
|
155 | + } |
|
159 | 156 | |
160 | - if ( ! $term instanceof WP_Term ) { |
|
161 | - wp_die( __( 'You attempted to edit an item that doesn’t exist. Perhaps it was deleted?' ) ); |
|
162 | - } |
|
157 | + $term_id = (int) $_REQUEST['tag_ID']; |
|
158 | + $term = get_term( $term_id ); |
|
163 | 159 | |
164 | - wp_redirect( esc_url_raw( get_edit_term_link( $term_id, $taxonomy, $post_type ) ) ); |
|
165 | - exit; |
|
160 | + if ( ! $term instanceof WP_Term ) { |
|
161 | + wp_die( __( 'You attempted to edit an item that doesn’t exist. Perhaps it was deleted?' ) ); |
|
162 | + } |
|
166 | 163 | |
167 | -case 'editedtag': |
|
168 | - $tag_ID = (int) $_POST['tag_ID']; |
|
169 | - check_admin_referer( 'update-tag_' . $tag_ID ); |
|
164 | + wp_redirect( esc_url_raw( get_edit_term_link( $term_id, $taxonomy, $post_type ) ) ); |
|
165 | + exit; |
|
170 | 166 | |
171 | - if ( ! current_user_can( $tax->cap->edit_terms ) ) { |
|
172 | - wp_die( |
|
173 | - '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . |
|
174 | - '<p>' . __( 'Sorry, you are not allowed to edit this item.' ) . '</p>', |
|
175 | - 403 |
|
176 | - ); |
|
177 | - } |
|
167 | + case 'editedtag': |
|
168 | + $tag_ID = (int) $_POST['tag_ID']; |
|
169 | + check_admin_referer( 'update-tag_' . $tag_ID ); |
|
178 | 170 | |
179 | - $tag = get_term( $tag_ID, $taxonomy ); |
|
180 | - if ( ! $tag ) |
|
181 | - wp_die( __( 'You attempted to edit an item that doesn’t exist. Perhaps it was deleted?' ) ); |
|
171 | + if ( ! current_user_can( $tax->cap->edit_terms ) ) { |
|
172 | + wp_die( |
|
173 | + '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . |
|
174 | + '<p>' . __( 'Sorry, you are not allowed to edit this item.' ) . '</p>', |
|
175 | + 403 |
|
176 | + ); |
|
177 | + } |
|
182 | 178 | |
183 | - $ret = wp_update_term( $tag_ID, $taxonomy, $_POST ); |
|
179 | + $tag = get_term( $tag_ID, $taxonomy ); |
|
180 | + if ( ! $tag ) |
|
181 | + wp_die( __( 'You attempted to edit an item that doesn’t exist. Perhaps it was deleted?' ) ); |
|
184 | 182 | |
185 | - $location = 'edit-tags.php?taxonomy=' . $taxonomy; |
|
186 | - if ( 'post' != $post_type ) |
|
187 | - $location .= '&post_type=' . $post_type; |
|
183 | + $ret = wp_update_term( $tag_ID, $taxonomy, $_POST ); |
|
188 | 184 | |
189 | - if ( $referer && false !== strpos( $referer, 'edit-tags.php' ) ) { |
|
190 | - $location = $referer; |
|
191 | - } |
|
185 | + $location = 'edit-tags.php?taxonomy=' . $taxonomy; |
|
186 | + if ( 'post' != $post_type ) |
|
187 | + $location .= '&post_type=' . $post_type; |
|
192 | 188 | |
193 | - if ( $ret && !is_wp_error( $ret ) ) |
|
194 | - $location = add_query_arg( 'message', 3, $location ); |
|
195 | - else |
|
196 | - $location = add_query_arg( array( 'error' => true, 'message' => 5 ), $location ); |
|
197 | - break; |
|
189 | + if ( $referer && false !== strpos( $referer, 'edit-tags.php' ) ) { |
|
190 | + $location = $referer; |
|
191 | + } |
|
192 | + |
|
193 | + if ( $ret && !is_wp_error( $ret ) ) |
|
194 | + $location = add_query_arg( 'message', 3, $location ); |
|
195 | + else |
|
196 | + $location = add_query_arg( array( 'error' => true, 'message' => 5 ), $location ); |
|
197 | + break; |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | if ( ! $location && ! empty( $_REQUEST['_wp_http_referer'] ) ) { |
@@ -7,24 +7,24 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | /** WordPress Administration Bootstrap */ |
10 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
10 | +require_once(dirname(__FILE__).'/admin.php'); |
|
11 | 11 | |
12 | -if ( ! $taxnow ) |
|
13 | - wp_die( __( 'Invalid taxonomy.' ) ); |
|
12 | +if ( ! $taxnow) |
|
13 | + wp_die(__('Invalid taxonomy.')); |
|
14 | 14 | |
15 | -$tax = get_taxonomy( $taxnow ); |
|
15 | +$tax = get_taxonomy($taxnow); |
|
16 | 16 | |
17 | -if ( ! $tax ) |
|
18 | - wp_die( __( 'Invalid taxonomy.' ) ); |
|
17 | +if ( ! $tax) |
|
18 | + wp_die(__('Invalid taxonomy.')); |
|
19 | 19 | |
20 | -if ( ! in_array( $tax->name, get_taxonomies( array( 'show_ui' => true ) ) ) ) { |
|
21 | - wp_die( __( 'Sorry, you are not allowed to manage these items.' ) ); |
|
20 | +if ( ! in_array($tax->name, get_taxonomies(array('show_ui' => true)))) { |
|
21 | + wp_die(__('Sorry, you are not allowed to manage these items.')); |
|
22 | 22 | } |
23 | 23 | |
24 | -if ( ! current_user_can( $tax->cap->manage_terms ) ) { |
|
24 | +if ( ! current_user_can($tax->cap->manage_terms)) { |
|
25 | 25 | wp_die( |
26 | - '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . |
|
27 | - '<p>' . __( 'Sorry, you are not allowed to manage these items.' ) . '</p>', |
|
26 | + '<h1>'.__('Cheatin’ uh?').'</h1>'. |
|
27 | + '<p>'.__('Sorry, you are not allowed to manage these items.').'</p>', |
|
28 | 28 | 403 |
29 | 29 | ); |
30 | 30 | } |
@@ -41,10 +41,10 @@ discard block |
||
41 | 41 | |
42 | 42 | $title = $tax->labels->name; |
43 | 43 | |
44 | -if ( 'post' != $post_type ) { |
|
45 | - $parent_file = ( 'attachment' == $post_type ) ? 'upload.php' : "edit.php?post_type=$post_type"; |
|
44 | +if ('post' != $post_type) { |
|
45 | + $parent_file = ('attachment' == $post_type) ? 'upload.php' : "edit.php?post_type=$post_type"; |
|
46 | 46 | $submenu_file = "edit-tags.php?taxonomy=$taxonomy&post_type=$post_type"; |
47 | -} elseif ( 'link_category' == $tax->name ) { |
|
47 | +} elseif ('link_category' == $tax->name) { |
|
48 | 48 | $parent_file = 'link-manager.php'; |
49 | 49 | $submenu_file = 'edit-tags.php?taxonomy=link_category'; |
50 | 50 | } else { |
@@ -52,158 +52,158 @@ discard block |
||
52 | 52 | $submenu_file = "edit-tags.php?taxonomy=$taxonomy"; |
53 | 53 | } |
54 | 54 | |
55 | -add_screen_option( 'per_page', array( 'default' => 20, 'option' => 'edit_' . $tax->name . '_per_page' ) ); |
|
55 | +add_screen_option('per_page', array('default' => 20, 'option' => 'edit_'.$tax->name.'_per_page')); |
|
56 | 56 | |
57 | -get_current_screen()->set_screen_reader_content( array( |
|
57 | +get_current_screen()->set_screen_reader_content(array( |
|
58 | 58 | 'heading_pagination' => $tax->labels->items_list_navigation, |
59 | 59 | 'heading_list' => $tax->labels->items_list, |
60 | -) ); |
|
60 | +)); |
|
61 | 61 | |
62 | 62 | $location = false; |
63 | 63 | $referer = wp_get_referer(); |
64 | 64 | |
65 | -switch ( $wp_list_table->current_action() ) { |
|
65 | +switch ($wp_list_table->current_action()) { |
|
66 | 66 | |
67 | 67 | case 'add-tag': |
68 | 68 | |
69 | - check_admin_referer( 'add-tag', '_wpnonce_add-tag' ); |
|
69 | + check_admin_referer('add-tag', '_wpnonce_add-tag'); |
|
70 | 70 | |
71 | - if ( ! current_user_can( $tax->cap->edit_terms ) ) { |
|
71 | + if ( ! current_user_can($tax->cap->edit_terms)) { |
|
72 | 72 | wp_die( |
73 | - '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . |
|
74 | - '<p>' . __( 'Sorry, you are not allowed to add this item.' ) . '</p>', |
|
73 | + '<h1>'.__('Cheatin’ uh?').'</h1>'. |
|
74 | + '<p>'.__('Sorry, you are not allowed to add this item.').'</p>', |
|
75 | 75 | 403 |
76 | 76 | ); |
77 | 77 | } |
78 | 78 | |
79 | - $ret = wp_insert_term( $_POST['tag-name'], $taxonomy, $_POST ); |
|
80 | - $location = 'edit-tags.php?taxonomy=' . $taxonomy; |
|
81 | - if ( 'post' != $post_type ) |
|
82 | - $location .= '&post_type=' . $post_type; |
|
79 | + $ret = wp_insert_term($_POST['tag-name'], $taxonomy, $_POST); |
|
80 | + $location = 'edit-tags.php?taxonomy='.$taxonomy; |
|
81 | + if ('post' != $post_type) |
|
82 | + $location .= '&post_type='.$post_type; |
|
83 | 83 | |
84 | - if ( $referer && false !== strpos( $referer, 'edit-tags.php' ) ) { |
|
84 | + if ($referer && false !== strpos($referer, 'edit-tags.php')) { |
|
85 | 85 | $location = $referer; |
86 | 86 | } |
87 | 87 | |
88 | - if ( $ret && !is_wp_error( $ret ) ) |
|
89 | - $location = add_query_arg( 'message', 1, $location ); |
|
88 | + if ($ret && ! is_wp_error($ret)) |
|
89 | + $location = add_query_arg('message', 1, $location); |
|
90 | 90 | else |
91 | - $location = add_query_arg( array( 'error' => true, 'message' => 4 ), $location ); |
|
91 | + $location = add_query_arg(array('error' => true, 'message' => 4), $location); |
|
92 | 92 | |
93 | 93 | break; |
94 | 94 | |
95 | 95 | case 'delete': |
96 | - $location = 'edit-tags.php?taxonomy=' . $taxonomy; |
|
97 | - if ( 'post' != $post_type ) |
|
98 | - $location .= '&post_type=' . $post_type; |
|
96 | + $location = 'edit-tags.php?taxonomy='.$taxonomy; |
|
97 | + if ('post' != $post_type) |
|
98 | + $location .= '&post_type='.$post_type; |
|
99 | 99 | |
100 | - if ( $referer && false !== strpos( $referer, 'edit-tags.php' ) ) { |
|
100 | + if ($referer && false !== strpos($referer, 'edit-tags.php')) { |
|
101 | 101 | $location = $referer; |
102 | 102 | } |
103 | 103 | |
104 | - if ( ! isset( $_REQUEST['tag_ID'] ) ) { |
|
104 | + if ( ! isset($_REQUEST['tag_ID'])) { |
|
105 | 105 | break; |
106 | 106 | } |
107 | 107 | |
108 | 108 | $tag_ID = (int) $_REQUEST['tag_ID']; |
109 | - check_admin_referer( 'delete-tag_' . $tag_ID ); |
|
109 | + check_admin_referer('delete-tag_'.$tag_ID); |
|
110 | 110 | |
111 | - if ( ! current_user_can( $tax->cap->delete_terms ) ) { |
|
111 | + if ( ! current_user_can($tax->cap->delete_terms)) { |
|
112 | 112 | wp_die( |
113 | - '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . |
|
114 | - '<p>' . __( 'Sorry, you are not allowed to delete this item.' ) . '</p>', |
|
113 | + '<h1>'.__('Cheatin’ uh?').'</h1>'. |
|
114 | + '<p>'.__('Sorry, you are not allowed to delete this item.').'</p>', |
|
115 | 115 | 403 |
116 | 116 | ); |
117 | 117 | } |
118 | 118 | |
119 | - wp_delete_term( $tag_ID, $taxonomy ); |
|
119 | + wp_delete_term($tag_ID, $taxonomy); |
|
120 | 120 | |
121 | - $location = add_query_arg( 'message', 2, $location ); |
|
121 | + $location = add_query_arg('message', 2, $location); |
|
122 | 122 | |
123 | 123 | break; |
124 | 124 | |
125 | 125 | case 'bulk-delete': |
126 | - check_admin_referer( 'bulk-tags' ); |
|
126 | + check_admin_referer('bulk-tags'); |
|
127 | 127 | |
128 | - if ( ! current_user_can( $tax->cap->delete_terms ) ) { |
|
128 | + if ( ! current_user_can($tax->cap->delete_terms)) { |
|
129 | 129 | wp_die( |
130 | - '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . |
|
131 | - '<p>' . __( 'Sorry, you are not allowed to delete these items.' ) . '</p>', |
|
130 | + '<h1>'.__('Cheatin’ uh?').'</h1>'. |
|
131 | + '<p>'.__('Sorry, you are not allowed to delete these items.').'</p>', |
|
132 | 132 | 403 |
133 | 133 | ); |
134 | 134 | } |
135 | 135 | |
136 | 136 | $tags = (array) $_REQUEST['delete_tags']; |
137 | - foreach ( $tags as $tag_ID ) { |
|
138 | - wp_delete_term( $tag_ID, $taxonomy ); |
|
137 | + foreach ($tags as $tag_ID) { |
|
138 | + wp_delete_term($tag_ID, $taxonomy); |
|
139 | 139 | } |
140 | 140 | |
141 | - $location = 'edit-tags.php?taxonomy=' . $taxonomy; |
|
142 | - if ( 'post' != $post_type ) |
|
143 | - $location .= '&post_type=' . $post_type; |
|
144 | - if ( $referer && false !== strpos( $referer, 'edit-tags.php' ) ) { |
|
141 | + $location = 'edit-tags.php?taxonomy='.$taxonomy; |
|
142 | + if ('post' != $post_type) |
|
143 | + $location .= '&post_type='.$post_type; |
|
144 | + if ($referer && false !== strpos($referer, 'edit-tags.php')) { |
|
145 | 145 | $location = $referer; |
146 | 146 | } |
147 | 147 | |
148 | - $location = add_query_arg( 'message', 6, $location ); |
|
148 | + $location = add_query_arg('message', 6, $location); |
|
149 | 149 | |
150 | 150 | break; |
151 | 151 | |
152 | 152 | case 'edit': |
153 | - if ( ! isset( $_REQUEST['tag_ID'] ) ) { |
|
153 | + if ( ! isset($_REQUEST['tag_ID'])) { |
|
154 | 154 | break; |
155 | 155 | } |
156 | 156 | |
157 | 157 | $term_id = (int) $_REQUEST['tag_ID']; |
158 | - $term = get_term( $term_id ); |
|
158 | + $term = get_term($term_id); |
|
159 | 159 | |
160 | - if ( ! $term instanceof WP_Term ) { |
|
161 | - wp_die( __( 'You attempted to edit an item that doesn’t exist. Perhaps it was deleted?' ) ); |
|
160 | + if ( ! $term instanceof WP_Term) { |
|
161 | + wp_die(__('You attempted to edit an item that doesn’t exist. Perhaps it was deleted?')); |
|
162 | 162 | } |
163 | 163 | |
164 | - wp_redirect( esc_url_raw( get_edit_term_link( $term_id, $taxonomy, $post_type ) ) ); |
|
164 | + wp_redirect(esc_url_raw(get_edit_term_link($term_id, $taxonomy, $post_type))); |
|
165 | 165 | exit; |
166 | 166 | |
167 | 167 | case 'editedtag': |
168 | 168 | $tag_ID = (int) $_POST['tag_ID']; |
169 | - check_admin_referer( 'update-tag_' . $tag_ID ); |
|
169 | + check_admin_referer('update-tag_'.$tag_ID); |
|
170 | 170 | |
171 | - if ( ! current_user_can( $tax->cap->edit_terms ) ) { |
|
171 | + if ( ! current_user_can($tax->cap->edit_terms)) { |
|
172 | 172 | wp_die( |
173 | - '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . |
|
174 | - '<p>' . __( 'Sorry, you are not allowed to edit this item.' ) . '</p>', |
|
173 | + '<h1>'.__('Cheatin’ uh?').'</h1>'. |
|
174 | + '<p>'.__('Sorry, you are not allowed to edit this item.').'</p>', |
|
175 | 175 | 403 |
176 | 176 | ); |
177 | 177 | } |
178 | 178 | |
179 | - $tag = get_term( $tag_ID, $taxonomy ); |
|
180 | - if ( ! $tag ) |
|
181 | - wp_die( __( 'You attempted to edit an item that doesn’t exist. Perhaps it was deleted?' ) ); |
|
179 | + $tag = get_term($tag_ID, $taxonomy); |
|
180 | + if ( ! $tag) |
|
181 | + wp_die(__('You attempted to edit an item that doesn’t exist. Perhaps it was deleted?')); |
|
182 | 182 | |
183 | - $ret = wp_update_term( $tag_ID, $taxonomy, $_POST ); |
|
183 | + $ret = wp_update_term($tag_ID, $taxonomy, $_POST); |
|
184 | 184 | |
185 | - $location = 'edit-tags.php?taxonomy=' . $taxonomy; |
|
186 | - if ( 'post' != $post_type ) |
|
187 | - $location .= '&post_type=' . $post_type; |
|
185 | + $location = 'edit-tags.php?taxonomy='.$taxonomy; |
|
186 | + if ('post' != $post_type) |
|
187 | + $location .= '&post_type='.$post_type; |
|
188 | 188 | |
189 | - if ( $referer && false !== strpos( $referer, 'edit-tags.php' ) ) { |
|
189 | + if ($referer && false !== strpos($referer, 'edit-tags.php')) { |
|
190 | 190 | $location = $referer; |
191 | 191 | } |
192 | 192 | |
193 | - if ( $ret && !is_wp_error( $ret ) ) |
|
194 | - $location = add_query_arg( 'message', 3, $location ); |
|
193 | + if ($ret && ! is_wp_error($ret)) |
|
194 | + $location = add_query_arg('message', 3, $location); |
|
195 | 195 | else |
196 | - $location = add_query_arg( array( 'error' => true, 'message' => 5 ), $location ); |
|
196 | + $location = add_query_arg(array('error' => true, 'message' => 5), $location); |
|
197 | 197 | break; |
198 | 198 | } |
199 | 199 | |
200 | -if ( ! $location && ! empty( $_REQUEST['_wp_http_referer'] ) ) { |
|
201 | - $location = remove_query_arg( array('_wp_http_referer', '_wpnonce'), wp_unslash($_SERVER['REQUEST_URI']) ); |
|
200 | +if ( ! $location && ! empty($_REQUEST['_wp_http_referer'])) { |
|
201 | + $location = remove_query_arg(array('_wp_http_referer', '_wpnonce'), wp_unslash($_SERVER['REQUEST_URI'])); |
|
202 | 202 | } |
203 | 203 | |
204 | -if ( $location ) { |
|
205 | - if ( ! empty( $_REQUEST['paged'] ) ) { |
|
206 | - $location = add_query_arg( 'paged', (int) $_REQUEST['paged'], $location ); |
|
204 | +if ($location) { |
|
205 | + if ( ! empty($_REQUEST['paged'])) { |
|
206 | + $location = add_query_arg('paged', (int) $_REQUEST['paged'], $location); |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | /** |
@@ -214,119 +214,119 @@ discard block |
||
214 | 214 | * @param string $location The destination URL. |
215 | 215 | * @param object $tax The taxonomy object. |
216 | 216 | */ |
217 | - wp_redirect( apply_filters( 'redirect_term_location', $location, $tax ) ); |
|
217 | + wp_redirect(apply_filters('redirect_term_location', $location, $tax)); |
|
218 | 218 | exit; |
219 | 219 | } |
220 | 220 | |
221 | 221 | $wp_list_table->prepare_items(); |
222 | -$total_pages = $wp_list_table->get_pagination_arg( 'total_pages' ); |
|
222 | +$total_pages = $wp_list_table->get_pagination_arg('total_pages'); |
|
223 | 223 | |
224 | -if ( $pagenum > $total_pages && $total_pages > 0 ) { |
|
225 | - wp_redirect( add_query_arg( 'paged', $total_pages ) ); |
|
224 | +if ($pagenum > $total_pages && $total_pages > 0) { |
|
225 | + wp_redirect(add_query_arg('paged', $total_pages)); |
|
226 | 226 | exit; |
227 | 227 | } |
228 | 228 | |
229 | 229 | wp_enqueue_script('admin-tags'); |
230 | -if ( current_user_can($tax->cap->edit_terms) ) |
|
230 | +if (current_user_can($tax->cap->edit_terms)) |
|
231 | 231 | wp_enqueue_script('inline-edit-tax'); |
232 | 232 | |
233 | -if ( 'category' == $taxonomy || 'link_category' == $taxonomy || 'post_tag' == $taxonomy ) { |
|
234 | - $help =''; |
|
235 | - if ( 'category' == $taxonomy ) |
|
236 | - $help = '<p>' . sprintf(__( 'You can use categories to define sections of your site and group related posts. The default category is “Uncategorized” until you change it in your <a href="%s">writing settings</a>.' ) , 'options-writing.php' ) . '</p>'; |
|
237 | - elseif ( 'link_category' == $taxonomy ) |
|
238 | - $help = '<p>' . __( 'You can create groups of links by using Link Categories. Link Category names must be unique and Link Categories are separate from the categories you use for posts.' ) . '</p>'; |
|
233 | +if ('category' == $taxonomy || 'link_category' == $taxonomy || 'post_tag' == $taxonomy) { |
|
234 | + $help = ''; |
|
235 | + if ('category' == $taxonomy) |
|
236 | + $help = '<p>'.sprintf(__('You can use categories to define sections of your site and group related posts. The default category is “Uncategorized” until you change it in your <a href="%s">writing settings</a>.'), 'options-writing.php').'</p>'; |
|
237 | + elseif ('link_category' == $taxonomy) |
|
238 | + $help = '<p>'.__('You can create groups of links by using Link Categories. Link Category names must be unique and Link Categories are separate from the categories you use for posts.').'</p>'; |
|
239 | 239 | else |
240 | - $help = '<p>' . __( 'You can assign keywords to your posts using <strong>tags</strong>. Unlike categories, tags have no hierarchy, meaning there’s no relationship from one tag to another.' ) . '</p>'; |
|
240 | + $help = '<p>'.__('You can assign keywords to your posts using <strong>tags</strong>. Unlike categories, tags have no hierarchy, meaning there’s no relationship from one tag to another.').'</p>'; |
|
241 | 241 | |
242 | - if ( 'link_category' == $taxonomy ) |
|
243 | - $help .= '<p>' . __( 'You can delete Link Categories in the Bulk Action pull-down, but that action does not delete the links within the category. Instead, it moves them to the default Link Category.' ) . '</p>'; |
|
242 | + if ('link_category' == $taxonomy) |
|
243 | + $help .= '<p>'.__('You can delete Link Categories in the Bulk Action pull-down, but that action does not delete the links within the category. Instead, it moves them to the default Link Category.').'</p>'; |
|
244 | 244 | else |
245 | - $help .='<p>' . __( 'What’s the difference between categories and tags? Normally, tags are ad-hoc keywords that identify important information in your post (names, subjects, etc) that may or may not recur in other posts, while categories are pre-determined sections. If you think of your site like a book, the categories are like the Table of Contents and the tags are like the terms in the index.' ) . '</p>'; |
|
245 | + $help .= '<p>'.__('What’s the difference between categories and tags? Normally, tags are ad-hoc keywords that identify important information in your post (names, subjects, etc) that may or may not recur in other posts, while categories are pre-determined sections. If you think of your site like a book, the categories are like the Table of Contents and the tags are like the terms in the index.').'</p>'; |
|
246 | 246 | |
247 | - get_current_screen()->add_help_tab( array( |
|
247 | + get_current_screen()->add_help_tab(array( |
|
248 | 248 | 'id' => 'overview', |
249 | 249 | 'title' => __('Overview'), |
250 | 250 | 'content' => $help, |
251 | - ) ); |
|
251 | + )); |
|
252 | 252 | |
253 | - if ( 'category' == $taxonomy || 'post_tag' == $taxonomy ) { |
|
254 | - if ( 'category' == $taxonomy ) |
|
255 | - $help = '<p>' . __( 'When adding a new category on this screen, you’ll fill in the following fields:' ) . '</p>'; |
|
253 | + if ('category' == $taxonomy || 'post_tag' == $taxonomy) { |
|
254 | + if ('category' == $taxonomy) |
|
255 | + $help = '<p>'.__('When adding a new category on this screen, you’ll fill in the following fields:').'</p>'; |
|
256 | 256 | else |
257 | - $help = '<p>' . __( 'When adding a new tag on this screen, you’ll fill in the following fields:' ) . '</p>'; |
|
257 | + $help = '<p>'.__('When adding a new tag on this screen, you’ll fill in the following fields:').'</p>'; |
|
258 | 258 | |
259 | - $help .= '<ul>' . |
|
260 | - '<li>' . __( '<strong>Name</strong> — The name is how it appears on your site.' ) . '</li>'; |
|
259 | + $help .= '<ul>'. |
|
260 | + '<li>'.__('<strong>Name</strong> — The name is how it appears on your site.').'</li>'; |
|
261 | 261 | |
262 | - if ( ! global_terms_enabled() ) |
|
263 | - $help .= '<li>' . __( '<strong>Slug</strong> — The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.' ) . '</li>'; |
|
262 | + if ( ! global_terms_enabled()) |
|
263 | + $help .= '<li>'.__('<strong>Slug</strong> — The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.').'</li>'; |
|
264 | 264 | |
265 | - if ( 'category' == $taxonomy ) |
|
266 | - $help .= '<li>' . __( '<strong>Parent</strong> — Categories, unlike tags, can have a hierarchy. You might have a Jazz category, and under that have child categories for Bebop and Big Band. Totally optional. To create a subcategory, just choose another category from the Parent dropdown.' ) . '</li>'; |
|
265 | + if ('category' == $taxonomy) |
|
266 | + $help .= '<li>'.__('<strong>Parent</strong> — Categories, unlike tags, can have a hierarchy. You might have a Jazz category, and under that have child categories for Bebop and Big Band. Totally optional. To create a subcategory, just choose another category from the Parent dropdown.').'</li>'; |
|
267 | 267 | |
268 | - $help .= '<li>' . __( '<strong>Description</strong> — The description is not prominent by default; however, some themes may display it.' ) . '</li>' . |
|
269 | - '</ul>' . |
|
270 | - '<p>' . __( 'You can change the display of this screen using the Screen Options tab to set how many items are displayed per screen and to display/hide columns in the table.' ) . '</p>'; |
|
268 | + $help .= '<li>'.__('<strong>Description</strong> — The description is not prominent by default; however, some themes may display it.').'</li>'. |
|
269 | + '</ul>'. |
|
270 | + '<p>'.__('You can change the display of this screen using the Screen Options tab to set how many items are displayed per screen and to display/hide columns in the table.').'</p>'; |
|
271 | 271 | |
272 | - get_current_screen()->add_help_tab( array( |
|
272 | + get_current_screen()->add_help_tab(array( |
|
273 | 273 | 'id' => 'adding-terms', |
274 | - 'title' => 'category' == $taxonomy ? __( 'Adding Categories' ) : __( 'Adding Tags' ), |
|
274 | + 'title' => 'category' == $taxonomy ? __('Adding Categories') : __('Adding Tags'), |
|
275 | 275 | 'content' => $help, |
276 | - ) ); |
|
276 | + )); |
|
277 | 277 | } |
278 | 278 | |
279 | - $help = '<p><strong>' . __( 'For more information:' ) . '</strong></p>'; |
|
279 | + $help = '<p><strong>'.__('For more information:').'</strong></p>'; |
|
280 | 280 | |
281 | - if ( 'category' == $taxonomy ) |
|
282 | - $help .= '<p>' . __( '<a href="https://codex.wordpress.org/Posts_Categories_Screen" target="_blank">Documentation on Categories</a>' ) . '</p>'; |
|
283 | - elseif ( 'link_category' == $taxonomy ) |
|
284 | - $help .= '<p>' . __( '<a href="https://codex.wordpress.org/Links_Link_Categories_Screen" target="_blank">Documentation on Link Categories</a>' ) . '</p>'; |
|
281 | + if ('category' == $taxonomy) |
|
282 | + $help .= '<p>'.__('<a href="https://codex.wordpress.org/Posts_Categories_Screen" target="_blank">Documentation on Categories</a>').'</p>'; |
|
283 | + elseif ('link_category' == $taxonomy) |
|
284 | + $help .= '<p>'.__('<a href="https://codex.wordpress.org/Links_Link_Categories_Screen" target="_blank">Documentation on Link Categories</a>').'</p>'; |
|
285 | 285 | else |
286 | - $help .= '<p>' . __( '<a href="https://codex.wordpress.org/Posts_Tags_Screen" target="_blank">Documentation on Tags</a>' ) . '</p>'; |
|
286 | + $help .= '<p>'.__('<a href="https://codex.wordpress.org/Posts_Tags_Screen" target="_blank">Documentation on Tags</a>').'</p>'; |
|
287 | 287 | |
288 | - $help .= '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'; |
|
288 | + $help .= '<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>'; |
|
289 | 289 | |
290 | - get_current_screen()->set_help_sidebar( $help ); |
|
290 | + get_current_screen()->set_help_sidebar($help); |
|
291 | 291 | |
292 | - unset( $help ); |
|
292 | + unset($help); |
|
293 | 293 | } |
294 | 294 | |
295 | -require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
|
295 | +require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
296 | 296 | |
297 | -if ( ! current_user_can( $tax->cap->edit_terms ) ) { |
|
297 | +if ( ! current_user_can($tax->cap->edit_terms)) { |
|
298 | 298 | wp_die( |
299 | - '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . |
|
300 | - '<p>' . __( 'Sorry, you are not allowed to edit this item.' ) . '</p>', |
|
299 | + '<h1>'.__('Cheatin’ uh?').'</h1>'. |
|
300 | + '<p>'.__('Sorry, you are not allowed to edit this item.').'</p>', |
|
301 | 301 | 403 |
302 | 302 | ); |
303 | 303 | } |
304 | 304 | |
305 | 305 | /** Also used by the Edit Tag form */ |
306 | -require_once( ABSPATH . 'wp-admin/includes/edit-tag-messages.php' ); |
|
306 | +require_once(ABSPATH.'wp-admin/includes/edit-tag-messages.php'); |
|
307 | 307 | |
308 | -$class = ( isset( $_REQUEST['error'] ) ) ? 'error' : 'updated'; |
|
308 | +$class = (isset($_REQUEST['error'])) ? 'error' : 'updated'; |
|
309 | 309 | |
310 | -if ( is_plugin_active( 'wpcat2tag-importer/wpcat2tag-importer.php' ) ) { |
|
311 | - $import_link = admin_url( 'admin.php?import=wpcat2tag' ); |
|
310 | +if (is_plugin_active('wpcat2tag-importer/wpcat2tag-importer.php')) { |
|
311 | + $import_link = admin_url('admin.php?import=wpcat2tag'); |
|
312 | 312 | } else { |
313 | - $import_link = admin_url( 'import.php' ); |
|
313 | + $import_link = admin_url('import.php'); |
|
314 | 314 | } |
315 | 315 | |
316 | 316 | ?> |
317 | 317 | |
318 | 318 | <div class="wrap nosubsub"> |
319 | -<h1><?php echo esc_html( $title ); |
|
320 | -if ( isset( $_REQUEST['s'] ) && strlen( $_REQUEST['s'] ) ) { |
|
319 | +<h1><?php echo esc_html($title); |
|
320 | +if (isset($_REQUEST['s']) && strlen($_REQUEST['s'])) { |
|
321 | 321 | /* translators: %s: search keywords */ |
322 | - printf( '<span class="subtitle">' . __( 'Search results for “%s”' ) . '</span>', esc_html( wp_unslash( $_REQUEST['s'] ) ) ); |
|
322 | + printf('<span class="subtitle">'.__('Search results for “%s”').'</span>', esc_html(wp_unslash($_REQUEST['s']))); |
|
323 | 323 | } |
324 | 324 | ?> |
325 | 325 | </h1> |
326 | 326 | |
327 | -<?php if ( $message ) : ?> |
|
327 | +<?php if ($message) : ?> |
|
328 | 328 | <div id="message" class="<?php echo $class; ?> notice is-dismissible"><p><?php echo $message; ?></p></div> |
329 | -<?php $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'message', 'error' ), $_SERVER['REQUEST_URI'] ); |
|
329 | +<?php $_SERVER['REQUEST_URI'] = remove_query_arg(array('message', 'error'), $_SERVER['REQUEST_URI']); |
|
330 | 330 | endif; ?> |
331 | 331 | <div id="ajax-response"></div> |
332 | 332 | |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | <input type="hidden" name="taxonomy" value="<?php echo esc_attr($taxonomy); ?>" /> |
335 | 335 | <input type="hidden" name="post_type" value="<?php echo esc_attr($post_type); ?>" /> |
336 | 336 | |
337 | -<?php $wp_list_table->search_box( $tax->labels->search_items, 'tag' ); ?> |
|
337 | +<?php $wp_list_table->search_box($tax->labels->search_items, 'tag'); ?> |
|
338 | 338 | |
339 | 339 | </form> |
340 | 340 | |
@@ -345,8 +345,8 @@ discard block |
||
345 | 345 | |
346 | 346 | <?php |
347 | 347 | |
348 | -if ( current_user_can($tax->cap->edit_terms) ) { |
|
349 | - if ( 'category' == $taxonomy ) { |
|
348 | +if (current_user_can($tax->cap->edit_terms)) { |
|
349 | + if ('category' == $taxonomy) { |
|
350 | 350 | /** |
351 | 351 | * Fires before the Add Category form. |
352 | 352 | * |
@@ -355,8 +355,8 @@ discard block |
||
355 | 355 | * |
356 | 356 | * @param object $arg Optional arguments cast to an object. |
357 | 357 | */ |
358 | - do_action( 'add_category_form_pre', (object) array( 'parent' => 0 ) ); |
|
359 | - } elseif ( 'link_category' == $taxonomy ) { |
|
358 | + do_action('add_category_form_pre', (object) array('parent' => 0)); |
|
359 | + } elseif ('link_category' == $taxonomy) { |
|
360 | 360 | /** |
361 | 361 | * Fires before the link category form. |
362 | 362 | * |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | * |
366 | 366 | * @param object $arg Optional arguments cast to an object. |
367 | 367 | */ |
368 | - do_action( 'add_link_category_form_pre', (object) array( 'parent' => 0 ) ); |
|
368 | + do_action('add_link_category_form_pre', (object) array('parent' => 0)); |
|
369 | 369 | } else { |
370 | 370 | /** |
371 | 371 | * Fires before the Add Tag form. |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | * |
376 | 376 | * @param string $taxonomy The taxonomy slug. |
377 | 377 | */ |
378 | - do_action( 'add_tag_form_pre', $taxonomy ); |
|
378 | + do_action('add_tag_form_pre', $taxonomy); |
|
379 | 379 | } |
380 | 380 | |
381 | 381 | /** |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | * |
388 | 388 | * @param string $taxonomy The taxonomy slug. |
389 | 389 | */ |
390 | - do_action( "{$taxonomy}_pre_add_form", $taxonomy ); |
|
390 | + do_action("{$taxonomy}_pre_add_form", $taxonomy); |
|
391 | 391 | ?> |
392 | 392 | |
393 | 393 | <div class="form-wrap"> |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | * |
402 | 402 | * @since 3.7.0 |
403 | 403 | */ |
404 | -do_action( "{$taxonomy}_term_new_form_tag" ); |
|
404 | +do_action("{$taxonomy}_term_new_form_tag"); |
|
405 | 405 | ?>> |
406 | 406 | <input type="hidden" name="action" value="add-tag" /> |
407 | 407 | <input type="hidden" name="screen" value="<?php echo esc_attr($current_screen->id); ?>" /> |
@@ -410,20 +410,20 @@ discard block |
||
410 | 410 | <?php wp_nonce_field('add-tag', '_wpnonce_add-tag'); ?> |
411 | 411 | |
412 | 412 | <div class="form-field form-required term-name-wrap"> |
413 | - <label for="tag-name"><?php _ex( 'Name', 'term name' ); ?></label> |
|
413 | + <label for="tag-name"><?php _ex('Name', 'term name'); ?></label> |
|
414 | 414 | <input name="tag-name" id="tag-name" type="text" value="" size="40" aria-required="true" /> |
415 | 415 | <p><?php _e('The name is how it appears on your site.'); ?></p> |
416 | 416 | </div> |
417 | -<?php if ( ! global_terms_enabled() ) : ?> |
|
417 | +<?php if ( ! global_terms_enabled()) : ?> |
|
418 | 418 | <div class="form-field term-slug-wrap"> |
419 | - <label for="tag-slug"><?php _e( 'Slug' ); ?></label> |
|
419 | + <label for="tag-slug"><?php _e('Slug'); ?></label> |
|
420 | 420 | <input name="slug" id="tag-slug" type="text" value="" size="40" /> |
421 | 421 | <p><?php _e('The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?></p> |
422 | 422 | </div> |
423 | 423 | <?php endif; // global_terms_enabled() ?> |
424 | -<?php if ( is_taxonomy_hierarchical($taxonomy) ) : ?> |
|
424 | +<?php if (is_taxonomy_hierarchical($taxonomy)) : ?> |
|
425 | 425 | <div class="form-field term-parent-wrap"> |
426 | - <label for="parent"><?php _ex( 'Parent', 'term parent' ); ?></label> |
|
426 | + <label for="parent"><?php _ex('Parent', 'term parent'); ?></label> |
|
427 | 427 | <?php |
428 | 428 | $dropdown_args = array( |
429 | 429 | 'hide_empty' => 0, |
@@ -432,7 +432,7 @@ discard block |
||
432 | 432 | 'name' => 'parent', |
433 | 433 | 'orderby' => 'name', |
434 | 434 | 'hierarchical' => true, |
435 | - 'show_option_none' => __( 'None' ), |
|
435 | + 'show_option_none' => __('None'), |
|
436 | 436 | ); |
437 | 437 | |
438 | 438 | /** |
@@ -456,23 +456,23 @@ discard block |
||
456 | 456 | * @param string $taxonomy The taxonomy slug. |
457 | 457 | * @param string $context Filter context. Accepts 'new' or 'edit'. |
458 | 458 | */ |
459 | - $dropdown_args = apply_filters( 'taxonomy_parent_dropdown_args', $dropdown_args, $taxonomy, 'new' ); |
|
459 | + $dropdown_args = apply_filters('taxonomy_parent_dropdown_args', $dropdown_args, $taxonomy, 'new'); |
|
460 | 460 | |
461 | - wp_dropdown_categories( $dropdown_args ); |
|
461 | + wp_dropdown_categories($dropdown_args); |
|
462 | 462 | ?> |
463 | - <?php if ( 'category' == $taxonomy ) : // @todo: Generic text for hierarchical taxonomies ?> |
|
463 | + <?php if ('category' == $taxonomy) : // @todo: Generic text for hierarchical taxonomies ?> |
|
464 | 464 | <p><?php _e('Categories, unlike tags, can have a hierarchy. You might have a Jazz category, and under that have children categories for Bebop and Big Band. Totally optional.'); ?></p> |
465 | 465 | <?php endif; ?> |
466 | 466 | </div> |
467 | 467 | <?php endif; // is_taxonomy_hierarchical() ?> |
468 | 468 | <div class="form-field term-description-wrap"> |
469 | - <label for="tag-description"><?php _e( 'Description' ); ?></label> |
|
469 | + <label for="tag-description"><?php _e('Description'); ?></label> |
|
470 | 470 | <textarea name="description" id="tag-description" rows="5" cols="40"></textarea> |
471 | 471 | <p><?php _e('The description is not prominent by default; however, some themes may show it.'); ?></p> |
472 | 472 | </div> |
473 | 473 | |
474 | 474 | <?php |
475 | -if ( ! is_taxonomy_hierarchical( $taxonomy ) ) { |
|
475 | +if ( ! is_taxonomy_hierarchical($taxonomy)) { |
|
476 | 476 | /** |
477 | 477 | * Fires after the Add Tag form fields for non-hierarchical taxonomies. |
478 | 478 | * |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | * |
481 | 481 | * @param string $taxonomy The taxonomy slug. |
482 | 482 | */ |
483 | - do_action( 'add_tag_form_fields', $taxonomy ); |
|
483 | + do_action('add_tag_form_fields', $taxonomy); |
|
484 | 484 | } |
485 | 485 | |
486 | 486 | /** |
@@ -492,11 +492,11 @@ discard block |
||
492 | 492 | * |
493 | 493 | * @param string $taxonomy The taxonomy slug. |
494 | 494 | */ |
495 | -do_action( "{$taxonomy}_add_form_fields", $taxonomy ); |
|
495 | +do_action("{$taxonomy}_add_form_fields", $taxonomy); |
|
496 | 496 | |
497 | -submit_button( $tax->labels->add_new_item ); |
|
497 | +submit_button($tax->labels->add_new_item); |
|
498 | 498 | |
499 | -if ( 'category' == $taxonomy ) { |
|
499 | +if ('category' == $taxonomy) { |
|
500 | 500 | /** |
501 | 501 | * Fires at the end of the Edit Category form. |
502 | 502 | * |
@@ -505,8 +505,8 @@ discard block |
||
505 | 505 | * |
506 | 506 | * @param object $arg Optional arguments cast to an object. |
507 | 507 | */ |
508 | - do_action( 'edit_category_form', (object) array( 'parent' => 0 ) ); |
|
509 | -} elseif ( 'link_category' == $taxonomy ) { |
|
508 | + do_action('edit_category_form', (object) array('parent' => 0)); |
|
509 | +} elseif ('link_category' == $taxonomy) { |
|
510 | 510 | /** |
511 | 511 | * Fires at the end of the Edit Link form. |
512 | 512 | * |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | * |
516 | 516 | * @param object $arg Optional arguments cast to an object. |
517 | 517 | */ |
518 | - do_action( 'edit_link_category_form', (object) array( 'parent' => 0 ) ); |
|
518 | + do_action('edit_link_category_form', (object) array('parent' => 0)); |
|
519 | 519 | } else { |
520 | 520 | /** |
521 | 521 | * Fires at the end of the Add Tag form. |
@@ -525,7 +525,7 @@ discard block |
||
525 | 525 | * |
526 | 526 | * @param string $taxonomy The taxonomy slug. |
527 | 527 | */ |
528 | - do_action( 'add_tag_form', $taxonomy ); |
|
528 | + do_action('add_tag_form', $taxonomy); |
|
529 | 529 | } |
530 | 530 | |
531 | 531 | /** |
@@ -537,23 +537,23 @@ discard block |
||
537 | 537 | * |
538 | 538 | * @param string $taxonomy The taxonomy slug. |
539 | 539 | */ |
540 | -do_action( "{$taxonomy}_add_form", $taxonomy ); |
|
540 | +do_action("{$taxonomy}_add_form", $taxonomy); |
|
541 | 541 | ?> |
542 | 542 | </form></div> |
543 | 543 | <?php } |
544 | 544 | |
545 | -if ( ! is_null( $tax->labels->popular_items ) ) { |
|
546 | - if ( current_user_can( $tax->cap->edit_terms ) ) { |
|
547 | - $tag_cloud = wp_tag_cloud( array( 'taxonomy' => $taxonomy, 'post_type' => $post_type, 'echo' => false, 'link' => 'edit' ) ); |
|
545 | +if ( ! is_null($tax->labels->popular_items)) { |
|
546 | + if (current_user_can($tax->cap->edit_terms)) { |
|
547 | + $tag_cloud = wp_tag_cloud(array('taxonomy' => $taxonomy, 'post_type' => $post_type, 'echo' => false, 'link' => 'edit')); |
|
548 | 548 | } else { |
549 | - $tag_cloud = wp_tag_cloud( array( 'taxonomy' => $taxonomy, 'echo' => false ) ); |
|
549 | + $tag_cloud = wp_tag_cloud(array('taxonomy' => $taxonomy, 'echo' => false)); |
|
550 | 550 | } |
551 | 551 | |
552 | - if ( $tag_cloud ) : |
|
552 | + if ($tag_cloud) : |
|
553 | 553 | ?> |
554 | 554 | <div class="tagcloud"> |
555 | 555 | <h2><?php echo $tax->labels->popular_items; ?></h2> |
556 | -<?php echo $tag_cloud; unset( $tag_cloud ); ?> |
|
556 | +<?php echo $tag_cloud; unset($tag_cloud); ?> |
|
557 | 557 | </div> |
558 | 558 | <?php |
559 | 559 | endif; |
@@ -567,33 +567,33 @@ discard block |
||
567 | 567 | <div id="col-right"> |
568 | 568 | <div class="col-wrap"> |
569 | 569 | <form id="posts-filter" method="post"> |
570 | -<input type="hidden" name="taxonomy" value="<?php echo esc_attr( $taxonomy ); ?>" /> |
|
571 | -<input type="hidden" name="post_type" value="<?php echo esc_attr( $post_type ); ?>" /> |
|
570 | +<input type="hidden" name="taxonomy" value="<?php echo esc_attr($taxonomy); ?>" /> |
|
571 | +<input type="hidden" name="post_type" value="<?php echo esc_attr($post_type); ?>" /> |
|
572 | 572 | |
573 | 573 | <?php $wp_list_table->display(); ?> |
574 | 574 | |
575 | 575 | </form> |
576 | 576 | |
577 | -<?php if ( 'category' == $taxonomy ) : ?> |
|
577 | +<?php if ('category' == $taxonomy) : ?> |
|
578 | 578 | <div class="form-wrap edit-term-notes"> |
579 | 579 | <p> |
580 | 580 | <?php |
581 | - echo '<strong>' . __( 'Note:' ) . '</strong><br />'; |
|
581 | + echo '<strong>'.__('Note:').'</strong><br />'; |
|
582 | 582 | printf( |
583 | 583 | /* translators: %s: default category */ |
584 | - __( 'Deleting a category does not delete the posts in that category. Instead, posts that were only assigned to the deleted category are set to the category %s.' ), |
|
584 | + __('Deleting a category does not delete the posts in that category. Instead, posts that were only assigned to the deleted category are set to the category %s.'), |
|
585 | 585 | /** This filter is documented in wp-includes/category-template.php */ |
586 | - '<strong>' . apply_filters( 'the_category', get_cat_name( get_option( 'default_category') ) ) . '</strong>' |
|
586 | + '<strong>'.apply_filters('the_category', get_cat_name(get_option('default_category'))).'</strong>' |
|
587 | 587 | ); |
588 | 588 | ?> |
589 | 589 | </p> |
590 | -<?php if ( current_user_can( 'import' ) ) : ?> |
|
591 | -<p><?php printf( __( 'Categories can be selectively converted to tags using the <a href="%s">category to tag converter</a>.' ), esc_url( $import_link ) ) ?></p> |
|
590 | +<?php if (current_user_can('import')) : ?> |
|
591 | +<p><?php printf(__('Categories can be selectively converted to tags using the <a href="%s">category to tag converter</a>.'), esc_url($import_link)) ?></p> |
|
592 | 592 | <?php endif; ?> |
593 | 593 | </div> |
594 | -<?php elseif ( 'post_tag' == $taxonomy && current_user_can( 'import' ) ) : ?> |
|
594 | +<?php elseif ('post_tag' == $taxonomy && current_user_can('import')) : ?> |
|
595 | 595 | <div class="form-wrap edit-term-notes"> |
596 | -<p><?php printf( __( 'Tags can be selectively converted to categories using the <a href="%s">tag to category converter</a>.' ), esc_url( $import_link ) ) ;?></p> |
|
596 | +<p><?php printf(__('Tags can be selectively converted to categories using the <a href="%s">tag to category converter</a>.'), esc_url($import_link)); ?></p> |
|
597 | 597 | </div> |
598 | 598 | <?php endif; |
599 | 599 | |
@@ -606,7 +606,7 @@ discard block |
||
606 | 606 | * |
607 | 607 | * @param string $taxonomy The taxonomy name. |
608 | 608 | */ |
609 | -do_action( "after-{$taxonomy}-table", $taxonomy ); |
|
609 | +do_action("after-{$taxonomy}-table", $taxonomy); |
|
610 | 610 | ?> |
611 | 611 | |
612 | 612 | </div> |
@@ -615,7 +615,7 @@ discard block |
||
615 | 615 | </div><!-- /col-container --> |
616 | 616 | </div><!-- /wrap --> |
617 | 617 | |
618 | -<?php if ( ! wp_is_mobile() ) : ?> |
|
618 | +<?php if ( ! wp_is_mobile()) : ?> |
|
619 | 619 | <script type="text/javascript"> |
620 | 620 | try{document.forms.addtag['tag-name'].focus();}catch(e){} |
621 | 621 | </script> |
@@ -624,4 +624,4 @@ discard block |
||
624 | 624 | |
625 | 625 | $wp_list_table->inline_edit(); |
626 | 626 | |
627 | -include( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
627 | +include(ABSPATH.'wp-admin/admin-footer.php'); |
@@ -15,87 +15,87 @@ discard block |
||
15 | 15 | wp_reset_vars(array('action')); |
16 | 16 | |
17 | 17 | switch ( $action ) { |
18 | -case 'editattachment' : |
|
19 | - $attachment_id = (int) $_POST['attachment_id']; |
|
20 | - check_admin_referer('media-form'); |
|
21 | - |
|
22 | - if ( !current_user_can('edit_post', $attachment_id) ) |
|
23 | - wp_die ( __('Sorry, you are not allowed to edit this attachment.') ); |
|
24 | - |
|
25 | - $errors = media_upload_form_handler(); |
|
26 | - |
|
27 | - if ( empty($errors) ) { |
|
28 | - $location = 'media.php'; |
|
29 | - if ( $referer = wp_get_original_referer() ) { |
|
30 | - if ( false !== strpos($referer, 'upload.php') || ( url_to_postid($referer) == $attachment_id ) ) |
|
31 | - $location = $referer; |
|
32 | - } |
|
33 | - if ( false !== strpos($location, 'upload.php') ) { |
|
34 | - $location = remove_query_arg('message', $location); |
|
35 | - $location = add_query_arg('posted', $attachment_id, $location); |
|
36 | - } elseif ( false !== strpos($location, 'media.php') ) { |
|
37 | - $location = add_query_arg('message', 'updated', $location); |
|
18 | + case 'editattachment' : |
|
19 | + $attachment_id = (int) $_POST['attachment_id']; |
|
20 | + check_admin_referer('media-form'); |
|
21 | + |
|
22 | + if ( !current_user_can('edit_post', $attachment_id) ) |
|
23 | + wp_die ( __('Sorry, you are not allowed to edit this attachment.') ); |
|
24 | + |
|
25 | + $errors = media_upload_form_handler(); |
|
26 | + |
|
27 | + if ( empty($errors) ) { |
|
28 | + $location = 'media.php'; |
|
29 | + if ( $referer = wp_get_original_referer() ) { |
|
30 | + if ( false !== strpos($referer, 'upload.php') || ( url_to_postid($referer) == $attachment_id ) ) |
|
31 | + $location = $referer; |
|
32 | + } |
|
33 | + if ( false !== strpos($location, 'upload.php') ) { |
|
34 | + $location = remove_query_arg('message', $location); |
|
35 | + $location = add_query_arg('posted', $attachment_id, $location); |
|
36 | + } elseif ( false !== strpos($location, 'media.php') ) { |
|
37 | + $location = add_query_arg('message', 'updated', $location); |
|
38 | + } |
|
39 | + wp_redirect($location); |
|
40 | + exit; |
|
38 | 41 | } |
39 | - wp_redirect($location); |
|
40 | - exit; |
|
41 | - } |
|
42 | 42 | |
43 | - // No break. |
|
44 | -case 'edit' : |
|
45 | - $title = __('Edit Media'); |
|
43 | + // No break. |
|
44 | + case 'edit' : |
|
45 | + $title = __('Edit Media'); |
|
46 | 46 | |
47 | - if ( empty($errors) ) |
|
48 | - $errors = null; |
|
47 | + if ( empty($errors) ) |
|
48 | + $errors = null; |
|
49 | 49 | |
50 | - if ( empty( $_GET['attachment_id'] ) ) { |
|
51 | - wp_redirect( admin_url('upload.php') ); |
|
52 | - exit(); |
|
53 | - } |
|
54 | - $att_id = (int) $_GET['attachment_id']; |
|
55 | - |
|
56 | - if ( !current_user_can('edit_post', $att_id) ) |
|
57 | - wp_die ( __('Sorry, you are not allowed to edit this attachment.') ); |
|
58 | - |
|
59 | - $att = get_post($att_id); |
|
60 | - |
|
61 | - if ( empty($att->ID) ) wp_die( __('You attempted to edit an attachment that doesn’t exist. Perhaps it was deleted?') ); |
|
62 | - if ( 'attachment' !== $att->post_type ) wp_die( __('You attempted to edit an item that isn’t an attachment. Please go back and try again.') ); |
|
63 | - if ( $att->post_status == 'trash' ) wp_die( __('You can’t edit this attachment because it is in the Trash. Please move it out of the Trash and try again.') ); |
|
64 | - |
|
65 | - add_filter('attachment_fields_to_edit', 'media_single_attachment_fields_to_edit', 10, 2); |
|
66 | - |
|
67 | - wp_enqueue_script( 'wp-ajax-response' ); |
|
68 | - wp_enqueue_script('image-edit'); |
|
69 | - wp_enqueue_style('imgareaselect'); |
|
70 | - |
|
71 | - get_current_screen()->add_help_tab( array( |
|
72 | - 'id' => 'overview', |
|
73 | - 'title' => __('Overview'), |
|
74 | - 'content' => |
|
75 | - '<p>' . __('This screen allows you to edit five fields for metadata in a file within the media library.') . '</p>' . |
|
76 | - '<p>' . __('For images only, you can click on Edit Image under the thumbnail to expand out an inline image editor with icons for cropping, rotating, or flipping the image as well as for undoing and redoing. The boxes on the right give you more options for scaling the image, for cropping it, and for cropping the thumbnail in a different way than you crop the original image. You can click on Help in those boxes to get more information.') . '</p>' . |
|
77 | - '<p>' . __('Note that you crop the image by clicking on it (the Crop icon is already selected) and dragging the cropping frame to select the desired part. Then click Save to retain the cropping.') . '</p>' . |
|
78 | - '<p>' . __('Remember to click Update Media to save metadata entered or changed.') . '</p>' |
|
79 | - ) ); |
|
80 | - |
|
81 | - get_current_screen()->set_help_sidebar( |
|
82 | - '<p><strong>' . __('For more information:') . '</strong></p>' . |
|
83 | - '<p>' . __('<a href="https://codex.wordpress.org/Media_Add_New_Screen#Edit_Media" target="_blank">Documentation on Edit Media</a>') . '</p>' . |
|
84 | - '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' |
|
85 | - ); |
|
86 | - |
|
87 | - require( ABSPATH . 'wp-admin/admin-header.php' ); |
|
88 | - |
|
89 | - $parent_file = 'upload.php'; |
|
90 | - $message = ''; |
|
91 | - $class = ''; |
|
92 | - if ( isset($_GET['message']) ) { |
|
93 | - switch ( $_GET['message'] ) { |
|
50 | + if ( empty( $_GET['attachment_id'] ) ) { |
|
51 | + wp_redirect( admin_url('upload.php') ); |
|
52 | + exit(); |
|
53 | + } |
|
54 | + $att_id = (int) $_GET['attachment_id']; |
|
55 | + |
|
56 | + if ( !current_user_can('edit_post', $att_id) ) |
|
57 | + wp_die ( __('Sorry, you are not allowed to edit this attachment.') ); |
|
58 | + |
|
59 | + $att = get_post($att_id); |
|
60 | + |
|
61 | + if ( empty($att->ID) ) wp_die( __('You attempted to edit an attachment that doesn’t exist. Perhaps it was deleted?') ); |
|
62 | + if ( 'attachment' !== $att->post_type ) wp_die( __('You attempted to edit an item that isn’t an attachment. Please go back and try again.') ); |
|
63 | + if ( $att->post_status == 'trash' ) wp_die( __('You can’t edit this attachment because it is in the Trash. Please move it out of the Trash and try again.') ); |
|
64 | + |
|
65 | + add_filter('attachment_fields_to_edit', 'media_single_attachment_fields_to_edit', 10, 2); |
|
66 | + |
|
67 | + wp_enqueue_script( 'wp-ajax-response' ); |
|
68 | + wp_enqueue_script('image-edit'); |
|
69 | + wp_enqueue_style('imgareaselect'); |
|
70 | + |
|
71 | + get_current_screen()->add_help_tab( array( |
|
72 | + 'id' => 'overview', |
|
73 | + 'title' => __('Overview'), |
|
74 | + 'content' => |
|
75 | + '<p>' . __('This screen allows you to edit five fields for metadata in a file within the media library.') . '</p>' . |
|
76 | + '<p>' . __('For images only, you can click on Edit Image under the thumbnail to expand out an inline image editor with icons for cropping, rotating, or flipping the image as well as for undoing and redoing. The boxes on the right give you more options for scaling the image, for cropping it, and for cropping the thumbnail in a different way than you crop the original image. You can click on Help in those boxes to get more information.') . '</p>' . |
|
77 | + '<p>' . __('Note that you crop the image by clicking on it (the Crop icon is already selected) and dragging the cropping frame to select the desired part. Then click Save to retain the cropping.') . '</p>' . |
|
78 | + '<p>' . __('Remember to click Update Media to save metadata entered or changed.') . '</p>' |
|
79 | + ) ); |
|
80 | + |
|
81 | + get_current_screen()->set_help_sidebar( |
|
82 | + '<p><strong>' . __('For more information:') . '</strong></p>' . |
|
83 | + '<p>' . __('<a href="https://codex.wordpress.org/Media_Add_New_Screen#Edit_Media" target="_blank">Documentation on Edit Media</a>') . '</p>' . |
|
84 | + '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' |
|
85 | + ); |
|
86 | + |
|
87 | + require( ABSPATH . 'wp-admin/admin-header.php' ); |
|
88 | + |
|
89 | + $parent_file = 'upload.php'; |
|
90 | + $message = ''; |
|
91 | + $class = ''; |
|
92 | + if ( isset($_GET['message']) ) { |
|
93 | + switch ( $_GET['message'] ) { |
|
94 | 94 | case 'updated' : |
95 | 95 | $message = __('Media file updated.'); |
96 | 96 | $class = 'updated'; |
97 | 97 | break; |
98 | - } |
|
98 | + } |
|
99 | 99 | } |
100 | 100 | if ( $message ) |
101 | 101 | echo "<div id='message' class='$class'><p>$message</p></div>\n"; |
@@ -139,8 +139,8 @@ discard block |
||
139 | 139 | |
140 | 140 | exit; |
141 | 141 | |
142 | -default: |
|
143 | - wp_redirect( admin_url('upload.php') ); |
|
144 | - exit; |
|
142 | + default: |
|
143 | + wp_redirect( admin_url('upload.php') ); |
|
144 | + exit; |
|
145 | 145 | |
146 | 146 | } |
@@ -7,33 +7,33 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | /** Load WordPress Administration Bootstrap */ |
10 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
10 | +require_once(dirname(__FILE__).'/admin.php'); |
|
11 | 11 | |
12 | 12 | $parent_file = 'upload.php'; |
13 | 13 | $submenu_file = 'upload.php'; |
14 | 14 | |
15 | 15 | wp_reset_vars(array('action')); |
16 | 16 | |
17 | -switch ( $action ) { |
|
17 | +switch ($action) { |
|
18 | 18 | case 'editattachment' : |
19 | 19 | $attachment_id = (int) $_POST['attachment_id']; |
20 | 20 | check_admin_referer('media-form'); |
21 | 21 | |
22 | - if ( !current_user_can('edit_post', $attachment_id) ) |
|
23 | - wp_die ( __('Sorry, you are not allowed to edit this attachment.') ); |
|
22 | + if ( ! current_user_can('edit_post', $attachment_id)) |
|
23 | + wp_die(__('Sorry, you are not allowed to edit this attachment.')); |
|
24 | 24 | |
25 | 25 | $errors = media_upload_form_handler(); |
26 | 26 | |
27 | - if ( empty($errors) ) { |
|
27 | + if (empty($errors)) { |
|
28 | 28 | $location = 'media.php'; |
29 | - if ( $referer = wp_get_original_referer() ) { |
|
30 | - if ( false !== strpos($referer, 'upload.php') || ( url_to_postid($referer) == $attachment_id ) ) |
|
29 | + if ($referer = wp_get_original_referer()) { |
|
30 | + if (false !== strpos($referer, 'upload.php') || (url_to_postid($referer) == $attachment_id)) |
|
31 | 31 | $location = $referer; |
32 | 32 | } |
33 | - if ( false !== strpos($location, 'upload.php') ) { |
|
33 | + if (false !== strpos($location, 'upload.php')) { |
|
34 | 34 | $location = remove_query_arg('message', $location); |
35 | - $location = add_query_arg('posted', $attachment_id, $location); |
|
36 | - } elseif ( false !== strpos($location, 'media.php') ) { |
|
35 | + $location = add_query_arg('posted', $attachment_id, $location); |
|
36 | + } elseif (false !== strpos($location, 'media.php')) { |
|
37 | 37 | $location = add_query_arg('message', 'updated', $location); |
38 | 38 | } |
39 | 39 | wp_redirect($location); |
@@ -44,60 +44,60 @@ discard block |
||
44 | 44 | case 'edit' : |
45 | 45 | $title = __('Edit Media'); |
46 | 46 | |
47 | - if ( empty($errors) ) |
|
47 | + if (empty($errors)) |
|
48 | 48 | $errors = null; |
49 | 49 | |
50 | - if ( empty( $_GET['attachment_id'] ) ) { |
|
51 | - wp_redirect( admin_url('upload.php') ); |
|
50 | + if (empty($_GET['attachment_id'])) { |
|
51 | + wp_redirect(admin_url('upload.php')); |
|
52 | 52 | exit(); |
53 | 53 | } |
54 | 54 | $att_id = (int) $_GET['attachment_id']; |
55 | 55 | |
56 | - if ( !current_user_can('edit_post', $att_id) ) |
|
57 | - wp_die ( __('Sorry, you are not allowed to edit this attachment.') ); |
|
56 | + if ( ! current_user_can('edit_post', $att_id)) |
|
57 | + wp_die(__('Sorry, you are not allowed to edit this attachment.')); |
|
58 | 58 | |
59 | 59 | $att = get_post($att_id); |
60 | 60 | |
61 | - if ( empty($att->ID) ) wp_die( __('You attempted to edit an attachment that doesn’t exist. Perhaps it was deleted?') ); |
|
62 | - if ( 'attachment' !== $att->post_type ) wp_die( __('You attempted to edit an item that isn’t an attachment. Please go back and try again.') ); |
|
63 | - if ( $att->post_status == 'trash' ) wp_die( __('You can’t edit this attachment because it is in the Trash. Please move it out of the Trash and try again.') ); |
|
61 | + if (empty($att->ID)) wp_die(__('You attempted to edit an attachment that doesn’t exist. Perhaps it was deleted?')); |
|
62 | + if ('attachment' !== $att->post_type) wp_die(__('You attempted to edit an item that isn’t an attachment. Please go back and try again.')); |
|
63 | + if ($att->post_status == 'trash') wp_die(__('You can’t edit this attachment because it is in the Trash. Please move it out of the Trash and try again.')); |
|
64 | 64 | |
65 | 65 | add_filter('attachment_fields_to_edit', 'media_single_attachment_fields_to_edit', 10, 2); |
66 | 66 | |
67 | - wp_enqueue_script( 'wp-ajax-response' ); |
|
67 | + wp_enqueue_script('wp-ajax-response'); |
|
68 | 68 | wp_enqueue_script('image-edit'); |
69 | 69 | wp_enqueue_style('imgareaselect'); |
70 | 70 | |
71 | - get_current_screen()->add_help_tab( array( |
|
71 | + get_current_screen()->add_help_tab(array( |
|
72 | 72 | 'id' => 'overview', |
73 | 73 | 'title' => __('Overview'), |
74 | 74 | 'content' => |
75 | - '<p>' . __('This screen allows you to edit five fields for metadata in a file within the media library.') . '</p>' . |
|
76 | - '<p>' . __('For images only, you can click on Edit Image under the thumbnail to expand out an inline image editor with icons for cropping, rotating, or flipping the image as well as for undoing and redoing. The boxes on the right give you more options for scaling the image, for cropping it, and for cropping the thumbnail in a different way than you crop the original image. You can click on Help in those boxes to get more information.') . '</p>' . |
|
77 | - '<p>' . __('Note that you crop the image by clicking on it (the Crop icon is already selected) and dragging the cropping frame to select the desired part. Then click Save to retain the cropping.') . '</p>' . |
|
78 | - '<p>' . __('Remember to click Update Media to save metadata entered or changed.') . '</p>' |
|
79 | - ) ); |
|
75 | + '<p>'.__('This screen allows you to edit five fields for metadata in a file within the media library.').'</p>'. |
|
76 | + '<p>'.__('For images only, you can click on Edit Image under the thumbnail to expand out an inline image editor with icons for cropping, rotating, or flipping the image as well as for undoing and redoing. The boxes on the right give you more options for scaling the image, for cropping it, and for cropping the thumbnail in a different way than you crop the original image. You can click on Help in those boxes to get more information.').'</p>'. |
|
77 | + '<p>'.__('Note that you crop the image by clicking on it (the Crop icon is already selected) and dragging the cropping frame to select the desired part. Then click Save to retain the cropping.').'</p>'. |
|
78 | + '<p>'.__('Remember to click Update Media to save metadata entered or changed.').'</p>' |
|
79 | + )); |
|
80 | 80 | |
81 | 81 | get_current_screen()->set_help_sidebar( |
82 | - '<p><strong>' . __('For more information:') . '</strong></p>' . |
|
83 | - '<p>' . __('<a href="https://codex.wordpress.org/Media_Add_New_Screen#Edit_Media" target="_blank">Documentation on Edit Media</a>') . '</p>' . |
|
84 | - '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' |
|
82 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
83 | + '<p>'.__('<a href="https://codex.wordpress.org/Media_Add_New_Screen#Edit_Media" target="_blank">Documentation on Edit Media</a>').'</p>'. |
|
84 | + '<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>' |
|
85 | 85 | ); |
86 | 86 | |
87 | - require( ABSPATH . 'wp-admin/admin-header.php' ); |
|
87 | + require(ABSPATH.'wp-admin/admin-header.php'); |
|
88 | 88 | |
89 | 89 | $parent_file = 'upload.php'; |
90 | 90 | $message = ''; |
91 | 91 | $class = ''; |
92 | - if ( isset($_GET['message']) ) { |
|
93 | - switch ( $_GET['message'] ) { |
|
92 | + if (isset($_GET['message'])) { |
|
93 | + switch ($_GET['message']) { |
|
94 | 94 | case 'updated' : |
95 | 95 | $message = __('Media file updated.'); |
96 | 96 | $class = 'updated'; |
97 | 97 | break; |
98 | 98 | } |
99 | 99 | } |
100 | - if ( $message ) |
|
100 | + if ($message) |
|
101 | 101 | echo "<div id='message' class='$class'><p>$message</p></div>\n"; |
102 | 102 | |
103 | 103 | ?> |
@@ -105,24 +105,24 @@ discard block |
||
105 | 105 | <div class="wrap"> |
106 | 106 | <h1> |
107 | 107 | <?php |
108 | -echo esc_html( $title ); |
|
109 | -if ( current_user_can( 'upload_files' ) ) { ?> |
|
108 | +echo esc_html($title); |
|
109 | +if (current_user_can('upload_files')) { ?> |
|
110 | 110 | <a href="media-new.php" class="page-title-action"><?php echo esc_html_x('Add New', 'file'); ?></a> |
111 | 111 | <?php } ?> |
112 | 112 | </h1> |
113 | 113 | |
114 | 114 | <form method="post" class="media-upload-form" id="media-single-form"> |
115 | 115 | <p class="submit" style="padding-bottom: 0;"> |
116 | -<?php submit_button( __( 'Update Media' ), 'primary', 'save', false ); ?> |
|
116 | +<?php submit_button(__('Update Media'), 'primary', 'save', false); ?> |
|
117 | 117 | </p> |
118 | 118 | |
119 | 119 | <div class="media-single"> |
120 | 120 | <div id="media-item-<?php echo $att_id; ?>" class="media-item"> |
121 | -<?php echo get_media_item( $att_id, array( 'toggle' => false, 'send' => false, 'delete' => false, 'show_title' => false, 'errors' => !empty($errors[$att_id]) ? $errors[$att_id] : null ) ); ?> |
|
121 | +<?php echo get_media_item($att_id, array('toggle' => false, 'send' => false, 'delete' => false, 'show_title' => false, 'errors' => ! empty($errors[$att_id]) ? $errors[$att_id] : null)); ?> |
|
122 | 122 | </div> |
123 | 123 | </div> |
124 | 124 | |
125 | -<?php submit_button( __( 'Update Media' ), 'primary', 'save' ); ?> |
|
125 | +<?php submit_button(__('Update Media'), 'primary', 'save'); ?> |
|
126 | 126 | <input type="hidden" name="post_id" id="post_id" value="<?php echo isset($post_id) ? esc_attr($post_id) : ''; ?>" /> |
127 | 127 | <input type="hidden" name="attachment_id" id="attachment_id" value="<?php echo esc_attr($att_id); ?>" /> |
128 | 128 | <input type="hidden" name="action" value="editattachment" /> |
@@ -135,12 +135,12 @@ discard block |
||
135 | 135 | |
136 | 136 | <?php |
137 | 137 | |
138 | - require( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
138 | + require(ABSPATH.'wp-admin/admin-footer.php'); |
|
139 | 139 | |
140 | 140 | exit; |
141 | 141 | |
142 | 142 | default: |
143 | - wp_redirect( admin_url('upload.php') ); |
|
143 | + wp_redirect(admin_url('upload.php')); |
|
144 | 144 | exit; |
145 | 145 | |
146 | 146 | } |
@@ -19,16 +19,18 @@ discard block |
||
19 | 19 | $attachment_id = (int) $_POST['attachment_id']; |
20 | 20 | check_admin_referer('media-form'); |
21 | 21 | |
22 | - if ( !current_user_can('edit_post', $attachment_id) ) |
|
23 | - wp_die ( __('Sorry, you are not allowed to edit this attachment.') ); |
|
22 | + if ( !current_user_can('edit_post', $attachment_id) ) { |
|
23 | + wp_die ( __('Sorry, you are not allowed to edit this attachment.') ); |
|
24 | + } |
|
24 | 25 | |
25 | 26 | $errors = media_upload_form_handler(); |
26 | 27 | |
27 | 28 | if ( empty($errors) ) { |
28 | 29 | $location = 'media.php'; |
29 | 30 | if ( $referer = wp_get_original_referer() ) { |
30 | - if ( false !== strpos($referer, 'upload.php') || ( url_to_postid($referer) == $attachment_id ) ) |
|
31 | - $location = $referer; |
|
31 | + if ( false !== strpos($referer, 'upload.php') || ( url_to_postid($referer) == $attachment_id ) ) { |
|
32 | + $location = $referer; |
|
33 | + } |
|
32 | 34 | } |
33 | 35 | if ( false !== strpos($location, 'upload.php') ) { |
34 | 36 | $location = remove_query_arg('message', $location); |
@@ -44,8 +46,9 @@ discard block |
||
44 | 46 | case 'edit' : |
45 | 47 | $title = __('Edit Media'); |
46 | 48 | |
47 | - if ( empty($errors) ) |
|
48 | - $errors = null; |
|
49 | + if ( empty($errors) ) { |
|
50 | + $errors = null; |
|
51 | + } |
|
49 | 52 | |
50 | 53 | if ( empty( $_GET['attachment_id'] ) ) { |
51 | 54 | wp_redirect( admin_url('upload.php') ); |
@@ -53,14 +56,21 @@ discard block |
||
53 | 56 | } |
54 | 57 | $att_id = (int) $_GET['attachment_id']; |
55 | 58 | |
56 | - if ( !current_user_can('edit_post', $att_id) ) |
|
57 | - wp_die ( __('Sorry, you are not allowed to edit this attachment.') ); |
|
59 | + if ( !current_user_can('edit_post', $att_id) ) { |
|
60 | + wp_die ( __('Sorry, you are not allowed to edit this attachment.') ); |
|
61 | + } |
|
58 | 62 | |
59 | 63 | $att = get_post($att_id); |
60 | 64 | |
61 | - if ( empty($att->ID) ) wp_die( __('You attempted to edit an attachment that doesn’t exist. Perhaps it was deleted?') ); |
|
62 | - if ( 'attachment' !== $att->post_type ) wp_die( __('You attempted to edit an item that isn’t an attachment. Please go back and try again.') ); |
|
63 | - if ( $att->post_status == 'trash' ) wp_die( __('You can’t edit this attachment because it is in the Trash. Please move it out of the Trash and try again.') ); |
|
65 | + if ( empty($att->ID) ) { |
|
66 | + wp_die( __('You attempted to edit an attachment that doesn’t exist. Perhaps it was deleted?') ); |
|
67 | + } |
|
68 | + if ( 'attachment' !== $att->post_type ) { |
|
69 | + wp_die( __('You attempted to edit an item that isn’t an attachment. Please go back and try again.') ); |
|
70 | + } |
|
71 | + if ( $att->post_status == 'trash' ) { |
|
72 | + wp_die( __('You can’t edit this attachment because it is in the Trash. Please move it out of the Trash and try again.') ); |
|
73 | + } |
|
64 | 74 | |
65 | 75 | add_filter('attachment_fields_to_edit', 'media_single_attachment_fields_to_edit', 10, 2); |
66 | 76 | |
@@ -97,8 +107,9 @@ discard block |
||
97 | 107 | break; |
98 | 108 | } |
99 | 109 | } |
100 | - if ( $message ) |
|
101 | - echo "<div id='message' class='$class'><p>$message</p></div>\n"; |
|
110 | + if ( $message ) { |
|
111 | + echo "<div id='message' class='$class'><p>$message</p></div>\n"; |
|
112 | + } |
|
102 | 113 | |
103 | 114 | ?> |
104 | 115 |
@@ -7,11 +7,11 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | /** WordPress Administration Bootstrap */ |
10 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
11 | -if ( ! current_user_can( 'edit_posts' ) ) { |
|
10 | +require_once(dirname(__FILE__).'/admin.php'); |
|
11 | +if ( ! current_user_can('edit_posts')) { |
|
12 | 12 | wp_die( |
13 | - '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . |
|
14 | - '<p>' . __( 'Sorry, you are not allowed to edit comments.' ) . '</p>', |
|
13 | + '<h1>'.__('Cheatin’ uh?').'</h1>'. |
|
14 | + '<p>'.__('Sorry, you are not allowed to edit comments.').'</p>', |
|
15 | 15 | 403 |
16 | 16 | ); |
17 | 17 | } |
@@ -21,90 +21,90 @@ discard block |
||
21 | 21 | |
22 | 22 | $doaction = $wp_list_table->current_action(); |
23 | 23 | |
24 | -if ( $doaction ) { |
|
25 | - check_admin_referer( 'bulk-comments' ); |
|
24 | +if ($doaction) { |
|
25 | + check_admin_referer('bulk-comments'); |
|
26 | 26 | |
27 | - if ( 'delete_all' == $doaction && !empty( $_REQUEST['pagegen_timestamp'] ) ) { |
|
28 | - $comment_status = wp_unslash( $_REQUEST['comment_status'] ); |
|
29 | - $delete_time = wp_unslash( $_REQUEST['pagegen_timestamp'] ); |
|
30 | - $comment_ids = $wpdb->get_col( $wpdb->prepare( "SELECT comment_ID FROM $wpdb->comments WHERE comment_approved = %s AND %s > comment_date_gmt", $comment_status, $delete_time ) ); |
|
27 | + if ('delete_all' == $doaction && ! empty($_REQUEST['pagegen_timestamp'])) { |
|
28 | + $comment_status = wp_unslash($_REQUEST['comment_status']); |
|
29 | + $delete_time = wp_unslash($_REQUEST['pagegen_timestamp']); |
|
30 | + $comment_ids = $wpdb->get_col($wpdb->prepare("SELECT comment_ID FROM $wpdb->comments WHERE comment_approved = %s AND %s > comment_date_gmt", $comment_status, $delete_time)); |
|
31 | 31 | $doaction = 'delete'; |
32 | - } elseif ( isset( $_REQUEST['delete_comments'] ) ) { |
|
32 | + } elseif (isset($_REQUEST['delete_comments'])) { |
|
33 | 33 | $comment_ids = $_REQUEST['delete_comments']; |
34 | - $doaction = ( $_REQUEST['action'] != -1 ) ? $_REQUEST['action'] : $_REQUEST['action2']; |
|
35 | - } elseif ( isset( $_REQUEST['ids'] ) ) { |
|
36 | - $comment_ids = array_map( 'absint', explode( ',', $_REQUEST['ids'] ) ); |
|
37 | - } elseif ( wp_get_referer() ) { |
|
38 | - wp_safe_redirect( wp_get_referer() ); |
|
34 | + $doaction = ($_REQUEST['action'] != -1) ? $_REQUEST['action'] : $_REQUEST['action2']; |
|
35 | + } elseif (isset($_REQUEST['ids'])) { |
|
36 | + $comment_ids = array_map('absint', explode(',', $_REQUEST['ids'])); |
|
37 | + } elseif (wp_get_referer()) { |
|
38 | + wp_safe_redirect(wp_get_referer()); |
|
39 | 39 | exit; |
40 | 40 | } |
41 | 41 | |
42 | 42 | $approved = $unapproved = $spammed = $unspammed = $trashed = $untrashed = $deleted = 0; |
43 | 43 | |
44 | - $redirect_to = remove_query_arg( array( 'trashed', 'untrashed', 'deleted', 'spammed', 'unspammed', 'approved', 'unapproved', 'ids' ), wp_get_referer() ); |
|
45 | - $redirect_to = add_query_arg( 'paged', $pagenum, $redirect_to ); |
|
44 | + $redirect_to = remove_query_arg(array('trashed', 'untrashed', 'deleted', 'spammed', 'unspammed', 'approved', 'unapproved', 'ids'), wp_get_referer()); |
|
45 | + $redirect_to = add_query_arg('paged', $pagenum, $redirect_to); |
|
46 | 46 | |
47 | - wp_defer_comment_counting( true ); |
|
47 | + wp_defer_comment_counting(true); |
|
48 | 48 | |
49 | - foreach ( $comment_ids as $comment_id ) { // Check the permissions on each |
|
50 | - if ( !current_user_can( 'edit_comment', $comment_id ) ) |
|
49 | + foreach ($comment_ids as $comment_id) { // Check the permissions on each |
|
50 | + if ( ! current_user_can('edit_comment', $comment_id)) |
|
51 | 51 | continue; |
52 | 52 | |
53 | - switch ( $doaction ) { |
|
53 | + switch ($doaction) { |
|
54 | 54 | case 'approve' : |
55 | - wp_set_comment_status( $comment_id, 'approve' ); |
|
55 | + wp_set_comment_status($comment_id, 'approve'); |
|
56 | 56 | $approved++; |
57 | 57 | break; |
58 | 58 | case 'unapprove' : |
59 | - wp_set_comment_status( $comment_id, 'hold' ); |
|
59 | + wp_set_comment_status($comment_id, 'hold'); |
|
60 | 60 | $unapproved++; |
61 | 61 | break; |
62 | 62 | case 'spam' : |
63 | - wp_spam_comment( $comment_id ); |
|
63 | + wp_spam_comment($comment_id); |
|
64 | 64 | $spammed++; |
65 | 65 | break; |
66 | 66 | case 'unspam' : |
67 | - wp_unspam_comment( $comment_id ); |
|
67 | + wp_unspam_comment($comment_id); |
|
68 | 68 | $unspammed++; |
69 | 69 | break; |
70 | 70 | case 'trash' : |
71 | - wp_trash_comment( $comment_id ); |
|
71 | + wp_trash_comment($comment_id); |
|
72 | 72 | $trashed++; |
73 | 73 | break; |
74 | 74 | case 'untrash' : |
75 | - wp_untrash_comment( $comment_id ); |
|
75 | + wp_untrash_comment($comment_id); |
|
76 | 76 | $untrashed++; |
77 | 77 | break; |
78 | 78 | case 'delete' : |
79 | - wp_delete_comment( $comment_id ); |
|
79 | + wp_delete_comment($comment_id); |
|
80 | 80 | $deleted++; |
81 | 81 | break; |
82 | 82 | } |
83 | 83 | } |
84 | 84 | |
85 | - wp_defer_comment_counting( false ); |
|
86 | - |
|
87 | - if ( $approved ) |
|
88 | - $redirect_to = add_query_arg( 'approved', $approved, $redirect_to ); |
|
89 | - if ( $unapproved ) |
|
90 | - $redirect_to = add_query_arg( 'unapproved', $unapproved, $redirect_to ); |
|
91 | - if ( $spammed ) |
|
92 | - $redirect_to = add_query_arg( 'spammed', $spammed, $redirect_to ); |
|
93 | - if ( $unspammed ) |
|
94 | - $redirect_to = add_query_arg( 'unspammed', $unspammed, $redirect_to ); |
|
95 | - if ( $trashed ) |
|
96 | - $redirect_to = add_query_arg( 'trashed', $trashed, $redirect_to ); |
|
97 | - if ( $untrashed ) |
|
98 | - $redirect_to = add_query_arg( 'untrashed', $untrashed, $redirect_to ); |
|
99 | - if ( $deleted ) |
|
100 | - $redirect_to = add_query_arg( 'deleted', $deleted, $redirect_to ); |
|
101 | - if ( $trashed || $spammed ) |
|
102 | - $redirect_to = add_query_arg( 'ids', join( ',', $comment_ids ), $redirect_to ); |
|
103 | - |
|
104 | - wp_safe_redirect( $redirect_to ); |
|
85 | + wp_defer_comment_counting(false); |
|
86 | + |
|
87 | + if ($approved) |
|
88 | + $redirect_to = add_query_arg('approved', $approved, $redirect_to); |
|
89 | + if ($unapproved) |
|
90 | + $redirect_to = add_query_arg('unapproved', $unapproved, $redirect_to); |
|
91 | + if ($spammed) |
|
92 | + $redirect_to = add_query_arg('spammed', $spammed, $redirect_to); |
|
93 | + if ($unspammed) |
|
94 | + $redirect_to = add_query_arg('unspammed', $unspammed, $redirect_to); |
|
95 | + if ($trashed) |
|
96 | + $redirect_to = add_query_arg('trashed', $trashed, $redirect_to); |
|
97 | + if ($untrashed) |
|
98 | + $redirect_to = add_query_arg('untrashed', $untrashed, $redirect_to); |
|
99 | + if ($deleted) |
|
100 | + $redirect_to = add_query_arg('deleted', $deleted, $redirect_to); |
|
101 | + if ($trashed || $spammed) |
|
102 | + $redirect_to = add_query_arg('ids', join(',', $comment_ids), $redirect_to); |
|
103 | + |
|
104 | + wp_safe_redirect($redirect_to); |
|
105 | 105 | exit; |
106 | -} elseif ( ! empty( $_GET['_wp_http_referer'] ) ) { |
|
107 | - wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ); |
|
106 | +} elseif ( ! empty($_GET['_wp_http_referer'])) { |
|
107 | + wp_redirect(remove_query_arg(array('_wp_http_referer', '_wpnonce'), wp_unslash($_SERVER['REQUEST_URI']))); |
|
108 | 108 | exit; |
109 | 109 | } |
110 | 110 | |
@@ -113,167 +113,167 @@ discard block |
||
113 | 113 | wp_enqueue_script('admin-comments'); |
114 | 114 | enqueue_comment_hotkeys_js(); |
115 | 115 | |
116 | -if ( $post_id ) { |
|
117 | - $comments_count = wp_count_comments( $post_id ); |
|
118 | - $draft_or_post_title = wp_html_excerpt( _draft_or_post_title( $post_id ), 50, '…' ); |
|
119 | - if ( $comments_count->moderated > 0 ) { |
|
116 | +if ($post_id) { |
|
117 | + $comments_count = wp_count_comments($post_id); |
|
118 | + $draft_or_post_title = wp_html_excerpt(_draft_or_post_title($post_id), 50, '…'); |
|
119 | + if ($comments_count->moderated > 0) { |
|
120 | 120 | /* translators: 1: comments count 2: post title */ |
121 | - $title = sprintf( __( 'Comments (%1$s) on “%2$s”' ), |
|
122 | - number_format_i18n( $comments_count->moderated ), |
|
121 | + $title = sprintf(__('Comments (%1$s) on “%2$s”'), |
|
122 | + number_format_i18n($comments_count->moderated), |
|
123 | 123 | $draft_or_post_title |
124 | 124 | ); |
125 | 125 | } else { |
126 | 126 | /* translators: %s: post title */ |
127 | - $title = sprintf( __( 'Comments on “%s”' ), |
|
127 | + $title = sprintf(__('Comments on “%s”'), |
|
128 | 128 | $draft_or_post_title |
129 | 129 | ); |
130 | 130 | } |
131 | 131 | } else { |
132 | 132 | $comments_count = wp_count_comments(); |
133 | - if ( $comments_count->moderated > 0 ) { |
|
133 | + if ($comments_count->moderated > 0) { |
|
134 | 134 | /* translators: %s: comments count */ |
135 | - $title = sprintf( __( 'Comments (%s)' ), |
|
136 | - number_format_i18n( $comments_count->moderated ) |
|
135 | + $title = sprintf(__('Comments (%s)'), |
|
136 | + number_format_i18n($comments_count->moderated) |
|
137 | 137 | ); |
138 | 138 | } else { |
139 | - $title = __( 'Comments' ); |
|
139 | + $title = __('Comments'); |
|
140 | 140 | } |
141 | 141 | } |
142 | 142 | |
143 | -add_screen_option( 'per_page' ); |
|
143 | +add_screen_option('per_page'); |
|
144 | 144 | |
145 | -get_current_screen()->add_help_tab( array( |
|
145 | +get_current_screen()->add_help_tab(array( |
|
146 | 146 | 'id' => 'overview', |
147 | 147 | 'title' => __('Overview'), |
148 | 148 | 'content' => |
149 | - '<p>' . __( 'You can manage comments made on your site similar to the way you manage posts and other content. This screen is customizable in the same ways as other management screens, and you can act on comments using the on-hover action links or the Bulk Actions.' ) . '</p>' |
|
150 | -) ); |
|
151 | -get_current_screen()->add_help_tab( array( |
|
149 | + '<p>'.__('You can manage comments made on your site similar to the way you manage posts and other content. This screen is customizable in the same ways as other management screens, and you can act on comments using the on-hover action links or the Bulk Actions.').'</p>' |
|
150 | +)); |
|
151 | +get_current_screen()->add_help_tab(array( |
|
152 | 152 | 'id' => 'moderating-comments', |
153 | 153 | 'title' => __('Moderating Comments'), |
154 | 154 | 'content' => |
155 | - '<p>' . __( 'A red bar on the left means the comment is waiting for you to moderate it.' ) . '</p>' . |
|
156 | - '<p>' . __( 'In the <strong>Author</strong> column, in addition to the author’s name, email address, and blog URL, the commenter’s IP address is shown. Clicking on this link will show you all the comments made from this IP address.' ) . '</p>' . |
|
157 | - '<p>' . __( 'In the <strong>Comment</strong> column, hovering over any comment gives you options to approve, reply (and approve), quick edit, edit, spam mark, or trash that comment.' ) . '</p>' . |
|
158 | - '<p>' . __( 'In the <strong>In Response To</strong> column, there are three elements. The text is the name of the post that inspired the comment, and links to the post editor for that entry. The View Post link leads to that post on your live site. The small bubble with the number in it shows the number of approved comments that post has received. If there are pending comments, a red notification circle with the number of pending comments is displayed. Clicking the notification circle will filter the comments screen to show only pending comments on that post.' ) . '</p>' . |
|
159 | - '<p>' . __( 'In the <strong>Submitted On</strong> column, the date and time the comment was left on your site appears. Clicking on the date/time link will take you to that comment on your live site.' ) . '</p>' . |
|
160 | - '<p>' . __( 'Many people take advantage of keyboard shortcuts to moderate their comments more quickly. Use the link to the side to learn more.' ) . '</p>' |
|
161 | -) ); |
|
155 | + '<p>'.__('A red bar on the left means the comment is waiting for you to moderate it.').'</p>'. |
|
156 | + '<p>'.__('In the <strong>Author</strong> column, in addition to the author’s name, email address, and blog URL, the commenter’s IP address is shown. Clicking on this link will show you all the comments made from this IP address.').'</p>'. |
|
157 | + '<p>'.__('In the <strong>Comment</strong> column, hovering over any comment gives you options to approve, reply (and approve), quick edit, edit, spam mark, or trash that comment.').'</p>'. |
|
158 | + '<p>'.__('In the <strong>In Response To</strong> column, there are three elements. The text is the name of the post that inspired the comment, and links to the post editor for that entry. The View Post link leads to that post on your live site. The small bubble with the number in it shows the number of approved comments that post has received. If there are pending comments, a red notification circle with the number of pending comments is displayed. Clicking the notification circle will filter the comments screen to show only pending comments on that post.').'</p>'. |
|
159 | + '<p>'.__('In the <strong>Submitted On</strong> column, the date and time the comment was left on your site appears. Clicking on the date/time link will take you to that comment on your live site.').'</p>'. |
|
160 | + '<p>'.__('Many people take advantage of keyboard shortcuts to moderate their comments more quickly. Use the link to the side to learn more.').'</p>' |
|
161 | +)); |
|
162 | 162 | |
163 | 163 | get_current_screen()->set_help_sidebar( |
164 | - '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . |
|
165 | - '<p>' . __( '<a href="https://codex.wordpress.org/Administration_Screens#Comments" target="_blank">Documentation on Comments</a>' ) . '</p>' . |
|
166 | - '<p>' . __( '<a href="https://codex.wordpress.org/Comment_Spam" target="_blank">Documentation on Comment Spam</a>' ) . '</p>' . |
|
167 | - '<p>' . __( '<a href="https://codex.wordpress.org/Keyboard_Shortcuts" target="_blank">Documentation on Keyboard Shortcuts</a>' ) . '</p>' . |
|
168 | - '<p>' . __( '<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>' |
|
164 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
165 | + '<p>'.__('<a href="https://codex.wordpress.org/Administration_Screens#Comments" target="_blank">Documentation on Comments</a>').'</p>'. |
|
166 | + '<p>'.__('<a href="https://codex.wordpress.org/Comment_Spam" target="_blank">Documentation on Comment Spam</a>').'</p>'. |
|
167 | + '<p>'.__('<a href="https://codex.wordpress.org/Keyboard_Shortcuts" target="_blank">Documentation on Keyboard Shortcuts</a>').'</p>'. |
|
168 | + '<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>' |
|
169 | 169 | ); |
170 | 170 | |
171 | -get_current_screen()->set_screen_reader_content( array( |
|
172 | - 'heading_views' => __( 'Filter comments list' ), |
|
173 | - 'heading_pagination' => __( 'Comments list navigation' ), |
|
174 | - 'heading_list' => __( 'Comments list' ), |
|
175 | -) ); |
|
171 | +get_current_screen()->set_screen_reader_content(array( |
|
172 | + 'heading_views' => __('Filter comments list'), |
|
173 | + 'heading_pagination' => __('Comments list navigation'), |
|
174 | + 'heading_list' => __('Comments list'), |
|
175 | +)); |
|
176 | 176 | |
177 | -require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
|
177 | +require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
178 | 178 | ?> |
179 | 179 | |
180 | 180 | <div class="wrap"> |
181 | 181 | <h1><?php |
182 | -if ( $post_id ) { |
|
182 | +if ($post_id) { |
|
183 | 183 | /* translators: %s: link to post */ |
184 | - printf( __( 'Comments on “%s”' ), |
|
185 | - sprintf( '<a href="%1$s">%2$s</a>', |
|
186 | - get_edit_post_link( $post_id ), |
|
187 | - wp_html_excerpt( _draft_or_post_title( $post_id ), 50, '…' ) |
|
184 | + printf(__('Comments on “%s”'), |
|
185 | + sprintf('<a href="%1$s">%2$s</a>', |
|
186 | + get_edit_post_link($post_id), |
|
187 | + wp_html_excerpt(_draft_or_post_title($post_id), 50, '…') |
|
188 | 188 | ) |
189 | 189 | ); |
190 | 190 | } else { |
191 | - _e( 'Comments' ); |
|
191 | + _e('Comments'); |
|
192 | 192 | } |
193 | 193 | |
194 | -if ( isset($_REQUEST['s']) && strlen( $_REQUEST['s'] ) ) { |
|
194 | +if (isset($_REQUEST['s']) && strlen($_REQUEST['s'])) { |
|
195 | 195 | echo '<span class="subtitle">'; |
196 | 196 | /* translators: %s: search keywords */ |
197 | - printf( __( 'Search results for “%s”' ), |
|
198 | - wp_html_excerpt( esc_html( wp_unslash( $_REQUEST['s'] ) ), 50, '…' ) |
|
197 | + printf(__('Search results for “%s”'), |
|
198 | + wp_html_excerpt(esc_html(wp_unslash($_REQUEST['s'])), 50, '…') |
|
199 | 199 | ); |
200 | 200 | echo '</span>'; |
201 | 201 | } |
202 | 202 | ?></h1> |
203 | 203 | |
204 | 204 | <?php |
205 | -if ( isset( $_REQUEST['error'] ) ) { |
|
205 | +if (isset($_REQUEST['error'])) { |
|
206 | 206 | $error = (int) $_REQUEST['error']; |
207 | 207 | $error_msg = ''; |
208 | - switch ( $error ) { |
|
208 | + switch ($error) { |
|
209 | 209 | case 1 : |
210 | - $error_msg = __( 'Invalid comment ID.' ); |
|
210 | + $error_msg = __('Invalid comment ID.'); |
|
211 | 211 | break; |
212 | 212 | case 2 : |
213 | - $error_msg = __( 'Sorry, you are not allowed to edit comments on this post.' ); |
|
213 | + $error_msg = __('Sorry, you are not allowed to edit comments on this post.'); |
|
214 | 214 | break; |
215 | 215 | } |
216 | - if ( $error_msg ) |
|
217 | - echo '<div id="moderated" class="error"><p>' . $error_msg . '</p></div>'; |
|
216 | + if ($error_msg) |
|
217 | + echo '<div id="moderated" class="error"><p>'.$error_msg.'</p></div>'; |
|
218 | 218 | } |
219 | 219 | |
220 | -if ( isset($_REQUEST['approved']) || isset($_REQUEST['deleted']) || isset($_REQUEST['trashed']) || isset($_REQUEST['untrashed']) || isset($_REQUEST['spammed']) || isset($_REQUEST['unspammed']) || isset($_REQUEST['same']) ) { |
|
221 | - $approved = isset( $_REQUEST['approved'] ) ? (int) $_REQUEST['approved'] : 0; |
|
222 | - $deleted = isset( $_REQUEST['deleted'] ) ? (int) $_REQUEST['deleted'] : 0; |
|
223 | - $trashed = isset( $_REQUEST['trashed'] ) ? (int) $_REQUEST['trashed'] : 0; |
|
224 | - $untrashed = isset( $_REQUEST['untrashed'] ) ? (int) $_REQUEST['untrashed'] : 0; |
|
225 | - $spammed = isset( $_REQUEST['spammed'] ) ? (int) $_REQUEST['spammed'] : 0; |
|
226 | - $unspammed = isset( $_REQUEST['unspammed'] ) ? (int) $_REQUEST['unspammed'] : 0; |
|
227 | - $same = isset( $_REQUEST['same'] ) ? (int) $_REQUEST['same'] : 0; |
|
228 | - |
|
229 | - if ( $approved > 0 || $deleted > 0 || $trashed > 0 || $untrashed > 0 || $spammed > 0 || $unspammed > 0 || $same > 0 ) { |
|
230 | - if ( $approved > 0 ) { |
|
220 | +if (isset($_REQUEST['approved']) || isset($_REQUEST['deleted']) || isset($_REQUEST['trashed']) || isset($_REQUEST['untrashed']) || isset($_REQUEST['spammed']) || isset($_REQUEST['unspammed']) || isset($_REQUEST['same'])) { |
|
221 | + $approved = isset($_REQUEST['approved']) ? (int) $_REQUEST['approved'] : 0; |
|
222 | + $deleted = isset($_REQUEST['deleted']) ? (int) $_REQUEST['deleted'] : 0; |
|
223 | + $trashed = isset($_REQUEST['trashed']) ? (int) $_REQUEST['trashed'] : 0; |
|
224 | + $untrashed = isset($_REQUEST['untrashed']) ? (int) $_REQUEST['untrashed'] : 0; |
|
225 | + $spammed = isset($_REQUEST['spammed']) ? (int) $_REQUEST['spammed'] : 0; |
|
226 | + $unspammed = isset($_REQUEST['unspammed']) ? (int) $_REQUEST['unspammed'] : 0; |
|
227 | + $same = isset($_REQUEST['same']) ? (int) $_REQUEST['same'] : 0; |
|
228 | + |
|
229 | + if ($approved > 0 || $deleted > 0 || $trashed > 0 || $untrashed > 0 || $spammed > 0 || $unspammed > 0 || $same > 0) { |
|
230 | + if ($approved > 0) { |
|
231 | 231 | /* translators: %s: number of comments approved */ |
232 | - $messages[] = sprintf( _n( '%s comment approved', '%s comments approved', $approved ), $approved ); |
|
232 | + $messages[] = sprintf(_n('%s comment approved', '%s comments approved', $approved), $approved); |
|
233 | 233 | } |
234 | 234 | |
235 | - if ( $spammed > 0 ) { |
|
235 | + if ($spammed > 0) { |
|
236 | 236 | $ids = isset($_REQUEST['ids']) ? $_REQUEST['ids'] : 0; |
237 | 237 | /* translators: %s: number of comments marked as spam */ |
238 | - $messages[] = sprintf( _n( '%s comment marked as spam.', '%s comments marked as spam.', $spammed ), $spammed ) . ' <a href="' . esc_url( wp_nonce_url( "edit-comments.php?doaction=undo&action=unspam&ids=$ids", "bulk-comments" ) ) . '">' . __('Undo') . '</a><br />'; |
|
238 | + $messages[] = sprintf(_n('%s comment marked as spam.', '%s comments marked as spam.', $spammed), $spammed).' <a href="'.esc_url(wp_nonce_url("edit-comments.php?doaction=undo&action=unspam&ids=$ids", "bulk-comments")).'">'.__('Undo').'</a><br />'; |
|
239 | 239 | } |
240 | 240 | |
241 | - if ( $unspammed > 0 ) { |
|
241 | + if ($unspammed > 0) { |
|
242 | 242 | /* translators: %s: number of comments restored from the spam */ |
243 | - $messages[] = sprintf( _n( '%s comment restored from the spam', '%s comments restored from the spam', $unspammed ), $unspammed ); |
|
243 | + $messages[] = sprintf(_n('%s comment restored from the spam', '%s comments restored from the spam', $unspammed), $unspammed); |
|
244 | 244 | } |
245 | 245 | |
246 | - if ( $trashed > 0 ) { |
|
246 | + if ($trashed > 0) { |
|
247 | 247 | $ids = isset($_REQUEST['ids']) ? $_REQUEST['ids'] : 0; |
248 | 248 | /* translators: %s: number of comments moved to the Trash */ |
249 | - $messages[] = sprintf( _n( '%s comment moved to the Trash.', '%s comments moved to the Trash.', $trashed ), $trashed ) . ' <a href="' . esc_url( wp_nonce_url( "edit-comments.php?doaction=undo&action=untrash&ids=$ids", "bulk-comments" ) ) . '">' . __('Undo') . '</a><br />'; |
|
249 | + $messages[] = sprintf(_n('%s comment moved to the Trash.', '%s comments moved to the Trash.', $trashed), $trashed).' <a href="'.esc_url(wp_nonce_url("edit-comments.php?doaction=undo&action=untrash&ids=$ids", "bulk-comments")).'">'.__('Undo').'</a><br />'; |
|
250 | 250 | } |
251 | 251 | |
252 | - if ( $untrashed > 0 ) { |
|
252 | + if ($untrashed > 0) { |
|
253 | 253 | /* translators: %s: number of comments restored from the Trash */ |
254 | - $messages[] = sprintf( _n( '%s comment restored from the Trash', '%s comments restored from the Trash', $untrashed ), $untrashed ); |
|
254 | + $messages[] = sprintf(_n('%s comment restored from the Trash', '%s comments restored from the Trash', $untrashed), $untrashed); |
|
255 | 255 | } |
256 | 256 | |
257 | - if ( $deleted > 0 ) { |
|
257 | + if ($deleted > 0) { |
|
258 | 258 | /* translators: %s: number of comments permanently deleted */ |
259 | - $messages[] = sprintf( _n( '%s comment permanently deleted', '%s comments permanently deleted', $deleted ), $deleted ); |
|
259 | + $messages[] = sprintf(_n('%s comment permanently deleted', '%s comments permanently deleted', $deleted), $deleted); |
|
260 | 260 | } |
261 | 261 | |
262 | - if ( $same > 0 && $comment = get_comment( $same ) ) { |
|
263 | - switch ( $comment->comment_approved ) { |
|
262 | + if ($same > 0 && $comment = get_comment($same)) { |
|
263 | + switch ($comment->comment_approved) { |
|
264 | 264 | case '1' : |
265 | - $messages[] = __('This comment is already approved.') . ' <a href="' . esc_url( admin_url( "comment.php?action=editcomment&c=$same" ) ) . '">' . __( 'Edit comment' ) . '</a>'; |
|
265 | + $messages[] = __('This comment is already approved.').' <a href="'.esc_url(admin_url("comment.php?action=editcomment&c=$same")).'">'.__('Edit comment').'</a>'; |
|
266 | 266 | break; |
267 | 267 | case 'trash' : |
268 | - $messages[] = __( 'This comment is already in the Trash.' ) . ' <a href="' . esc_url( admin_url( 'edit-comments.php?comment_status=trash' ) ) . '"> ' . __( 'View Trash' ) . '</a>'; |
|
268 | + $messages[] = __('This comment is already in the Trash.').' <a href="'.esc_url(admin_url('edit-comments.php?comment_status=trash')).'"> '.__('View Trash').'</a>'; |
|
269 | 269 | break; |
270 | 270 | case 'spam' : |
271 | - $messages[] = __( 'This comment is already marked as spam.' ) . ' <a href="' . esc_url( admin_url( "comment.php?action=editcomment&c=$same" ) ) . '">' . __( 'Edit comment' ) . '</a>'; |
|
271 | + $messages[] = __('This comment is already marked as spam.').' <a href="'.esc_url(admin_url("comment.php?action=editcomment&c=$same")).'">'.__('Edit comment').'</a>'; |
|
272 | 272 | break; |
273 | 273 | } |
274 | 274 | } |
275 | 275 | |
276 | - echo '<div id="moderated" class="updated notice is-dismissible"><p>' . implode( "<br/>\n", $messages ) . '</p></div>'; |
|
276 | + echo '<div id="moderated" class="updated notice is-dismissible"><p>'.implode("<br/>\n", $messages).'</p></div>'; |
|
277 | 277 | } |
278 | 278 | } |
279 | 279 | ?> |
@@ -282,20 +282,20 @@ discard block |
||
282 | 282 | |
283 | 283 | <form id="comments-form" method="get"> |
284 | 284 | |
285 | -<?php $wp_list_table->search_box( __( 'Search Comments' ), 'comment' ); ?> |
|
285 | +<?php $wp_list_table->search_box(__('Search Comments'), 'comment'); ?> |
|
286 | 286 | |
287 | -<?php if ( $post_id ) : ?> |
|
288 | -<input type="hidden" name="p" value="<?php echo esc_attr( intval( $post_id ) ); ?>" /> |
|
287 | +<?php if ($post_id) : ?> |
|
288 | +<input type="hidden" name="p" value="<?php echo esc_attr(intval($post_id)); ?>" /> |
|
289 | 289 | <?php endif; ?> |
290 | 290 | <input type="hidden" name="comment_status" value="<?php echo esc_attr($comment_status); ?>" /> |
291 | 291 | <input type="hidden" name="pagegen_timestamp" value="<?php echo esc_attr(current_time('mysql', 1)); ?>" /> |
292 | 292 | |
293 | -<input type="hidden" name="_total" value="<?php echo esc_attr( $wp_list_table->get_pagination_arg('total_items') ); ?>" /> |
|
294 | -<input type="hidden" name="_per_page" value="<?php echo esc_attr( $wp_list_table->get_pagination_arg('per_page') ); ?>" /> |
|
295 | -<input type="hidden" name="_page" value="<?php echo esc_attr( $wp_list_table->get_pagination_arg('page') ); ?>" /> |
|
293 | +<input type="hidden" name="_total" value="<?php echo esc_attr($wp_list_table->get_pagination_arg('total_items')); ?>" /> |
|
294 | +<input type="hidden" name="_per_page" value="<?php echo esc_attr($wp_list_table->get_pagination_arg('per_page')); ?>" /> |
|
295 | +<input type="hidden" name="_page" value="<?php echo esc_attr($wp_list_table->get_pagination_arg('page')); ?>" /> |
|
296 | 296 | |
297 | -<?php if ( isset($_REQUEST['paged']) ) { ?> |
|
298 | - <input type="hidden" name="paged" value="<?php echo esc_attr( absint( $_REQUEST['paged'] ) ); ?>" /> |
|
297 | +<?php if (isset($_REQUEST['paged'])) { ?> |
|
298 | + <input type="hidden" name="paged" value="<?php echo esc_attr(absint($_REQUEST['paged'])); ?>" /> |
|
299 | 299 | <?php } ?> |
300 | 300 | |
301 | 301 | <?php $wp_list_table->display(); ?> |
@@ -307,4 +307,4 @@ discard block |
||
307 | 307 | <?php |
308 | 308 | wp_comment_reply('-1', true, 'detail'); |
309 | 309 | wp_comment_trashnotice(); |
310 | -include( ABSPATH . 'wp-admin/admin-footer.php' ); ?> |
|
310 | +include(ABSPATH.'wp-admin/admin-footer.php'); ?> |
@@ -7,47 +7,47 @@ |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | /** WordPress Administration Bootstrap */ |
10 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
10 | +require_once(dirname(__FILE__).'/admin.php'); |
|
11 | 11 | |
12 | -$title = __( 'Freedoms' ); |
|
12 | +$title = __('Freedoms'); |
|
13 | 13 | |
14 | -list( $display_version ) = explode( '-', $wp_version ); |
|
14 | +list($display_version) = explode('-', $wp_version); |
|
15 | 15 | |
16 | -include( ABSPATH . 'wp-admin/admin-header.php' ); |
|
16 | +include(ABSPATH.'wp-admin/admin-header.php'); |
|
17 | 17 | ?> |
18 | 18 | <div class="wrap about-wrap"> |
19 | 19 | |
20 | -<h1><?php printf( __( 'Welcome to WordPress %s' ), $display_version ); ?></h1> |
|
20 | +<h1><?php printf(__('Welcome to WordPress %s'), $display_version); ?></h1> |
|
21 | 21 | |
22 | -<p class="about-text"><?php printf( __( 'Thank you for updating to the latest version. WordPress %s changes a lot behind the scenes to make your WordPress experience even better!' ), $display_version ); ?></p> |
|
22 | +<p class="about-text"><?php printf(__('Thank you for updating to the latest version. WordPress %s changes a lot behind the scenes to make your WordPress experience even better!'), $display_version); ?></p> |
|
23 | 23 | |
24 | -<div class="wp-badge"><?php printf( __( 'Version %s' ), $display_version ); ?></div> |
|
24 | +<div class="wp-badge"><?php printf(__('Version %s'), $display_version); ?></div> |
|
25 | 25 | |
26 | 26 | <h2 class="nav-tab-wrapper wp-clearfix"> |
27 | - <a href="about.php" class="nav-tab"><?php _e( 'What’s New' ); ?></a> |
|
28 | - <a href="credits.php" class="nav-tab"><?php _e( 'Credits' ); ?></a> |
|
29 | - <a href="freedoms.php" class="nav-tab nav-tab-active"><?php _e( 'Freedoms' ); ?></a> |
|
27 | + <a href="about.php" class="nav-tab"><?php _e('What’s New'); ?></a> |
|
28 | + <a href="credits.php" class="nav-tab"><?php _e('Credits'); ?></a> |
|
29 | + <a href="freedoms.php" class="nav-tab nav-tab-active"><?php _e('Freedoms'); ?></a> |
|
30 | 30 | </h2> |
31 | 31 | |
32 | -<p class="about-description"><?php printf( __( 'WordPress is Free and open source software, built by a distributed community of mostly volunteer developers from around the world. WordPress comes with some awesome, worldview-changing rights courtesy of its <a href="%s">license</a>, the GPL.' ), 'https://wordpress.org/about/license/' ); ?></p> |
|
32 | +<p class="about-description"><?php printf(__('WordPress is Free and open source software, built by a distributed community of mostly volunteer developers from around the world. WordPress comes with some awesome, worldview-changing rights courtesy of its <a href="%s">license</a>, the GPL.'), 'https://wordpress.org/about/license/'); ?></p> |
|
33 | 33 | |
34 | 34 | <ol start="0"> |
35 | - <li><p><?php _e( 'You have the freedom to run the program, for any purpose.' ); ?></p></li> |
|
36 | - <li><p><?php _e( 'You have access to the source code, the freedom to study how the program works, and the freedom to change it to make it do what you wish.' ); ?></p></li> |
|
37 | - <li><p><?php _e( 'You have the freedom to redistribute copies of the original program so you can help your neighbor.' ); ?></p></li> |
|
38 | - <li><p><?php _e( 'You have the freedom to distribute copies of your modified versions to others. By doing this you can give the whole community a chance to benefit from your changes.' ); ?></p></li> |
|
35 | + <li><p><?php _e('You have the freedom to run the program, for any purpose.'); ?></p></li> |
|
36 | + <li><p><?php _e('You have access to the source code, the freedom to study how the program works, and the freedom to change it to make it do what you wish.'); ?></p></li> |
|
37 | + <li><p><?php _e('You have the freedom to redistribute copies of the original program so you can help your neighbor.'); ?></p></li> |
|
38 | + <li><p><?php _e('You have the freedom to distribute copies of your modified versions to others. By doing this you can give the whole community a chance to benefit from your changes.'); ?></p></li> |
|
39 | 39 | </ol> |
40 | 40 | |
41 | -<p><?php printf( __( 'WordPress grows when people like you tell their friends about it, and the thousands of businesses and services that are built on and around WordPress share that fact with their users. We’re flattered every time someone spreads the good word, just make sure to <a href="%s">check out our trademark guidelines</a> first.' ), 'http://wordpressfoundation.org/trademark-policy/' ); ?></p> |
|
41 | +<p><?php printf(__('WordPress grows when people like you tell their friends about it, and the thousands of businesses and services that are built on and around WordPress share that fact with their users. We’re flattered every time someone spreads the good word, just make sure to <a href="%s">check out our trademark guidelines</a> first.'), 'http://wordpressfoundation.org/trademark-policy/'); ?></p> |
|
42 | 42 | |
43 | 43 | <p><?php |
44 | 44 | |
45 | -$plugins_url = current_user_can( 'activate_plugins' ) ? admin_url( 'plugins.php' ) : 'https://wordpress.org/plugins/'; |
|
46 | -$themes_url = current_user_can( 'switch_themes' ) ? admin_url( 'themes.php' ) : 'https://wordpress.org/themes/'; |
|
45 | +$plugins_url = current_user_can('activate_plugins') ? admin_url('plugins.php') : 'https://wordpress.org/plugins/'; |
|
46 | +$themes_url = current_user_can('switch_themes') ? admin_url('themes.php') : 'https://wordpress.org/themes/'; |
|
47 | 47 | |
48 | -printf( __( 'Every plugin and theme in WordPress.org’s directory is 100%% GPL or a similarly free and compatible license, so you can feel safe finding <a href="%1$s">plugins</a> and <a href="%2$s">themes</a> there. If you get a plugin or theme from another source, make sure to <a href="%3$s">ask them if it’s GPL</a> first. If they don’t respect the WordPress license, we don’t recommend them.' ), $plugins_url, $themes_url, 'https://wordpress.org/about/license/' ); ?></p> |
|
48 | +printf(__('Every plugin and theme in WordPress.org’s directory is 100%% GPL or a similarly free and compatible license, so you can feel safe finding <a href="%1$s">plugins</a> and <a href="%2$s">themes</a> there. If you get a plugin or theme from another source, make sure to <a href="%3$s">ask them if it’s GPL</a> first. If they don’t respect the WordPress license, we don’t recommend them.'), $plugins_url, $themes_url, 'https://wordpress.org/about/license/'); ?></p> |
|
49 | 49 | |
50 | -<p><?php _e( 'Don’t you wish all software came with these freedoms? So do we! For more information, check out the <a href="https://www.fsf.org/">Free Software Foundation</a>.' ); ?></p> |
|
50 | +<p><?php _e('Don’t you wish all software came with these freedoms? So do we! For more information, check out the <a href="https://www.fsf.org/">Free Software Foundation</a>.'); ?></p> |
|
51 | 51 | |
52 | 52 | </div> |
53 | -<?php include( ABSPATH . 'wp-admin/admin-footer.php' ); ?> |
|
53 | +<?php include(ABSPATH.'wp-admin/admin-footer.php'); ?> |
@@ -7,58 +7,58 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | /** WordPress Administration Bootstrap */ |
10 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
10 | +require_once(dirname(__FILE__).'/admin.php'); |
|
11 | 11 | |
12 | -if ( ! current_user_can( 'switch_themes' ) && ! current_user_can( 'edit_theme_options' ) ) { |
|
12 | +if ( ! current_user_can('switch_themes') && ! current_user_can('edit_theme_options')) { |
|
13 | 13 | wp_die( |
14 | - '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . |
|
15 | - '<p>' . __( 'Sorry, you are not allowed to edit theme options on this site.' ) . '</p>', |
|
14 | + '<h1>'.__('Cheatin’ uh?').'</h1>'. |
|
15 | + '<p>'.__('Sorry, you are not allowed to edit theme options on this site.').'</p>', |
|
16 | 16 | 403 |
17 | 17 | ); |
18 | 18 | } |
19 | 19 | |
20 | -if ( current_user_can( 'switch_themes' ) && isset($_GET['action'] ) ) { |
|
21 | - if ( 'activate' == $_GET['action'] ) { |
|
22 | - check_admin_referer('switch-theme_' . $_GET['stylesheet']); |
|
23 | - $theme = wp_get_theme( $_GET['stylesheet'] ); |
|
20 | +if (current_user_can('switch_themes') && isset($_GET['action'])) { |
|
21 | + if ('activate' == $_GET['action']) { |
|
22 | + check_admin_referer('switch-theme_'.$_GET['stylesheet']); |
|
23 | + $theme = wp_get_theme($_GET['stylesheet']); |
|
24 | 24 | |
25 | - if ( ! $theme->exists() || ! $theme->is_allowed() ) { |
|
25 | + if ( ! $theme->exists() || ! $theme->is_allowed()) { |
|
26 | 26 | wp_die( |
27 | - '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . |
|
28 | - '<p>' . __( 'The requested theme does not exist.' ) . '</p>', |
|
27 | + '<h1>'.__('Cheatin’ uh?').'</h1>'. |
|
28 | + '<p>'.__('The requested theme does not exist.').'</p>', |
|
29 | 29 | 403 |
30 | 30 | ); |
31 | 31 | } |
32 | 32 | |
33 | - switch_theme( $theme->get_stylesheet() ); |
|
34 | - wp_redirect( admin_url('themes.php?activated=true') ); |
|
33 | + switch_theme($theme->get_stylesheet()); |
|
34 | + wp_redirect(admin_url('themes.php?activated=true')); |
|
35 | 35 | exit; |
36 | - } elseif ( 'delete' == $_GET['action'] ) { |
|
37 | - check_admin_referer('delete-theme_' . $_GET['stylesheet']); |
|
38 | - $theme = wp_get_theme( $_GET['stylesheet'] ); |
|
36 | + } elseif ('delete' == $_GET['action']) { |
|
37 | + check_admin_referer('delete-theme_'.$_GET['stylesheet']); |
|
38 | + $theme = wp_get_theme($_GET['stylesheet']); |
|
39 | 39 | |
40 | - if ( ! current_user_can( 'delete_themes' ) ) { |
|
40 | + if ( ! current_user_can('delete_themes')) { |
|
41 | 41 | wp_die( |
42 | - '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . |
|
43 | - '<p>' . __( 'Sorry, you are not allowed to delete this item.' ) . '</p>', |
|
42 | + '<h1>'.__('Cheatin’ uh?').'</h1>'. |
|
43 | + '<p>'.__('Sorry, you are not allowed to delete this item.').'</p>', |
|
44 | 44 | 403 |
45 | 45 | ); |
46 | 46 | } |
47 | 47 | |
48 | - if ( ! $theme->exists() ) { |
|
48 | + if ( ! $theme->exists()) { |
|
49 | 49 | wp_die( |
50 | - '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . |
|
51 | - '<p>' . __( 'The requested theme does not exist.' ) . '</p>', |
|
50 | + '<h1>'.__('Cheatin’ uh?').'</h1>'. |
|
51 | + '<p>'.__('The requested theme does not exist.').'</p>', |
|
52 | 52 | 403 |
53 | 53 | ); |
54 | 54 | } |
55 | 55 | |
56 | 56 | $active = wp_get_theme(); |
57 | - if ( $active->get( 'Template' ) == $_GET['stylesheet'] ) { |
|
58 | - wp_redirect( admin_url( 'themes.php?delete-active-child=true' ) ); |
|
57 | + if ($active->get('Template') == $_GET['stylesheet']) { |
|
58 | + wp_redirect(admin_url('themes.php?delete-active-child=true')); |
|
59 | 59 | } else { |
60 | - delete_theme( $_GET['stylesheet'] ); |
|
61 | - wp_redirect( admin_url( 'themes.php?deleted=true' ) ); |
|
60 | + delete_theme($_GET['stylesheet']); |
|
61 | + wp_redirect(admin_url('themes.php?deleted=true')); |
|
62 | 62 | } |
63 | 63 | exit; |
64 | 64 | } |
@@ -68,116 +68,116 @@ discard block |
||
68 | 68 | $parent_file = 'themes.php'; |
69 | 69 | |
70 | 70 | // Help tab: Overview |
71 | -if ( current_user_can( 'switch_themes' ) ) { |
|
72 | - $help_overview = '<p>' . __( 'This screen is used for managing your installed themes. Aside from the default theme(s) included with your WordPress installation, themes are designed and developed by third parties.' ) . '</p>' . |
|
73 | - '<p>' . __( 'From this screen you can:' ) . '</p>' . |
|
74 | - '<ul><li>' . __( 'Hover or tap to see Activate and Live Preview buttons' ) . '</li>' . |
|
75 | - '<li>' . __( 'Click on the theme to see the theme name, version, author, description, tags, and the Delete link' ) . '</li>' . |
|
76 | - '<li>' . __( 'Click Customize for the current theme or Live Preview for any other theme to see a live preview' ) . '</li></ul>' . |
|
77 | - '<p>' . __( 'The current theme is displayed highlighted as the first theme.' ) . '</p>' . |
|
78 | - '<p>' . __( 'The search for installed themes will search for terms in their name, description, author, or tag.' ) . ' <span id="live-search-desc">' . __( 'The search results will be updated as you type.' ) . '</span></p>'; |
|
79 | - |
|
80 | - get_current_screen()->add_help_tab( array( |
|
71 | +if (current_user_can('switch_themes')) { |
|
72 | + $help_overview = '<p>'.__('This screen is used for managing your installed themes. Aside from the default theme(s) included with your WordPress installation, themes are designed and developed by third parties.').'</p>'. |
|
73 | + '<p>'.__('From this screen you can:').'</p>'. |
|
74 | + '<ul><li>'.__('Hover or tap to see Activate and Live Preview buttons').'</li>'. |
|
75 | + '<li>'.__('Click on the theme to see the theme name, version, author, description, tags, and the Delete link').'</li>'. |
|
76 | + '<li>'.__('Click Customize for the current theme or Live Preview for any other theme to see a live preview').'</li></ul>'. |
|
77 | + '<p>'.__('The current theme is displayed highlighted as the first theme.').'</p>'. |
|
78 | + '<p>'.__('The search for installed themes will search for terms in their name, description, author, or tag.').' <span id="live-search-desc">'.__('The search results will be updated as you type.').'</span></p>'; |
|
79 | + |
|
80 | + get_current_screen()->add_help_tab(array( |
|
81 | 81 | 'id' => 'overview', |
82 | - 'title' => __( 'Overview' ), |
|
82 | + 'title' => __('Overview'), |
|
83 | 83 | 'content' => $help_overview |
84 | - ) ); |
|
84 | + )); |
|
85 | 85 | } // switch_themes |
86 | 86 | |
87 | 87 | // Help tab: Adding Themes |
88 | -if ( current_user_can( 'install_themes' ) ) { |
|
89 | - if ( is_multisite() ) { |
|
90 | - $help_install = '<p>' . __('Installing themes on Multisite can only be done from the Network Admin section.') . '</p>'; |
|
88 | +if (current_user_can('install_themes')) { |
|
89 | + if (is_multisite()) { |
|
90 | + $help_install = '<p>'.__('Installing themes on Multisite can only be done from the Network Admin section.').'</p>'; |
|
91 | 91 | } else { |
92 | - $help_install = '<p>' . sprintf( __('If you would like to see more themes to choose from, click on the “Add New” button and you will be able to browse or search for additional themes from the <a href="%s" target="_blank">WordPress Theme Directory</a>. Themes in the WordPress Theme Directory are designed and developed by third parties, and are compatible with the license WordPress uses. Oh, and they’re free!'), 'https://wordpress.org/themes/' ) . '</p>'; |
|
92 | + $help_install = '<p>'.sprintf(__('If you would like to see more themes to choose from, click on the “Add New” button and you will be able to browse or search for additional themes from the <a href="%s" target="_blank">WordPress Theme Directory</a>. Themes in the WordPress Theme Directory are designed and developed by third parties, and are compatible with the license WordPress uses. Oh, and they’re free!'), 'https://wordpress.org/themes/').'</p>'; |
|
93 | 93 | } |
94 | 94 | |
95 | - get_current_screen()->add_help_tab( array( |
|
95 | + get_current_screen()->add_help_tab(array( |
|
96 | 96 | 'id' => 'adding-themes', |
97 | 97 | 'title' => __('Adding Themes'), |
98 | 98 | 'content' => $help_install |
99 | - ) ); |
|
99 | + )); |
|
100 | 100 | } // install_themes |
101 | 101 | |
102 | 102 | // Help tab: Previewing and Customizing |
103 | -if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { |
|
103 | +if (current_user_can('edit_theme_options') && current_user_can('customize')) { |
|
104 | 104 | $help_customize = |
105 | - '<p>' . __( 'Tap or hover on any theme then click the Live Preview button to see a live preview of that theme and change theme options in a separate, full-screen view. You can also find a Live Preview button at the bottom of the theme details screen. Any installed theme can be previewed and customized in this way.' ) . '</p>'. |
|
106 | - '<p>' . __( 'The theme being previewed is fully interactive — navigate to different pages to see how the theme handles posts, archives, and other page templates. The settings may differ depending on what theme features the theme being previewed supports. To accept the new settings and activate the theme all in one step, click the Save & Activate button above the menu.' ) . '</p>' . |
|
107 | - '<p>' . __( 'When previewing on smaller monitors, you can use the collapse icon at the bottom of the left-hand pane. This will hide the pane, giving you more room to preview your site in the new theme. To bring the pane back, click on the collapse icon again.' ) . '</p>'; |
|
105 | + '<p>'.__('Tap or hover on any theme then click the Live Preview button to see a live preview of that theme and change theme options in a separate, full-screen view. You can also find a Live Preview button at the bottom of the theme details screen. Any installed theme can be previewed and customized in this way.').'</p>'. |
|
106 | + '<p>'.__('The theme being previewed is fully interactive — navigate to different pages to see how the theme handles posts, archives, and other page templates. The settings may differ depending on what theme features the theme being previewed supports. To accept the new settings and activate the theme all in one step, click the Save & Activate button above the menu.').'</p>'. |
|
107 | + '<p>'.__('When previewing on smaller monitors, you can use the collapse icon at the bottom of the left-hand pane. This will hide the pane, giving you more room to preview your site in the new theme. To bring the pane back, click on the collapse icon again.').'</p>'; |
|
108 | 108 | |
109 | - get_current_screen()->add_help_tab( array( |
|
109 | + get_current_screen()->add_help_tab(array( |
|
110 | 110 | 'id' => 'customize-preview-themes', |
111 | - 'title' => __( 'Previewing and Customizing' ), |
|
111 | + 'title' => __('Previewing and Customizing'), |
|
112 | 112 | 'content' => $help_customize |
113 | - ) ); |
|
113 | + )); |
|
114 | 114 | } // edit_theme_options && customize |
115 | 115 | |
116 | 116 | get_current_screen()->set_help_sidebar( |
117 | - '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . |
|
118 | - '<p>' . __( '<a href="https://codex.wordpress.org/Using_Themes" target="_blank">Documentation on Using Themes</a>' ) . '</p>' . |
|
119 | - '<p>' . __( '<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>' |
|
117 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
118 | + '<p>'.__('<a href="https://codex.wordpress.org/Using_Themes" target="_blank">Documentation on Using Themes</a>').'</p>'. |
|
119 | + '<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>' |
|
120 | 120 | ); |
121 | 121 | |
122 | -if ( current_user_can( 'switch_themes' ) ) { |
|
122 | +if (current_user_can('switch_themes')) { |
|
123 | 123 | $themes = wp_prepare_themes_for_js(); |
124 | 124 | } else { |
125 | - $themes = wp_prepare_themes_for_js( array( wp_get_theme() ) ); |
|
125 | + $themes = wp_prepare_themes_for_js(array(wp_get_theme())); |
|
126 | 126 | } |
127 | -wp_reset_vars( array( 'theme', 'search' ) ); |
|
127 | +wp_reset_vars(array('theme', 'search')); |
|
128 | 128 | |
129 | -wp_localize_script( 'theme', '_wpThemeSettings', array( |
|
129 | +wp_localize_script('theme', '_wpThemeSettings', array( |
|
130 | 130 | 'themes' => $themes, |
131 | 131 | 'settings' => array( |
132 | - 'canInstall' => ( ! is_multisite() && current_user_can( 'install_themes' ) ), |
|
133 | - 'installURI' => ( ! is_multisite() && current_user_can( 'install_themes' ) ) ? admin_url( 'theme-install.php' ) : null, |
|
134 | - 'confirmDelete' => __( "Are you sure you want to delete this theme?\n\nClick 'Cancel' to go back, 'OK' to confirm the delete." ), |
|
135 | - 'adminUrl' => parse_url( admin_url(), PHP_URL_PATH ), |
|
132 | + 'canInstall' => ( ! is_multisite() && current_user_can('install_themes')), |
|
133 | + 'installURI' => ( ! is_multisite() && current_user_can('install_themes')) ? admin_url('theme-install.php') : null, |
|
134 | + 'confirmDelete' => __("Are you sure you want to delete this theme?\n\nClick 'Cancel' to go back, 'OK' to confirm the delete."), |
|
135 | + 'adminUrl' => parse_url(admin_url(), PHP_URL_PATH), |
|
136 | 136 | ), |
137 | 137 | 'l10n' => array( |
138 | - 'addNew' => __( 'Add New Theme' ), |
|
139 | - 'search' => __( 'Search Installed Themes' ), |
|
140 | - 'searchPlaceholder' => __( 'Search installed themes...' ), // placeholder (no ellipsis) |
|
141 | - 'themesFound' => __( 'Number of Themes found: %d' ), |
|
142 | - 'noThemesFound' => __( 'No themes found. Try a different search.' ), |
|
138 | + 'addNew' => __('Add New Theme'), |
|
139 | + 'search' => __('Search Installed Themes'), |
|
140 | + 'searchPlaceholder' => __('Search installed themes...'), // placeholder (no ellipsis) |
|
141 | + 'themesFound' => __('Number of Themes found: %d'), |
|
142 | + 'noThemesFound' => __('No themes found. Try a different search.'), |
|
143 | 143 | ), |
144 | -) ); |
|
144 | +)); |
|
145 | 145 | |
146 | 146 | add_thickbox(); |
147 | -wp_enqueue_script( 'theme' ); |
|
148 | -wp_enqueue_script( 'updates' ); |
|
149 | -wp_enqueue_script( 'customize-loader' ); |
|
147 | +wp_enqueue_script('theme'); |
|
148 | +wp_enqueue_script('updates'); |
|
149 | +wp_enqueue_script('customize-loader'); |
|
150 | 150 | |
151 | -require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
|
151 | +require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
152 | 152 | ?> |
153 | 153 | |
154 | 154 | <div class="wrap"> |
155 | - <h1><?php esc_html_e( 'Themes' ); ?> |
|
156 | - <span class="title-count theme-count"><?php echo count( $themes ); ?></span> |
|
157 | - <?php if ( ! is_multisite() && current_user_can( 'install_themes' ) ) : ?> |
|
158 | - <a href="<?php echo admin_url( 'theme-install.php' ); ?>" class="hide-if-no-js page-title-action"><?php echo esc_html_x( 'Add New', 'Add new theme' ); ?></a> |
|
155 | + <h1><?php esc_html_e('Themes'); ?> |
|
156 | + <span class="title-count theme-count"><?php echo count($themes); ?></span> |
|
157 | + <?php if ( ! is_multisite() && current_user_can('install_themes')) : ?> |
|
158 | + <a href="<?php echo admin_url('theme-install.php'); ?>" class="hide-if-no-js page-title-action"><?php echo esc_html_x('Add New', 'Add new theme'); ?></a> |
|
159 | 159 | <?php endif; ?> |
160 | 160 | </h1> |
161 | 161 | <?php |
162 | -if ( ! validate_current_theme() || isset( $_GET['broken'] ) ) : ?> |
|
162 | +if ( ! validate_current_theme() || isset($_GET['broken'])) : ?> |
|
163 | 163 | <div id="message1" class="updated notice is-dismissible"><p><?php _e('The active theme is broken. Reverting to the default theme.'); ?></p></div> |
164 | -<?php elseif ( isset($_GET['activated']) ) : |
|
165 | - if ( isset( $_GET['previewed'] ) ) { ?> |
|
166 | - <div id="message2" class="updated notice is-dismissible"><p><?php _e( 'Settings saved and theme activated.' ); ?> <a href="<?php echo home_url( '/' ); ?>"><?php _e( 'Visit site' ); ?></a></p></div> |
|
164 | +<?php elseif (isset($_GET['activated'])) : |
|
165 | + if (isset($_GET['previewed'])) { ?> |
|
166 | + <div id="message2" class="updated notice is-dismissible"><p><?php _e('Settings saved and theme activated.'); ?> <a href="<?php echo home_url('/'); ?>"><?php _e('Visit site'); ?></a></p></div> |
|
167 | 167 | <?php } else { ?> |
168 | -<div id="message2" class="updated notice is-dismissible"><p><?php _e( 'New theme activated.' ); ?> <a href="<?php echo home_url( '/' ); ?>"><?php _e( 'Visit site' ); ?></a></p></div><?php |
|
168 | +<div id="message2" class="updated notice is-dismissible"><p><?php _e('New theme activated.'); ?> <a href="<?php echo home_url('/'); ?>"><?php _e('Visit site'); ?></a></p></div><?php |
|
169 | 169 | } |
170 | - elseif ( isset($_GET['deleted']) ) : ?> |
|
170 | + elseif (isset($_GET['deleted'])) : ?> |
|
171 | 171 | <div id="message3" class="updated notice is-dismissible"><p><?php _e('Theme deleted.') ?></p></div> |
172 | -<?php elseif ( isset( $_GET['delete-active-child'] ) ) : ?> |
|
173 | - <div id="message4" class="error"><p><?php _e( 'You cannot delete a theme while it has an active child theme.' ); ?></p></div> |
|
172 | +<?php elseif (isset($_GET['delete-active-child'])) : ?> |
|
173 | + <div id="message4" class="error"><p><?php _e('You cannot delete a theme while it has an active child theme.'); ?></p></div> |
|
174 | 174 | <?php |
175 | 175 | endif; |
176 | 176 | |
177 | 177 | $ct = wp_get_theme(); |
178 | 178 | |
179 | -if ( $ct->errors() && ( ! is_multisite() || current_user_can( 'manage_network_themes' ) ) ) { |
|
180 | - echo '<div class="error"><p>' . sprintf( __( 'ERROR: %s' ), $ct->errors()->get_error_message() ) . '</p></div>'; |
|
179 | +if ($ct->errors() && ( ! is_multisite() || current_user_can('manage_network_themes'))) { |
|
180 | + echo '<div class="error"><p>'.sprintf(__('ERROR: %s'), $ct->errors()->get_error_message()).'</p></div>'; |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | /* |
@@ -188,37 +188,37 @@ discard block |
||
188 | 188 | |
189 | 189 | // Pretend you didn't see this. |
190 | 190 | $current_theme_actions = array(); |
191 | - if ( is_array( $submenu ) && isset( $submenu['themes.php'] ) ) { |
|
192 | - foreach ( (array) $submenu['themes.php'] as $item) { |
|
191 | + if (is_array($submenu) && isset($submenu['themes.php'])) { |
|
192 | + foreach ((array) $submenu['themes.php'] as $item) { |
|
193 | 193 | $class = ''; |
194 | - if ( 'themes.php' == $item[2] || 'theme-editor.php' == $item[2] || 0 === strpos( $item[2], 'customize.php' ) ) |
|
194 | + if ('themes.php' == $item[2] || 'theme-editor.php' == $item[2] || 0 === strpos($item[2], 'customize.php')) |
|
195 | 195 | continue; |
196 | 196 | // 0 = name, 1 = capability, 2 = file |
197 | - if ( ( strcmp($self, $item[2]) == 0 && empty($parent_file)) || ($parent_file && ($item[2] == $parent_file)) ) |
|
197 | + if ((strcmp($self, $item[2]) == 0 && empty($parent_file)) || ($parent_file && ($item[2] == $parent_file))) |
|
198 | 198 | $class = ' current'; |
199 | - if ( !empty($submenu[$item[2]]) ) { |
|
199 | + if ( ! empty($submenu[$item[2]])) { |
|
200 | 200 | $submenu[$item[2]] = array_values($submenu[$item[2]]); // Re-index. |
201 | 201 | $menu_hook = get_plugin_page_hook($submenu[$item[2]][0][2], $item[2]); |
202 | - if ( file_exists(WP_PLUGIN_DIR . "/{$submenu[$item[2]][0][2]}") || !empty($menu_hook)) |
|
202 | + if (file_exists(WP_PLUGIN_DIR."/{$submenu[$item[2]][0][2]}") || ! empty($menu_hook)) |
|
203 | 203 | $current_theme_actions[] = "<a class='button button-secondary$class' href='admin.php?page={$submenu[$item[2]][0][2]}'>{$item[0]}</a>"; |
204 | 204 | else |
205 | 205 | $current_theme_actions[] = "<a class='button button-secondary$class' href='{$submenu[$item[2]][0][2]}'>{$item[0]}</a>"; |
206 | - } elseif ( ! empty( $item[2] ) && current_user_can( $item[1] ) ) { |
|
206 | + } elseif ( ! empty($item[2]) && current_user_can($item[1])) { |
|
207 | 207 | $menu_file = $item[2]; |
208 | 208 | |
209 | - if ( current_user_can( 'customize' ) ) { |
|
210 | - if ( 'custom-header' === $menu_file ) { |
|
209 | + if (current_user_can('customize')) { |
|
210 | + if ('custom-header' === $menu_file) { |
|
211 | 211 | $current_theme_actions[] = "<a class='button button-secondary hide-if-no-customize$class' href='customize.php?autofocus[control]=header_image'>{$item[0]}</a>"; |
212 | - } elseif ( 'custom-background' === $menu_file ) { |
|
212 | + } elseif ('custom-background' === $menu_file) { |
|
213 | 213 | $current_theme_actions[] = "<a class='button button-secondary hide-if-no-customize$class' href='customize.php?autofocus[control]=background_image'>{$item[0]}</a>"; |
214 | 214 | } |
215 | 215 | } |
216 | 216 | |
217 | - if ( false !== ( $pos = strpos( $menu_file, '?' ) ) ) { |
|
218 | - $menu_file = substr( $menu_file, 0, $pos ); |
|
217 | + if (false !== ($pos = strpos($menu_file, '?'))) { |
|
218 | + $menu_file = substr($menu_file, 0, $pos); |
|
219 | 219 | } |
220 | 220 | |
221 | - if ( file_exists( ABSPATH . "wp-admin/$menu_file" ) ) { |
|
221 | + if (file_exists(ABSPATH."wp-admin/$menu_file")) { |
|
222 | 222 | $current_theme_actions[] = "<a class='button button-secondary$class' href='{$item[2]}'>{$item[0]}</a>"; |
223 | 223 | } else { |
224 | 224 | $current_theme_actions[] = "<a class='button button-secondary$class' href='themes.php?page={$item[2]}'>{$item[0]}</a>"; |
@@ -237,12 +237,12 @@ discard block |
||
237 | 237 | * This PHP is synchronized with the tmpl-theme template below! |
238 | 238 | */ |
239 | 239 | |
240 | -foreach ( $themes as $theme ) : |
|
241 | - $aria_action = esc_attr( $theme['id'] . '-action' ); |
|
242 | - $aria_name = esc_attr( $theme['id'] . '-name' ); |
|
240 | +foreach ($themes as $theme) : |
|
241 | + $aria_action = esc_attr($theme['id'].'-action'); |
|
242 | + $aria_name = esc_attr($theme['id'].'-name'); |
|
243 | 243 | ?> |
244 | -<div class="theme<?php if ( $theme['active'] ) echo ' active'; ?>" tabindex="0" aria-describedby="<?php echo $aria_action . ' ' . $aria_name; ?>"> |
|
245 | - <?php if ( ! empty( $theme['screenshot'][0] ) ) { ?> |
|
244 | +<div class="theme<?php if ($theme['active']) echo ' active'; ?>" tabindex="0" aria-describedby="<?php echo $aria_action.' '.$aria_name; ?>"> |
|
245 | + <?php if ( ! empty($theme['screenshot'][0])) { ?> |
|
246 | 246 | <div class="theme-screenshot"> |
247 | 247 | <img src="<?php echo $theme['screenshot'][0]; ?>" alt="" /> |
248 | 248 | </div> |
@@ -250,20 +250,20 @@ discard block |
||
250 | 250 | <div class="theme-screenshot blank"></div> |
251 | 251 | <?php } ?> |
252 | 252 | |
253 | - <?php if ( $theme['hasUpdate'] ) : ?> |
|
253 | + <?php if ($theme['hasUpdate']) : ?> |
|
254 | 254 | <div class="update-message notice inline notice-warning notice-alt"> |
255 | - <p><?php _e( 'New version available. <button class="button-link" type="button">Update now</button>' ); ?></p> |
|
255 | + <p><?php _e('New version available. <button class="button-link" type="button">Update now</button>'); ?></p> |
|
256 | 256 | </div> |
257 | 257 | <?php endif; ?> |
258 | 258 | |
259 | - <span class="more-details" id="<?php echo $aria_action; ?>"><?php _e( 'Theme Details' ); ?></span> |
|
260 | - <div class="theme-author"><?php printf( __( 'By %s' ), $theme['author'] ); ?></div> |
|
259 | + <span class="more-details" id="<?php echo $aria_action; ?>"><?php _e('Theme Details'); ?></span> |
|
260 | + <div class="theme-author"><?php printf(__('By %s'), $theme['author']); ?></div> |
|
261 | 261 | |
262 | - <?php if ( $theme['active'] ) { ?> |
|
262 | + <?php if ($theme['active']) { ?> |
|
263 | 263 | <h2 class="theme-name" id="<?php echo $aria_name; ?>"> |
264 | 264 | <?php |
265 | 265 | /* translators: %s: theme name */ |
266 | - printf( __( '<span>Active:</span> %s' ), $theme['name'] ); |
|
266 | + printf(__('<span>Active:</span> %s'), $theme['name']); |
|
267 | 267 | ?> |
268 | 268 | </h2> |
269 | 269 | <?php } else { ?> |
@@ -272,18 +272,18 @@ discard block |
||
272 | 272 | |
273 | 273 | <div class="theme-actions"> |
274 | 274 | |
275 | - <?php if ( $theme['active'] ) { ?> |
|
276 | - <?php if ( $theme['actions']['customize'] && current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { ?> |
|
277 | - <a class="button button-primary customize load-customize hide-if-no-customize" href="<?php echo $theme['actions']['customize']; ?>"><?php _e( 'Customize' ); ?></a> |
|
275 | + <?php if ($theme['active']) { ?> |
|
276 | + <?php if ($theme['actions']['customize'] && current_user_can('edit_theme_options') && current_user_can('customize')) { ?> |
|
277 | + <a class="button button-primary customize load-customize hide-if-no-customize" href="<?php echo $theme['actions']['customize']; ?>"><?php _e('Customize'); ?></a> |
|
278 | 278 | <?php } ?> |
279 | 279 | <?php } else { ?> |
280 | 280 | <?php |
281 | 281 | /* translators: %s: Theme name */ |
282 | - $aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' ); |
|
282 | + $aria_label = sprintf(_x('Activate %s', 'theme'), '{{ data.name }}'); |
|
283 | 283 | ?> |
284 | - <a class="button button-secondary activate" href="<?php echo $theme['actions']['activate']; ?>" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Activate' ); ?></a> |
|
285 | - <?php if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { ?> |
|
286 | - <a class="button button-primary load-customize hide-if-no-customize" href="<?php echo $theme['actions']['customize']; ?>"><?php _e( 'Live Preview' ); ?></a> |
|
284 | + <a class="button button-secondary activate" href="<?php echo $theme['actions']['activate']; ?>" aria-label="<?php echo esc_attr($aria_label); ?>"><?php _e('Activate'); ?></a> |
|
285 | + <?php if (current_user_can('edit_theme_options') && current_user_can('customize')) { ?> |
|
286 | + <a class="button button-primary load-customize hide-if-no-customize" href="<?php echo $theme['actions']['customize']; ?>"><?php _e('Live Preview'); ?></a> |
|
287 | 287 | <?php } ?> |
288 | 288 | <?php } ?> |
289 | 289 | |
@@ -294,61 +294,61 @@ discard block |
||
294 | 294 | </div> |
295 | 295 | <div class="theme-overlay"></div> |
296 | 296 | |
297 | -<p class="no-themes"><?php _e( 'No themes found. Try a different search.' ); ?></p> |
|
297 | +<p class="no-themes"><?php _e('No themes found. Try a different search.'); ?></p> |
|
298 | 298 | |
299 | 299 | <?php |
300 | 300 | // List broken themes, if any. |
301 | -if ( ! is_multisite() && current_user_can('edit_themes') && $broken_themes = wp_get_themes( array( 'errors' => true ) ) ) { |
|
301 | +if ( ! is_multisite() && current_user_can('edit_themes') && $broken_themes = wp_get_themes(array('errors' => true))) { |
|
302 | 302 | ?> |
303 | 303 | |
304 | 304 | <div class="broken-themes"> |
305 | 305 | <h3><?php _e('Broken Themes'); ?></h3> |
306 | -<p><?php _e( 'The following themes are installed but incomplete.' ); ?></p> |
|
306 | +<p><?php _e('The following themes are installed but incomplete.'); ?></p> |
|
307 | 307 | |
308 | 308 | <?php |
309 | -$can_delete = current_user_can( 'delete_themes' ); |
|
310 | -$can_install = current_user_can( 'install_themes' ); |
|
309 | +$can_delete = current_user_can('delete_themes'); |
|
310 | +$can_install = current_user_can('install_themes'); |
|
311 | 311 | ?> |
312 | 312 | <table> |
313 | 313 | <tr> |
314 | 314 | <th><?php _ex('Name', 'theme name'); ?></th> |
315 | 315 | <th><?php _e('Description'); ?></th> |
316 | - <?php if ( $can_delete ) { ?> |
|
316 | + <?php if ($can_delete) { ?> |
|
317 | 317 | <td></td> |
318 | 318 | <?php } ?> |
319 | - <?php if ( $can_install ) { ?> |
|
319 | + <?php if ($can_install) { ?> |
|
320 | 320 | <td></td> |
321 | 321 | <?php } ?> |
322 | 322 | </tr> |
323 | - <?php foreach ( $broken_themes as $broken_theme ) : ?> |
|
323 | + <?php foreach ($broken_themes as $broken_theme) : ?> |
|
324 | 324 | <tr> |
325 | - <td><?php echo $broken_theme->get( 'Name' ) ? $broken_theme->display( 'Name' ) : $broken_theme->get_stylesheet(); ?></td> |
|
325 | + <td><?php echo $broken_theme->get('Name') ? $broken_theme->display('Name') : $broken_theme->get_stylesheet(); ?></td> |
|
326 | 326 | <td><?php echo $broken_theme->errors()->get_error_message(); ?></td> |
327 | 327 | <?php |
328 | - if ( $can_delete ) { |
|
328 | + if ($can_delete) { |
|
329 | 329 | $stylesheet = $broken_theme->get_stylesheet(); |
330 | - $delete_url = add_query_arg( array( |
|
330 | + $delete_url = add_query_arg(array( |
|
331 | 331 | 'action' => 'delete', |
332 | - 'stylesheet' => urlencode( $stylesheet ), |
|
333 | - ), admin_url( 'themes.php' ) ); |
|
334 | - $delete_url = wp_nonce_url( $delete_url, 'delete-theme_' . $stylesheet ); |
|
332 | + 'stylesheet' => urlencode($stylesheet), |
|
333 | + ), admin_url('themes.php')); |
|
334 | + $delete_url = wp_nonce_url($delete_url, 'delete-theme_'.$stylesheet); |
|
335 | 335 | ?> |
336 | - <td><a href="<?php echo esc_url( $delete_url ); ?>" class="button button-secondary delete-theme"><?php _e( 'Delete' ); ?></a></td> |
|
336 | + <td><a href="<?php echo esc_url($delete_url); ?>" class="button button-secondary delete-theme"><?php _e('Delete'); ?></a></td> |
|
337 | 337 | <?php |
338 | 338 | } |
339 | 339 | |
340 | - if ( $can_install && 'theme_no_parent' === $broken_theme->errors()->get_error_code() ) { |
|
341 | - $parent_theme_name = $broken_theme->get( 'Template' ); |
|
342 | - $parent_theme = themes_api( 'theme_information', array( 'slug' => urlencode( $parent_theme_name ) ) ); |
|
340 | + if ($can_install && 'theme_no_parent' === $broken_theme->errors()->get_error_code()) { |
|
341 | + $parent_theme_name = $broken_theme->get('Template'); |
|
342 | + $parent_theme = themes_api('theme_information', array('slug' => urlencode($parent_theme_name))); |
|
343 | 343 | |
344 | - if ( ! is_wp_error( $parent_theme ) ) { |
|
345 | - $install_url = add_query_arg( array( |
|
344 | + if ( ! is_wp_error($parent_theme)) { |
|
345 | + $install_url = add_query_arg(array( |
|
346 | 346 | 'action' => 'install-theme', |
347 | - 'theme' => urlencode( $parent_theme_name ), |
|
348 | - ), admin_url( 'update.php' ) ); |
|
349 | - $install_url = wp_nonce_url( $install_url, 'install-theme_' . $parent_theme_name ); |
|
347 | + 'theme' => urlencode($parent_theme_name), |
|
348 | + ), admin_url('update.php')); |
|
349 | + $install_url = wp_nonce_url($install_url, 'install-theme_'.$parent_theme_name); |
|
350 | 350 | ?> |
351 | - <td><a href="<?php echo esc_url( $install_url ); ?>" class="button button-secondary install-theme"><?php _e( 'Install Parent Theme' ); ?></a></td> |
|
351 | + <td><a href="<?php echo esc_url($install_url); ?>" class="button button-secondary install-theme"><?php _e('Install Parent Theme'); ?></a></td> |
|
352 | 352 | <?php |
353 | 353 | } |
354 | 354 | } |
@@ -378,14 +378,14 @@ discard block |
||
378 | 378 | <# } #> |
379 | 379 | |
380 | 380 | <# if ( data.hasUpdate ) { #> |
381 | - <div class="update-message notice inline notice-warning notice-alt"><p><?php _e( 'New version available. <button class="button-link" type="button">Update now</button>' ); ?></p></div> |
|
381 | + <div class="update-message notice inline notice-warning notice-alt"><p><?php _e('New version available. <button class="button-link" type="button">Update now</button>'); ?></p></div> |
|
382 | 382 | <# } #> |
383 | 383 | |
384 | - <span class="more-details" id="{{ data.id }}-action"><?php _e( 'Theme Details' ); ?></span> |
|
384 | + <span class="more-details" id="{{ data.id }}-action"><?php _e('Theme Details'); ?></span> |
|
385 | 385 | <div class="theme-author"> |
386 | 386 | <?php |
387 | 387 | /* translators: %s: Theme author name */ |
388 | - printf( __( 'By %s' ), '{{{ data.author }}}' ); |
|
388 | + printf(__('By %s'), '{{{ data.author }}}'); |
|
389 | 389 | ?> |
390 | 390 | </div> |
391 | 391 | |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | <h2 class="theme-name" id="{{ data.id }}-name"> |
394 | 394 | <?php |
395 | 395 | /* translators: %s: Theme name */ |
396 | - printf( __( '<span>Active:</span> %s' ), '{{{ data.name }}}' ); |
|
396 | + printf(__('<span>Active:</span> %s'), '{{{ data.name }}}'); |
|
397 | 397 | ?> |
398 | 398 | </h2> |
399 | 399 | <# } else { #> |
@@ -403,15 +403,15 @@ discard block |
||
403 | 403 | <div class="theme-actions"> |
404 | 404 | <# if ( data.active ) { #> |
405 | 405 | <# if ( data.actions.customize ) { #> |
406 | - <a class="button button-primary customize load-customize hide-if-no-customize" href="{{{ data.actions.customize }}}"><?php _e( 'Customize' ); ?></a> |
|
406 | + <a class="button button-primary customize load-customize hide-if-no-customize" href="{{{ data.actions.customize }}}"><?php _e('Customize'); ?></a> |
|
407 | 407 | <# } #> |
408 | 408 | <# } else { #> |
409 | 409 | <?php |
410 | 410 | /* translators: %s: Theme name */ |
411 | - $aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' ); |
|
411 | + $aria_label = sprintf(_x('Activate %s', 'theme'), '{{ data.name }}'); |
|
412 | 412 | ?> |
413 | - <a class="button button-secondary activate" href="{{{ data.actions.activate }}}" aria-label="<?php echo $aria_label; ?>"><?php _e( 'Activate' ); ?></a> |
|
414 | - <a class="button button-primary load-customize hide-if-no-customize" href="{{{ data.actions.customize }}}"><?php _e( 'Live Preview' ); ?></a> |
|
413 | + <a class="button button-secondary activate" href="{{{ data.actions.activate }}}" aria-label="<?php echo $aria_label; ?>"><?php _e('Activate'); ?></a> |
|
414 | + <a class="button button-primary load-customize hide-if-no-customize" href="{{{ data.actions.customize }}}"><?php _e('Live Preview'); ?></a> |
|
415 | 415 | <# } #> |
416 | 416 | </div> |
417 | 417 | </script> |
@@ -420,9 +420,9 @@ discard block |
||
420 | 420 | <div class="theme-backdrop"></div> |
421 | 421 | <div class="theme-wrap wp-clearfix"> |
422 | 422 | <div class="theme-header"> |
423 | - <button class="left dashicons dashicons-no"><span class="screen-reader-text"><?php _e( 'Show previous theme' ); ?></span></button> |
|
424 | - <button class="right dashicons dashicons-no"><span class="screen-reader-text"><?php _e( 'Show next theme' ); ?></span></button> |
|
425 | - <button class="close dashicons dashicons-no"><span class="screen-reader-text"><?php _e( 'Close details dialog' ); ?></span></button> |
|
423 | + <button class="left dashicons dashicons-no"><span class="screen-reader-text"><?php _e('Show previous theme'); ?></span></button> |
|
424 | + <button class="right dashicons dashicons-no"><span class="screen-reader-text"><?php _e('Show next theme'); ?></span></button> |
|
425 | + <button class="close dashicons dashicons-no"><span class="screen-reader-text"><?php _e('Close details dialog'); ?></span></button> |
|
426 | 426 | </div> |
427 | 427 | <div class="theme-about wp-clearfix"> |
428 | 428 | <div class="theme-screenshots"> |
@@ -435,47 +435,47 @@ discard block |
||
435 | 435 | |
436 | 436 | <div class="theme-info"> |
437 | 437 | <# if ( data.active ) { #> |
438 | - <span class="current-label"><?php _e( 'Current Theme' ); ?></span> |
|
438 | + <span class="current-label"><?php _e('Current Theme'); ?></span> |
|
439 | 439 | <# } #> |
440 | - <h2 class="theme-name">{{{ data.name }}}<span class="theme-version"><?php printf( __( 'Version: %s' ), '{{ data.version }}' ); ?></span></h2> |
|
441 | - <p class="theme-author"><?php printf( __( 'By %s' ), '{{{ data.authorAndUri }}}' ); ?></p> |
|
440 | + <h2 class="theme-name">{{{ data.name }}}<span class="theme-version"><?php printf(__('Version: %s'), '{{ data.version }}'); ?></span></h2> |
|
441 | + <p class="theme-author"><?php printf(__('By %s'), '{{{ data.authorAndUri }}}'); ?></p> |
|
442 | 442 | |
443 | 443 | <# if ( data.hasUpdate ) { #> |
444 | 444 | <div class="notice notice-warning notice-alt notice-large"> |
445 | - <h3 class="notice-title"><?php _e( 'Update Available' ); ?></h3> |
|
445 | + <h3 class="notice-title"><?php _e('Update Available'); ?></h3> |
|
446 | 446 | {{{ data.update }}} |
447 | 447 | </div> |
448 | 448 | <# } #> |
449 | 449 | <p class="theme-description">{{{ data.description }}}</p> |
450 | 450 | |
451 | 451 | <# if ( data.parent ) { #> |
452 | - <p class="parent-theme"><?php printf( __( 'This is a child theme of %s.' ), '<strong>{{{ data.parent }}}</strong>' ); ?></p> |
|
452 | + <p class="parent-theme"><?php printf(__('This is a child theme of %s.'), '<strong>{{{ data.parent }}}</strong>'); ?></p> |
|
453 | 453 | <# } #> |
454 | 454 | |
455 | 455 | <# if ( data.tags ) { #> |
456 | - <p class="theme-tags"><span><?php _e( 'Tags:' ); ?></span> {{{ data.tags }}}</p> |
|
456 | + <p class="theme-tags"><span><?php _e('Tags:'); ?></span> {{{ data.tags }}}</p> |
|
457 | 457 | <# } #> |
458 | 458 | </div> |
459 | 459 | </div> |
460 | 460 | |
461 | 461 | <div class="theme-actions"> |
462 | 462 | <div class="active-theme"> |
463 | - <a href="{{{ data.actions.customize }}}" class="button button-primary customize load-customize hide-if-no-customize"><?php _e( 'Customize' ); ?></a> |
|
464 | - <?php echo implode( ' ', $current_theme_actions ); ?> |
|
463 | + <a href="{{{ data.actions.customize }}}" class="button button-primary customize load-customize hide-if-no-customize"><?php _e('Customize'); ?></a> |
|
464 | + <?php echo implode(' ', $current_theme_actions); ?> |
|
465 | 465 | </div> |
466 | 466 | <div class="inactive-theme"> |
467 | 467 | <?php |
468 | 468 | /* translators: %s: Theme name */ |
469 | - $aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' ); |
|
469 | + $aria_label = sprintf(_x('Activate %s', 'theme'), '{{ data.name }}'); |
|
470 | 470 | ?> |
471 | 471 | <# if ( data.actions.activate ) { #> |
472 | - <a href="{{{ data.actions.activate }}}" class="button button-secondary activate" aria-label="<?php echo $aria_label; ?>"><?php _e( 'Activate' ); ?></a> |
|
472 | + <a href="{{{ data.actions.activate }}}" class="button button-secondary activate" aria-label="<?php echo $aria_label; ?>"><?php _e('Activate'); ?></a> |
|
473 | 473 | <# } #> |
474 | - <a href="{{{ data.actions.customize }}}" class="button button-primary load-customize hide-if-no-customize"><?php _e( 'Live Preview' ); ?></a> |
|
474 | + <a href="{{{ data.actions.customize }}}" class="button button-primary load-customize hide-if-no-customize"><?php _e('Live Preview'); ?></a> |
|
475 | 475 | </div> |
476 | 476 | |
477 | 477 | <# if ( ! data.active && data.actions['delete'] ) { #> |
478 | - <a href="{{{ data.actions['delete'] }}}" class="button button-secondary delete-theme"><?php _e( 'Delete' ); ?></a> |
|
478 | + <a href="{{{ data.actions['delete'] }}}" class="button button-secondary delete-theme"><?php _e('Delete'); ?></a> |
|
479 | 479 | <# } #> |
480 | 480 | </div> |
481 | 481 | </div> |
@@ -486,4 +486,4 @@ discard block |
||
486 | 486 | wp_print_admin_notice_templates(); |
487 | 487 | wp_print_update_row_templates(); |
488 | 488 | |
489 | -require( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
489 | +require(ABSPATH.'wp-admin/admin-footer.php'); |
@@ -7,69 +7,69 @@ discard block |
||
7 | 7 | * @since 3.0.0 |
8 | 8 | */ |
9 | 9 | |
10 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
10 | +require_once(dirname(__FILE__).'/admin.php'); |
|
11 | 11 | |
12 | -if ( !is_multisite() ) |
|
13 | - wp_die( __( 'Multisite support is not enabled.' ) ); |
|
12 | +if ( ! is_multisite()) |
|
13 | + wp_die(__('Multisite support is not enabled.')); |
|
14 | 14 | |
15 | -if ( ! current_user_can('read') ) |
|
16 | - wp_die( __( 'Sorry, you are not allowed to access this page.' ) ); |
|
15 | +if ( ! current_user_can('read')) |
|
16 | + wp_die(__('Sorry, you are not allowed to access this page.')); |
|
17 | 17 | |
18 | -$action = isset( $_POST['action'] ) ? $_POST['action'] : 'splash'; |
|
18 | +$action = isset($_POST['action']) ? $_POST['action'] : 'splash'; |
|
19 | 19 | |
20 | -$blogs = get_blogs_of_user( $current_user->ID ); |
|
20 | +$blogs = get_blogs_of_user($current_user->ID); |
|
21 | 21 | |
22 | 22 | $updated = false; |
23 | -if ( 'updateblogsettings' == $action && isset( $_POST['primary_blog'] ) ) { |
|
24 | - check_admin_referer( 'update-my-sites' ); |
|
23 | +if ('updateblogsettings' == $action && isset($_POST['primary_blog'])) { |
|
24 | + check_admin_referer('update-my-sites'); |
|
25 | 25 | |
26 | - $blog = get_blog_details( (int) $_POST['primary_blog'] ); |
|
27 | - if ( $blog && isset( $blog->domain ) ) { |
|
28 | - update_user_option( $current_user->ID, 'primary_blog', (int) $_POST['primary_blog'], true ); |
|
26 | + $blog = get_blog_details((int) $_POST['primary_blog']); |
|
27 | + if ($blog && isset($blog->domain)) { |
|
28 | + update_user_option($current_user->ID, 'primary_blog', (int) $_POST['primary_blog'], true); |
|
29 | 29 | $updated = true; |
30 | 30 | } else { |
31 | - wp_die( __( 'The primary site you chose does not exist.' ) ); |
|
31 | + wp_die(__('The primary site you chose does not exist.')); |
|
32 | 32 | } |
33 | 33 | } |
34 | 34 | |
35 | -$title = __( 'My Sites' ); |
|
35 | +$title = __('My Sites'); |
|
36 | 36 | $parent_file = 'index.php'; |
37 | 37 | |
38 | -get_current_screen()->add_help_tab( array( |
|
38 | +get_current_screen()->add_help_tab(array( |
|
39 | 39 | 'id' => 'overview', |
40 | 40 | 'title' => __('Overview'), |
41 | 41 | 'content' => |
42 | - '<p>' . __('This screen shows an individual user all of their sites in this network, and also allows that user to set a primary site. They can use the links under each site to visit either the front end or the dashboard for that site.') . '</p>' . |
|
43 | - '<p>' . __('Up until WordPress version 3.0, what is now called a Multisite Network had to be installed separately as WordPress MU (multi-user).') . '</p>' |
|
44 | -) ); |
|
42 | + '<p>'.__('This screen shows an individual user all of their sites in this network, and also allows that user to set a primary site. They can use the links under each site to visit either the front end or the dashboard for that site.').'</p>'. |
|
43 | + '<p>'.__('Up until WordPress version 3.0, what is now called a Multisite Network had to be installed separately as WordPress MU (multi-user).').'</p>' |
|
44 | +)); |
|
45 | 45 | |
46 | 46 | get_current_screen()->set_help_sidebar( |
47 | - '<p><strong>' . __('For more information:') . '</strong></p>' . |
|
48 | - '<p>' . __('<a href="https://codex.wordpress.org/Dashboard_My_Sites_Screen" target="_blank">Documentation on My Sites</a>') . '</p>' . |
|
49 | - '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' |
|
47 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
48 | + '<p>'.__('<a href="https://codex.wordpress.org/Dashboard_My_Sites_Screen" target="_blank">Documentation on My Sites</a>').'</p>'. |
|
49 | + '<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>' |
|
50 | 50 | ); |
51 | 51 | |
52 | -require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
|
52 | +require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
53 | 53 | |
54 | -if ( $updated ) { ?> |
|
55 | - <div id="message" class="updated notice is-dismissible"><p><strong><?php _e( 'Settings saved.' ); ?></strong></p></div> |
|
54 | +if ($updated) { ?> |
|
55 | + <div id="message" class="updated notice is-dismissible"><p><strong><?php _e('Settings saved.'); ?></strong></p></div> |
|
56 | 56 | <?php } ?> |
57 | 57 | |
58 | 58 | <div class="wrap"> |
59 | 59 | <h1><?php |
60 | -echo esc_html( $title ); |
|
60 | +echo esc_html($title); |
|
61 | 61 | |
62 | -if ( in_array( get_site_option( 'registration' ), array( 'all', 'blog' ) ) ) { |
|
62 | +if (in_array(get_site_option('registration'), array('all', 'blog'))) { |
|
63 | 63 | /** This filter is documented in wp-login.php */ |
64 | - $sign_up_url = apply_filters( 'wp_signup_location', network_site_url( 'wp-signup.php' ) ); |
|
65 | - printf( ' <a href="%s" class="page-title-action">%s</a>', esc_url( $sign_up_url ), esc_html_x( 'Add New', 'site' ) ); |
|
64 | + $sign_up_url = apply_filters('wp_signup_location', network_site_url('wp-signup.php')); |
|
65 | + printf(' <a href="%s" class="page-title-action">%s</a>', esc_url($sign_up_url), esc_html_x('Add New', 'site')); |
|
66 | 66 | } |
67 | 67 | ?></h1> |
68 | 68 | |
69 | 69 | <?php |
70 | -if ( empty( $blogs ) ) : |
|
70 | +if (empty($blogs)) : |
|
71 | 71 | echo '<p>'; |
72 | - _e( 'You must be a member of at least one site to use this page.' ); |
|
72 | + _e('You must be a member of at least one site to use this page.'); |
|
73 | 73 | echo '</p>'; |
74 | 74 | else : |
75 | 75 | ?> |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | * |
82 | 82 | * @since 3.0.0 |
83 | 83 | */ |
84 | - do_action( 'myblogs_allblogs_options' ); |
|
84 | + do_action('myblogs_allblogs_options'); |
|
85 | 85 | ?> |
86 | 86 | <br clear="all" /> |
87 | 87 | <ul class="my-sites striped"> |
@@ -98,14 +98,14 @@ discard block |
||
98 | 98 | * @param string $settings_html The settings HTML markup. Default empty. |
99 | 99 | * @param object $context Context of the setting (global or site-specific). Default 'global'. |
100 | 100 | */ |
101 | - $settings_html = apply_filters( 'myblogs_options', '', 'global' ); |
|
102 | - if ( $settings_html != '' ) { |
|
103 | - echo '<h3>' . __( 'Global Settings' ) . '</h3>'; |
|
101 | + $settings_html = apply_filters('myblogs_options', '', 'global'); |
|
102 | + if ($settings_html != '') { |
|
103 | + echo '<h3>'.__('Global Settings').'</h3>'; |
|
104 | 104 | echo $settings_html; |
105 | 105 | } |
106 | - reset( $blogs ); |
|
106 | + reset($blogs); |
|
107 | 107 | |
108 | - foreach ( $blogs as $user_blog ) { |
|
108 | + foreach ($blogs as $user_blog) { |
|
109 | 109 | echo "<li>"; |
110 | 110 | echo "<h3>{$user_blog->blogname}</h3>"; |
111 | 111 | /** |
@@ -116,16 +116,16 @@ discard block |
||
116 | 116 | * @param string $string The HTML site link markup. |
117 | 117 | * @param object $user_blog An object containing the site data. |
118 | 118 | */ |
119 | - echo "<p class='my-sites-actions'>" . apply_filters( 'myblogs_blog_actions', "<a href='" . esc_url( get_home_url( $user_blog->userblog_id ) ). "'>" . __( 'Visit' ) . "</a> | <a href='" . esc_url( get_admin_url( $user_blog->userblog_id ) ) . "'>" . __( 'Dashboard' ) . "</a>", $user_blog ) . "</p>"; |
|
119 | + echo "<p class='my-sites-actions'>".apply_filters('myblogs_blog_actions', "<a href='".esc_url(get_home_url($user_blog->userblog_id))."'>".__('Visit')."</a> | <a href='".esc_url(get_admin_url($user_blog->userblog_id))."'>".__('Dashboard')."</a>", $user_blog)."</p>"; |
|
120 | 120 | /** This filter is documented in wp-admin/my-sites.php */ |
121 | - echo apply_filters( 'myblogs_options', '', $user_blog ); |
|
121 | + echo apply_filters('myblogs_options', '', $user_blog); |
|
122 | 122 | echo "</li>"; |
123 | 123 | }?> |
124 | 124 | </ul> |
125 | 125 | <?php |
126 | - if ( count( $blogs ) > 1 || has_action( 'myblogs_allblogs_options' ) || has_filter( 'myblogs_options' ) ) { |
|
126 | + if (count($blogs) > 1 || has_action('myblogs_allblogs_options') || has_filter('myblogs_options')) { |
|
127 | 127 | ?><input type="hidden" name="action" value="updateblogsettings" /><?php |
128 | - wp_nonce_field( 'update-my-sites' ); |
|
128 | + wp_nonce_field('update-my-sites'); |
|
129 | 129 | submit_button(); |
130 | 130 | } |
131 | 131 | ?> |
@@ -133,4 +133,4 @@ discard block |
||
133 | 133 | <?php endif; ?> |
134 | 134 | </div> |
135 | 135 | <?php |
136 | -include( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
136 | +include(ABSPATH.'wp-admin/admin-footer.php'); |
@@ -137,15 +137,17 @@ discard block |
||
137 | 137 | * @return int Current step |
138 | 138 | */ |
139 | 139 | public function step() { |
140 | - if ( ! isset( $_GET['step'] ) ) |
|
141 | - return 1; |
|
140 | + if ( ! isset( $_GET['step'] ) ) { |
|
141 | + return 1; |
|
142 | + } |
|
142 | 143 | |
143 | 144 | $step = (int) $_GET['step']; |
144 | 145 | if ( $step < 1 || 3 < $step || |
145 | 146 | ( 2 == $step && ! wp_verify_nonce( $_REQUEST['_wpnonce-custom-header-upload'], 'custom-header-upload' ) ) || |
146 | 147 | ( 3 == $step && ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'custom-header-crop-image' ) ) |
147 | - ) |
|
148 | - return 1; |
|
148 | + ) { |
|
149 | + return 1; |
|
150 | + } |
|
149 | 151 | |
150 | 152 | return $step; |
151 | 153 | } |
@@ -161,8 +163,9 @@ discard block |
||
161 | 163 | if ( ( 1 == $step || 3 == $step ) ) { |
162 | 164 | wp_enqueue_media(); |
163 | 165 | wp_enqueue_script( 'custom-header' ); |
164 | - if ( current_theme_supports( 'custom-header', 'header-text' ) ) |
|
165 | - wp_enqueue_script( 'wp-color-picker' ); |
|
166 | + if ( current_theme_supports( 'custom-header', 'header-text' ) ) { |
|
167 | + wp_enqueue_script( 'wp-color-picker' ); |
|
168 | + } |
|
166 | 169 | } elseif ( 2 == $step ) { |
167 | 170 | wp_enqueue_script('imgareaselect'); |
168 | 171 | } |
@@ -176,10 +179,11 @@ discard block |
||
176 | 179 | public function css_includes() { |
177 | 180 | $step = $this->step(); |
178 | 181 | |
179 | - if ( ( 1 == $step || 3 == $step ) && current_theme_supports( 'custom-header', 'header-text' ) ) |
|
180 | - wp_enqueue_style( 'wp-color-picker' ); |
|
181 | - elseif ( 2 == $step ) |
|
182 | - wp_enqueue_style('imgareaselect'); |
|
182 | + if ( ( 1 == $step || 3 == $step ) && current_theme_supports( 'custom-header', 'header-text' ) ) { |
|
183 | + wp_enqueue_style( 'wp-color-picker' ); |
|
184 | + } elseif ( 2 == $step ) { |
|
185 | + wp_enqueue_style('imgareaselect'); |
|
186 | + } |
|
183 | 187 | } |
184 | 188 | |
185 | 189 | /** |
@@ -188,11 +192,13 @@ discard block |
||
188 | 192 | * @since 2.6.0 |
189 | 193 | */ |
190 | 194 | public function take_action() { |
191 | - if ( ! current_user_can('edit_theme_options') ) |
|
192 | - return; |
|
195 | + if ( ! current_user_can('edit_theme_options') ) { |
|
196 | + return; |
|
197 | + } |
|
193 | 198 | |
194 | - if ( empty( $_POST ) ) |
|
195 | - return; |
|
199 | + if ( empty( $_POST ) ) { |
|
200 | + return; |
|
201 | + } |
|
196 | 202 | |
197 | 203 | $this->updated = true; |
198 | 204 | |
@@ -215,10 +221,11 @@ discard block |
||
215 | 221 | check_admin_referer( 'custom-header-options', '_wpnonce-custom-header-options' ); |
216 | 222 | $_POST['text-color'] = str_replace( '#', '', $_POST['text-color'] ); |
217 | 223 | $color = preg_replace('/[^0-9a-fA-F]/', '', $_POST['text-color']); |
218 | - if ( strlen($color) == 6 || strlen($color) == 3 ) |
|
219 | - set_theme_mod('header_textcolor', $color); |
|
220 | - elseif ( ! $color ) |
|
221 | - set_theme_mod( 'header_textcolor', 'blank' ); |
|
224 | + if ( strlen($color) == 6 || strlen($color) == 3 ) { |
|
225 | + set_theme_mod('header_textcolor', $color); |
|
226 | + } elseif ( ! $color ) { |
|
227 | + set_theme_mod( 'header_textcolor', 'blank' ); |
|
228 | + } |
|
222 | 229 | } |
223 | 230 | |
224 | 231 | if ( isset( $_POST['default-header'] ) ) { |
@@ -238,8 +245,9 @@ discard block |
||
238 | 245 | public function process_default_headers() { |
239 | 246 | global $_wp_default_headers; |
240 | 247 | |
241 | - if ( !isset($_wp_default_headers) ) |
|
242 | - return; |
|
248 | + if ( !isset($_wp_default_headers) ) { |
|
249 | + return; |
|
250 | + } |
|
243 | 251 | |
244 | 252 | if ( ! empty( $this->default_headers ) ) { |
245 | 253 | return; |
@@ -289,8 +297,9 @@ discard block |
||
289 | 297 | echo '<div class="default-header">'; |
290 | 298 | echo '<label><input name="default-header" type="radio" value="' . esc_attr( $header_key ) . '" ' . checked( $header_url, get_theme_mod( 'header_image' ), false ) . ' />'; |
291 | 299 | $width = ''; |
292 | - if ( !empty( $header['attachment_id'] ) ) |
|
293 | - $width = ' width="230"'; |
|
300 | + if ( !empty( $header['attachment_id'] ) ) { |
|
301 | + $width = ' width="230"'; |
|
302 | + } |
|
294 | 303 | echo '<img src="' . set_url_scheme( $header_thumbnail ) . '" alt="' . esc_attr( $header_alt_text ) .'"' . $width . ' /></label>'; |
295 | 304 | echo '</div>'; |
296 | 305 | } |
@@ -304,10 +313,11 @@ discard block |
||
304 | 313 | */ |
305 | 314 | public function js() { |
306 | 315 | $step = $this->step(); |
307 | - if ( ( 1 == $step || 3 == $step ) && current_theme_supports( 'custom-header', 'header-text' ) ) |
|
308 | - $this->js_1(); |
|
309 | - elseif ( 2 == $step ) |
|
310 | - $this->js_2(); |
|
316 | + if ( ( 1 == $step || 3 == $step ) && current_theme_supports( 'custom-header', 'header-text' ) ) { |
|
317 | + $this->js_1(); |
|
318 | + } elseif ( 2 == $step ) { |
|
319 | + $this->js_2(); |
|
320 | + } |
|
311 | 321 | } |
312 | 322 | |
313 | 323 | /** |
@@ -492,21 +502,24 @@ discard block |
||
492 | 502 | |
493 | 503 | if ( $header_image ) { |
494 | 504 | $header_image_style = 'background-image:url(' . esc_url( $header_image ) . ');'; |
495 | - } else { |
|
505 | + } else { |
|
496 | 506 | $header_image_style = ''; |
497 | 507 | } |
498 | 508 | |
499 | - if ( $custom_header->width ) |
|
500 | - $header_image_style .= 'max-width:' . $custom_header->width . 'px;'; |
|
501 | - if ( $custom_header->height ) |
|
502 | - $header_image_style .= 'height:' . $custom_header->height . 'px;'; |
|
509 | + if ( $custom_header->width ) { |
|
510 | + $header_image_style .= 'max-width:' . $custom_header->width . 'px;'; |
|
511 | + } |
|
512 | + if ( $custom_header->height ) { |
|
513 | + $header_image_style .= 'height:' . $custom_header->height . 'px;'; |
|
514 | + } |
|
503 | 515 | ?> |
504 | 516 | <div id="headimg" style="<?php echo $header_image_style; ?>"> |
505 | 517 | <?php |
506 | - if ( display_header_text() ) |
|
507 | - $style = ' style="color:#' . get_header_textcolor() . ';"'; |
|
508 | - else |
|
509 | - $style = ' style="display:none;"'; |
|
518 | + if ( display_header_text() ) { |
|
519 | + $style = ' style="color:#' . get_header_textcolor() . ';"'; |
|
520 | + } else { |
|
521 | + $style = ' style="display:none;"'; |
|
522 | + } |
|
510 | 523 | ?> |
511 | 524 | <h1><a id="name" class="displaying-header-text" <?php echo $style; ?> onclick="return false;" href="<?php bloginfo('url'); ?>" tabindex="-1"><?php bloginfo( 'name' ); ?></a></h1> |
512 | 525 | <div id="desc" class="displaying-header-text" <?php echo $style; ?>><?php bloginfo( 'description' ); ?></div> |
@@ -525,8 +538,8 @@ discard block |
||
525 | 538 | if ( ! current_theme_supports( 'custom-header', 'flex-height' ) && ! current_theme_supports( 'custom-header', 'flex-width' ) ) { |
526 | 539 | printf( __( 'Images of exactly <strong>%1$d × %2$d pixels</strong> will be used as-is.' ) . '<br />', get_theme_support( 'custom-header', 'width' ), get_theme_support( 'custom-header', 'height' ) ); |
527 | 540 | } elseif ( current_theme_supports( 'custom-header', 'flex-height' ) ) { |
528 | - if ( ! current_theme_supports( 'custom-header', 'flex-width' ) ) |
|
529 | - printf( |
|
541 | + if ( ! current_theme_supports( 'custom-header', 'flex-width' ) ) { |
|
542 | + printf( |
|
530 | 543 | /* translators: %s: size in pixels */ |
531 | 544 | __( 'Images should be at least %s wide.' ) . ' ', |
532 | 545 | sprintf( |
@@ -535,9 +548,10 @@ discard block |
||
535 | 548 | get_theme_support( 'custom-header', 'width' ) |
536 | 549 | ) |
537 | 550 | ); |
551 | + } |
|
538 | 552 | } elseif ( current_theme_supports( 'custom-header', 'flex-width' ) ) { |
539 | - if ( ! current_theme_supports( 'custom-header', 'flex-height' ) ) |
|
540 | - printf( |
|
553 | + if ( ! current_theme_supports( 'custom-header', 'flex-height' ) ) { |
|
554 | + printf( |
|
541 | 555 | /* translators: %s: size in pixels */ |
542 | 556 | __( 'Images should be at least %s tall.' ) . ' ', |
543 | 557 | sprintf( |
@@ -546,10 +560,11 @@ discard block |
||
546 | 560 | get_theme_support( 'custom-header', 'height' ) |
547 | 561 | ) |
548 | 562 | ); |
563 | + } |
|
549 | 564 | } |
550 | 565 | if ( current_theme_supports( 'custom-header', 'flex-height' ) || current_theme_supports( 'custom-header', 'flex-width' ) ) { |
551 | - if ( current_theme_supports( 'custom-header', 'width' ) ) |
|
552 | - printf( |
|
566 | + if ( current_theme_supports( 'custom-header', 'width' ) ) { |
|
567 | + printf( |
|
553 | 568 | /* translators: %s: size in pixels */ |
554 | 569 | __( 'Suggested width is %s.' ) . ' ', |
555 | 570 | sprintf( |
@@ -558,8 +573,9 @@ discard block |
||
558 | 573 | get_theme_support( 'custom-header', 'width' ) |
559 | 574 | ) |
560 | 575 | ); |
561 | - if ( current_theme_supports( 'custom-header', 'height' ) ) |
|
562 | - printf( |
|
576 | + } |
|
577 | + if ( current_theme_supports( 'custom-header', 'height' ) ) { |
|
578 | + printf( |
|
563 | 579 | /* translators: %s: size in pixels */ |
564 | 580 | __( 'Suggested height is %s.' ) . ' ', |
565 | 581 | sprintf( |
@@ -568,6 +584,7 @@ discard block |
||
568 | 584 | get_theme_support( 'custom-header', 'height' ) |
569 | 585 | ) |
570 | 586 | ); |
587 | + } |
|
571 | 588 | } |
572 | 589 | ?></p> |
573 | 590 | <form enctype="multipart/form-data" id="upload-form" class="wp-upload-form" method="post" action="<?php echo esc_url( add_query_arg( 'step', 2 ) ) ?>"> |
@@ -620,9 +637,12 @@ discard block |
||
620 | 637 | <td> |
621 | 638 | <?php if ( current_theme_supports( 'custom-header', 'uploads' ) ) : ?> |
622 | 639 | <p><?php _e( 'If you don‘t want to upload your own image, you can use one of these cool headers, or show a random one.' ) ?></p> |
623 | -<?php else: ?> |
|
640 | +<?php else { |
|
641 | + : ?> |
|
624 | 642 | <p><?php _e( 'You can use one of these cool headers or show a random one on each page.' ) ?></p> |
625 | -<?php endif; ?> |
|
643 | +<?php endif; |
|
644 | +} |
|
645 | +?> |
|
626 | 646 | <?php |
627 | 647 | $this->show_header_selector( 'default' ); |
628 | 648 | ?> |
@@ -752,11 +772,13 @@ discard block |
||
752 | 772 | |
753 | 773 | $max_width = 0; |
754 | 774 | // For flex, limit size of image displayed to 1500px unless theme says otherwise |
755 | - if ( current_theme_supports( 'custom-header', 'flex-width' ) ) |
|
756 | - $max_width = 1500; |
|
775 | + if ( current_theme_supports( 'custom-header', 'flex-width' ) ) { |
|
776 | + $max_width = 1500; |
|
777 | + } |
|
757 | 778 | |
758 | - if ( current_theme_supports( 'custom-header', 'max-width' ) ) |
|
759 | - $max_width = max( $max_width, get_theme_support( 'custom-header', 'max-width' ) ); |
|
779 | + if ( current_theme_supports( 'custom-header', 'max-width' ) ) { |
|
780 | + $max_width = max( $max_width, get_theme_support( 'custom-header', 'max-width' ) ); |
|
781 | + } |
|
760 | 782 | $max_width = max( $max_width, get_theme_support( 'custom-header', 'width' ) ); |
761 | 783 | |
762 | 784 | // If flexible height isn't supported and the image is the exact right size |
@@ -764,8 +786,9 @@ discard block |
||
764 | 786 | && $width == get_theme_support( 'custom-header', 'width' ) && $height == get_theme_support( 'custom-header', 'height' ) ) |
765 | 787 | { |
766 | 788 | // Add the meta-data |
767 | - if ( file_exists( $file ) ) |
|
768 | - wp_update_attachment_metadata( $attachment_id, wp_generate_attachment_metadata( $attachment_id, $file ) ); |
|
789 | + if ( file_exists( $file ) ) { |
|
790 | + wp_update_attachment_metadata( $attachment_id, wp_generate_attachment_metadata( $attachment_id, $file ) ); |
|
791 | + } |
|
769 | 792 | |
770 | 793 | $this->set_header_image( compact( 'url', 'attachment_id', 'width', 'height' ) ); |
771 | 794 | |
@@ -783,8 +806,9 @@ discard block |
||
783 | 806 | } elseif ( $width > $max_width ) { |
784 | 807 | $oitar = $width / $max_width; |
785 | 808 | $image = wp_crop_image($attachment_id, 0, 0, $width, $height, $max_width, $height / $oitar, false, str_replace(basename($file), 'midsize-'.basename($file), $file)); |
786 | - if ( ! $image || is_wp_error( $image ) ) |
|
787 | - wp_die( __( 'Image could not be processed. Please go back and try again.' ), __( 'Image Processing Error' ) ); |
|
809 | + if ( ! $image || is_wp_error( $image ) ) { |
|
810 | + wp_die( __( 'Image could not be processed. Please go back and try again.' ), __( 'Image Processing Error' ) ); |
|
811 | + } |
|
788 | 812 | |
789 | 813 | /** This filter is documented in wp-admin/custom-header.php */ |
790 | 814 | $image = apply_filters( 'wp_create_file_in_uploads', $image, $attachment_id ); // For replication |
@@ -822,8 +846,9 @@ discard block |
||
822 | 846 | <p class="submit"> |
823 | 847 | <?php submit_button( __( 'Crop and Publish' ), 'primary', 'submit', false ); ?> |
824 | 848 | <?php |
825 | - if ( isset( $oitar ) && 1 == $oitar && ( current_theme_supports( 'custom-header', 'flex-height' ) || current_theme_supports( 'custom-header', 'flex-width' ) ) ) |
|
826 | - submit_button( __( 'Skip Cropping, Publish Image as Is' ), 'secondary', 'skip-cropping', false ); |
|
849 | + if ( isset( $oitar ) && 1 == $oitar && ( current_theme_supports( 'custom-header', 'flex-height' ) || current_theme_supports( 'custom-header', 'flex-width' ) ) ) { |
|
850 | + submit_button( __( 'Skip Cropping, Publish Image as Is' ), 'secondary', 'skip-cropping', false ); |
|
851 | + } |
|
827 | 852 | ?> |
828 | 853 | </p> |
829 | 854 | </form> |
@@ -842,13 +867,15 @@ discard block |
||
842 | 867 | |
843 | 868 | $uploaded_file = $_FILES['import']; |
844 | 869 | $wp_filetype = wp_check_filetype_and_ext( $uploaded_file['tmp_name'], $uploaded_file['name'] ); |
845 | - if ( ! wp_match_mime_types( 'image', $wp_filetype['type'] ) ) |
|
846 | - wp_die( __( 'The uploaded file is not a valid image. Please try again.' ) ); |
|
870 | + if ( ! wp_match_mime_types( 'image', $wp_filetype['type'] ) ) { |
|
871 | + wp_die( __( 'The uploaded file is not a valid image. Please try again.' ) ); |
|
872 | + } |
|
847 | 873 | |
848 | 874 | $file = wp_handle_upload($uploaded_file, $overrides); |
849 | 875 | |
850 | - if ( isset($file['error']) ) |
|
851 | - wp_die( $file['error'], __( 'Image Upload Error' ) ); |
|
876 | + if ( isset($file['error']) ) { |
|
877 | + wp_die( $file['error'], __( 'Image Upload Error' ) ); |
|
878 | + } |
|
852 | 879 | |
853 | 880 | $url = $file['url']; |
854 | 881 | $type = $file['type']; |
@@ -912,23 +939,26 @@ discard block |
||
912 | 939 | $height = $dimensions['dst_height']; |
913 | 940 | $width = $dimensions['dst_width']; |
914 | 941 | |
915 | - if ( empty( $_POST['skip-cropping'] ) ) |
|
916 | - $cropped = wp_crop_image( $attachment_id, (int) $_POST['x1'], (int) $_POST['y1'], (int) $_POST['width'], (int) $_POST['height'], $width, $height ); |
|
917 | - elseif ( ! empty( $_POST['create-new-attachment'] ) ) |
|
918 | - $cropped = _copy_image_file( $attachment_id ); |
|
919 | - else |
|
920 | - $cropped = get_attached_file( $attachment_id ); |
|
942 | + if ( empty( $_POST['skip-cropping'] ) ) { |
|
943 | + $cropped = wp_crop_image( $attachment_id, (int) $_POST['x1'], (int) $_POST['y1'], (int) $_POST['width'], (int) $_POST['height'], $width, $height ); |
|
944 | + } elseif ( ! empty( $_POST['create-new-attachment'] ) ) { |
|
945 | + $cropped = _copy_image_file( $attachment_id ); |
|
946 | + } else { |
|
947 | + $cropped = get_attached_file( $attachment_id ); |
|
948 | + } |
|
921 | 949 | |
922 | - if ( ! $cropped || is_wp_error( $cropped ) ) |
|
923 | - wp_die( __( 'Image could not be processed. Please go back and try again.' ), __( 'Image Processing Error' ) ); |
|
950 | + if ( ! $cropped || is_wp_error( $cropped ) ) { |
|
951 | + wp_die( __( 'Image could not be processed. Please go back and try again.' ), __( 'Image Processing Error' ) ); |
|
952 | + } |
|
924 | 953 | |
925 | 954 | /** This filter is documented in wp-admin/custom-header.php */ |
926 | 955 | $cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); // For replication |
927 | 956 | |
928 | 957 | $object = $this->create_attachment_object( $cropped, $attachment_id ); |
929 | 958 | |
930 | - if ( ! empty( $_POST['create-new-attachment'] ) ) |
|
931 | - unset( $object['ID'] ); |
|
959 | + if ( ! empty( $_POST['create-new-attachment'] ) ) { |
|
960 | + unset( $object['ID'] ); |
|
961 | + } |
|
932 | 962 | |
933 | 963 | // Update the attachment |
934 | 964 | $attachment_id = $this->insert_attachment( $object, $cropped ); |
@@ -965,15 +995,17 @@ discard block |
||
965 | 995 | * @since 2.1.0 |
966 | 996 | */ |
967 | 997 | public function admin_page() { |
968 | - if ( ! current_user_can('edit_theme_options') ) |
|
969 | - wp_die(__('Sorry, you are not allowed to customize headers.')); |
|
998 | + if ( ! current_user_can('edit_theme_options') ) { |
|
999 | + wp_die(__('Sorry, you are not allowed to customize headers.')); |
|
1000 | + } |
|
970 | 1001 | $step = $this->step(); |
971 | - if ( 2 == $step ) |
|
972 | - $this->step_2(); |
|
973 | - elseif ( 3 == $step ) |
|
974 | - $this->step_3(); |
|
975 | - else |
|
976 | - $this->step_1(); |
|
1002 | + if ( 2 == $step ) { |
|
1003 | + $this->step_2(); |
|
1004 | + } elseif ( 3 == $step ) { |
|
1005 | + $this->step_3(); |
|
1006 | + } else { |
|
1007 | + $this->step_1(); |
|
1008 | + } |
|
977 | 1009 | } |
978 | 1010 | |
979 | 1011 | /** |
@@ -1015,8 +1047,9 @@ discard block |
||
1015 | 1047 | final public function set_header_image( $choice ) { |
1016 | 1048 | if ( is_array( $choice ) || is_object( $choice ) ) { |
1017 | 1049 | $choice = (array) $choice; |
1018 | - if ( ! isset( $choice['attachment_id'] ) || ! isset( $choice['url'] ) ) |
|
1019 | - return; |
|
1050 | + if ( ! isset( $choice['attachment_id'] ) || ! isset( $choice['url'] ) ) { |
|
1051 | + return; |
|
1052 | + } |
|
1020 | 1053 | |
1021 | 1054 | $choice['url'] = esc_url_raw( $choice['url'] ); |
1022 | 1055 | |
@@ -1046,10 +1079,11 @@ discard block |
||
1046 | 1079 | |
1047 | 1080 | } else { |
1048 | 1081 | $this->process_default_headers(); |
1049 | - if ( isset( $this->default_headers[ $choice ] ) ) |
|
1050 | - $header_image_data = $this->default_headers[ $choice ]; |
|
1051 | - else |
|
1052 | - return; |
|
1082 | + if ( isset( $this->default_headers[ $choice ] ) ) { |
|
1083 | + $header_image_data = $this->default_headers[ $choice ]; |
|
1084 | + } else { |
|
1085 | + return; |
|
1086 | + } |
|
1053 | 1087 | } |
1054 | 1088 | |
1055 | 1089 | set_theme_mod( 'header_image', esc_url_raw( $header_image_data['url'] ) ); |
@@ -1123,21 +1157,17 @@ discard block |
||
1123 | 1157 | |
1124 | 1158 | if ( $has_flex_height && ( ! $has_flex_width || $width > $max_width ) ) { |
1125 | 1159 | $dst['dst_height'] = absint( $height * ( $max_width / $width ) ); |
1126 | - } |
|
1127 | - elseif ( $has_flex_height && $has_flex_width ) { |
|
1160 | + } elseif ( $has_flex_height && $has_flex_width ) { |
|
1128 | 1161 | $dst['dst_height'] = $height; |
1129 | - } |
|
1130 | - else { |
|
1162 | + } else { |
|
1131 | 1163 | $dst['dst_height'] = $theme_height; |
1132 | 1164 | } |
1133 | 1165 | |
1134 | 1166 | if ( $has_flex_width && ( ! $has_flex_height || $width > $max_width ) ) { |
1135 | 1167 | $dst['dst_width'] = absint( $width * ( $max_width / $width ) ); |
1136 | - } |
|
1137 | - elseif ( $has_flex_width && $has_flex_height ) { |
|
1168 | + } elseif ( $has_flex_width && $has_flex_height ) { |
|
1138 | 1169 | $dst['dst_width'] = $width; |
1139 | - } |
|
1140 | - else { |
|
1170 | + } else { |
|
1141 | 1171 | $dst['dst_width'] = $theme_width; |
1142 | 1172 | } |
1143 | 1173 |
@@ -7,28 +7,28 @@ discard block |
||
7 | 7 | * @since 3.4.0 |
8 | 8 | */ |
9 | 9 | |
10 | -define( 'IFRAME_REQUEST', true ); |
|
10 | +define('IFRAME_REQUEST', true); |
|
11 | 11 | |
12 | 12 | /** Load WordPress Administration Bootstrap */ |
13 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
13 | +require_once(dirname(__FILE__).'/admin.php'); |
|
14 | 14 | |
15 | -if ( ! current_user_can( 'customize' ) ) { |
|
15 | +if ( ! current_user_can('customize')) { |
|
16 | 16 | wp_die( |
17 | - '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . |
|
18 | - '<p>' . __( 'Sorry, you are not allowed to customize this site.' ) . '</p>', |
|
17 | + '<h1>'.__('Cheatin’ uh?').'</h1>'. |
|
18 | + '<p>'.__('Sorry, you are not allowed to customize this site.').'</p>', |
|
19 | 19 | 403 |
20 | 20 | ); |
21 | 21 | } |
22 | 22 | |
23 | -wp_reset_vars( array( 'url', 'return', 'autofocus' ) ); |
|
24 | -if ( ! empty( $url ) ) { |
|
25 | - $wp_customize->set_preview_url( wp_unslash( $url ) ); |
|
23 | +wp_reset_vars(array('url', 'return', 'autofocus')); |
|
24 | +if ( ! empty($url)) { |
|
25 | + $wp_customize->set_preview_url(wp_unslash($url)); |
|
26 | 26 | } |
27 | -if ( ! empty( $return ) ) { |
|
28 | - $wp_customize->set_return_url( wp_unslash( $return ) ); |
|
27 | +if ( ! empty($return)) { |
|
28 | + $wp_customize->set_return_url(wp_unslash($return)); |
|
29 | 29 | } |
30 | -if ( ! empty( $autofocus ) && is_array( $autofocus ) ) { |
|
31 | - $wp_customize->set_autofocus( wp_unslash( $autofocus ) ); |
|
30 | +if ( ! empty($autofocus) && is_array($autofocus)) { |
|
31 | + $wp_customize->set_autofocus(wp_unslash($autofocus)); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | /** |
@@ -41,56 +41,56 @@ discard block |
||
41 | 41 | $wp_scripts = new WP_Scripts; |
42 | 42 | $wp_scripts->registered = $registered; |
43 | 43 | |
44 | -add_action( 'customize_controls_print_scripts', 'print_head_scripts', 20 ); |
|
45 | -add_action( 'customize_controls_print_footer_scripts', '_wp_footer_scripts' ); |
|
46 | -add_action( 'customize_controls_print_styles', 'print_admin_styles', 20 ); |
|
44 | +add_action('customize_controls_print_scripts', 'print_head_scripts', 20); |
|
45 | +add_action('customize_controls_print_footer_scripts', '_wp_footer_scripts'); |
|
46 | +add_action('customize_controls_print_styles', 'print_admin_styles', 20); |
|
47 | 47 | |
48 | 48 | /** |
49 | 49 | * Fires when Customizer controls are initialized, before scripts are enqueued. |
50 | 50 | * |
51 | 51 | * @since 3.4.0 |
52 | 52 | */ |
53 | -do_action( 'customize_controls_init' ); |
|
53 | +do_action('customize_controls_init'); |
|
54 | 54 | |
55 | -wp_enqueue_script( 'customize-controls' ); |
|
56 | -wp_enqueue_style( 'customize-controls' ); |
|
55 | +wp_enqueue_script('customize-controls'); |
|
56 | +wp_enqueue_style('customize-controls'); |
|
57 | 57 | |
58 | 58 | /** |
59 | 59 | * Enqueue Customizer control scripts. |
60 | 60 | * |
61 | 61 | * @since 3.4.0 |
62 | 62 | */ |
63 | -do_action( 'customize_controls_enqueue_scripts' ); |
|
63 | +do_action('customize_controls_enqueue_scripts'); |
|
64 | 64 | |
65 | 65 | // Let's roll. |
66 | -@header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset')); |
|
66 | +@header('Content-Type: '.get_option('html_type').'; charset='.get_option('blog_charset')); |
|
67 | 67 | |
68 | 68 | wp_user_settings(); |
69 | 69 | _wp_admin_html_begin(); |
70 | 70 | |
71 | 71 | $body_class = 'wp-core-ui wp-customizer js'; |
72 | 72 | |
73 | -if ( wp_is_mobile() ) : |
|
73 | +if (wp_is_mobile()) : |
|
74 | 74 | $body_class .= ' mobile'; |
75 | 75 | |
76 | 76 | ?><meta name="viewport" id="viewport-meta" content="width=device-width, initial-scale=1.0, minimum-scale=0.5, maximum-scale=1.2" /><?php |
77 | 77 | endif; |
78 | 78 | |
79 | -if ( $wp_customize->is_ios() ) { |
|
79 | +if ($wp_customize->is_ios()) { |
|
80 | 80 | $body_class .= ' ios'; |
81 | 81 | } |
82 | 82 | |
83 | -if ( is_rtl() ) { |
|
83 | +if (is_rtl()) { |
|
84 | 84 | $body_class .= ' rtl'; |
85 | 85 | } |
86 | -$body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_locale() ) ) ); |
|
86 | +$body_class .= ' locale-'.sanitize_html_class(strtolower(str_replace('_', '-', get_locale()))); |
|
87 | 87 | |
88 | -$admin_title = sprintf( $wp_customize->get_document_title_template(), __( 'Loading…' ) ); |
|
88 | +$admin_title = sprintf($wp_customize->get_document_title_template(), __('Loading…')); |
|
89 | 89 | |
90 | 90 | ?><title><?php echo $admin_title; ?></title> |
91 | 91 | |
92 | 92 | <script type="text/javascript"> |
93 | -var ajaxurl = <?php echo wp_json_encode( admin_url( 'admin-ajax.php', 'relative' ) ); ?>; |
|
93 | +var ajaxurl = <?php echo wp_json_encode(admin_url('admin-ajax.php', 'relative')); ?>; |
|
94 | 94 | </script> |
95 | 95 | |
96 | 96 | <?php |
@@ -99,31 +99,31 @@ discard block |
||
99 | 99 | * |
100 | 100 | * @since 3.4.0 |
101 | 101 | */ |
102 | -do_action( 'customize_controls_print_styles' ); |
|
102 | +do_action('customize_controls_print_styles'); |
|
103 | 103 | |
104 | 104 | /** |
105 | 105 | * Fires when Customizer control scripts are printed. |
106 | 106 | * |
107 | 107 | * @since 3.4.0 |
108 | 108 | */ |
109 | -do_action( 'customize_controls_print_scripts' ); |
|
109 | +do_action('customize_controls_print_scripts'); |
|
110 | 110 | ?> |
111 | 111 | </head> |
112 | -<body class="<?php echo esc_attr( $body_class ); ?>"> |
|
112 | +<body class="<?php echo esc_attr($body_class); ?>"> |
|
113 | 113 | <div class="wp-full-overlay expanded"> |
114 | 114 | <form id="customize-controls" class="wrap wp-full-overlay-sidebar"> |
115 | 115 | <div id="customize-header-actions" class="wp-full-overlay-header"> |
116 | 116 | <?php |
117 | - $save_text = $wp_customize->is_theme_active() ? __( 'Save & Publish' ) : __( 'Save & Activate' ); |
|
118 | - submit_button( $save_text, 'primary save', 'save', false ); |
|
117 | + $save_text = $wp_customize->is_theme_active() ? __('Save & Publish') : __('Save & Activate'); |
|
118 | + submit_button($save_text, 'primary save', 'save', false); |
|
119 | 119 | ?> |
120 | 120 | <span class="spinner"></span> |
121 | 121 | <button type="button" class="customize-controls-preview-toggle"> |
122 | - <span class="controls"><?php _e( 'Customize' ); ?></span> |
|
123 | - <span class="preview"><?php _e( 'Preview' ); ?></span> |
|
122 | + <span class="controls"><?php _e('Customize'); ?></span> |
|
123 | + <span class="preview"><?php _e('Preview'); ?></span> |
|
124 | 124 | </button> |
125 | - <a class="customize-controls-close" href="<?php echo esc_url( $wp_customize->get_return_url() ); ?>"> |
|
126 | - <span class="screen-reader-text"><?php _e( 'Close the Customizer and go back to the previous page' ); ?></span> |
|
125 | + <a class="customize-controls-close" href="<?php echo esc_url($wp_customize->get_return_url()); ?>"> |
|
126 | + <span class="screen-reader-text"><?php _e('Close the Customizer and go back to the previous page'); ?></span> |
|
127 | 127 | </a> |
128 | 128 | </div> |
129 | 129 | |
@@ -132,12 +132,12 @@ discard block |
||
132 | 132 | <div id="customize-info" class="accordion-section customize-info"> |
133 | 133 | <div class="accordion-section-title"> |
134 | 134 | <span class="preview-notice"><?php |
135 | - echo sprintf( __( 'You are customizing %s' ), '<strong class="panel-title site-title">' . get_bloginfo( 'name' ) . '</strong>' ); |
|
135 | + echo sprintf(__('You are customizing %s'), '<strong class="panel-title site-title">'.get_bloginfo('name').'</strong>'); |
|
136 | 136 | ?></span> |
137 | - <button type="button" class="customize-help-toggle dashicons dashicons-editor-help" aria-expanded="false"><span class="screen-reader-text"><?php _e( 'Help' ); ?></span></button> |
|
137 | + <button type="button" class="customize-help-toggle dashicons dashicons-editor-help" aria-expanded="false"><span class="screen-reader-text"><?php _e('Help'); ?></span></button> |
|
138 | 138 | </div> |
139 | 139 | <div class="customize-panel-description"><?php |
140 | - _e( 'The Customizer allows you to preview changes to your site before publishing them. You can also navigate to different pages on your site to preview them.' ); |
|
140 | + _e('The Customizer allows you to preview changes to your site before publishing them. You can also navigate to different pages on your site to preview them.'); |
|
141 | 141 | ?></div> |
142 | 142 | </div> |
143 | 143 | |
@@ -149,28 +149,28 @@ discard block |
||
149 | 149 | |
150 | 150 | <div id="customize-footer-actions" class="wp-full-overlay-footer"> |
151 | 151 | <?php $previewable_devices = $wp_customize->get_previewable_devices(); ?> |
152 | - <?php if ( ! empty( $previewable_devices ) ) : ?> |
|
152 | + <?php if ( ! empty($previewable_devices)) : ?> |
|
153 | 153 | <div class="devices"> |
154 | - <?php foreach ( (array) $previewable_devices as $device => $settings ) : ?> |
|
154 | + <?php foreach ((array) $previewable_devices as $device => $settings) : ?> |
|
155 | 155 | <?php |
156 | - if ( empty( $settings['label'] ) ) { |
|
156 | + if (empty($settings['label'])) { |
|
157 | 157 | continue; |
158 | 158 | } |
159 | - $active = ! empty( $settings['default'] ); |
|
160 | - $class = 'preview-' . $device; |
|
161 | - if ( $active ) { |
|
159 | + $active = ! empty($settings['default']); |
|
160 | + $class = 'preview-'.$device; |
|
161 | + if ($active) { |
|
162 | 162 | $class .= ' active'; |
163 | 163 | } |
164 | 164 | ?> |
165 | - <button type="button" class="<?php echo esc_attr( $class ); ?>" aria-pressed="<?php echo esc_attr( $active ) ?>" data-device="<?php echo esc_attr( $device ); ?>"> |
|
166 | - <span class="screen-reader-text"><?php echo esc_html( $settings['label'] ); ?></span> |
|
165 | + <button type="button" class="<?php echo esc_attr($class); ?>" aria-pressed="<?php echo esc_attr($active) ?>" data-device="<?php echo esc_attr($device); ?>"> |
|
166 | + <span class="screen-reader-text"><?php echo esc_html($settings['label']); ?></span> |
|
167 | 167 | </button> |
168 | 168 | <?php endforeach; ?> |
169 | 169 | </div> |
170 | 170 | <?php endif; ?> |
171 | - <button type="button" class="collapse-sidebar button-secondary" aria-expanded="true" aria-label="<?php esc_attr_e( 'Collapse Sidebar' ); ?>"> |
|
171 | + <button type="button" class="collapse-sidebar button-secondary" aria-expanded="true" aria-label="<?php esc_attr_e('Collapse Sidebar'); ?>"> |
|
172 | 172 | <span class="collapse-sidebar-arrow"></span> |
173 | - <span class="collapse-sidebar-label"><?php _e( 'Collapse' ); ?></span> |
|
173 | + <span class="collapse-sidebar-label"><?php _e('Collapse'); ?></span> |
|
174 | 174 | </button> |
175 | 175 | </div> |
176 | 176 | </form> |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | * |
183 | 183 | * @since 3.4.0 |
184 | 184 | */ |
185 | - do_action( 'customize_controls_print_footer_scripts' ); |
|
185 | + do_action('customize_controls_print_footer_scripts'); |
|
186 | 186 | ?> |
187 | 187 | </div> |
188 | 188 | </body> |
@@ -6,55 +6,55 @@ discard block |
||
6 | 6 | * @subpackage Administration |
7 | 7 | */ |
8 | 8 | // TODO route this pages via a specific iframe handler instead of the do_action below |
9 | -if ( !defined( 'IFRAME_REQUEST' ) && isset( $_GET['tab'] ) && ( 'plugin-information' == $_GET['tab'] ) ) |
|
10 | - define( 'IFRAME_REQUEST', true ); |
|
9 | +if ( ! defined('IFRAME_REQUEST') && isset($_GET['tab']) && ('plugin-information' == $_GET['tab'])) |
|
10 | + define('IFRAME_REQUEST', true); |
|
11 | 11 | |
12 | 12 | /** |
13 | 13 | * WordPress Administration Bootstrap. |
14 | 14 | */ |
15 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
15 | +require_once(dirname(__FILE__).'/admin.php'); |
|
16 | 16 | |
17 | -if ( ! current_user_can('install_plugins') ) |
|
17 | +if ( ! current_user_can('install_plugins')) |
|
18 | 18 | wp_die(__('Sorry, you are not allowed to install plugins on this site.')); |
19 | 19 | |
20 | -if ( is_multisite() && ! is_network_admin() ) { |
|
21 | - wp_redirect( network_admin_url( 'plugin-install.php' ) ); |
|
20 | +if (is_multisite() && ! is_network_admin()) { |
|
21 | + wp_redirect(network_admin_url('plugin-install.php')); |
|
22 | 22 | exit(); |
23 | 23 | } |
24 | 24 | |
25 | 25 | $wp_list_table = _get_list_table('WP_Plugin_Install_List_Table'); |
26 | 26 | $pagenum = $wp_list_table->get_pagenum(); |
27 | 27 | |
28 | -if ( ! empty( $_REQUEST['_wp_http_referer'] ) ) { |
|
29 | - $location = remove_query_arg( '_wp_http_referer', wp_unslash( $_SERVER['REQUEST_URI'] ) ); |
|
28 | +if ( ! empty($_REQUEST['_wp_http_referer'])) { |
|
29 | + $location = remove_query_arg('_wp_http_referer', wp_unslash($_SERVER['REQUEST_URI'])); |
|
30 | 30 | |
31 | - if ( ! empty( $_REQUEST['paged'] ) ) { |
|
32 | - $location = add_query_arg( 'paged', (int) $_REQUEST['paged'], $location ); |
|
31 | + if ( ! empty($_REQUEST['paged'])) { |
|
32 | + $location = add_query_arg('paged', (int) $_REQUEST['paged'], $location); |
|
33 | 33 | } |
34 | 34 | |
35 | - wp_redirect( $location ); |
|
35 | + wp_redirect($location); |
|
36 | 36 | exit; |
37 | 37 | } |
38 | 38 | |
39 | 39 | $wp_list_table->prepare_items(); |
40 | 40 | |
41 | -$total_pages = $wp_list_table->get_pagination_arg( 'total_pages' ); |
|
41 | +$total_pages = $wp_list_table->get_pagination_arg('total_pages'); |
|
42 | 42 | |
43 | -if ( $pagenum > $total_pages && $total_pages > 0 ) { |
|
44 | - wp_redirect( add_query_arg( 'paged', $total_pages ) ); |
|
43 | +if ($pagenum > $total_pages && $total_pages > 0) { |
|
44 | + wp_redirect(add_query_arg('paged', $total_pages)); |
|
45 | 45 | exit; |
46 | 46 | } |
47 | 47 | |
48 | -$title = __( 'Add Plugins' ); |
|
48 | +$title = __('Add Plugins'); |
|
49 | 49 | $parent_file = 'plugins.php'; |
50 | 50 | |
51 | -wp_enqueue_script( 'plugin-install' ); |
|
52 | -if ( 'plugin-information' != $tab ) |
|
51 | +wp_enqueue_script('plugin-install'); |
|
52 | +if ('plugin-information' != $tab) |
|
53 | 53 | add_thickbox(); |
54 | 54 | |
55 | 55 | $body_id = $tab; |
56 | 56 | |
57 | -wp_enqueue_script( 'updates' ); |
|
57 | +wp_enqueue_script('updates'); |
|
58 | 58 | |
59 | 59 | /** |
60 | 60 | * Fires before each tab on the Install Plugins screen is loaded. |
@@ -64,61 +64,61 @@ discard block |
||
64 | 64 | * |
65 | 65 | * @since 2.7.0 |
66 | 66 | */ |
67 | -do_action( "install_plugins_pre_$tab" ); |
|
67 | +do_action("install_plugins_pre_$tab"); |
|
68 | 68 | |
69 | 69 | /* |
70 | 70 | * Call the pre upload action on every non-upload plugin install screen |
71 | 71 | * because the form is always displayed on these screens. |
72 | 72 | */ |
73 | -if ( 'upload' !== $tab ) { |
|
73 | +if ('upload' !== $tab) { |
|
74 | 74 | /** This action is documented in wp-admin/plugin-install.php */ |
75 | - do_action( 'install_plugins_pre_upload' ); |
|
75 | + do_action('install_plugins_pre_upload'); |
|
76 | 76 | } |
77 | 77 | |
78 | -get_current_screen()->add_help_tab( array( |
|
78 | +get_current_screen()->add_help_tab(array( |
|
79 | 79 | 'id' => 'overview', |
80 | 80 | 'title' => __('Overview'), |
81 | 81 | 'content' => |
82 | - '<p>' . sprintf( __('Plugins hook into WordPress to extend its functionality with custom features. Plugins are developed independently from the core WordPress application by thousands of developers all over the world. All plugins in the official <a href="%s" target="_blank">WordPress Plugin Directory</a> are compatible with the license WordPress uses.' ), 'https://wordpress.org/plugins/' ) . '</p>' . |
|
83 | - '<p>' . __( 'You can find new plugins to install by searching or browsing the directory right here in your own Plugins section.' ) . ' <span id="live-search-desc" class="hide-if-no-js">' . __( 'The search results will be updated as you type.' ) . '</span></p>' |
|
82 | + '<p>'.sprintf(__('Plugins hook into WordPress to extend its functionality with custom features. Plugins are developed independently from the core WordPress application by thousands of developers all over the world. All plugins in the official <a href="%s" target="_blank">WordPress Plugin Directory</a> are compatible with the license WordPress uses.'), 'https://wordpress.org/plugins/').'</p>'. |
|
83 | + '<p>'.__('You can find new plugins to install by searching or browsing the directory right here in your own Plugins section.').' <span id="live-search-desc" class="hide-if-no-js">'.__('The search results will be updated as you type.').'</span></p>' |
|
84 | 84 | |
85 | -) ); |
|
86 | -get_current_screen()->add_help_tab( array( |
|
85 | +)); |
|
86 | +get_current_screen()->add_help_tab(array( |
|
87 | 87 | 'id' => 'adding-plugins', |
88 | 88 | 'title' => __('Adding Plugins'), |
89 | 89 | 'content' => |
90 | - '<p>' . __('If you know what you’re looking for, Search is your best bet. The Search screen has options to search the WordPress Plugin Directory for a particular Term, Author, or Tag. You can also search the directory by selecting popular tags. Tags in larger type mean more plugins have been labeled with that tag.') . '</p>' . |
|
91 | - '<p>' . __( 'If you just want to get an idea of what’s available, you can browse Featured and Popular plugins by using the links above the plugins list. These sections rotate regularly.' ) . '</p>' . |
|
92 | - '<p>' . __( 'You can also browse a user’s favorite plugins, by using the Favorites link above the plugins list and entering their WordPress.org username.' ) . '</p>' . |
|
93 | - '<p>' . __( 'If you want to install a plugin that you’ve downloaded elsewhere, click the Upload Plugin button above the plugins list. You will be prompted to upload the .zip package, and once uploaded, you can activate the new plugin.' ) . '</p>' |
|
94 | -) ); |
|
90 | + '<p>'.__('If you know what you’re looking for, Search is your best bet. The Search screen has options to search the WordPress Plugin Directory for a particular Term, Author, or Tag. You can also search the directory by selecting popular tags. Tags in larger type mean more plugins have been labeled with that tag.').'</p>'. |
|
91 | + '<p>'.__('If you just want to get an idea of what’s available, you can browse Featured and Popular plugins by using the links above the plugins list. These sections rotate regularly.').'</p>'. |
|
92 | + '<p>'.__('You can also browse a user’s favorite plugins, by using the Favorites link above the plugins list and entering their WordPress.org username.').'</p>'. |
|
93 | + '<p>'.__('If you want to install a plugin that you’ve downloaded elsewhere, click the Upload Plugin button above the plugins list. You will be prompted to upload the .zip package, and once uploaded, you can activate the new plugin.').'</p>' |
|
94 | +)); |
|
95 | 95 | |
96 | 96 | get_current_screen()->set_help_sidebar( |
97 | - '<p><strong>' . __('For more information:') . '</strong></p>' . |
|
98 | - '<p>' . __('<a href="https://codex.wordpress.org/Plugins_Add_New_Screen" target="_blank">Documentation on Installing Plugins</a>') . '</p>' . |
|
99 | - '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' |
|
97 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
98 | + '<p>'.__('<a href="https://codex.wordpress.org/Plugins_Add_New_Screen" target="_blank">Documentation on Installing Plugins</a>').'</p>'. |
|
99 | + '<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>' |
|
100 | 100 | ); |
101 | 101 | |
102 | -get_current_screen()->set_screen_reader_content( array( |
|
103 | - 'heading_views' => __( 'Filter plugins list' ), |
|
104 | - 'heading_pagination' => __( 'Plugins list navigation' ), |
|
105 | - 'heading_list' => __( 'Plugins list' ), |
|
106 | -) ); |
|
102 | +get_current_screen()->set_screen_reader_content(array( |
|
103 | + 'heading_views' => __('Filter plugins list'), |
|
104 | + 'heading_pagination' => __('Plugins list navigation'), |
|
105 | + 'heading_list' => __('Plugins list'), |
|
106 | +)); |
|
107 | 107 | |
108 | 108 | /** |
109 | 109 | * WordPress Administration Template Header. |
110 | 110 | */ |
111 | -include(ABSPATH . 'wp-admin/admin-header.php'); |
|
111 | +include(ABSPATH.'wp-admin/admin-header.php'); |
|
112 | 112 | ?> |
113 | -<div class="wrap <?php echo esc_attr( "plugin-install-tab-$tab" ); ?>"> |
|
113 | +<div class="wrap <?php echo esc_attr("plugin-install-tab-$tab"); ?>"> |
|
114 | 114 | <h1> |
115 | 115 | <?php |
116 | - echo esc_html( $title ); |
|
117 | - if ( ! empty( $tabs['upload'] ) && current_user_can( 'upload_plugins' ) ) { |
|
118 | - printf( ' <a href="%s" class="upload-view-toggle page-title-action"><span class="upload">%s</span><span class="browse">%s</span></a>', |
|
119 | - ( 'upload' === $tab ) ? self_admin_url( 'plugin-install.php' ) : self_admin_url( 'plugin-install.php?tab=upload' ), |
|
120 | - __( 'Upload Plugin' ), |
|
121 | - __( 'Browse Plugins' ) |
|
116 | + echo esc_html($title); |
|
117 | + if ( ! empty($tabs['upload']) && current_user_can('upload_plugins')) { |
|
118 | + printf(' <a href="%s" class="upload-view-toggle page-title-action"><span class="upload">%s</span><span class="browse">%s</span></a>', |
|
119 | + ('upload' === $tab) ? self_admin_url('plugin-install.php') : self_admin_url('plugin-install.php?tab=upload'), |
|
120 | + __('Upload Plugin'), |
|
121 | + __('Browse Plugins') |
|
122 | 122 | ); |
123 | 123 | } |
124 | 124 | ?> |
@@ -129,18 +129,18 @@ discard block |
||
129 | 129 | * Output the upload plugin form on every non-upload plugin install screen, so it can be |
130 | 130 | * displayed via JavaScript rather then opening up the devoted upload plugin page. |
131 | 131 | */ |
132 | -if ( $tab !== 'upload' ) { |
|
132 | +if ($tab !== 'upload') { |
|
133 | 133 | ?> |
134 | 134 | <div class="upload-plugin-wrap"> |
135 | 135 | <?php |
136 | 136 | /** This action is documented in wp-admin/plugin-install.php */ |
137 | - do_action( 'install_plugins_upload' ); |
|
137 | + do_action('install_plugins_upload'); |
|
138 | 138 | ?> |
139 | 139 | </div> |
140 | 140 | <?php |
141 | 141 | } |
142 | 142 | |
143 | -if ( $tab !== 'upload' ) { |
|
143 | +if ($tab !== 'upload') { |
|
144 | 144 | $wp_list_table->views(); |
145 | 145 | echo '<br class="clear" />'; |
146 | 146 | } |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | * |
156 | 156 | * @param int $paged The current page number of the plugins list table. |
157 | 157 | */ |
158 | -do_action( "install_plugins_$tab", $paged ); ?> |
|
158 | +do_action("install_plugins_$tab", $paged); ?> |
|
159 | 159 | |
160 | 160 | <span class="spinner"></span> |
161 | 161 | </div> |
@@ -167,4 +167,4 @@ discard block |
||
167 | 167 | /** |
168 | 168 | * WordPress Administration Template Footer. |
169 | 169 | */ |
170 | -include(ABSPATH . 'wp-admin/admin-footer.php'); |
|
170 | +include(ABSPATH.'wp-admin/admin-footer.php'); |