changeset 16 | a86126ab1dd4 |
parent 9 | 177826044cd9 |
child 18 | be944660c56a |
15:3d4e9c994f10 | 16:a86126ab1dd4 |
---|---|
1 <?php |
1 <?php |
2 |
2 /** |
3 // -- Post related Meta Boxes |
3 * WordPress Administration Meta Boxes API. |
4 * |
|
5 * @package WordPress |
|
6 * @subpackage Administration |
|
7 */ |
|
8 |
|
9 // |
|
10 // Post-related Meta Boxes. |
|
11 // |
|
4 |
12 |
5 /** |
13 /** |
6 * Displays post submit form fields. |
14 * Displays post submit form fields. |
7 * |
15 * |
8 * @since 2.7.0 |
16 * @since 2.7.0 |
9 * |
17 * |
10 * @global string $action |
18 * @global string $action |
11 * |
19 * |
12 * @param WP_Post $post Current post object. |
20 * @param WP_Post $post Current post object. |
13 * @param array $args { |
21 * @param array $args { |
14 * Array of arguments for building the post submit meta box. |
22 * Array of arguments for building the post submit meta box. |
15 * |
23 * |
16 * @type string $id Meta box 'id' attribute. |
24 * @type string $id Meta box 'id' attribute. |
17 * @type string $title Meta box title. |
25 * @type string $title Meta box title. |
18 * @type callable $callback Meta box display callback. |
26 * @type callable $callback Meta box display callback. |
20 * } |
28 * } |
21 */ |
29 */ |
22 function post_submit_meta_box( $post, $args = array() ) { |
30 function post_submit_meta_box( $post, $args = array() ) { |
23 global $action; |
31 global $action; |
24 |
32 |
33 $post_id = (int) $post->ID; |
|
25 $post_type = $post->post_type; |
34 $post_type = $post->post_type; |
26 $post_type_object = get_post_type_object( $post_type ); |
35 $post_type_object = get_post_type_object( $post_type ); |
27 $can_publish = current_user_can( $post_type_object->cap->publish_posts ); |
36 $can_publish = current_user_can( $post_type_object->cap->publish_posts ); |
28 ?> |
37 ?> |
29 <div class="submitbox" id="submitpost"> |
38 <div class="submitbox" id="submitpost"> |
30 |
39 |
31 <div id="minor-publishing"> |
40 <div id="minor-publishing"> |
32 |
41 |
33 <?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key ?> |
42 <?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key. ?> |
34 <div style="display:none;"> |
43 <div style="display:none;"> |
35 <?php submit_button( __( 'Save' ), '', 'save' ); ?> |
44 <?php submit_button( __( 'Save' ), '', 'save' ); ?> |
36 </div> |
45 </div> |
37 |
46 |
38 <div id="minor-publishing-actions"> |
47 <div id="minor-publishing-actions"> |
39 <div id="save-action"> |
48 <div id="save-action"> |
40 <?php |
49 <?php |
41 if ( 'publish' != $post->post_status && 'future' != $post->post_status && 'pending' != $post->post_status ) { |
50 if ( ! in_array( $post->post_status, array( 'publish', 'future', 'pending' ), true ) ) { |
42 $private_style = ''; |
51 $private_style = ''; |
43 if ( 'private' == $post->post_status ) { |
52 if ( 'private' === $post->post_status ) { |
44 $private_style = 'style="display:none"'; |
53 $private_style = 'style="display:none"'; |
45 } |
54 } |
55 ?> |
|
56 <input <?php echo $private_style; ?> type="submit" name="save" id="save-post" value="<?php esc_attr_e( 'Save Draft' ); ?>" class="button" /> |
|
57 <span class="spinner"></span> |
|
58 <?php } elseif ( 'pending' === $post->post_status && $can_publish ) { ?> |
|
59 <input type="submit" name="save" id="save-post" value="<?php esc_attr_e( 'Save as Pending' ); ?>" class="button" /> |
|
60 <span class="spinner"></span> |
|
61 <?php } ?> |
|
62 </div> |
|
63 |
|
64 <?php |
|
65 if ( is_post_type_viewable( $post_type_object ) ) : |
|
66 ?> |
|
67 <div id="preview-action"> |
|
68 <?php |
|
69 $preview_link = esc_url( get_preview_post_link( $post ) ); |
|
70 if ( 'publish' === $post->post_status ) { |
|
71 $preview_button_text = __( 'Preview Changes' ); |
|
72 } else { |
|
73 $preview_button_text = __( 'Preview' ); |
|
74 } |
|
75 |
|
76 $preview_button = sprintf( |
|
77 '%1$s<span class="screen-reader-text"> %2$s</span>', |
|
78 $preview_button_text, |
|
79 /* translators: Accessibility text. */ |
|
80 __( '(opens in a new tab)' ) |
|
81 ); |
|
82 ?> |
|
83 <a class="preview button" href="<?php echo $preview_link; ?>" target="wp-preview-<?php echo $post_id; ?>" id="post-preview"><?php echo $preview_button; ?></a> |
|
84 <input type="hidden" name="wp-preview" id="wp-preview" value="" /> |
|
85 </div> |
|
86 <?php |
|
87 endif; |
|
88 |
|
89 /** |
|
90 * Fires before the post time/date setting in the Publish meta box. |
|
91 * |
|
92 * @since 4.4.0 |
|
93 * |
|
94 * @param WP_Post $post WP_Post object for the current post. |
|
95 */ |
|
96 do_action( 'post_submitbox_minor_actions', $post ); |
|
46 ?> |
97 ?> |
47 <input <?php echo $private_style; ?> type="submit" name="save" id="save-post" value="<?php esc_attr_e( 'Save Draft' ); ?>" class="button" /> |
98 <div class="clear"></div> |
48 <span class="spinner"></span> |
99 </div> |
49 <?php } elseif ( 'pending' == $post->post_status && $can_publish ) { ?> |
100 |
50 <input type="submit" name="save" id="save-post" value="<?php esc_attr_e( 'Save as Pending' ); ?>" class="button" /> |
101 <div id="misc-publishing-actions"> |
51 <span class="spinner"></span> |
102 <div class="misc-pub-section misc-pub-post-status"> |
52 <?php } ?> |
103 <?php _e( 'Status:' ); ?> |
53 </div> |
104 <span id="post-status-display"> |
54 <?php if ( is_post_type_viewable( $post_type_object ) ) : ?> |
105 <?php |
55 <div id="preview-action"> |
106 switch ( $post->post_status ) { |
56 <?php |
107 case 'private': |
57 $preview_link = esc_url( get_preview_post_link( $post ) ); |
108 _e( 'Privately Published' ); |
58 if ( 'publish' == $post->post_status ) { |
109 break; |
59 $preview_button_text = __( 'Preview Changes' ); |
110 case 'publish': |
60 } else { |
111 _e( 'Published' ); |
61 $preview_button_text = __( 'Preview' ); |
112 break; |
62 } |
113 case 'future': |
63 |
114 _e( 'Scheduled' ); |
64 $preview_button = sprintf( |
115 break; |
65 '%1$s<span class="screen-reader-text"> %2$s</span>', |
116 case 'pending': |
66 $preview_button_text, |
117 _e( 'Pending Review' ); |
67 /* translators: accessibility text */ |
118 break; |
68 __( '(opens in a new tab)' ) |
119 case 'draft': |
69 ); |
120 case 'auto-draft': |
70 ?> |
121 _e( 'Draft' ); |
71 <a class="preview button" href="<?php echo $preview_link; ?>" target="wp-preview-<?php echo (int) $post->ID; ?>" id="post-preview"><?php echo $preview_button; ?></a> |
122 break; |
72 <input type="hidden" name="wp-preview" id="wp-preview" value="" /> |
123 } |
73 </div> |
124 ?> |
74 <?php endif; // public post type ?> |
125 </span> |
75 <?php |
126 |
76 /** |
|
77 * Fires before the post time/date setting in the Publish meta box. |
|
78 * |
|
79 * @since 4.4.0 |
|
80 * |
|
81 * @param WP_Post $post WP_Post object for the current post. |
|
82 */ |
|
83 do_action( 'post_submitbox_minor_actions', $post ); |
|
84 ?> |
|
85 <div class="clear"></div> |
|
86 </div><!-- #minor-publishing-actions --> |
|
87 |
|
88 <div id="misc-publishing-actions"> |
|
89 |
|
90 <div class="misc-pub-section misc-pub-post-status"> |
|
91 <?php _e( 'Status:' ); ?> <span id="post-status-display"> |
|
92 <?php |
127 <?php |
93 |
128 if ( 'publish' === $post->post_status || 'private' === $post->post_status || $can_publish ) { |
94 switch ( $post->post_status ) { |
129 $private_style = ''; |
95 case 'private': |
130 if ( 'private' === $post->post_status ) { |
96 _e( 'Privately Published' ); |
131 $private_style = 'style="display:none"'; |
97 break; |
132 } |
98 case 'publish': |
133 ?> |
99 _e( 'Published' ); |
134 <a href="#post_status" <?php echo $private_style; ?> class="edit-post-status hide-if-no-js" role="button"><span aria-hidden="true"><?php _e( 'Edit' ); ?></span> <span class="screen-reader-text"><?php _e( 'Edit status' ); ?></span></a> |
100 break; |
135 |
101 case 'future': |
136 <div id="post-status-select" class="hide-if-js"> |
102 _e( 'Scheduled' ); |
137 <input type="hidden" name="hidden_post_status" id="hidden_post_status" value="<?php echo esc_attr( ( 'auto-draft' === $post->post_status ) ? 'draft' : $post->post_status ); ?>" /> |
103 break; |
138 <label for="post_status" class="screen-reader-text"><?php _e( 'Set status' ); ?></label> |
104 case 'pending': |
139 <select name="post_status" id="post_status"> |
105 _e( 'Pending Review' ); |
140 <?php if ( 'publish' === $post->post_status ) : ?> |
106 break; |
141 <option<?php selected( $post->post_status, 'publish' ); ?> value='publish'><?php _e( 'Published' ); ?></option> |
107 case 'draft': |
142 <?php elseif ( 'private' === $post->post_status ) : ?> |
108 case 'auto-draft': |
143 <option<?php selected( $post->post_status, 'private' ); ?> value='publish'><?php _e( 'Privately Published' ); ?></option> |
109 _e( 'Draft' ); |
144 <?php elseif ( 'future' === $post->post_status ) : ?> |
110 break; |
145 <option<?php selected( $post->post_status, 'future' ); ?> value='future'><?php _e( 'Scheduled' ); ?></option> |
146 <?php endif; ?> |
|
147 <option<?php selected( $post->post_status, 'pending' ); ?> value='pending'><?php _e( 'Pending Review' ); ?></option> |
|
148 <?php if ( 'auto-draft' === $post->post_status ) : ?> |
|
149 <option<?php selected( $post->post_status, 'auto-draft' ); ?> value='draft'><?php _e( 'Draft' ); ?></option> |
|
150 <?php else : ?> |
|
151 <option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php _e( 'Draft' ); ?></option> |
|
152 <?php endif; ?> |
|
153 </select> |
|
154 <a href="#post_status" class="save-post-status hide-if-no-js button"><?php _e( 'OK' ); ?></a> |
|
155 <a href="#post_status" class="cancel-post-status hide-if-no-js button-cancel"><?php _e( 'Cancel' ); ?></a> |
|
156 </div> |
|
157 <?php |
|
111 } |
158 } |
112 ?> |
159 ?> |
113 </span> |
160 </div> |
114 <?php |
161 |
115 if ( 'publish' == $post->post_status || 'private' == $post->post_status || $can_publish ) { |
162 <div class="misc-pub-section misc-pub-visibility" id="visibility"> |
116 $private_style = ''; |
163 <?php _e( 'Visibility:' ); ?> |
117 if ( 'private' == $post->post_status ) { |
164 <span id="post-visibility-display"> |
118 $private_style = 'style="display:none"'; |
165 <?php |
119 } |
166 if ( 'private' === $post->post_status ) { |
167 $post->post_password = ''; |
|
168 $visibility = 'private'; |
|
169 $visibility_trans = __( 'Private' ); |
|
170 } elseif ( ! empty( $post->post_password ) ) { |
|
171 $visibility = 'password'; |
|
172 $visibility_trans = __( 'Password protected' ); |
|
173 } elseif ( 'post' === $post_type && is_sticky( $post_id ) ) { |
|
174 $visibility = 'public'; |
|
175 $visibility_trans = __( 'Public, Sticky' ); |
|
176 } else { |
|
177 $visibility = 'public'; |
|
178 $visibility_trans = __( 'Public' ); |
|
179 } |
|
180 |
|
181 echo esc_html( $visibility_trans ); |
|
182 ?> |
|
183 </span> |
|
184 |
|
185 <?php if ( $can_publish ) { ?> |
|
186 <a href="#visibility" class="edit-visibility hide-if-no-js" role="button"><span aria-hidden="true"><?php _e( 'Edit' ); ?></span> <span class="screen-reader-text"><?php _e( 'Edit visibility' ); ?></span></a> |
|
187 |
|
188 <div id="post-visibility-select" class="hide-if-js"> |
|
189 <input type="hidden" name="hidden_post_password" id="hidden-post-password" value="<?php echo esc_attr( $post->post_password ); ?>" /> |
|
190 <?php if ( 'post' === $post_type ) : ?> |
|
191 <input type="checkbox" style="display:none" name="hidden_post_sticky" id="hidden-post-sticky" value="sticky" <?php checked( is_sticky( $post_id ) ); ?> /> |
|
192 <?php endif; ?> |
|
193 |
|
194 <input type="hidden" name="hidden_post_visibility" id="hidden-post-visibility" value="<?php echo esc_attr( $visibility ); ?>" /> |
|
195 <input type="radio" name="visibility" id="visibility-radio-public" value="public" <?php checked( $visibility, 'public' ); ?> /> <label for="visibility-radio-public" class="selectit"><?php _e( 'Public' ); ?></label><br /> |
|
196 |
|
197 <?php if ( 'post' === $post_type && current_user_can( 'edit_others_posts' ) ) : ?> |
|
198 <span id="sticky-span"><input id="sticky" name="sticky" type="checkbox" value="sticky" <?php checked( is_sticky( $post_id ) ); ?> /> <label for="sticky" class="selectit"><?php _e( 'Stick this post to the front page' ); ?></label><br /></span> |
|
199 <?php endif; ?> |
|
200 |
|
201 <input type="radio" name="visibility" id="visibility-radio-password" value="password" <?php checked( $visibility, 'password' ); ?> /> <label for="visibility-radio-password" class="selectit"><?php _e( 'Password protected' ); ?></label><br /> |
|
202 <span id="password-span"><label for="post_password"><?php _e( 'Password:' ); ?></label> <input type="text" name="post_password" id="post_password" value="<?php echo esc_attr( $post->post_password ); ?>" maxlength="255" /><br /></span> |
|
203 |
|
204 <input type="radio" name="visibility" id="visibility-radio-private" value="private" <?php checked( $visibility, 'private' ); ?> /> <label for="visibility-radio-private" class="selectit"><?php _e( 'Private' ); ?></label><br /> |
|
205 |
|
206 <p> |
|
207 <a href="#visibility" class="save-post-visibility hide-if-no-js button"><?php _e( 'OK' ); ?></a> |
|
208 <a href="#visibility" class="cancel-post-visibility hide-if-no-js button-cancel"><?php _e( 'Cancel' ); ?></a> |
|
209 </p> |
|
210 </div> |
|
211 <?php } ?> |
|
212 </div> |
|
213 |
|
214 <?php |
|
215 /* translators: Publish box date string. 1: Date, 2: Time. See https://www.php.net/date */ |
|
216 $date_string = __( '%1$s at %2$s' ); |
|
217 /* translators: Publish box date format, see https://www.php.net/date */ |
|
218 $date_format = _x( 'M j, Y', 'publish box date format' ); |
|
219 /* translators: Publish box time format, see https://www.php.net/date */ |
|
220 $time_format = _x( 'H:i', 'publish box time format' ); |
|
221 |
|
222 if ( 0 !== $post_id ) { |
|
223 if ( 'future' === $post->post_status ) { // Scheduled for publishing at a future date. |
|
224 /* translators: Post date information. %s: Date on which the post is currently scheduled to be published. */ |
|
225 $stamp = __( 'Scheduled for: %s' ); |
|
226 } elseif ( 'publish' === $post->post_status || 'private' === $post->post_status ) { // Already published. |
|
227 /* translators: Post date information. %s: Date on which the post was published. */ |
|
228 $stamp = __( 'Published on: %s' ); |
|
229 } elseif ( '0000-00-00 00:00:00' === $post->post_date_gmt ) { // Draft, 1 or more saves, no date specified. |
|
230 $stamp = __( 'Publish <b>immediately</b>' ); |
|
231 } elseif ( time() < strtotime( $post->post_date_gmt . ' +0000' ) ) { // Draft, 1 or more saves, future date specified. |
|
232 /* translators: Post date information. %s: Date on which the post is to be published. */ |
|
233 $stamp = __( 'Schedule for: %s' ); |
|
234 } else { // Draft, 1 or more saves, date specified. |
|
235 /* translators: Post date information. %s: Date on which the post is to be published. */ |
|
236 $stamp = __( 'Publish on: %s' ); |
|
237 } |
|
238 $date = sprintf( |
|
239 $date_string, |
|
240 date_i18n( $date_format, strtotime( $post->post_date ) ), |
|
241 date_i18n( $time_format, strtotime( $post->post_date ) ) |
|
242 ); |
|
243 } else { // Draft (no saves, and thus no date specified). |
|
244 $stamp = __( 'Publish <b>immediately</b>' ); |
|
245 $date = sprintf( |
|
246 $date_string, |
|
247 date_i18n( $date_format, strtotime( current_time( 'mysql' ) ) ), |
|
248 date_i18n( $time_format, strtotime( current_time( 'mysql' ) ) ) |
|
249 ); |
|
250 } |
|
251 |
|
252 if ( ! empty( $args['args']['revisions_count'] ) ) : |
|
253 ?> |
|
254 <div class="misc-pub-section misc-pub-revisions"> |
|
255 <?php |
|
256 /* translators: Post revisions heading. %s: The number of available revisions. */ |
|
257 printf( __( 'Revisions: %s' ), '<b>' . number_format_i18n( $args['args']['revisions_count'] ) . '</b>' ); |
|
258 ?> |
|
259 <a class="hide-if-no-js" href="<?php echo esc_url( get_edit_post_link( $args['args']['revision_id'] ) ); ?>"><span aria-hidden="true"><?php _ex( 'Browse', 'revisions' ); ?></span> <span class="screen-reader-text"><?php _e( 'Browse revisions' ); ?></span></a> |
|
260 </div> |
|
261 <?php |
|
262 endif; |
|
263 |
|
264 if ( $can_publish ) : // Contributors don't get to choose the date of publish. |
|
265 ?> |
|
266 <div class="misc-pub-section curtime misc-pub-curtime"> |
|
267 <span id="timestamp"> |
|
268 <?php printf( $stamp, '<b>' . $date . '</b>' ); ?> |
|
269 </span> |
|
270 <a href="#edit_timestamp" class="edit-timestamp hide-if-no-js" role="button"> |
|
271 <span aria-hidden="true"><?php _e( 'Edit' ); ?></span> |
|
272 <span class="screen-reader-text"><?php _e( 'Edit date and time' ); ?></span> |
|
273 </a> |
|
274 <fieldset id="timestampdiv" class="hide-if-js"> |
|
275 <legend class="screen-reader-text"><?php _e( 'Date and time' ); ?></legend> |
|
276 <?php touch_time( ( 'edit' === $action ), 1 ); ?> |
|
277 </fieldset> |
|
278 </div> |
|
279 <?php |
|
280 endif; |
|
281 |
|
282 if ( 'draft' === $post->post_status && get_post_meta( $post_id, '_customize_changeset_uuid', true ) ) : |
|
283 ?> |
|
284 <div class="notice notice-info notice-alt inline"> |
|
285 <p> |
|
286 <?php |
|
287 printf( |
|
288 /* translators: %s: URL to the Customizer. */ |
|
289 __( 'This draft comes from your <a href="%s">unpublished customization changes</a>. You can edit, but there’s no need to publish now. It will be published automatically with those changes.' ), |
|
290 esc_url( |
|
291 add_query_arg( |
|
292 'changeset_uuid', |
|
293 rawurlencode( get_post_meta( $post_id, '_customize_changeset_uuid', true ) ), |
|
294 admin_url( 'customize.php' ) |
|
295 ) |
|
296 ) |
|
297 ); |
|
298 ?> |
|
299 </p> |
|
300 </div> |
|
301 <?php |
|
302 endif; |
|
303 |
|
304 /** |
|
305 * Fires after the post time/date setting in the Publish meta box. |
|
306 * |
|
307 * @since 2.9.0 |
|
308 * @since 4.4.0 Added the `$post` parameter. |
|
309 * |
|
310 * @param WP_Post $post WP_Post object for the current post. |
|
311 */ |
|
312 do_action( 'post_submitbox_misc_actions', $post ); |
|
120 ?> |
313 ?> |
121 <a href="#post_status" <?php echo $private_style; ?> class="edit-post-status hide-if-no-js" role="button"><span aria-hidden="true"><?php _e( 'Edit' ); ?></span> <span class="screen-reader-text"><?php _e( 'Edit status' ); ?></span></a> |
|
122 |
|
123 <div id="post-status-select" class="hide-if-js"> |
|
124 <input type="hidden" name="hidden_post_status" id="hidden_post_status" value="<?php echo esc_attr( ( 'auto-draft' == $post->post_status ) ? 'draft' : $post->post_status ); ?>" /> |
|
125 <label for="post_status" class="screen-reader-text"><?php _e( 'Set status' ); ?></label> |
|
126 <select name="post_status" id="post_status"> |
|
127 <?php if ( 'publish' == $post->post_status ) : ?> |
|
128 <option<?php selected( $post->post_status, 'publish' ); ?> value='publish'><?php _e( 'Published' ); ?></option> |
|
129 <?php elseif ( 'private' == $post->post_status ) : ?> |
|
130 <option<?php selected( $post->post_status, 'private' ); ?> value='publish'><?php _e( 'Privately Published' ); ?></option> |
|
131 <?php elseif ( 'future' == $post->post_status ) : ?> |
|
132 <option<?php selected( $post->post_status, 'future' ); ?> value='future'><?php _e( 'Scheduled' ); ?></option> |
|
133 <?php endif; ?> |
|
134 <option<?php selected( $post->post_status, 'pending' ); ?> value='pending'><?php _e( 'Pending Review' ); ?></option> |
|
135 <?php if ( 'auto-draft' == $post->post_status ) : ?> |
|
136 <option<?php selected( $post->post_status, 'auto-draft' ); ?> value='draft'><?php _e( 'Draft' ); ?></option> |
|
137 <?php else : ?> |
|
138 <option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php _e( 'Draft' ); ?></option> |
|
139 <?php endif; ?> |
|
140 </select> |
|
141 <a href="#post_status" class="save-post-status hide-if-no-js button"><?php _e( 'OK' ); ?></a> |
|
142 <a href="#post_status" class="cancel-post-status hide-if-no-js button-cancel"><?php _e( 'Cancel' ); ?></a> |
|
143 </div> |
|
144 |
|
145 <?php } ?> |
|
146 </div><!-- .misc-pub-section --> |
|
147 |
|
148 <div class="misc-pub-section misc-pub-visibility" id="visibility"> |
|
149 <?php _e( 'Visibility:' ); ?> <span id="post-visibility-display"> |
|
150 <?php |
|
151 |
|
152 if ( 'private' == $post->post_status ) { |
|
153 $post->post_password = ''; |
|
154 $visibility = 'private'; |
|
155 $visibility_trans = __( 'Private' ); |
|
156 } elseif ( ! empty( $post->post_password ) ) { |
|
157 $visibility = 'password'; |
|
158 $visibility_trans = __( 'Password protected' ); |
|
159 } elseif ( $post_type == 'post' && is_sticky( $post->ID ) ) { |
|
160 $visibility = 'public'; |
|
161 $visibility_trans = __( 'Public, Sticky' ); |
|
162 } else { |
|
163 $visibility = 'public'; |
|
164 $visibility_trans = __( 'Public' ); |
|
165 } |
|
166 |
|
167 echo esc_html( $visibility_trans ); |
|
168 ?> |
|
169 </span> |
|
170 <?php if ( $can_publish ) { ?> |
|
171 <a href="#visibility" class="edit-visibility hide-if-no-js" role="button"><span aria-hidden="true"><?php _e( 'Edit' ); ?></span> <span class="screen-reader-text"><?php _e( 'Edit visibility' ); ?></span></a> |
|
172 |
|
173 <div id="post-visibility-select" class="hide-if-js"> |
|
174 <input type="hidden" name="hidden_post_password" id="hidden-post-password" value="<?php echo esc_attr( $post->post_password ); ?>" /> |
|
175 <?php if ( $post_type == 'post' ) : ?> |
|
176 <input type="checkbox" style="display:none" name="hidden_post_sticky" id="hidden-post-sticky" value="sticky" <?php checked( is_sticky( $post->ID ) ); ?> /> |
|
177 <?php endif; ?> |
|
178 <input type="hidden" name="hidden_post_visibility" id="hidden-post-visibility" value="<?php echo esc_attr( $visibility ); ?>" /> |
|
179 <input type="radio" name="visibility" id="visibility-radio-public" value="public" <?php checked( $visibility, 'public' ); ?> /> <label for="visibility-radio-public" class="selectit"><?php _e( 'Public' ); ?></label><br /> |
|
180 <?php if ( $post_type == 'post' && current_user_can( 'edit_others_posts' ) ) : ?> |
|
181 <span id="sticky-span"><input id="sticky" name="sticky" type="checkbox" value="sticky" <?php checked( is_sticky( $post->ID ) ); ?> /> <label for="sticky" class="selectit"><?php _e( 'Stick this post to the front page' ); ?></label><br /></span> |
|
182 <?php endif; ?> |
|
183 <input type="radio" name="visibility" id="visibility-radio-password" value="password" <?php checked( $visibility, 'password' ); ?> /> <label for="visibility-radio-password" class="selectit"><?php _e( 'Password protected' ); ?></label><br /> |
|
184 <span id="password-span"><label for="post_password"><?php _e( 'Password:' ); ?></label> <input type="text" name="post_password" id="post_password" value="<?php echo esc_attr( $post->post_password ); ?>" maxlength="255" /><br /></span> |
|
185 <input type="radio" name="visibility" id="visibility-radio-private" value="private" <?php checked( $visibility, 'private' ); ?> /> <label for="visibility-radio-private" class="selectit"><?php _e( 'Private' ); ?></label><br /> |
|
186 |
|
187 <p> |
|
188 <a href="#visibility" class="save-post-visibility hide-if-no-js button"><?php _e( 'OK' ); ?></a> |
|
189 <a href="#visibility" class="cancel-post-visibility hide-if-no-js button-cancel"><?php _e( 'Cancel' ); ?></a> |
|
190 </p> |
|
191 </div> |
|
192 <?php } ?> |
|
193 |
|
194 </div><!-- .misc-pub-section --> |
|
195 |
|
196 <?php |
|
197 /* translators: Publish box date format, see https://secure.php.net/date */ |
|
198 $datef = __( 'M j, Y @ H:i' ); |
|
199 if ( 0 != $post->ID ) { |
|
200 if ( 'future' == $post->post_status ) { // scheduled for publishing at a future date |
|
201 /* translators: Post date information. %s: Date on which the post is currently scheduled to be published */ |
|
202 $stamp = __( 'Scheduled for: <b>%s</b>' ); |
|
203 } elseif ( 'publish' == $post->post_status || 'private' == $post->post_status ) { // already published |
|
204 /* translators: Post date information. %s: Date on which the post was published */ |
|
205 $stamp = __( 'Published on: <b>%s</b>' ); |
|
206 } elseif ( '0000-00-00 00:00:00' == $post->post_date_gmt ) { // draft, 1 or more saves, no date specified |
|
207 $stamp = __( 'Publish <b>immediately</b>' ); |
|
208 } elseif ( time() < strtotime( $post->post_date_gmt . ' +0000' ) ) { // draft, 1 or more saves, future date specified |
|
209 /* translators: Post date information. %s: Date on which the post is to be published */ |
|
210 $stamp = __( 'Schedule for: <b>%s</b>' ); |
|
211 } else { // draft, 1 or more saves, date specified |
|
212 /* translators: Post date information. %s: Date on which the post is to be published */ |
|
213 $stamp = __( 'Publish on: <b>%s</b>' ); |
|
214 } |
|
215 $date = date_i18n( $datef, strtotime( $post->post_date ) ); |
|
216 } else { // draft (no saves, and thus no date specified) |
|
217 $stamp = __( 'Publish <b>immediately</b>' ); |
|
218 $date = date_i18n( $datef, strtotime( current_time( 'mysql' ) ) ); |
|
219 } |
|
220 |
|
221 if ( ! empty( $args['args']['revisions_count'] ) ) : |
|
222 ?> |
|
223 <div class="misc-pub-section misc-pub-revisions"> |
|
224 <?php |
|
225 /* translators: Post revisions heading. %s: The number of available revisions */ |
|
226 printf( __( 'Revisions: %s' ), '<b>' . number_format_i18n( $args['args']['revisions_count'] ) . '</b>' ); |
|
227 ?> |
|
228 <a class="hide-if-no-js" href="<?php echo esc_url( get_edit_post_link( $args['args']['revision_id'] ) ); ?>"><span aria-hidden="true"><?php _ex( 'Browse', 'revisions' ); ?></span> <span class="screen-reader-text"><?php _e( 'Browse revisions' ); ?></span></a> |
|
229 </div> |
|
230 <?php |
|
231 endif; |
|
232 |
|
233 if ( $can_publish ) : // Contributors don't get to choose the date of publish |
|
234 ?> |
|
235 <div class="misc-pub-section curtime misc-pub-curtime"> |
|
236 <span id="timestamp"> |
|
237 <?php printf( $stamp, $date ); ?></span> |
|
238 <a href="#edit_timestamp" class="edit-timestamp hide-if-no-js" role="button"><span aria-hidden="true"><?php _e( 'Edit' ); ?></span> <span class="screen-reader-text"><?php _e( 'Edit date and time' ); ?></span></a> |
|
239 <fieldset id="timestampdiv" class="hide-if-js"> |
|
240 <legend class="screen-reader-text"><?php _e( 'Date and time' ); ?></legend> |
|
241 <?php touch_time( ( $action === 'edit' ), 1 ); ?> |
|
242 </fieldset> |
|
243 </div><?php // /misc-pub-section ?> |
|
244 <?php endif; ?> |
|
245 |
|
246 <?php if ( 'draft' === $post->post_status && get_post_meta( $post->ID, '_customize_changeset_uuid', true ) ) : ?> |
|
247 <div class="notice notice-info notice-alt inline"> |
|
248 <p> |
|
249 <?php |
|
250 echo sprintf( |
|
251 /* translators: %s: URL to the Customizer */ |
|
252 __( 'This draft comes from your <a href="%s">unpublished customization changes</a>. You can edit, but there’s no need to publish now. It will be published automatically with those changes.' ), |
|
253 esc_url( |
|
254 add_query_arg( |
|
255 'changeset_uuid', |
|
256 rawurlencode( get_post_meta( $post->ID, '_customize_changeset_uuid', true ) ), |
|
257 admin_url( 'customize.php' ) |
|
258 ) |
|
259 ) |
|
260 ); |
|
261 ?> |
|
262 </p> |
|
263 </div> |
314 </div> |
264 <?php endif; ?> |
315 <div class="clear"></div> |
265 |
|
266 <?php |
|
267 /** |
|
268 * Fires after the post time/date setting in the Publish meta box. |
|
269 * |
|
270 * @since 2.9.0 |
|
271 * @since 4.4.0 Added the `$post` parameter. |
|
272 * |
|
273 * @param WP_Post $post WP_Post object for the current post. |
|
274 */ |
|
275 do_action( 'post_submitbox_misc_actions', $post ); |
|
276 ?> |
|
277 </div> |
|
278 <div class="clear"></div> |
|
279 </div> |
316 </div> |
280 |
317 |
281 <div id="major-publishing-actions"> |
318 <div id="major-publishing-actions"> |
282 <?php |
319 <?php |
283 /** |
320 /** |
289 * @param WP_Post|null $post WP_Post object for the current post on Edit Post screen, |
326 * @param WP_Post|null $post WP_Post object for the current post on Edit Post screen, |
290 * null on Edit Link screen. |
327 * null on Edit Link screen. |
291 */ |
328 */ |
292 do_action( 'post_submitbox_start', $post ); |
329 do_action( 'post_submitbox_start', $post ); |
293 ?> |
330 ?> |
294 <div id="delete-action"> |
331 <div id="delete-action"> |
295 <?php |
332 <?php |
296 if ( current_user_can( 'delete_post', $post->ID ) ) { |
333 if ( current_user_can( 'delete_post', $post_id ) ) { |
297 if ( ! EMPTY_TRASH_DAYS ) { |
334 if ( ! EMPTY_TRASH_DAYS ) { |
298 $delete_text = __( 'Delete Permanently' ); |
335 $delete_text = __( 'Delete permanently' ); |
336 } else { |
|
337 $delete_text = __( 'Move to Trash' ); |
|
338 } |
|
339 ?> |
|
340 <a class="submitdelete deletion" href="<?php echo get_delete_post_link( $post_id ); ?>"><?php echo $delete_text; ?></a> |
|
341 <?php |
|
342 } |
|
343 ?> |
|
344 </div> |
|
345 |
|
346 <div id="publishing-action"> |
|
347 <span class="spinner"></span> |
|
348 <?php |
|
349 if ( ! in_array( $post->post_status, array( 'publish', 'future', 'private' ), true ) || 0 === $post_id ) { |
|
350 if ( $can_publish ) : |
|
351 if ( ! empty( $post->post_date_gmt ) && time() < strtotime( $post->post_date_gmt . ' +0000' ) ) : |
|
352 ?> |
|
353 <input name="original_publish" type="hidden" id="original_publish" value="<?php echo esc_attr_x( 'Schedule', 'post action/button label' ); ?>" /> |
|
354 <?php submit_button( _x( 'Schedule', 'post action/button label' ), 'primary large', 'publish', false ); ?> |
|
355 <?php |
|
356 else : |
|
357 ?> |
|
358 <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e( 'Publish' ); ?>" /> |
|
359 <?php submit_button( __( 'Publish' ), 'primary large', 'publish', false ); ?> |
|
360 <?php |
|
361 endif; |
|
362 else : |
|
363 ?> |
|
364 <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e( 'Submit for Review' ); ?>" /> |
|
365 <?php submit_button( __( 'Submit for Review' ), 'primary large', 'publish', false ); ?> |
|
366 <?php |
|
367 endif; |
|
299 } else { |
368 } else { |
300 $delete_text = __( 'Move to Trash' ); |
369 ?> |
370 <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e( 'Update' ); ?>" /> |
|
371 <?php submit_button( __( 'Update' ), 'primary large', 'save', false, array( 'id' => 'publish' ) ); ?> |
|
372 <?php |
|
301 } |
373 } |
302 ?> |
374 ?> |
303 <a class="submitdelete deletion" href="<?php echo get_delete_post_link( $post->ID ); ?>"><?php echo $delete_text; ?></a> |
375 </div> |
304 <?php |
376 <div class="clear"></div> |
305 } |
377 </div> |
306 ?> |
378 |
307 </div> |
379 </div> |
308 |
|
309 <div id="publishing-action"> |
|
310 <span class="spinner"></span> |
|
311 <?php |
|
312 if ( ! in_array( $post->post_status, array( 'publish', 'future', 'private' ) ) || 0 == $post->ID ) { |
|
313 if ( $can_publish ) : |
|
314 if ( ! empty( $post->post_date_gmt ) && time() < strtotime( $post->post_date_gmt . ' +0000' ) ) : |
|
315 ?> |
|
316 <input name="original_publish" type="hidden" id="original_publish" value="<?php echo esc_attr_x( 'Schedule', 'post action/button label' ); ?>" /> |
|
317 <?php submit_button( _x( 'Schedule', 'post action/button label' ), 'primary large', 'publish', false ); ?> |
|
318 <?php else : ?> |
|
319 <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e( 'Publish' ); ?>" /> |
|
320 <?php submit_button( __( 'Publish' ), 'primary large', 'publish', false ); ?> |
|
321 <?php |
|
322 endif; |
|
323 else : |
|
324 ?> |
|
325 <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e( 'Submit for Review' ); ?>" /> |
|
326 <?php submit_button( __( 'Submit for Review' ), 'primary large', 'publish', false ); ?> |
|
327 <?php |
|
328 endif; |
|
329 } else { |
|
330 ?> |
|
331 <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e( 'Update' ); ?>" /> |
|
332 <input name="save" type="submit" class="button button-primary button-large" id="publish" value="<?php esc_attr_e( 'Update' ); ?>" /> |
|
333 <?php |
|
334 } |
|
335 ?> |
|
336 </div> |
|
337 <div class="clear"></div> |
|
338 </div> |
|
339 </div> |
|
340 |
|
341 <?php |
380 <?php |
342 } |
381 } |
343 |
382 |
344 /** |
383 /** |
345 * Display attachment submit form fields. |
384 * Display attachment submit form fields. |
352 ?> |
391 ?> |
353 <div class="submitbox" id="submitpost"> |
392 <div class="submitbox" id="submitpost"> |
354 |
393 |
355 <div id="minor-publishing"> |
394 <div id="minor-publishing"> |
356 |
395 |
357 <?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key ?> |
396 <?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key. ?> |
358 <div style="display:none;"> |
397 <div style="display:none;"> |
359 <?php submit_button( __( 'Save' ), '', 'save' ); ?> |
398 <?php submit_button( __( 'Save' ), '', 'save' ); ?> |
360 </div> |
399 </div> |
361 |
400 |
362 |
401 |
363 <div id="misc-publishing-actions"> |
402 <div id="misc-publishing-actions"> |
364 <div class="misc-pub-section curtime misc-pub-curtime"> |
403 <div class="misc-pub-section curtime misc-pub-curtime"> |
365 <span id="timestamp"> |
404 <span id="timestamp"> |
366 <?php |
405 <?php |
367 $date = date_i18n( |
406 $uploaded_on = sprintf( |
368 /* translators: Publish box date format, see https://secure.php.net/date */ |
407 /* translators: Publish box date string. 1: Date, 2: Time. See https://www.php.net/date */ |
369 __( 'M j, Y @ H:i' ), |
408 __( '%1$s at %2$s' ), |
370 strtotime( $post->post_date ) |
409 /* translators: Publish box date format, see https://www.php.net/date */ |
410 date_i18n( _x( 'M j, Y', 'publish box date format' ), strtotime( $post->post_date ) ), |
|
411 /* translators: Publish box time format, see https://www.php.net/date */ |
|
412 date_i18n( _x( 'H:i', 'publish box time format' ), strtotime( $post->post_date ) ) |
|
371 ); |
413 ); |
372 printf( |
414 /* translators: Attachment information. %s: Date the attachment was uploaded. */ |
373 /* translators: Attachment information. %s: Date the attachment was uploaded */ |
415 printf( __( 'Uploaded on: %s' ), '<b>' . $uploaded_on . '</b>' ); |
374 __( 'Uploaded on: %s' ), |
416 ?> |
375 '<b>' . $date . '</b>' |
|
376 ); |
|
377 ?> |
|
378 </span> |
417 </span> |
379 </div><!-- .misc-pub-section --> |
418 </div><!-- .misc-pub-section --> |
380 |
419 |
381 <?php |
420 <?php |
382 /** |
421 /** |
400 if ( current_user_can( 'delete_post', $post->ID ) ) { |
439 if ( current_user_can( 'delete_post', $post->ID ) ) { |
401 if ( EMPTY_TRASH_DAYS && MEDIA_TRASH ) { |
440 if ( EMPTY_TRASH_DAYS && MEDIA_TRASH ) { |
402 echo "<a class='submitdelete deletion' href='" . get_delete_post_link( $post->ID ) . "'>" . __( 'Move to Trash' ) . '</a>'; |
441 echo "<a class='submitdelete deletion' href='" . get_delete_post_link( $post->ID ) . "'>" . __( 'Move to Trash' ) . '</a>'; |
403 } else { |
442 } else { |
404 $delete_ays = ! MEDIA_TRASH ? " onclick='return showNotice.warn();'" : ''; |
443 $delete_ays = ! MEDIA_TRASH ? " onclick='return showNotice.warn();'" : ''; |
405 echo "<a class='submitdelete deletion'$delete_ays href='" . get_delete_post_link( $post->ID, null, true ) . "'>" . __( 'Delete Permanently' ) . '</a>'; |
444 echo "<a class='submitdelete deletion'$delete_ays href='" . get_delete_post_link( $post->ID, null, true ) . "'>" . __( 'Delete permanently' ) . '</a>'; |
406 } |
445 } |
407 } |
446 } |
408 ?> |
447 ?> |
409 </div> |
448 </div> |
410 |
449 |
443 if ( is_array( $post_formats[0] ) ) : |
482 if ( is_array( $post_formats[0] ) ) : |
444 $post_format = get_post_format( $post->ID ); |
483 $post_format = get_post_format( $post->ID ); |
445 if ( ! $post_format ) { |
484 if ( ! $post_format ) { |
446 $post_format = '0'; |
485 $post_format = '0'; |
447 } |
486 } |
448 // Add in the current one if it isn't there yet, in case the current theme doesn't support it |
487 // Add in the current one if it isn't there yet, in case the current theme doesn't support it. |
449 if ( $post_format && ! in_array( $post_format, $post_formats[0] ) ) { |
488 if ( $post_format && ! in_array( $post_format, $post_formats[0], true ) ) { |
450 $post_formats[0][] = $post_format; |
489 $post_formats[0][] = $post_format; |
451 } |
490 } |
452 ?> |
491 ?> |
453 <div id="post-formats-select"> |
492 <div id="post-formats-select"> |
454 <fieldset> |
493 <fieldset> |
490 if ( ! isset( $box['args'] ) || ! is_array( $box['args'] ) ) { |
529 if ( ! isset( $box['args'] ) || ! is_array( $box['args'] ) ) { |
491 $args = array(); |
530 $args = array(); |
492 } else { |
531 } else { |
493 $args = $box['args']; |
532 $args = $box['args']; |
494 } |
533 } |
495 $r = wp_parse_args( $args, $defaults ); |
534 $parsed_args = wp_parse_args( $args, $defaults ); |
496 $tax_name = esc_attr( $r['taxonomy'] ); |
535 $tax_name = esc_attr( $parsed_args['taxonomy'] ); |
497 $taxonomy = get_taxonomy( $r['taxonomy'] ); |
536 $taxonomy = get_taxonomy( $parsed_args['taxonomy'] ); |
498 $user_can_assign_terms = current_user_can( $taxonomy->cap->assign_terms ); |
537 $user_can_assign_terms = current_user_can( $taxonomy->cap->assign_terms ); |
499 $comma = _x( ',', 'tag delimiter' ); |
538 $comma = _x( ',', 'tag delimiter' ); |
500 $terms_to_edit = get_terms_to_edit( $post->ID, $tax_name ); |
539 $terms_to_edit = get_terms_to_edit( $post->ID, $tax_name ); |
501 if ( ! is_string( $terms_to_edit ) ) { |
540 if ( ! is_string( $terms_to_edit ) ) { |
502 $terms_to_edit = ''; |
541 $terms_to_edit = ''; |
553 if ( ! isset( $box['args'] ) || ! is_array( $box['args'] ) ) { |
592 if ( ! isset( $box['args'] ) || ! is_array( $box['args'] ) ) { |
554 $args = array(); |
593 $args = array(); |
555 } else { |
594 } else { |
556 $args = $box['args']; |
595 $args = $box['args']; |
557 } |
596 } |
558 $r = wp_parse_args( $args, $defaults ); |
597 $parsed_args = wp_parse_args( $args, $defaults ); |
559 $tax_name = esc_attr( $r['taxonomy'] ); |
598 $tax_name = esc_attr( $parsed_args['taxonomy'] ); |
560 $taxonomy = get_taxonomy( $r['taxonomy'] ); |
599 $taxonomy = get_taxonomy( $parsed_args['taxonomy'] ); |
561 ?> |
600 ?> |
562 <div id="taxonomy-<?php echo $tax_name; ?>" class="categorydiv"> |
601 <div id="taxonomy-<?php echo $tax_name; ?>" class="categorydiv"> |
563 <ul id="<?php echo $tax_name; ?>-tabs" class="category-tabs"> |
602 <ul id="<?php echo $tax_name; ?>-tabs" class="category-tabs"> |
564 <li class="tabs"><a href="#<?php echo $tax_name; ?>-all"><?php echo $taxonomy->labels->all_items; ?></a></li> |
603 <li class="tabs"><a href="#<?php echo $tax_name; ?>-all"><?php echo $taxonomy->labels->all_items; ?></a></li> |
565 <li class="hide-if-no-js"><a href="#<?php echo $tax_name; ?>-pop"><?php echo esc_html( $taxonomy->labels->most_used ); ?></a></li> |
604 <li class="hide-if-no-js"><a href="#<?php echo $tax_name; ?>-pop"><?php echo esc_html( $taxonomy->labels->most_used ); ?></a></li> |
571 </ul> |
610 </ul> |
572 </div> |
611 </div> |
573 |
612 |
574 <div id="<?php echo $tax_name; ?>-all" class="tabs-panel"> |
613 <div id="<?php echo $tax_name; ?>-all" class="tabs-panel"> |
575 <?php |
614 <?php |
576 $name = ( $tax_name == 'category' ) ? 'post_category' : 'tax_input[' . $tax_name . ']'; |
615 $name = ( 'category' === $tax_name ) ? 'post_category' : 'tax_input[' . $tax_name . ']'; |
577 echo "<input type='hidden' name='{$name}[]' value='0' />"; // Allows for an empty term set to be sent. 0 is an invalid Term ID and will be ignored by empty() checks. |
616 // Allows for an empty term set to be sent. 0 is an invalid term ID and will be ignored by empty() checks. |
617 echo "<input type='hidden' name='{$name}[]' value='0' />"; |
|
578 ?> |
618 ?> |
579 <ul id="<?php echo $tax_name; ?>checklist" data-wp-lists="list:<?php echo $tax_name; ?>" class="categorychecklist form-no-clear"> |
619 <ul id="<?php echo $tax_name; ?>checklist" data-wp-lists="list:<?php echo $tax_name; ?>" class="categorychecklist form-no-clear"> |
580 <?php |
620 <?php |
581 wp_terms_checklist( |
621 wp_terms_checklist( |
582 $post->ID, |
622 $post->ID, |
590 </div> |
630 </div> |
591 <?php if ( current_user_can( $taxonomy->cap->edit_terms ) ) : ?> |
631 <?php if ( current_user_can( $taxonomy->cap->edit_terms ) ) : ?> |
592 <div id="<?php echo $tax_name; ?>-adder" class="wp-hidden-children"> |
632 <div id="<?php echo $tax_name; ?>-adder" class="wp-hidden-children"> |
593 <a id="<?php echo $tax_name; ?>-add-toggle" href="#<?php echo $tax_name; ?>-add" class="hide-if-no-js taxonomy-add-new"> |
633 <a id="<?php echo $tax_name; ?>-add-toggle" href="#<?php echo $tax_name; ?>-add" class="hide-if-no-js taxonomy-add-new"> |
594 <?php |
634 <?php |
595 /* translators: %s: add new taxonomy label */ |
635 /* translators: %s: Add New taxonomy label. */ |
596 printf( __( '+ %s' ), $taxonomy->labels->add_new_item ); |
636 printf( __( '+ %s' ), $taxonomy->labels->add_new_item ); |
597 ?> |
637 ?> |
598 </a> |
638 </a> |
599 <p id="<?php echo $tax_name; ?>-add" class="category-add wp-hidden-child"> |
639 <p id="<?php echo $tax_name; ?>-add" class="category-add wp-hidden-child"> |
600 <label class="screen-reader-text" for="new<?php echo $tax_name; ?>"><?php echo $taxonomy->labels->add_new_item; ?></label> |
640 <label class="screen-reader-text" for="new<?php echo $tax_name; ?>"><?php echo $taxonomy->labels->add_new_item; ?></label> |
661 ?> |
701 ?> |
662 <label class="screen-reader-text" for="excerpt"><?php _e( 'Excerpt' ); ?></label><textarea rows="1" cols="40" name="excerpt" id="excerpt"><?php echo $post->post_excerpt; // textarea_escaped ?></textarea> |
702 <label class="screen-reader-text" for="excerpt"><?php _e( 'Excerpt' ); ?></label><textarea rows="1" cols="40" name="excerpt" id="excerpt"><?php echo $post->post_excerpt; // textarea_escaped ?></textarea> |
663 <p> |
703 <p> |
664 <?php |
704 <?php |
665 printf( |
705 printf( |
666 /* translators: %s: Codex URL */ |
706 /* translators: %s: Documentation URL. */ |
667 __( 'Excerpts are optional hand-crafted summaries of your content that can be used in your theme. <a href="%s">Learn more about manual excerpts</a>.' ), |
707 __( 'Excerpts are optional hand-crafted summaries of your content that can be used in your theme. <a href="%s">Learn more about manual excerpts</a>.' ), |
668 __( 'https://codex.wordpress.org/Excerpt' ) |
708 __( 'https://wordpress.org/support/article/excerpt/' ) |
669 ); |
709 ); |
670 ?> |
710 ?> |
671 </p> |
711 </p> |
672 <?php |
712 <?php |
673 } |
713 } |
680 * @param object $post |
720 * @param object $post |
681 */ |
721 */ |
682 function post_trackback_meta_box( $post ) { |
722 function post_trackback_meta_box( $post ) { |
683 $form_trackback = '<input type="text" name="trackback_url" id="trackback_url" class="code" value="' . |
723 $form_trackback = '<input type="text" name="trackback_url" id="trackback_url" class="code" value="' . |
684 esc_attr( str_replace( "\n", ' ', $post->to_ping ) ) . '" aria-describedby="trackback-url-desc" />'; |
724 esc_attr( str_replace( "\n", ' ', $post->to_ping ) ) . '" aria-describedby="trackback-url-desc" />'; |
685 if ( '' != $post->pinged ) { |
725 |
726 if ( '' !== $post->pinged ) { |
|
686 $pings = '<p>' . __( 'Already pinged:' ) . '</p><ul>'; |
727 $pings = '<p>' . __( 'Already pinged:' ) . '</p><ul>'; |
687 $already_pinged = explode( "\n", trim( $post->pinged ) ); |
728 $already_pinged = explode( "\n", trim( $post->pinged ) ); |
688 foreach ( $already_pinged as $pinged_url ) { |
729 foreach ( $already_pinged as $pinged_url ) { |
689 $pings .= "\n\t<li>" . esc_html( $pinged_url ) . '</li>'; |
730 $pings .= "\n\t<li>" . esc_html( $pinged_url ) . '</li>'; |
690 } |
731 } |
698 </p> |
739 </p> |
699 <p id="trackback-url-desc" class="howto"><?php _e( 'Separate multiple URLs with spaces' ); ?></p> |
740 <p id="trackback-url-desc" class="howto"><?php _e( 'Separate multiple URLs with spaces' ); ?></p> |
700 <p> |
741 <p> |
701 <?php |
742 <?php |
702 printf( |
743 printf( |
703 /* translators: %s: Codex URL */ |
744 /* translators: %s: Documentation URL. */ |
704 __( 'Trackbacks are a way to notify legacy blog systems that you’ve linked to them. If you link other WordPress sites, they’ll be notified automatically using <a href="%s">pingbacks</a>, no other action necessary.' ), |
745 __( 'Trackbacks are a way to notify legacy blog systems that you’ve linked to them. If you link other WordPress sites, they’ll be notified automatically using <a href="%s">pingbacks</a>, no other action necessary.' ), |
705 __( 'https://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments' ) |
746 __( 'https://wordpress.org/support/article/introduction-to-blogging/#comments' ) |
706 ); |
747 ); |
707 ?> |
748 ?> |
708 </p> |
749 </p> |
709 <?php |
750 <?php |
710 if ( ! empty( $pings ) ) { |
751 if ( ! empty( $pings ) ) { |
735 ?> |
776 ?> |
736 </div> |
777 </div> |
737 <p> |
778 <p> |
738 <?php |
779 <?php |
739 printf( |
780 printf( |
740 /* translators: %s: Codex URL */ |
781 /* translators: %s: Documentation URL. */ |
741 __( 'Custom fields can be used to add extra metadata to a post that you can <a href="%s">use in your theme</a>.' ), |
782 __( 'Custom fields can be used to add extra metadata to a post that you can <a href="%s">use in your theme</a>.' ), |
742 __( 'https://codex.wordpress.org/Using_Custom_Fields' ) |
783 __( 'https://wordpress.org/support/article/custom-fields/' ) |
743 ); |
784 ); |
744 ?> |
785 ?> |
745 </p> |
786 </p> |
746 <?php |
787 <?php |
747 } |
788 } |
759 <p class="meta-options"> |
800 <p class="meta-options"> |
760 <label for="comment_status" class="selectit"><input name="comment_status" type="checkbox" id="comment_status" value="open" <?php checked( $post->comment_status, 'open' ); ?> /> <?php _e( 'Allow comments' ); ?></label><br /> |
801 <label for="comment_status" class="selectit"><input name="comment_status" type="checkbox" id="comment_status" value="open" <?php checked( $post->comment_status, 'open' ); ?> /> <?php _e( 'Allow comments' ); ?></label><br /> |
761 <label for="ping_status" class="selectit"><input name="ping_status" type="checkbox" id="ping_status" value="open" <?php checked( $post->ping_status, 'open' ); ?> /> |
802 <label for="ping_status" class="selectit"><input name="ping_status" type="checkbox" id="ping_status" value="open" <?php checked( $post->ping_status, 'open' ); ?> /> |
762 <?php |
803 <?php |
763 printf( |
804 printf( |
764 /* translators: %s: Codex URL */ |
805 /* translators: %s: Documentation URL. */ |
765 __( 'Allow <a href="%s">trackbacks and pingbacks</a> on this page' ), |
806 __( 'Allow <a href="%s">trackbacks and pingbacks</a> on this page' ), |
766 __( 'https://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments' ) |
807 __( 'https://wordpress.org/support/article/introduction-to-blogging/#managing-comments' ) |
767 ); |
808 ); |
768 ?> |
809 ?> |
769 </label> |
810 </label> |
770 <?php |
811 <?php |
771 /** |
812 /** |
773 * |
814 * |
774 * @since 3.1.0 |
815 * @since 3.1.0 |
775 * |
816 * |
776 * @param WP_Post $post WP_Post object of the current post. |
817 * @param WP_Post $post WP_Post object of the current post. |
777 */ |
818 */ |
778 do_action( 'post_comment_status_meta_box-options', $post ); |
819 do_action( 'post_comment_status_meta_box-options', $post ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
779 ?> |
820 ?> |
780 </p> |
821 </p> |
781 <?php |
822 <?php |
782 } |
823 } |
783 |
824 |
802 * @param object $post |
843 * @param object $post |
803 */ |
844 */ |
804 function post_comment_meta_box( $post ) { |
845 function post_comment_meta_box( $post ) { |
805 wp_nonce_field( 'get-comments', 'add_comment_nonce', false ); |
846 wp_nonce_field( 'get-comments', 'add_comment_nonce', false ); |
806 ?> |
847 ?> |
807 <p class="hide-if-no-js" id="add-new-comment"><button type="button" class="button" onclick="window.commentReply && commentReply.addcomment(<?php echo $post->ID; ?>);"><?php _e( 'Add comment' ); ?></button></p> |
848 <p class="hide-if-no-js" id="add-new-comment"><button type="button" class="button" onclick="window.commentReply && commentReply.addcomment(<?php echo $post->ID; ?>);"><?php _e( 'Add Comment' ); ?></button></p> |
808 <?php |
849 <?php |
809 |
850 |
810 $total = get_comments( |
851 $total = get_comments( |
811 array( |
852 array( |
812 'post_id' => $post->ID, |
853 'post_id' => $post->ID, |
819 |
860 |
820 if ( 1 > $total ) { |
861 if ( 1 > $total ) { |
821 echo '<p id="no-comments">' . __( 'No comments yet.' ) . '</p>'; |
862 echo '<p id="no-comments">' . __( 'No comments yet.' ) . '</p>'; |
822 } else { |
863 } else { |
823 $hidden = get_hidden_meta_boxes( get_current_screen() ); |
864 $hidden = get_hidden_meta_boxes( get_current_screen() ); |
824 if ( ! in_array( 'commentsdiv', $hidden ) ) { |
865 if ( ! in_array( 'commentsdiv', $hidden, true ) ) { |
825 ?> |
866 ?> |
826 <script type="text/javascript">jQuery(document).ready(function(){commentsBox.get(<?php echo $total; ?>, 10);});</script> |
867 <script type="text/javascript">jQuery(document).ready(function(){commentsBox.get(<?php echo $total; ?>, 10);});</script> |
827 <?php |
868 <?php |
828 } |
869 } |
829 |
870 |
884 */ |
925 */ |
885 function post_revisions_meta_box( $post ) { |
926 function post_revisions_meta_box( $post ) { |
886 wp_list_post_revisions( $post ); |
927 wp_list_post_revisions( $post ); |
887 } |
928 } |
888 |
929 |
889 // -- Page related Meta Boxes |
930 // |
931 // Page-related Meta Boxes. |
|
932 // |
|
890 |
933 |
891 /** |
934 /** |
892 * Display page attributes form fields. |
935 * Display page attributes form fields. |
893 * |
936 * |
894 * @since 2.7.0 |
937 * @since 2.7.0 |
919 */ |
962 */ |
920 $dropdown_args = apply_filters( 'page_attributes_dropdown_pages_args', $dropdown_args, $post ); |
963 $dropdown_args = apply_filters( 'page_attributes_dropdown_pages_args', $dropdown_args, $post ); |
921 $pages = wp_dropdown_pages( $dropdown_args ); |
964 $pages = wp_dropdown_pages( $dropdown_args ); |
922 if ( ! empty( $pages ) ) : |
965 if ( ! empty( $pages ) ) : |
923 ?> |
966 ?> |
924 <p class="post-attributes-label-wrapper"><label class="post-attributes-label" for="parent_id"><?php _e( 'Parent' ); ?></label></p> |
967 <p class="post-attributes-label-wrapper parent-id-label-wrapper"><label class="post-attributes-label" for="parent_id"><?php _e( 'Parent' ); ?></label></p> |
925 <?php echo $pages; ?> |
968 <?php echo $pages; ?> |
926 <?php |
969 <?php |
927 endif; // end empty pages check |
970 endif; // End empty pages check. |
928 endif; // end hierarchical check. |
971 endif; // End hierarchical check. |
929 |
972 |
930 if ( count( get_page_templates( $post ) ) > 0 && get_option( 'page_for_posts' ) != $post->ID ) : |
973 if ( count( get_page_templates( $post ) ) > 0 && get_option( 'page_for_posts' ) != $post->ID ) : |
931 $template = ! empty( $post->page_template ) ? $post->page_template : false; |
974 $template = ! empty( $post->page_template ) ? $post->page_template : false; |
932 ?> |
975 ?> |
933 <p class="post-attributes-label-wrapper"><label class="post-attributes-label" for="page_template"><?php _e( 'Template' ); ?></label> |
976 <p class="post-attributes-label-wrapper page-template-label-wrapper"><label class="post-attributes-label" for="page_template"><?php _e( 'Template' ); ?></label> |
934 <?php |
977 <?php |
935 /** |
978 /** |
936 * Fires immediately after the label inside the 'Template' section |
979 * Fires immediately after the label inside the 'Template' section |
937 * of the 'Page Attributes' meta box. |
980 * of the 'Page Attributes' meta box. |
938 * |
981 * |
953 * |
996 * |
954 * @param string $label The display value for the default page template title. |
997 * @param string $label The display value for the default page template title. |
955 * @param string $context Where the option label is displayed. Possible values |
998 * @param string $context Where the option label is displayed. Possible values |
956 * include 'meta-box' or 'quick-edit'. |
999 * include 'meta-box' or 'quick-edit'. |
957 */ |
1000 */ |
958 $default_title = apply_filters( 'default_page_template_title', __( 'Default Template' ), 'meta-box' ); |
1001 $default_title = apply_filters( 'default_page_template_title', __( 'Default template' ), 'meta-box' ); |
959 ?> |
1002 ?> |
960 <option value="default"><?php echo esc_html( $default_title ); ?></option> |
1003 <option value="default"><?php echo esc_html( $default_title ); ?></option> |
961 <?php page_template_dropdown( $template, $post->post_type ); ?> |
1004 <?php page_template_dropdown( $template, $post->post_type ); ?> |
962 </select> |
1005 </select> |
963 <?php endif; ?> |
1006 <?php endif; ?> |
964 <?php if ( post_type_supports( $post->post_type, 'page-attributes' ) ) : ?> |
1007 <?php if ( post_type_supports( $post->post_type, 'page-attributes' ) ) : ?> |
965 <p class="post-attributes-label-wrapper"><label class="post-attributes-label" for="menu_order"><?php _e( 'Order' ); ?></label></p> |
1008 <p class="post-attributes-label-wrapper menu-order-label-wrapper"><label class="post-attributes-label" for="menu_order"><?php _e( 'Order' ); ?></label></p> |
966 <input name="menu_order" type="text" size="4" id="menu_order" value="<?php echo esc_attr( $post->menu_order ); ?>" /> |
1009 <input name="menu_order" type="text" size="4" id="menu_order" value="<?php echo esc_attr( $post->menu_order ); ?>" /> |
967 <?php |
1010 <?php |
968 /** |
1011 /** |
969 * Fires before the help hint text in the 'Page Attributes' meta box. |
1012 * Fires before the help hint text in the 'Page Attributes' meta box. |
970 * |
1013 * |
972 * |
1015 * |
973 * @param WP_Post $post The current post. |
1016 * @param WP_Post $post The current post. |
974 */ |
1017 */ |
975 do_action( 'page_attributes_misc_attributes', $post ); |
1018 do_action( 'page_attributes_misc_attributes', $post ); |
976 ?> |
1019 ?> |
977 <?php if ( 'page' == $post->post_type && get_current_screen()->get_help_tabs() ) : ?> |
1020 <?php if ( 'page' === $post->post_type && get_current_screen()->get_help_tabs() ) : ?> |
978 <p><?php _e( 'Need help? Use the Help tab above the screen title.' ); ?></p> |
1021 <p class="post-attributes-help-text"><?php _e( 'Need help? Use the Help tab above the screen title.' ); ?></p> |
979 <?php |
1022 <?php |
980 endif; |
1023 endif; |
981 endif; |
1024 endif; |
982 } |
1025 } |
983 |
1026 |
984 // -- Link related Meta Boxes |
1027 // |
1028 // Link-related Meta Boxes. |
|
1029 // |
|
985 |
1030 |
986 /** |
1031 /** |
987 * Display link create form fields. |
1032 * Display link create form fields. |
988 * |
1033 * |
989 * @since 2.7.0 |
1034 * @since 2.7.0 |
994 ?> |
1039 ?> |
995 <div class="submitbox" id="submitlink"> |
1040 <div class="submitbox" id="submitlink"> |
996 |
1041 |
997 <div id="minor-publishing"> |
1042 <div id="minor-publishing"> |
998 |
1043 |
999 <?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key ?> |
1044 <?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key. ?> |
1000 <div style="display:none;"> |
1045 <div style="display:none;"> |
1001 <?php submit_button( __( 'Save' ), '', 'save', false ); ?> |
1046 <?php submit_button( __( 'Save' ), '', 'save', false ); ?> |
1002 </div> |
1047 </div> |
1003 |
1048 |
1004 <div id="minor-publishing-actions"> |
1049 <div id="minor-publishing-actions"> |
1023 /** This action is documented in wp-admin/includes/meta-boxes.php */ |
1068 /** This action is documented in wp-admin/includes/meta-boxes.php */ |
1024 do_action( 'post_submitbox_start', null ); |
1069 do_action( 'post_submitbox_start', null ); |
1025 ?> |
1070 ?> |
1026 <div id="delete-action"> |
1071 <div id="delete-action"> |
1027 <?php |
1072 <?php |
1028 if ( ! empty( $_GET['action'] ) && 'edit' == $_GET['action'] && current_user_can( 'manage_links' ) ) { |
1073 if ( ! empty( $_GET['action'] ) && 'edit' === $_GET['action'] && current_user_can( 'manage_links' ) ) { |
1029 ?> |
1074 printf( |
1030 <a class="submitdelete deletion" href="<?php echo wp_nonce_url( "link.php?action=delete&link_id=$link->link_id", 'delete-bookmark_' . $link->link_id ); ?>" onclick="if ( confirm('<?php echo esc_js( sprintf( __( "You are about to delete this link '%s'\n 'Cancel' to stop, 'OK' to delete." ), $link->link_name ) ); ?>') ) {return true;}return false;"><?php _e( 'Delete' ); ?></a> |
1075 '<a class="submitdelete deletion" href="%s" onclick="return confirm( \'%s\' );">%s</a>', |
1031 <?php } ?> |
1076 wp_nonce_url( "link.php?action=delete&link_id=$link->link_id", 'delete-bookmark_' . $link->link_id ), |
1077 /* translators: %s: Link name. */ |
|
1078 esc_js( sprintf( __( "You are about to delete this link '%s'\n 'Cancel' to stop, 'OK' to delete." ), $link->link_name ) ), |
|
1079 __( 'Delete' ) |
|
1080 ); |
|
1081 } |
|
1082 ?> |
|
1032 </div> |
1083 </div> |
1033 |
1084 |
1034 <div id="publishing-action"> |
1085 <div id="publishing-action"> |
1035 <?php if ( ! empty( $link->link_id ) ) { ?> |
1086 <?php if ( ! empty( $link->link_id ) ) { ?> |
1036 <input name="save" type="submit" class="button button-primary button-large" id="publish" value="<?php esc_attr_e( 'Update Link' ); ?>" /> |
1087 <input name="save" type="submit" class="button button-primary button-large" id="publish" value="<?php esc_attr_e( 'Update Link' ); ?>" /> |
1062 */ |
1113 */ |
1063 function link_categories_meta_box( $link ) { |
1114 function link_categories_meta_box( $link ) { |
1064 ?> |
1115 ?> |
1065 <div id="taxonomy-linkcategory" class="categorydiv"> |
1116 <div id="taxonomy-linkcategory" class="categorydiv"> |
1066 <ul id="category-tabs" class="category-tabs"> |
1117 <ul id="category-tabs" class="category-tabs"> |
1067 <li class="tabs"><a href="#categories-all"><?php _e( 'All Categories' ); ?></a></li> |
1118 <li class="tabs"><a href="#categories-all"><?php _e( 'All categories' ); ?></a></li> |
1068 <li class="hide-if-no-js"><a href="#categories-pop"><?php _ex( 'Most Used', 'categories' ); ?></a></li> |
1119 <li class="hide-if-no-js"><a href="#categories-pop"><?php _ex( 'Most Used', 'categories' ); ?></a></li> |
1069 </ul> |
1120 </ul> |
1070 |
1121 |
1071 <div id="categories-all" class="tabs-panel"> |
1122 <div id="categories-all" class="tabs-panel"> |
1072 <ul id="categorychecklist" data-wp-lists="list:category" class="categorychecklist form-no-clear"> |
1123 <ul id="categorychecklist" data-wp-lists="list:category" class="categorychecklist form-no-clear"> |
1110 function link_target_meta_box( $link ) { |
1161 function link_target_meta_box( $link ) { |
1111 |
1162 |
1112 ?> |
1163 ?> |
1113 <fieldset><legend class="screen-reader-text"><span><?php _e( 'Target' ); ?></span></legend> |
1164 <fieldset><legend class="screen-reader-text"><span><?php _e( 'Target' ); ?></span></legend> |
1114 <p><label for="link_target_blank" class="selectit"> |
1165 <p><label for="link_target_blank" class="selectit"> |
1115 <input id="link_target_blank" type="radio" name="link_target" value="_blank" <?php echo ( isset( $link->link_target ) && ( $link->link_target == '_blank' ) ? 'checked="checked"' : '' ); ?> /> |
1166 <input id="link_target_blank" type="radio" name="link_target" value="_blank" <?php echo ( isset( $link->link_target ) && ( '_blank' === $link->link_target ) ? 'checked="checked"' : '' ); ?> /> |
1116 <?php _e( '<code>_blank</code> — new window or tab.' ); ?></label></p> |
1167 <?php _e( '<code>_blank</code> — new window or tab.' ); ?></label></p> |
1117 <p><label for="link_target_top" class="selectit"> |
1168 <p><label for="link_target_top" class="selectit"> |
1118 <input id="link_target_top" type="radio" name="link_target" value="_top" <?php echo ( isset( $link->link_target ) && ( $link->link_target == '_top' ) ? 'checked="checked"' : '' ); ?> /> |
1169 <input id="link_target_top" type="radio" name="link_target" value="_top" <?php echo ( isset( $link->link_target ) && ( '_top' === $link->link_target ) ? 'checked="checked"' : '' ); ?> /> |
1119 <?php _e( '<code>_top</code> — current window or tab, with no frames.' ); ?></label></p> |
1170 <?php _e( '<code>_top</code> — current window or tab, with no frames.' ); ?></label></p> |
1120 <p><label for="link_target_none" class="selectit"> |
1171 <p><label for="link_target_none" class="selectit"> |
1121 <input id="link_target_none" type="radio" name="link_target" value="" <?php echo ( isset( $link->link_target ) && ( $link->link_target == '' ) ? 'checked="checked"' : '' ); ?> /> |
1172 <input id="link_target_none" type="radio" name="link_target" value="" <?php echo ( isset( $link->link_target ) && ( '' === $link->link_target ) ? 'checked="checked"' : '' ); ?> /> |
1122 <?php _e( '<code>_none</code> — same window or tab.' ); ?></label></p> |
1173 <?php _e( '<code>_none</code> — same window or tab.' ); ?></label></p> |
1123 </fieldset> |
1174 </fieldset> |
1124 <p><?php _e( 'Choose the target frame for your link.' ); ?></p> |
1175 <p><?php _e( 'Choose the target frame for your link.' ); ?></p> |
1125 <?php |
1176 <?php |
1126 } |
1177 } |
1132 * |
1183 * |
1133 * @global object $link |
1184 * @global object $link |
1134 * |
1185 * |
1135 * @param string $class |
1186 * @param string $class |
1136 * @param string $value |
1187 * @param string $value |
1137 * @param mixed $deprecated Never used. |
1188 * @param mixed $deprecated Never used. |
1138 */ |
1189 */ |
1139 function xfn_check( $class, $value = '', $deprecated = '' ) { |
1190 function xfn_check( $class, $value = '', $deprecated = '' ) { |
1140 global $link; |
1191 global $link; |
1141 |
1192 |
1142 if ( ! empty( $deprecated ) ) { |
1193 if ( ! empty( $deprecated ) ) { |
1143 _deprecated_argument( __FUNCTION__, '2.5.0' ); // Never implemented |
1194 _deprecated_argument( __FUNCTION__, '2.5.0' ); // Never implemented. |
1144 } |
1195 } |
1145 |
1196 |
1146 $link_rel = isset( $link->link_rel ) ? $link->link_rel : ''; // In PHP 5.3: $link_rel = $link->link_rel ?: ''; |
1197 $link_rel = isset( $link->link_rel ) ? $link->link_rel : ''; // In PHP 5.3: $link_rel = $link->link_rel ?: ''; |
1147 $rels = preg_split( '/\s+/', $link_rel ); |
1198 $rels = preg_split( '/\s+/', $link_rel ); |
1148 |
1199 |
1149 if ( '' != $value && in_array( $value, $rels ) ) { |
1200 if ( '' !== $value && in_array( $value, $rels, true ) ) { |
1150 echo ' checked="checked"'; |
1201 echo ' checked="checked"'; |
1151 } |
1202 } |
1152 |
1203 |
1153 if ( '' == $value ) { |
1204 if ( '' === $value ) { |
1154 if ( 'family' == $class && strpos( $link_rel, 'child' ) === false && strpos( $link_rel, 'parent' ) === false && strpos( $link_rel, 'sibling' ) === false && strpos( $link_rel, 'spouse' ) === false && strpos( $link_rel, 'kin' ) === false ) { |
1205 if ( 'family' === $class && strpos( $link_rel, 'child' ) === false && strpos( $link_rel, 'parent' ) === false && strpos( $link_rel, 'sibling' ) === false && strpos( $link_rel, 'spouse' ) === false && strpos( $link_rel, 'kin' ) === false ) { |
1155 echo ' checked="checked"'; |
1206 echo ' checked="checked"'; |
1156 } |
1207 } |
1157 if ( 'friendship' == $class && strpos( $link_rel, 'friend' ) === false && strpos( $link_rel, 'acquaintance' ) === false && strpos( $link_rel, 'contact' ) === false ) { |
1208 if ( 'friendship' === $class && strpos( $link_rel, 'friend' ) === false && strpos( $link_rel, 'acquaintance' ) === false && strpos( $link_rel, 'contact' ) === false ) { |
1158 echo ' checked="checked"'; |
1209 echo ' checked="checked"'; |
1159 } |
1210 } |
1160 if ( 'geographical' == $class && strpos( $link_rel, 'co-resident' ) === false && strpos( $link_rel, 'neighbor' ) === false ) { |
1211 if ( 'geographical' === $class && strpos( $link_rel, 'co-resident' ) === false && strpos( $link_rel, 'neighbor' ) === false ) { |
1161 echo ' checked="checked"'; |
1212 echo ' checked="checked"'; |
1162 } |
1213 } |
1163 if ( 'identity' == $class && in_array( 'me', $rels ) ) { |
1214 if ( 'identity' === $class && in_array( 'me', $rels, true ) ) { |
1164 echo ' checked="checked"'; |
1215 echo ' checked="checked"'; |
1165 } |
1216 } |
1166 } |
1217 } |
1167 } |
1218 } |
1168 |
1219 |
1175 */ |
1226 */ |
1176 function link_xfn_meta_box( $link ) { |
1227 function link_xfn_meta_box( $link ) { |
1177 ?> |
1228 ?> |
1178 <table class="links-table"> |
1229 <table class="links-table"> |
1179 <tr> |
1230 <tr> |
1180 <th scope="row"><label for="link_rel"><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'rel:' ); ?></label></th> |
1231 <th scope="row"><label for="link_rel"><?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'rel:' ); ?></label></th> |
1181 <td><input type="text" name="link_rel" id="link_rel" value="<?php echo ( isset( $link->link_rel ) ? esc_attr( $link->link_rel ) : '' ); ?>" /></td> |
1232 <td><input type="text" name="link_rel" id="link_rel" value="<?php echo ( isset( $link->link_rel ) ? esc_attr( $link->link_rel ) : '' ); ?>" /></td> |
1182 </tr> |
1233 </tr> |
1183 <tr> |
1234 <tr> |
1184 <th scope="row"><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'identity' ); ?></th> |
1235 <th scope="row"><?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'identity' ); ?></th> |
1185 <td><fieldset><legend class="screen-reader-text"><span><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'identity' ); ?></span></legend> |
1236 <td><fieldset><legend class="screen-reader-text"><span><?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'identity' ); ?></span></legend> |
1186 <label for="me"> |
1237 <label for="me"> |
1187 <input type="checkbox" name="identity" value="me" id="me" <?php xfn_check( 'identity', 'me' ); ?> /> |
1238 <input type="checkbox" name="identity" value="me" id="me" <?php xfn_check( 'identity', 'me' ); ?> /> |
1188 <?php _e( 'another web address of mine' ); ?></label> |
1239 <?php _e( 'another web address of mine' ); ?></label> |
1189 </fieldset></td> |
1240 </fieldset></td> |
1190 </tr> |
1241 </tr> |
1191 <tr> |
1242 <tr> |
1192 <th scope="row"><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'friendship' ); ?></th> |
1243 <th scope="row"><?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'friendship' ); ?></th> |
1193 <td><fieldset><legend class="screen-reader-text"><span><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'friendship' ); ?></span></legend> |
1244 <td><fieldset><legend class="screen-reader-text"><span><?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'friendship' ); ?></span></legend> |
1194 <label for="contact"> |
1245 <label for="contact"> |
1195 <input class="valinp" type="radio" name="friendship" value="contact" id="contact" <?php xfn_check( 'friendship', 'contact' ); ?> /> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'contact' ); ?> |
1246 <input class="valinp" type="radio" name="friendship" value="contact" id="contact" <?php xfn_check( 'friendship', 'contact' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'contact' ); ?> |
1196 </label> |
1247 </label> |
1197 <label for="acquaintance"> |
1248 <label for="acquaintance"> |
1198 <input class="valinp" type="radio" name="friendship" value="acquaintance" id="acquaintance" <?php xfn_check( 'friendship', 'acquaintance' ); ?> /> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'acquaintance' ); ?> |
1249 <input class="valinp" type="radio" name="friendship" value="acquaintance" id="acquaintance" <?php xfn_check( 'friendship', 'acquaintance' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'acquaintance' ); ?> |
1199 </label> |
1250 </label> |
1200 <label for="friend"> |
1251 <label for="friend"> |
1201 <input class="valinp" type="radio" name="friendship" value="friend" id="friend" <?php xfn_check( 'friendship', 'friend' ); ?> /> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'friend' ); ?> |
1252 <input class="valinp" type="radio" name="friendship" value="friend" id="friend" <?php xfn_check( 'friendship', 'friend' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'friend' ); ?> |
1202 </label> |
1253 </label> |
1203 <label for="friendship"> |
1254 <label for="friendship"> |
1204 <input name="friendship" type="radio" class="valinp" value="" id="friendship" <?php xfn_check( 'friendship' ); ?> /> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'none' ); ?> |
1255 <input name="friendship" type="radio" class="valinp" value="" id="friendship" <?php xfn_check( 'friendship' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'none' ); ?> |
1205 </label> |
1256 </label> |
1206 </fieldset></td> |
1257 </fieldset></td> |
1207 </tr> |
1258 </tr> |
1208 <tr> |
1259 <tr> |
1209 <th scope="row"> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'physical' ); ?> </th> |
1260 <th scope="row"> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'physical' ); ?> </th> |
1210 <td><fieldset><legend class="screen-reader-text"><span><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'physical' ); ?></span></legend> |
1261 <td><fieldset><legend class="screen-reader-text"><span><?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'physical' ); ?></span></legend> |
1211 <label for="met"> |
1262 <label for="met"> |
1212 <input class="valinp" type="checkbox" name="physical" value="met" id="met" <?php xfn_check( 'physical', 'met' ); ?> /> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'met' ); ?> |
1263 <input class="valinp" type="checkbox" name="physical" value="met" id="met" <?php xfn_check( 'physical', 'met' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'met' ); ?> |
1213 </label> |
1264 </label> |
1214 </fieldset></td> |
1265 </fieldset></td> |
1215 </tr> |
1266 </tr> |
1216 <tr> |
1267 <tr> |
1217 <th scope="row"> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'professional' ); ?> </th> |
1268 <th scope="row"> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'professional' ); ?> </th> |
1218 <td><fieldset><legend class="screen-reader-text"><span><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'professional' ); ?></span></legend> |
1269 <td><fieldset><legend class="screen-reader-text"><span><?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'professional' ); ?></span></legend> |
1219 <label for="co-worker"> |
1270 <label for="co-worker"> |
1220 <input class="valinp" type="checkbox" name="professional" value="co-worker" id="co-worker" <?php xfn_check( 'professional', 'co-worker' ); ?> /> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'co-worker' ); ?> |
1271 <input class="valinp" type="checkbox" name="professional" value="co-worker" id="co-worker" <?php xfn_check( 'professional', 'co-worker' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'co-worker' ); ?> |
1221 </label> |
1272 </label> |
1222 <label for="colleague"> |
1273 <label for="colleague"> |
1223 <input class="valinp" type="checkbox" name="professional" value="colleague" id="colleague" <?php xfn_check( 'professional', 'colleague' ); ?> /> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'colleague' ); ?> |
1274 <input class="valinp" type="checkbox" name="professional" value="colleague" id="colleague" <?php xfn_check( 'professional', 'colleague' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'colleague' ); ?> |
1224 </label> |
1275 </label> |
1225 </fieldset></td> |
1276 </fieldset></td> |
1226 </tr> |
1277 </tr> |
1227 <tr> |
1278 <tr> |
1228 <th scope="row"><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'geographical' ); ?></th> |
1279 <th scope="row"><?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'geographical' ); ?></th> |
1229 <td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'geographical' ); ?> </span></legend> |
1280 <td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'geographical' ); ?> </span></legend> |
1230 <label for="co-resident"> |
1281 <label for="co-resident"> |
1231 <input class="valinp" type="radio" name="geographical" value="co-resident" id="co-resident" <?php xfn_check( 'geographical', 'co-resident' ); ?> /> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'co-resident' ); ?> |
1282 <input class="valinp" type="radio" name="geographical" value="co-resident" id="co-resident" <?php xfn_check( 'geographical', 'co-resident' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'co-resident' ); ?> |
1232 </label> |
1283 </label> |
1233 <label for="neighbor"> |
1284 <label for="neighbor"> |
1234 <input class="valinp" type="radio" name="geographical" value="neighbor" id="neighbor" <?php xfn_check( 'geographical', 'neighbor' ); ?> /> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'neighbor' ); ?> |
1285 <input class="valinp" type="radio" name="geographical" value="neighbor" id="neighbor" <?php xfn_check( 'geographical', 'neighbor' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'neighbor' ); ?> |
1235 </label> |
1286 </label> |
1236 <label for="geographical"> |
1287 <label for="geographical"> |
1237 <input class="valinp" type="radio" name="geographical" value="" id="geographical" <?php xfn_check( 'geographical' ); ?> /> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'none' ); ?> |
1288 <input class="valinp" type="radio" name="geographical" value="" id="geographical" <?php xfn_check( 'geographical' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'none' ); ?> |
1238 </label> |
1289 </label> |
1239 </fieldset></td> |
1290 </fieldset></td> |
1240 </tr> |
1291 </tr> |
1241 <tr> |
1292 <tr> |
1242 <th scope="row"><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'family' ); ?></th> |
1293 <th scope="row"><?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'family' ); ?></th> |
1243 <td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'family' ); ?> </span></legend> |
1294 <td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'family' ); ?> </span></legend> |
1244 <label for="child"> |
1295 <label for="child"> |
1245 <input class="valinp" type="radio" name="family" value="child" id="child" <?php xfn_check( 'family', 'child' ); ?> /> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'child' ); ?> |
1296 <input class="valinp" type="radio" name="family" value="child" id="child" <?php xfn_check( 'family', 'child' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'child' ); ?> |
1246 </label> |
1297 </label> |
1247 <label for="kin"> |
1298 <label for="kin"> |
1248 <input class="valinp" type="radio" name="family" value="kin" id="kin" <?php xfn_check( 'family', 'kin' ); ?> /> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'kin' ); ?> |
1299 <input class="valinp" type="radio" name="family" value="kin" id="kin" <?php xfn_check( 'family', 'kin' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'kin' ); ?> |
1249 </label> |
1300 </label> |
1250 <label for="parent"> |
1301 <label for="parent"> |
1251 <input class="valinp" type="radio" name="family" value="parent" id="parent" <?php xfn_check( 'family', 'parent' ); ?> /> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'parent' ); ?> |
1302 <input class="valinp" type="radio" name="family" value="parent" id="parent" <?php xfn_check( 'family', 'parent' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'parent' ); ?> |
1252 </label> |
1303 </label> |
1253 <label for="sibling"> |
1304 <label for="sibling"> |
1254 <input class="valinp" type="radio" name="family" value="sibling" id="sibling" <?php xfn_check( 'family', 'sibling' ); ?> /> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'sibling' ); ?> |
1305 <input class="valinp" type="radio" name="family" value="sibling" id="sibling" <?php xfn_check( 'family', 'sibling' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'sibling' ); ?> |
1255 </label> |
1306 </label> |
1256 <label for="spouse"> |
1307 <label for="spouse"> |
1257 <input class="valinp" type="radio" name="family" value="spouse" id="spouse" <?php xfn_check( 'family', 'spouse' ); ?> /> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'spouse' ); ?> |
1308 <input class="valinp" type="radio" name="family" value="spouse" id="spouse" <?php xfn_check( 'family', 'spouse' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'spouse' ); ?> |
1258 </label> |
1309 </label> |
1259 <label for="family"> |
1310 <label for="family"> |
1260 <input class="valinp" type="radio" name="family" value="" id="family" <?php xfn_check( 'family' ); ?> /> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'none' ); ?> |
1311 <input class="valinp" type="radio" name="family" value="" id="family" <?php xfn_check( 'family' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'none' ); ?> |
1261 </label> |
1312 </label> |
1262 </fieldset></td> |
1313 </fieldset></td> |
1263 </tr> |
1314 </tr> |
1264 <tr> |
1315 <tr> |
1265 <th scope="row"><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'romantic' ); ?></th> |
1316 <th scope="row"><?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'romantic' ); ?></th> |
1266 <td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'romantic' ); ?> </span></legend> |
1317 <td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'romantic' ); ?> </span></legend> |
1267 <label for="muse"> |
1318 <label for="muse"> |
1268 <input class="valinp" type="checkbox" name="romantic" value="muse" id="muse" <?php xfn_check( 'romantic', 'muse' ); ?> /> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'muse' ); ?> |
1319 <input class="valinp" type="checkbox" name="romantic" value="muse" id="muse" <?php xfn_check( 'romantic', 'muse' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'muse' ); ?> |
1269 </label> |
1320 </label> |
1270 <label for="crush"> |
1321 <label for="crush"> |
1271 <input class="valinp" type="checkbox" name="romantic" value="crush" id="crush" <?php xfn_check( 'romantic', 'crush' ); ?> /> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'crush' ); ?> |
1322 <input class="valinp" type="checkbox" name="romantic" value="crush" id="crush" <?php xfn_check( 'romantic', 'crush' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'crush' ); ?> |
1272 </label> |
1323 </label> |
1273 <label for="date"> |
1324 <label for="date"> |
1274 <input class="valinp" type="checkbox" name="romantic" value="date" id="date" <?php xfn_check( 'romantic', 'date' ); ?> /> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'date' ); ?> |
1325 <input class="valinp" type="checkbox" name="romantic" value="date" id="date" <?php xfn_check( 'romantic', 'date' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'date' ); ?> |
1275 </label> |
1326 </label> |
1276 <label for="romantic"> |
1327 <label for="romantic"> |
1277 <input class="valinp" type="checkbox" name="romantic" value="sweetheart" id="romantic" <?php xfn_check( 'romantic', 'sweetheart' ); ?> /> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'sweetheart' ); ?> |
1328 <input class="valinp" type="checkbox" name="romantic" value="sweetheart" id="romantic" <?php xfn_check( 'romantic', 'sweetheart' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'sweetheart' ); ?> |
1278 </label> |
1329 </label> |
1279 </fieldset></td> |
1330 </fieldset></td> |
1280 </tr> |
1331 </tr> |
1281 |
1332 |
1282 </table> |
1333 </table> |
1283 <p><?php _e( 'If the link is to a person, you can specify your relationship with them using the above form. If you would like to learn more about the idea check out <a href="http://gmpg.org/xfn/">XFN</a>.' ); ?></p> |
1334 <p><?php _e( 'If the link is to a person, you can specify your relationship with them using the above form. If you would like to learn more about the idea check out <a href="https://gmpg.org/xfn/">XFN</a>.' ); ?></p> |
1284 <?php |
1335 <?php |
1285 } |
1336 } |
1286 |
1337 |
1287 /** |
1338 /** |
1288 * Display advanced link options form fields. |
1339 * Display advanced link options form fields. |
1308 </tr> |
1359 </tr> |
1309 <tr> |
1360 <tr> |
1310 <th scope="row"><label for="link_rating"><?php _e( 'Rating' ); ?></label></th> |
1361 <th scope="row"><label for="link_rating"><?php _e( 'Rating' ); ?></label></th> |
1311 <td><select name="link_rating" id="link_rating" size="1"> |
1362 <td><select name="link_rating" id="link_rating" size="1"> |
1312 <?php |
1363 <?php |
1313 for ( $r = 0; $r <= 10; $r++ ) { |
1364 for ( $parsed_args = 0; $parsed_args <= 10; $parsed_args++ ) { |
1314 echo '<option value="' . $r . '"'; |
1365 echo '<option value="' . $parsed_args . '"'; |
1315 if ( isset( $link->link_rating ) && $link->link_rating == $r ) { |
1366 if ( isset( $link->link_rating ) && $link->link_rating == $parsed_args ) { |
1316 echo ' selected="selected"'; |
1367 echo ' selected="selected"'; |
1317 } |
1368 } |
1318 echo( '>' . $r . '</option>' ); |
1369 echo( '>' . $parsed_args . '</option>' ); |
1319 } |
1370 } |
1320 ?> |
1371 ?> |
1321 </select> <?php _e( '(Leave at 0 for no rating.)' ); ?> |
1372 </select> <?php _e( '(Leave at 0 for no rating.)' ); ?> |
1322 </td> |
1373 </td> |
1323 </tr> |
1374 </tr> |
1383 $thumbnail_support = post_type_supports( 'attachment:video', 'thumbnail' ) || current_theme_supports( 'post-thumbnails', 'attachment:video' ); |
1434 $thumbnail_support = post_type_supports( 'attachment:video', 'thumbnail' ) || current_theme_supports( 'post-thumbnails', 'attachment:video' ); |
1384 } |
1435 } |
1385 } |
1436 } |
1386 |
1437 |
1387 $publish_callback_args = array( '__back_compat_meta_box' => true ); |
1438 $publish_callback_args = array( '__back_compat_meta_box' => true ); |
1388 if ( post_type_supports( $post_type, 'revisions' ) && 'auto-draft' != $post->post_status ) { |
1439 |
1389 $revisions = wp_get_post_revisions( $post->ID ); |
1440 if ( post_type_supports( $post_type, 'revisions' ) && 'auto-draft' !== $post->post_status ) { |
1441 $revisions = wp_get_post_revisions( $post->ID, array( 'fields' => 'ids' ) ); |
|
1390 |
1442 |
1391 // We should aim to show the revisions meta box only when there are revisions. |
1443 // We should aim to show the revisions meta box only when there are revisions. |
1392 if ( count( $revisions ) > 1 ) { |
1444 if ( count( $revisions ) > 1 ) { |
1393 reset( $revisions ); // Reset pointer for key() |
|
1394 $publish_callback_args = array( |
1445 $publish_callback_args = array( |
1395 'revisions_count' => count( $revisions ), |
1446 'revisions_count' => count( $revisions ), |
1396 'revision_id' => key( $revisions ), |
1447 'revision_id' => reset( $revisions ), |
1397 '__back_compat_meta_box' => true, |
1448 '__back_compat_meta_box' => true, |
1398 ); |
1449 ); |
1450 |
|
1399 add_meta_box( 'revisionsdiv', __( 'Revisions' ), 'post_revisions_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) ); |
1451 add_meta_box( 'revisionsdiv', __( 'Revisions' ), 'post_revisions_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) ); |
1400 } |
1452 } |
1401 } |
1453 } |
1402 |
1454 |
1403 if ( 'attachment' == $post_type ) { |
1455 if ( 'attachment' === $post_type ) { |
1404 wp_enqueue_script( 'image-edit' ); |
1456 wp_enqueue_script( 'image-edit' ); |
1405 wp_enqueue_style( 'imgareaselect' ); |
1457 wp_enqueue_style( 'imgareaselect' ); |
1406 add_meta_box( 'submitdiv', __( 'Save' ), 'attachment_submit_meta_box', null, 'side', 'core', array( '__back_compat_meta_box' => true ) ); |
1458 add_meta_box( 'submitdiv', __( 'Save' ), 'attachment_submit_meta_box', null, 'side', 'core', array( '__back_compat_meta_box' => true ) ); |
1407 add_action( 'edit_form_after_title', 'edit_form_image_editor' ); |
1459 add_action( 'edit_form_after_title', 'edit_form_image_editor' ); |
1408 |
1460 |
1415 |
1467 |
1416 if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post_type, 'post-formats' ) ) { |
1468 if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post_type, 'post-formats' ) ) { |
1417 add_meta_box( 'formatdiv', _x( 'Format', 'post format' ), 'post_format_meta_box', null, 'side', 'core', array( '__back_compat_meta_box' => true ) ); |
1469 add_meta_box( 'formatdiv', _x( 'Format', 'post format' ), 'post_format_meta_box', null, 'side', 'core', array( '__back_compat_meta_box' => true ) ); |
1418 } |
1470 } |
1419 |
1471 |
1420 // all taxonomies |
1472 // All taxonomies. |
1421 foreach ( get_object_taxonomies( $post ) as $tax_name ) { |
1473 foreach ( get_object_taxonomies( $post ) as $tax_name ) { |
1422 $taxonomy = get_taxonomy( $tax_name ); |
1474 $taxonomy = get_taxonomy( $tax_name ); |
1423 if ( ! $taxonomy->show_ui || false === $taxonomy->meta_box_cb ) { |
1475 if ( ! $taxonomy->show_ui || false === $taxonomy->meta_box_cb ) { |
1424 continue; |
1476 continue; |
1425 } |
1477 } |
1479 |
1531 |
1480 /** |
1532 /** |
1481 * Fires in the middle of built-in meta box registration. |
1533 * Fires in the middle of built-in meta box registration. |
1482 * |
1534 * |
1483 * @since 2.1.0 |
1535 * @since 2.1.0 |
1484 * @deprecated 3.7.0 Use 'add_meta_boxes' instead. |
1536 * @deprecated 3.7.0 Use {@see 'add_meta_boxes'} instead. |
1485 * |
1537 * |
1486 * @param WP_Post $post Post object. |
1538 * @param WP_Post $post Post object. |
1487 */ |
1539 */ |
1488 do_action( 'dbx_post_advanced', $post ); |
1540 do_action_deprecated( 'dbx_post_advanced', array( $post ), '3.7.0', 'add_meta_boxes' ); |
1489 |
1541 |
1490 // Allow the Discussion meta box to show up if the post type supports comments, |
1542 // Allow the Discussion meta box to show up if the post type supports comments, |
1491 // or if comments or pings are open. |
1543 // or if comments or pings are open. |
1492 if ( comments_open( $post ) || pings_open( $post ) || post_type_supports( $post_type, 'comments' ) ) { |
1544 if ( comments_open( $post ) || pings_open( $post ) || post_type_supports( $post_type, 'comments' ) ) { |
1493 add_meta_box( 'commentstatusdiv', __( 'Discussion' ), 'post_comment_status_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) ); |
1545 add_meta_box( 'commentstatusdiv', __( 'Discussion' ), 'post_comment_status_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) ); |
1497 if ( empty( $stati ) ) { |
1549 if ( empty( $stati ) ) { |
1498 $stati = array( 'publish' ); |
1550 $stati = array( 'publish' ); |
1499 } |
1551 } |
1500 $stati[] = 'private'; |
1552 $stati[] = 'private'; |
1501 |
1553 |
1502 if ( in_array( get_post_status( $post ), $stati ) ) { |
1554 if ( in_array( get_post_status( $post ), $stati, true ) ) { |
1503 // If the post type support comments, or the post has comments, allow the |
1555 // If the post type support comments, or the post has comments, |
1504 // Comments meta box. |
1556 // allow the Comments meta box. |
1505 if ( comments_open( $post ) || pings_open( $post ) || $post->comment_count > 0 || post_type_supports( $post_type, 'comments' ) ) { |
1557 if ( comments_open( $post ) || pings_open( $post ) || $post->comment_count > 0 || post_type_supports( $post_type, 'comments' ) ) { |
1506 add_meta_box( 'commentsdiv', __( 'Comments' ), 'post_comment_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) ); |
1558 add_meta_box( 'commentsdiv', __( 'Comments' ), 'post_comment_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) ); |
1507 } |
1559 } |
1508 } |
1560 } |
1509 |
1561 |
1510 if ( ! ( 'pending' == get_post_status( $post ) && ! current_user_can( $post_type_object->cap->publish_posts ) ) ) { |
1562 if ( ! ( 'pending' === get_post_status( $post ) && ! current_user_can( $post_type_object->cap->publish_posts ) ) ) { |
1511 add_meta_box( 'slugdiv', __( 'Slug' ), 'post_slug_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) ); |
1563 add_meta_box( 'slugdiv', __( 'Slug' ), 'post_slug_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) ); |
1512 } |
1564 } |
1513 |
1565 |
1514 if ( post_type_supports( $post_type, 'author' ) && current_user_can( $post_type_object->cap->edit_others_posts ) ) { |
1566 if ( post_type_supports( $post_type, 'author' ) && current_user_can( $post_type_object->cap->edit_others_posts ) ) { |
1515 add_meta_box( 'authordiv', __( 'Author' ), 'post_author_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) ); |
1567 add_meta_box( 'authordiv', __( 'Author' ), 'post_author_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) ); |
1541 * |
1593 * |
1542 * Fires once for each of the default meta box contexts: normal, advanced, and side. |
1594 * Fires once for each of the default meta box contexts: normal, advanced, and side. |
1543 * |
1595 * |
1544 * @since 3.0.0 |
1596 * @since 3.0.0 |
1545 * |
1597 * |
1546 * @param string $post_type Post type of the post. |
1598 * @param string $post_type Post type of the post on Edit Post screen, 'link' on Edit Link screen, |
1547 * @param string $context string Meta box context. |
1599 * 'dashboard' on Dashboard screen. |
1548 * @param WP_Post $post Post object. |
1600 * @param string $context Meta box context. Possible values include 'normal', 'advanced', 'side'. |
1601 * @param WP_Post|object|string $post Post object on Edit Post screen, link object on Edit Link screen, |
|
1602 * an empty string on Dashboard screen. |
|
1549 */ |
1603 */ |
1550 do_action( 'do_meta_boxes', $post_type, 'normal', $post ); |
1604 do_action( 'do_meta_boxes', $post_type, 'normal', $post ); |
1551 /** This action is documented in wp-admin/includes/meta-boxes.php */ |
1605 /** This action is documented in wp-admin/includes/meta-boxes.php */ |
1552 do_action( 'do_meta_boxes', $post_type, 'advanced', $post ); |
1606 do_action( 'do_meta_boxes', $post_type, 'advanced', $post ); |
1553 /** This action is documented in wp-admin/includes/meta-boxes.php */ |
1607 /** This action is documented in wp-admin/includes/meta-boxes.php */ |