1 | <?php |
---|
2 | |
---|
3 | // -- Post related Meta Boxes |
---|
4 | |
---|
5 | /** |
---|
6 | * Display post submit form fields. |
---|
7 | * |
---|
8 | * @since 2.7.0 |
---|
9 | * |
---|
10 | * @param object $post |
---|
11 | */ |
---|
12 | function post_submit_meta_box($post, $args = array() ) { |
---|
13 | global $action; |
---|
14 | |
---|
15 | $post_type = $post->post_type; |
---|
16 | $post_type_object = get_post_type_object($post_type); |
---|
17 | $can_publish = current_user_can($post_type_object->cap->publish_posts); |
---|
18 | ?> |
---|
19 | <div class="submitbox" id="submitpost"> |
---|
20 | |
---|
21 | <div id="minor-publishing"> |
---|
22 | |
---|
23 | <?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key ?> |
---|
24 | <div style="display:none;"> |
---|
25 | <?php submit_button( __( 'Save' ), 'button', 'save' ); ?> |
---|
26 | </div> |
---|
27 | |
---|
28 | <div id="minor-publishing-actions"> |
---|
29 | <div id="save-action"> |
---|
30 | <?php if ( 'publish' != $post->post_status && 'future' != $post->post_status && 'pending' != $post->post_status ) { ?> |
---|
31 | <input <?php if ( 'private' == $post->post_status ) { ?>style="display:none"<?php } ?> type="submit" name="save" id="save-post" value="<?php esc_attr_e('Save Draft'); ?>" class="button" /> |
---|
32 | <?php } elseif ( 'pending' == $post->post_status && $can_publish ) { ?> |
---|
33 | <input type="submit" name="save" id="save-post" value="<?php esc_attr_e('Save as Pending'); ?>" class="button" /> |
---|
34 | <?php } ?> |
---|
35 | <span class="spinner"></span> |
---|
36 | </div> |
---|
37 | <?php if ( $post_type_object->public ) : ?> |
---|
38 | <div id="preview-action"> |
---|
39 | <?php |
---|
40 | if ( 'publish' == $post->post_status ) { |
---|
41 | $preview_link = esc_url( get_permalink( $post->ID ) ); |
---|
42 | $preview_button = __( 'Preview Changes' ); |
---|
43 | } else { |
---|
44 | $preview_link = set_url_scheme( get_permalink( $post->ID ) ); |
---|
45 | |
---|
46 | /** |
---|
47 | * Filter the URI of a post preview in the post submit box. |
---|
48 | * |
---|
49 | * @since 2.0.5 |
---|
50 | * @since 4.0.0 $post parameter was added. |
---|
51 | * |
---|
52 | * @param string $preview_link URI the user will be directed to for a post preview. |
---|
53 | * @param WP_Post $post Post object. |
---|
54 | */ |
---|
55 | $preview_link = esc_url( apply_filters( 'preview_post_link', add_query_arg( 'preview', 'true', $preview_link ), $post ) ); |
---|
56 | $preview_button = __( 'Preview' ); |
---|
57 | } |
---|
58 | ?> |
---|
59 | <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> |
---|
60 | <input type="hidden" name="wp-preview" id="wp-preview" value="" /> |
---|
61 | </div> |
---|
62 | <?php endif; // public post type ?> |
---|
63 | <div class="clear"></div> |
---|
64 | </div><!-- #minor-publishing-actions --> |
---|
65 | |
---|
66 | <div id="misc-publishing-actions"> |
---|
67 | |
---|
68 | <div class="misc-pub-section misc-pub-post-status"><label for="post_status"><?php _e('Status:') ?></label> |
---|
69 | <span id="post-status-display"> |
---|
70 | <?php |
---|
71 | switch ( $post->post_status ) { |
---|
72 | case 'private': |
---|
73 | _e('Privately Published'); |
---|
74 | break; |
---|
75 | case 'publish': |
---|
76 | _e('Published'); |
---|
77 | break; |
---|
78 | case 'future': |
---|
79 | _e('Scheduled'); |
---|
80 | break; |
---|
81 | case 'pending': |
---|
82 | _e('Pending Review'); |
---|
83 | break; |
---|
84 | case 'draft': |
---|
85 | _e('Draft'); |
---|
86 | case 'auto-draft': |
---|
87 | _e('!'); |
---|
88 | break; |
---|
89 | } |
---|
90 | ?> |
---|
91 | </span> |
---|
92 | <?php if ( 'publish' == $post->post_status || 'private' == $post->post_status || $can_publish ) { ?> |
---|
93 | <a href="#post_status" <?php if ( 'private' == $post->post_status ) { ?>style="display:none;" <?php } ?>class="edit-post-status hide-if-no-js"><span aria-hidden="true"><?php _e( 'Edit' ); ?></span> <span class="screen-reader-text"><?php _e( 'Edit status' ); ?></span></a> |
---|
94 | |
---|
95 | <div id="post-status-select" class="hide-if-js"> |
---|
96 | <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); ?>" /> |
---|
97 | <select name='post_status' id='post_status'> |
---|
98 | |
---|
99 | <?php if ( 'draft' == $post->post_status ) : ?> |
---|
100 | <option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php _e('Draft') ?></option> |
---|
101 | <!-- |
---|
102 | <?php elseif ( 'private' == $post->post_status ) : ?> |
---|
103 | <option<?php selected( $post->post_status, 'private' ); ?> value='private'><?php _e('Privately Published') ?></option> |
---|
104 | --> |
---|
105 | <?php elseif ( 'future' == $post->post_status ) : ?> |
---|
106 | <option<?php selected( $post->post_status, 'future' ); ?> value='future'><?php _e('Scheduled') ?></option> |
---|
107 | |
---|
108 | <!-- |
---|
109 | <?php elseif ( 'publish' == $post->post_status ) : ?> |
---|
110 | <option<?php selected( $post->post_status, 'pending' ); ?> value='pending'><?php _e('Pending Review') ?></option> |
---|
111 | --> |
---|
112 | |
---|
113 | <?php endif; ?> |
---|
114 | <!-- |
---|
115 | --> |
---|
116 | <option<?php selected( $post->post_status, 'draft' ); ?> value='pending'><?php _e('Pending') ?></option> |
---|
117 | |
---|
118 | |
---|
119 | <?php if ( 'auto-draft' == $post->post_status ) : ?> |
---|
120 | <option<?php selected( $post->post_status, 'auto-draft' ); ?> value='draft'><?php _e('Draft') ?></option> |
---|
121 | |
---|
122 | |
---|
123 | <?php else : ?> |
---|
124 | <option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php _e('Draft') ?></option> |
---|
125 | <!-- |
---|
126 | <option<?php selected( $post->post_status, 'publish' ); ?> value='published'><?php _e('Published') ?></option> |
---|
127 | --> |
---|
128 | <?php endif; ?> |
---|
129 | |
---|
130 | |
---|
131 | </select> |
---|
132 | <a href="#post_status" class="save-post-status hide-if-no-js button"><?php _e('OK'); ?></a> |
---|
133 | <a href="#post_status" class="cancel-post-status hide-if-no-js button-cancel"><?php _e('Cancel'); ?></a> |
---|
134 | </div> |
---|
135 | |
---|
136 | <?php } ?> |
---|
137 | </div><!-- .misc-pub-section --> |
---|
138 | |
---|
139 | <div class="misc-pub-section misc-pub-visibility" id="visibility"> |
---|
140 | <?php _e('Visibility:'); ?> <span id="post-visibility-display"><?php |
---|
141 | |
---|
142 | if ( 'publish' == $post->post_status ) { |
---|
143 | $visibility = 'public'; |
---|
144 | $visibility_trans = __('Public'); |
---|
145 | } elseif ( 'draft' == $post->post_status ) { |
---|
146 | $visibility = 'public'; |
---|
147 | $visibility_trans = __('Public'); |
---|
148 | } elseif ( 'pending' == $post->post_status ) { |
---|
149 | $visibility = 'public'; |
---|
150 | $visibility_trans = __('Public'); |
---|
151 | } elseif ( !empty( $post->post_password ) ) { |
---|
152 | $visibility = 'password'; |
---|
153 | $visibility_trans = __('Password protected'); |
---|
154 | } elseif ( $post_type == 'post' && is_sticky( $post->ID ) ) { |
---|
155 | $visibility = 'public'; |
---|
156 | $visibility_trans = __('Public, Sticky'); |
---|
157 | } else { |
---|
158 | $post->post_password = ''; |
---|
159 | $visibility = 'private'; |
---|
160 | $visibility_trans = __('Private'); |
---|
161 | } |
---|
162 | |
---|
163 | echo esc_html( $visibility_trans ); ?></span> |
---|
164 | <?php if ( $can_publish ) { ?> |
---|
165 | <a href="#visibility" class="edit-visibility hide-if-no-js"><span aria-hidden="true"><?php _e( 'Edit' ); ?></span> <span class="screen-reader-text"><?php _e( 'Edit visibility' ); ?></span></a> |
---|
166 | |
---|
167 | <div id="post-visibility-select" class="hide-if-js"> |
---|
168 | <input type="hidden" name="hidden_post_password" id="hidden-post-password" value="<?php echo esc_attr($post->post_password); ?>" /> |
---|
169 | <?php if ($post_type == 'post'): ?> |
---|
170 | <input type="checkbox" style="display:none" name="hidden_post_sticky" id="hidden-post-sticky" value="sticky" <?php checked(is_sticky($post->ID)); ?> /> |
---|
171 | <?php endif; ?> |
---|
172 | <input type="hidden" name="hidden_post_visibility" id="hidden-post-visibility" value="<?php echo esc_attr( $visibility ); ?>" /> |
---|
173 | <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 /> |
---|
174 | <?php if ( $post_type == 'post' && current_user_can( 'edit_others_posts' ) ) : ?> |
---|
175 | <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> |
---|
176 | <?php endif; ?> |
---|
177 | <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 /> |
---|
178 | <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="20" /><br /></span> |
---|
179 | <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 /> |
---|
180 | |
---|
181 | <p> |
---|
182 | <a href="#visibility" class="save-post-visibility hide-if-no-js button"><?php _e('OK'); ?></a> |
---|
183 | <a href="#visibility" class="cancel-post-visibility hide-if-no-js button-cancel"><?php _e('Cancel'); ?></a> |
---|
184 | </p> |
---|
185 | </div> |
---|
186 | <?php } ?> |
---|
187 | |
---|
188 | </div><!-- .misc-pub-section --> |
---|
189 | |
---|
190 | <?php |
---|
191 | /* translators: Publish box date format, see http://php.net/date */ |
---|
192 | $datef = __( 'M j, Y @ G:i' ); |
---|
193 | if ( 0 != $post->ID ) { |
---|
194 | if ( 'future' == $post->post_status ) { // scheduled for publishing at a future date |
---|
195 | $stamp = __('Scheduled for: <b>%1$s</b>'); |
---|
196 | } else if ( 'publish' == $post->post_status || 'private' == $post->post_status ) { // already published |
---|
197 | $stamp = __('Published on: <b>%1$s</b>'); |
---|
198 | } else if ( '0000-00-00 00:00:00' == $post->post_date_gmt ) { // draft, 1 or more saves, no date specified |
---|
199 | $stamp = __('Publish <b>immediately</b>'); |
---|
200 | } else if ( time() < strtotime( $post->post_date_gmt . ' +0000' ) ) { // draft, 1 or more saves, future date specified |
---|
201 | $stamp = __('Schedule for: <b>%1$s</b>'); |
---|
202 | } else { // draft, 1 or more saves, date specified |
---|
203 | $stamp = __('Publish on: <b>%1$s</b>'); |
---|
204 | } |
---|
205 | $date = date_i18n( $datef, strtotime( $post->post_date ) ); |
---|
206 | } else { // draft (no saves, and thus no date specified) |
---|
207 | $stamp = __('Publish <b>immediately</b>'); |
---|
208 | $date = date_i18n( $datef, strtotime( current_time('mysql') ) ); |
---|
209 | } |
---|
210 | |
---|
211 | if ( ! empty( $args['args']['revisions_count'] ) ) : |
---|
212 | $revisions_to_keep = wp_revisions_to_keep( $post ); |
---|
213 | ?> |
---|
214 | <div class="misc-pub-section misc-pub-revisions"> |
---|
215 | <?php |
---|
216 | if ( $revisions_to_keep > 0 && $revisions_to_keep <= $args['args']['revisions_count'] ) { |
---|
217 | echo '<span title="' . esc_attr( sprintf( __( 'Your site is configured to keep only the last %s revisions.' ), |
---|
218 | number_format_i18n( $revisions_to_keep ) ) ) . '">'; |
---|
219 | printf( __( 'Revisions: %s' ), '<b>' . number_format_i18n( $args['args']['revisions_count'] ) . '+</b>' ); |
---|
220 | echo '</span>'; |
---|
221 | } else { |
---|
222 | printf( __( 'Revisions: %s' ), '<b>' . number_format_i18n( $args['args']['revisions_count'] ) . '</b>' ); |
---|
223 | } |
---|
224 | ?> |
---|
225 | <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> |
---|
226 | </div> |
---|
227 | <?php endif; |
---|
228 | |
---|
229 | if ( $can_publish ) : // Contributors don't get to choose the date of publish ?> |
---|
230 | <div class="misc-pub-section curtime misc-pub-curtime"> |
---|
231 | <span id="timestamp"> |
---|
232 | <?php printf($stamp, $date); ?></span> |
---|
233 | <a href="#edit_timestamp" class="edit-timestamp hide-if-no-js"><span aria-hidden="true"><?php _e( 'Edit' ); ?></span> <span class="screen-reader-text"><?php _e( 'Edit date and time' ); ?></span></a> |
---|
234 | <div id="timestampdiv" class="hide-if-js"><?php touch_time(($action == 'edit'), 1); ?></div> |
---|
235 | </div><?php // /misc-pub-section ?> |
---|
236 | <?php endif; ?> |
---|
237 | |
---|
238 | <?php |
---|
239 | /** |
---|
240 | * Fires after the post time/date setting in the Publish meta box. |
---|
241 | * |
---|
242 | * @since 2.9.0 |
---|
243 | */ |
---|
244 | do_action( 'post_submitbox_misc_actions' ); |
---|
245 | ?> |
---|
246 | </div> |
---|
247 | <div class="clear"></div> |
---|
248 | </div> |
---|
249 | |
---|
250 | <div id="major-publishing-actions"> |
---|
251 | <?php |
---|
252 | /** |
---|
253 | * Fires at the beginning of the publishing actions section of the Publish meta box. |
---|
254 | * |
---|
255 | * @since 2.7.0 |
---|
256 | */ |
---|
257 | do_action( 'post_submitbox_start' ); |
---|
258 | ?> |
---|
259 | <div id="delete-action"> |
---|
260 | <?php |
---|
261 | if ( current_user_can( "delete_post", $post->ID ) ) { |
---|
262 | if ( !EMPTY_TRASH_DAYS ) |
---|
263 | $delete_text = __('Delete Permanently'); |
---|
264 | else |
---|
265 | $delete_text = __('Move to Trash'); |
---|
266 | ?> |
---|
267 | <a class="submitdelete deletion" href="<?php echo get_delete_post_link($post->ID); ?>"><?php echo $delete_text; ?></a><?php |
---|
268 | } ?> |
---|
269 | </div> |
---|
270 | |
---|
271 | <div id="publishing-action"> |
---|
272 | <span class="spinner"></span> |
---|
273 | <?php |
---|
274 | if ( !in_array( $post->post_status, array('publish', 'future', 'private') ) || 0 == $post->ID ) { |
---|
275 | if ( $can_publish ) : |
---|
276 | if ( !empty($post->post_date_gmt) && time() < strtotime( $post->post_date_gmt . ' +0000' ) ) : ?> |
---|
277 | <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Schedule') ?>" /> |
---|
278 | <?php submit_button( __( 'Schedule' ), 'primary button-large', 'publish', false, array( 'accesskey' => 'p' ) ); ?> |
---|
279 | <?php else : ?> |
---|
280 | <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Publish') ?>" /> |
---|
281 | <?php submit_button( __( 'Publish' ), 'primary button-large', 'publish', false, array( 'accesskey' => 'p' ) ); ?> |
---|
282 | <?php endif; |
---|
283 | else : ?> |
---|
284 | <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Submit for Review') ?>" /> |
---|
285 | <?php submit_button( __( 'Submit for Review' ), 'primary button-large', 'publish', false, array( 'accesskey' => 'p' ) ); ?> |
---|
286 | <?php |
---|
287 | endif; |
---|
288 | } else { ?> |
---|
289 | <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Update') ?>" /> |
---|
290 | <input name="save" type="submit" class="button button-primary button-large" id="publish" accesskey="p" value="<?php esc_attr_e('Update') ?>" /> |
---|
291 | <?php |
---|
292 | } ?> |
---|
293 | </div> |
---|
294 | <div class="clear"></div> |
---|
295 | </div> |
---|
296 | </div> |
---|
297 | |
---|
298 | <?php |
---|
299 | } |
---|
300 | |
---|
301 | /** |
---|
302 | * Display attachment submit form fields. |
---|
303 | * |
---|
304 | * @since 3.5.0 |
---|
305 | * |
---|
306 | * @param object $post |
---|
307 | */ |
---|
308 | function attachment_submit_meta_box( $post ) { |
---|
309 | ?> |
---|
310 | <div class="submitbox" id="submitpost"> |
---|
311 | |
---|
312 | <div id="minor-publishing"> |
---|
313 | |
---|
314 | <?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key ?> |
---|
315 | <div style="display:none;"> |
---|
316 | <?php submit_button( __( 'Save' ), 'button', 'save' ); ?> |
---|
317 | </div> |
---|
318 | |
---|
319 | |
---|
320 | <div id="misc-publishing-actions"> |
---|
321 | <?php |
---|
322 | /* translators: Publish box date format, see http://php.net/date */ |
---|
323 | $datef = __( 'M j, Y @ G:i' ); |
---|
324 | $stamp = __('Uploaded on: <b>%1$s</b>'); |
---|
325 | $date = date_i18n( $datef, strtotime( $post->post_date ) ); |
---|
326 | ?> |
---|
327 | <div class="misc-pub-section curtime misc-pub-curtime"> |
---|
328 | <span id="timestamp"><?php printf($stamp, $date); ?></span> |
---|
329 | </div><!-- .misc-pub-section --> |
---|
330 | |
---|
331 | <?php |
---|
332 | /** |
---|
333 | * Fires after the 'Uploaded on' section of the Save meta box |
---|
334 | * in the attachment editing screen. |
---|
335 | * |
---|
336 | * @since 3.5.0 |
---|
337 | */ |
---|
338 | do_action( 'attachment_submitbox_misc_actions' ); |
---|
339 | ?> |
---|
340 | </div><!-- #misc-publishing-actions --> |
---|
341 | <div class="clear"></div> |
---|
342 | </div><!-- #minor-publishing --> |
---|
343 | |
---|
344 | <div id="major-publishing-actions"> |
---|
345 | <div id="delete-action"> |
---|
346 | <?php |
---|
347 | if ( current_user_can( 'delete_post', $post->ID ) ) |
---|
348 | if ( EMPTY_TRASH_DAYS && MEDIA_TRASH ) { |
---|
349 | echo "<a class='submitdelete deletion' href='" . get_delete_post_link( $post->ID ) . "'>" . __( 'Trash' ) . "</a>"; |
---|
350 | } else { |
---|
351 | $delete_ays = ! MEDIA_TRASH ? " onclick='return showNotice.warn();'" : ''; |
---|
352 | echo "<a class='submitdelete deletion'$delete_ays href='" . get_delete_post_link( $post->ID, null, true ) . "'>" . __( 'Delete Permanently' ) . "</a>"; |
---|
353 | } |
---|
354 | ?> |
---|
355 | </div> |
---|
356 | |
---|
357 | <div id="publishing-action"> |
---|
358 | <span class="spinner"></span> |
---|
359 | <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Update') ?>" /> |
---|
360 | <input name="save" type="submit" class="button-primary button-large" id="publish" accesskey="p" value="<?php esc_attr_e('Update') ?>" /> |
---|
361 | </div> |
---|
362 | <div class="clear"></div> |
---|
363 | </div><!-- #major-publishing-actions --> |
---|
364 | |
---|
365 | </div> |
---|
366 | |
---|
367 | <?php |
---|
368 | } |
---|
369 | |
---|
370 | /** |
---|
371 | * Display post format form elements. |
---|
372 | * |
---|
373 | * @since 3.1.0 |
---|
374 | * |
---|
375 | * @param WP_Post $post Post object. |
---|
376 | * @param array $box { |
---|
377 | * Post formats meta box arguments. |
---|
378 | * |
---|
379 | * @type string $id Meta box ID. |
---|
380 | * @type string $title Meta box title. |
---|
381 | * @type callback $callback Meta box display callback. |
---|
382 | * @type array $args Extra meta box arguments. |
---|
383 | * } |
---|
384 | */ |
---|
385 | function post_format_meta_box( $post, $box ) { |
---|
386 | if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post->post_type, 'post-formats' ) ) : |
---|
387 | $post_formats = get_theme_support( 'post-formats' ); |
---|
388 | |
---|
389 | if ( is_array( $post_formats[0] ) ) : |
---|
390 | $post_format = get_post_format( $post->ID ); |
---|
391 | if ( !$post_format ) |
---|
392 | $post_format = '0'; |
---|
393 | // Add in the current one if it isn't there yet, in case the current theme doesn't support it |
---|
394 | if ( $post_format && !in_array( $post_format, $post_formats[0] ) ) |
---|
395 | $post_formats[0][] = $post_format; |
---|
396 | ?> |
---|
397 | <div id="post-formats-select"> |
---|
398 | <input type="radio" name="post_format" class="post-format" id="post-format-0" value="0" <?php checked( $post_format, '0' ); ?> /> <label for="post-format-0" class="post-format-icon post-format-standard"><?php echo get_post_format_string( 'standard' ); ?></label> |
---|
399 | <?php foreach ( $post_formats[0] as $format ) : ?> |
---|
400 | <br /><input type="radio" name="post_format" class="post-format" id="post-format-<?php echo esc_attr( $format ); ?>" value="<?php echo esc_attr( $format ); ?>" <?php checked( $post_format, $format ); ?> /> <label for="post-format-<?php echo esc_attr( $format ); ?>" class="post-format-icon post-format-<?php echo esc_attr( $format ); ?>"><?php echo esc_html( get_post_format_string( $format ) ); ?></label> |
---|
401 | <?php endforeach; ?><br /> |
---|
402 | </div> |
---|
403 | <?php endif; endif; |
---|
404 | } |
---|
405 | |
---|
406 | /** |
---|
407 | * Display post tags form fields. |
---|
408 | * |
---|
409 | * @since 2.6.0 |
---|
410 | * |
---|
411 | * @todo Create taxonomy-agnostic wrapper for this. |
---|
412 | * |
---|
413 | * @param WP_Post $post Post object. |
---|
414 | * @param array $box { |
---|
415 | * Tags meta box arguments. |
---|
416 | * |
---|
417 | * @type string $id Meta box ID. |
---|
418 | * @type string $title Meta box title. |
---|
419 | * @type callback $callback Meta box display callback. |
---|
420 | * @type array $args { |
---|
421 | * Extra meta box arguments. |
---|
422 | * |
---|
423 | * @type string $taxonomy Taxonomy. Default 'post_tag'. |
---|
424 | * } |
---|
425 | * } |
---|
426 | */ |
---|
427 | function post_tags_meta_box( $post, $box ) { |
---|
428 | $defaults = array( 'taxonomy' => 'post_tag' ); |
---|
429 | if ( ! isset( $box['args'] ) || ! is_array( $box['args'] ) ) { |
---|
430 | $args = array(); |
---|
431 | } else { |
---|
432 | $args = $box['args']; |
---|
433 | } |
---|
434 | $r = wp_parse_args( $args, $defaults ); |
---|
435 | $tax_name = esc_attr( $r['taxonomy'] ); |
---|
436 | $taxonomy = get_taxonomy( $r['taxonomy'] ); |
---|
437 | $user_can_assign_terms = current_user_can( $taxonomy->cap->assign_terms ); |
---|
438 | $comma = _x( ',', 'tag delimiter' ); |
---|
439 | ?> |
---|
440 | <div class="tagsdiv" id="<?php echo $tax_name; ?>"> |
---|
441 | <div class="jaxtag"> |
---|
442 | <div class="nojs-tags hide-if-js"> |
---|
443 | <p><?php echo $taxonomy->labels->add_or_remove_items; ?></p> |
---|
444 | <textarea name="<?php echo "tax_input[$tax_name]"; ?>" rows="3" cols="20" class="the-tags" id="tax-input-<?php echo $tax_name; ?>" <?php disabled( ! $user_can_assign_terms ); ?>><?php echo str_replace( ',', $comma . ' ', get_terms_to_edit( $post->ID, $tax_name ) ); // textarea_escaped by esc_attr() ?></textarea></div> |
---|
445 | <?php if ( $user_can_assign_terms ) : ?> |
---|
446 | <div class="ajaxtag hide-if-no-js"> |
---|
447 | <label class="screen-reader-text" for="new-tag-<?php echo $tax_name; ?>"><?php echo $box['title']; ?></label> |
---|
448 | <div class="taghint"><?php echo $taxonomy->labels->add_new_item; ?></div> |
---|
449 | <p><input type="text" id="new-tag-<?php echo $tax_name; ?>" name="newtag[<?php echo $tax_name; ?>]" class="newtag form-input-tip" size="16" autocomplete="off" value="" /> |
---|
450 | <input type="button" class="button tagadd" value="<?php esc_attr_e('Add'); ?>" /></p> |
---|
451 | </div> |
---|
452 | <p class="howto"><?php echo $taxonomy->labels->separate_items_with_commas; ?></p> |
---|
453 | <?php endif; ?> |
---|
454 | </div> |
---|
455 | <div class="tagchecklist"></div> |
---|
456 | </div> |
---|
457 | <?php if ( $user_can_assign_terms ) : ?> |
---|
458 | <p class="hide-if-no-js"><a href="#titlediv" class="tagcloud-link" id="link-<?php echo $tax_name; ?>"><?php echo $taxonomy->labels->choose_from_most_used; ?></a></p> |
---|
459 | <?php endif; ?> |
---|
460 | <?php |
---|
461 | } |
---|
462 | |
---|
463 | /** |
---|
464 | * Display post categories form fields. |
---|
465 | * |
---|
466 | * @since 2.6.0 |
---|
467 | * |
---|
468 | * @todo Create taxonomy-agnostic wrapper for this. |
---|
469 | * |
---|
470 | * @param WP_Post $post Post object. |
---|
471 | * @param array $box { |
---|
472 | * Categories meta box arguments. |
---|
473 | * |
---|
474 | * @type string $id Meta box ID. |
---|
475 | * @type string $title Meta box title. |
---|
476 | * @type callback $callback Meta box display callback. |
---|
477 | * @type array $args { |
---|
478 | * Extra meta box arguments. |
---|
479 | * |
---|
480 | * @type string $taxonomy Taxonomy. Default 'category'. |
---|
481 | * } |
---|
482 | * } |
---|
483 | */ |
---|
484 | function post_categories_meta_box( $post, $box ) { |
---|
485 | $defaults = array( 'taxonomy' => 'category' ); |
---|
486 | if ( ! isset( $box['args'] ) || ! is_array( $box['args'] ) ) { |
---|
487 | $args = array(); |
---|
488 | } else { |
---|
489 | $args = $box['args']; |
---|
490 | } |
---|
491 | $r = wp_parse_args( $args, $defaults ); |
---|
492 | $tax_name = esc_attr( $r['taxonomy'] ); |
---|
493 | $taxonomy = get_taxonomy( $r['taxonomy'] ); |
---|
494 | ?> |
---|
495 | <div id="taxonomy-<?php echo $tax_name; ?>" class="categorydiv"> |
---|
496 | <ul id="<?php echo $tax_name; ?>-tabs" class="category-tabs"> |
---|
497 | <li class="tabs"><a href="#<?php echo $tax_name; ?>-all"><?php echo $taxonomy->labels->all_items; ?></a></li> |
---|
498 | <li class="hide-if-no-js"><a href="#<?php echo $tax_name; ?>-pop"><?php _e( 'Most Used' ); ?></a></li> |
---|
499 | </ul> |
---|
500 | |
---|
501 | <div id="<?php echo $tax_name; ?>-pop" class="tabs-panel" style="display: none;"> |
---|
502 | <ul id="<?php echo $tax_name; ?>checklist-pop" class="categorychecklist form-no-clear" > |
---|
503 | <?php $popular_ids = wp_popular_terms_checklist( $tax_name ); ?> |
---|
504 | </ul> |
---|
505 | </div> |
---|
506 | |
---|
507 | <div id="<?php echo $tax_name; ?>-all" class="tabs-panel"> |
---|
508 | <?php |
---|
509 | $name = ( $tax_name == 'category' ) ? 'post_category' : 'tax_input[' . $tax_name . ']'; |
---|
510 | 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. |
---|
511 | ?> |
---|
512 | <ul id="<?php echo $tax_name; ?>checklist" data-wp-lists="list:<?php echo $tax_name; ?>" class="categorychecklist form-no-clear"> |
---|
513 | <?php wp_terms_checklist( $post->ID, array( 'taxonomy' => $tax_name, 'popular_cats' => $popular_ids ) ); ?> |
---|
514 | </ul> |
---|
515 | </div> |
---|
516 | <?php if ( current_user_can( $taxonomy->cap->edit_terms ) ) : ?> |
---|
517 | <div id="<?php echo $tax_name; ?>-adder" class="wp-hidden-children"> |
---|
518 | <h4> |
---|
519 | <a id="<?php echo $tax_name; ?>-add-toggle" href="#<?php echo $tax_name; ?>-add" class="hide-if-no-js"> |
---|
520 | <?php |
---|
521 | /* translators: %s: add new taxonomy label */ |
---|
522 | printf( __( '+ %s' ), $taxonomy->labels->add_new_item ); |
---|
523 | ?> |
---|
524 | </a> |
---|
525 | </h4> |
---|
526 | <p id="<?php echo $tax_name; ?>-add" class="category-add wp-hidden-child"> |
---|
527 | <label class="screen-reader-text" for="new<?php echo $tax_name; ?>"><?php echo $taxonomy->labels->add_new_item; ?></label> |
---|
528 | <input type="text" name="new<?php echo $tax_name; ?>" id="new<?php echo $tax_name; ?>" class="form-required form-input-tip" value="<?php echo esc_attr( $taxonomy->labels->new_item_name ); ?>" aria-required="true"/> |
---|
529 | <label class="screen-reader-text" for="new<?php echo $tax_name; ?>_parent"> |
---|
530 | <?php echo $taxonomy->labels->parent_item_colon; ?> |
---|
531 | </label> |
---|
532 | <?php wp_dropdown_categories( array( 'taxonomy' => $tax_name, 'hide_empty' => 0, 'name' => 'new' . $tax_name . '_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => '— ' . $taxonomy->labels->parent_item . ' —' ) ); ?> |
---|
533 | <input type="button" id="<?php echo $tax_name; ?>-add-submit" data-wp-lists="add:<?php echo $tax_name; ?>checklist:<?php echo $tax_name; ?>-add" class="button category-add-submit" value="<?php echo esc_attr( $taxonomy->labels->add_new_item ); ?>" /> |
---|
534 | <?php wp_nonce_field( 'add-' . $tax_name, '_ajax_nonce-add-' . $tax_name, false ); ?> |
---|
535 | <span id="<?php echo $tax_name; ?>-ajax-response"></span> |
---|
536 | </p> |
---|
537 | </div> |
---|
538 | <?php endif; ?> |
---|
539 | </div> |
---|
540 | <?php |
---|
541 | } |
---|
542 | |
---|
543 | /** |
---|
544 | * Display post excerpt form fields. |
---|
545 | * |
---|
546 | * @since 2.6.0 |
---|
547 | * |
---|
548 | * @param object $post |
---|
549 | */ |
---|
550 | function post_excerpt_meta_box($post) { |
---|
551 | ?> |
---|
552 | <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> |
---|
553 | <p><?php _e('Excerpts are optional hand-crafted summaries of your content that can be used in your theme. <a href="http://codex.wordpress.org/Excerpt" target="_blank">Learn more about manual excerpts.</a>'); ?></p> |
---|
554 | <?php |
---|
555 | } |
---|
556 | |
---|
557 | /** |
---|
558 | * Display trackback links form fields. |
---|
559 | * |
---|
560 | * @since 2.6.0 |
---|
561 | * |
---|
562 | * @param object $post |
---|
563 | */ |
---|
564 | function post_trackback_meta_box($post) { |
---|
565 | $form_trackback = '<input type="text" name="trackback_url" id="trackback_url" class="code" value="'. esc_attr( str_replace("\n", ' ', $post->to_ping) ) .'" />'; |
---|
566 | if ('' != $post->pinged) { |
---|
567 | $pings = '<p>'. __('Already pinged:') . '</p><ul>'; |
---|
568 | $already_pinged = explode("\n", trim($post->pinged)); |
---|
569 | foreach ($already_pinged as $pinged_url) { |
---|
570 | $pings .= "\n\t<li>" . esc_html($pinged_url) . "</li>"; |
---|
571 | } |
---|
572 | $pings .= '</ul>'; |
---|
573 | } |
---|
574 | |
---|
575 | ?> |
---|
576 | <p><label for="trackback_url"><?php _e('Send trackbacks to:'); ?></label> <?php echo $form_trackback; ?><br /> (<?php _e('Separate multiple URLs with spaces'); ?>)</p> |
---|
577 | <p><?php _e('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="http://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments" target="_blank">pingbacks</a>, no other action necessary.'); ?></p> |
---|
578 | <?php |
---|
579 | if ( ! empty($pings) ) |
---|
580 | echo $pings; |
---|
581 | } |
---|
582 | |
---|
583 | /** |
---|
584 | * Display custom fields form fields. |
---|
585 | * |
---|
586 | * @since 2.6.0 |
---|
587 | * |
---|
588 | * @param object $post |
---|
589 | */ |
---|
590 | function post_custom_meta_box($post) { |
---|
591 | ?> |
---|
592 | <div id="postcustomstuff"> |
---|
593 | <div id="ajax-response"></div> |
---|
594 | <?php |
---|
595 | $metadata = has_meta($post->ID); |
---|
596 | foreach ( $metadata as $key => $value ) { |
---|
597 | if ( is_protected_meta( $metadata[ $key ][ 'meta_key' ], 'post' ) || ! current_user_can( 'edit_post_meta', $post->ID, $metadata[ $key ][ 'meta_key' ] ) ) |
---|
598 | unset( $metadata[ $key ] ); |
---|
599 | } |
---|
600 | list_meta( $metadata ); |
---|
601 | meta_form( $post ); ?> |
---|
602 | </div> |
---|
603 | <p><?php _e('Custom fields can be used to add extra metadata to a post that you can <a href="http://codex.wordpress.org/Using_Custom_Fields" target="_blank">use in your theme</a>.'); ?></p> |
---|
604 | <?php |
---|
605 | } |
---|
606 | |
---|
607 | /** |
---|
608 | * Display comments status form fields. |
---|
609 | * |
---|
610 | * @since 2.6.0 |
---|
611 | * |
---|
612 | * @param object $post |
---|
613 | */ |
---|
614 | function post_comment_status_meta_box($post) { |
---|
615 | ?> |
---|
616 | <input name="advanced_view" type="hidden" value="1" /> |
---|
617 | <p class="meta-options"> |
---|
618 | <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 /> |
---|
619 | <label for="ping_status" class="selectit"><input name="ping_status" type="checkbox" id="ping_status" value="open" <?php checked($post->ping_status, 'open'); ?> /> <?php printf( __( 'Allow <a href="%s" target="_blank">trackbacks and pingbacks</a> on this page.' ), __( 'http://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments' ) ); ?></label> |
---|
620 | <?php |
---|
621 | /** |
---|
622 | * Fires at the end of the Discussion meta box on the post editing screen. |
---|
623 | * |
---|
624 | * @since 3.1.0 |
---|
625 | * |
---|
626 | * @param WP_Post $post WP_Post object of the current post. |
---|
627 | */ |
---|
628 | do_action( 'post_comment_status_meta_box-options', $post ); |
---|
629 | ?> |
---|
630 | </p> |
---|
631 | <?php |
---|
632 | } |
---|
633 | |
---|
634 | /** |
---|
635 | * Display comments for post table header |
---|
636 | * |
---|
637 | * @since 3.0.0 |
---|
638 | * |
---|
639 | * @param array $result table header rows |
---|
640 | * @return array |
---|
641 | */ |
---|
642 | function post_comment_meta_box_thead($result) { |
---|
643 | unset($result['cb'], $result['response']); |
---|
644 | return $result; |
---|
645 | } |
---|
646 | |
---|
647 | /** |
---|
648 | * Display comments for post. |
---|
649 | * |
---|
650 | * @since 2.8.0 |
---|
651 | * |
---|
652 | * @param object $post |
---|
653 | */ |
---|
654 | function post_comment_meta_box( $post ) { |
---|
655 | wp_nonce_field( 'get-comments', 'add_comment_nonce', false ); |
---|
656 | ?> |
---|
657 | <p class="hide-if-no-js" id="add-new-comment"><a class="button" href="#commentstatusdiv" onclick="window.commentReply && commentReply.addcomment(<?php echo $post->ID; ?>);return false;"><?php _e('Add comment'); ?></a></p> |
---|
658 | <?php |
---|
659 | |
---|
660 | $total = get_comments( array( 'post_id' => $post->ID, 'number' => 1, 'count' => true ) ); |
---|
661 | $wp_list_table = _get_list_table('WP_Post_Comments_List_Table'); |
---|
662 | $wp_list_table->display( true ); |
---|
663 | |
---|
664 | if ( 1 > $total ) { |
---|
665 | echo '<p id="no-comments">' . __('No comments yet.') . '</p>'; |
---|
666 | } else { |
---|
667 | $hidden = get_hidden_meta_boxes( get_current_screen() ); |
---|
668 | if ( ! in_array('commentsdiv', $hidden) ) { |
---|
669 | ?> |
---|
670 | <script type="text/javascript">jQuery(document).ready(function(){commentsBox.get(<?php echo $total; ?>, 10);});</script> |
---|
671 | <?php |
---|
672 | } |
---|
673 | |
---|
674 | ?> |
---|
675 | <p class="hide-if-no-js" id="show-comments"><a href="#commentstatusdiv" onclick="commentsBox.get(<?php echo $total; ?>);return false;"><?php _e('Show comments'); ?></a> <span class="spinner"></span></p> |
---|
676 | <?php |
---|
677 | } |
---|
678 | |
---|
679 | wp_comment_trashnotice(); |
---|
680 | } |
---|
681 | |
---|
682 | /** |
---|
683 | * Display slug form fields. |
---|
684 | * |
---|
685 | * @since 2.6.0 |
---|
686 | * |
---|
687 | * @param object $post |
---|
688 | */ |
---|
689 | function post_slug_meta_box($post) { |
---|
690 | /** This filter is documented in wp-admin/edit-tag-form.php */ |
---|
691 | ?> |
---|
692 | <label class="screen-reader-text" for="post_name"><?php _e('Slug') ?></label><input name="post_name" type="text" size="13" id="post_name" value="<?php echo esc_attr( apply_filters( 'editable_slug', $post->post_name ) ); ?>" /> |
---|
693 | <?php |
---|
694 | } |
---|
695 | |
---|
696 | /** |
---|
697 | * Display form field with list of authors. |
---|
698 | * |
---|
699 | * @since 2.6.0 |
---|
700 | * |
---|
701 | * @param object $post |
---|
702 | */ |
---|
703 | function post_author_meta_box($post) { |
---|
704 | global $user_ID; |
---|
705 | ?> |
---|
706 | <label class="screen-reader-text" for="post_author_override"><?php _e('Author'); ?></label> |
---|
707 | <?php |
---|
708 | wp_dropdown_users( array( |
---|
709 | 'who' => 'authors', |
---|
710 | 'name' => 'post_author_override', |
---|
711 | 'selected' => empty($post->ID) ? $user_ID : $post->post_author, |
---|
712 | 'include_selected' => true |
---|
713 | ) ); |
---|
714 | } |
---|
715 | |
---|
716 | /** |
---|
717 | * Display list of revisions. |
---|
718 | * |
---|
719 | * @since 2.6.0 |
---|
720 | * |
---|
721 | * @param object $post |
---|
722 | */ |
---|
723 | function post_revisions_meta_box( $post ) { |
---|
724 | wp_list_post_revisions( $post ); |
---|
725 | } |
---|
726 | |
---|
727 | // -- Page related Meta Boxes |
---|
728 | |
---|
729 | /** |
---|
730 | * Display page attributes form fields. |
---|
731 | * |
---|
732 | * @since 2.7.0 |
---|
733 | * |
---|
734 | * @param object $post |
---|
735 | */ |
---|
736 | function page_attributes_meta_box($post) { |
---|
737 | $post_type_object = get_post_type_object($post->post_type); |
---|
738 | if ( $post_type_object->hierarchical ) { |
---|
739 | $dropdown_args = array( |
---|
740 | 'post_type' => $post->post_type, |
---|
741 | 'exclude_tree' => $post->ID, |
---|
742 | 'selected' => $post->post_parent, |
---|
743 | 'name' => 'parent_id', |
---|
744 | 'show_option_none' => __('(no parent)'), |
---|
745 | 'sort_column' => 'menu_order, post_title', |
---|
746 | 'echo' => 0, |
---|
747 | ); |
---|
748 | |
---|
749 | /** |
---|
750 | * Filter the arguments used to generate a Pages drop-down element. |
---|
751 | * |
---|
752 | * @since 3.3.0 |
---|
753 | * |
---|
754 | * @see wp_dropdown_pages() |
---|
755 | * |
---|
756 | * @param array $dropdown_args Array of arguments used to generate the pages drop-down. |
---|
757 | * @param WP_Post $post The current WP_Post object. |
---|
758 | */ |
---|
759 | $dropdown_args = apply_filters( 'page_attributes_dropdown_pages_args', $dropdown_args, $post ); |
---|
760 | $pages = wp_dropdown_pages( $dropdown_args ); |
---|
761 | if ( ! empty($pages) ) { |
---|
762 | ?> |
---|
763 | <p><strong><?php _e('Parent') ?></strong></p> |
---|
764 | <label class="screen-reader-text" for="parent_id"><?php _e('Parent') ?></label> |
---|
765 | <?php echo $pages; ?> |
---|
766 | <?php |
---|
767 | } // end empty pages check |
---|
768 | } // end hierarchical check. |
---|
769 | if ( 'page' == $post->post_type && 0 != count( get_page_templates( $post ) ) ) { |
---|
770 | $template = !empty($post->page_template) ? $post->page_template : false; |
---|
771 | ?> |
---|
772 | <p><strong><?php _e('Template') ?></strong></p> |
---|
773 | <label class="screen-reader-text" for="page_template"><?php _e('Page Template') ?></label><select name="page_template" id="page_template"> |
---|
774 | <?php |
---|
775 | /** |
---|
776 | * Filter the title of the default page template displayed in the drop-down. |
---|
777 | * |
---|
778 | * @since 4.1.0 |
---|
779 | * |
---|
780 | * @param string $label The display value for the default page template title. |
---|
781 | * @param string $context Where the option label is displayed. Possible values |
---|
782 | * include 'meta-box' or 'quick-edit'. |
---|
783 | */ |
---|
784 | $default_title = apply_filters( 'default_page_template_title', __( 'Default Template' ), 'meta-box' ); |
---|
785 | ?> |
---|
786 | <option value="default"><?php echo esc_html( $default_title ); ?></option> |
---|
787 | <?php page_template_dropdown($template); ?> |
---|
788 | </select> |
---|
789 | <?php |
---|
790 | } ?> |
---|
791 | <p><strong><?php _e('Order') ?></strong></p> |
---|
792 | <p><label class="screen-reader-text" for="menu_order"><?php _e('Order') ?></label><input name="menu_order" type="text" size="4" id="menu_order" value="<?php echo esc_attr($post->menu_order) ?>" /></p> |
---|
793 | <p><?php if ( 'page' == $post->post_type ) _e( 'Need help? Use the Help tab in the upper right of your screen.' ); ?></p> |
---|
794 | <?php |
---|
795 | } |
---|
796 | |
---|
797 | // -- Link related Meta Boxes |
---|
798 | |
---|
799 | /** |
---|
800 | * Display link create form fields. |
---|
801 | * |
---|
802 | * @since 2.7.0 |
---|
803 | * |
---|
804 | * @param object $link |
---|
805 | */ |
---|
806 | function link_submit_meta_box($link) { |
---|
807 | ?> |
---|
808 | <div class="submitbox" id="submitlink"> |
---|
809 | |
---|
810 | <div id="minor-publishing"> |
---|
811 | |
---|
812 | <?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key ?> |
---|
813 | <div style="display:none;"> |
---|
814 | <?php submit_button( __( 'Save' ), 'button', 'save', false ); ?> |
---|
815 | </div> |
---|
816 | |
---|
817 | <div id="minor-publishing-actions"> |
---|
818 | <div id="preview-action"> |
---|
819 | <?php if ( !empty($link->link_id) ) { ?> |
---|
820 | <a class="preview button" href="<?php echo $link->link_url; ?>" target="_blank"><?php _e('Visit Link'); ?></a> |
---|
821 | <?php } ?> |
---|
822 | </div> |
---|
823 | <div class="clear"></div> |
---|
824 | </div> |
---|
825 | |
---|
826 | <div id="misc-publishing-actions"> |
---|
827 | <div class="misc-pub-section misc-pub-private"> |
---|
828 | <label for="link_private" class="selectit"><input id="link_private" name="link_visible" type="checkbox" value="N" <?php checked($link->link_visible, 'N'); ?> /> <?php _e('Keep this link private') ?></label> |
---|
829 | </div> |
---|
830 | </div> |
---|
831 | |
---|
832 | </div> |
---|
833 | |
---|
834 | <div id="major-publishing-actions"> |
---|
835 | <?php |
---|
836 | /** This action is documented in wp-admin/includes/meta-boxes.php */ |
---|
837 | do_action( 'post_submitbox_start' ); |
---|
838 | ?> |
---|
839 | <div id="delete-action"> |
---|
840 | <?php |
---|
841 | if ( !empty($_GET['action']) && 'edit' == $_GET['action'] && current_user_can('manage_links') ) { ?> |
---|
842 | <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> |
---|
843 | <?php } ?> |
---|
844 | </div> |
---|
845 | |
---|
846 | <div id="publishing-action"> |
---|
847 | <?php if ( !empty($link->link_id) ) { ?> |
---|
848 | <input name="save" type="submit" class="button-large button-primary" id="publish" accesskey="p" value="<?php esc_attr_e('Update Link') ?>" /> |
---|
849 | <?php } else { ?> |
---|
850 | <input name="save" type="submit" class="button-large button-primary" id="publish" accesskey="p" value="<?php esc_attr_e('Add Link') ?>" /> |
---|
851 | <?php } ?> |
---|
852 | </div> |
---|
853 | <div class="clear"></div> |
---|
854 | </div> |
---|
855 | <?php |
---|
856 | /** |
---|
857 | * Fires at the end of the Publish box in the Link editing screen. |
---|
858 | * |
---|
859 | * @since 2.5.0 |
---|
860 | */ |
---|
861 | do_action( 'submitlink_box' ); |
---|
862 | ?> |
---|
863 | <div class="clear"></div> |
---|
864 | </div> |
---|
865 | <?php |
---|
866 | } |
---|
867 | |
---|
868 | /** |
---|
869 | * Display link categories form fields. |
---|
870 | * |
---|
871 | * @since 2.6.0 |
---|
872 | * |
---|
873 | * @param object $link |
---|
874 | */ |
---|
875 | function link_categories_meta_box($link) { |
---|
876 | ?> |
---|
877 | <div id="taxonomy-linkcategory" class="categorydiv"> |
---|
878 | <ul id="category-tabs" class="category-tabs"> |
---|
879 | <li class="tabs"><a href="#categories-all"><?php _e( 'All Categories' ); ?></a></li> |
---|
880 | <li class="hide-if-no-js"><a href="#categories-pop"><?php _e( 'Most Used' ); ?></a></li> |
---|
881 | </ul> |
---|
882 | |
---|
883 | <div id="categories-all" class="tabs-panel"> |
---|
884 | <ul id="categorychecklist" data-wp-lists="list:category" class="categorychecklist form-no-clear"> |
---|
885 | <?php |
---|
886 | if ( isset($link->link_id) ) |
---|
887 | wp_link_category_checklist($link->link_id); |
---|
888 | else |
---|
889 | wp_link_category_checklist(); |
---|
890 | ?> |
---|
891 | </ul> |
---|
892 | </div> |
---|
893 | |
---|
894 | <div id="categories-pop" class="tabs-panel" style="display: none;"> |
---|
895 | <ul id="categorychecklist-pop" class="categorychecklist form-no-clear"> |
---|
896 | <?php wp_popular_terms_checklist('link_category'); ?> |
---|
897 | </ul> |
---|
898 | </div> |
---|
899 | |
---|
900 | <div id="category-adder" class="wp-hidden-children"> |
---|
901 | <h4><a id="category-add-toggle" href="#category-add"><?php _e( '+ Add New Category' ); ?></a></h4> |
---|
902 | <p id="link-category-add" class="wp-hidden-child"> |
---|
903 | <label class="screen-reader-text" for="newcat"><?php _e( '+ Add New Category' ); ?></label> |
---|
904 | <input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php esc_attr_e( 'New category name' ); ?>" aria-required="true" /> |
---|
905 | <input type="button" id="link-category-add-submit" data-wp-lists="add:categorychecklist:link-category-add" class="button" value="<?php esc_attr_e( 'Add' ); ?>" /> |
---|
906 | <?php wp_nonce_field( 'add-link-category', '_ajax_nonce', false ); ?> |
---|
907 | <span id="category-ajax-response"></span> |
---|
908 | </p> |
---|
909 | </div> |
---|
910 | </div> |
---|
911 | <?php |
---|
912 | } |
---|
913 | |
---|
914 | /** |
---|
915 | * Display form fields for changing link target. |
---|
916 | * |
---|
917 | * @since 2.6.0 |
---|
918 | * |
---|
919 | * @param object $link |
---|
920 | */ |
---|
921 | function link_target_meta_box($link) { ?> |
---|
922 | <fieldset><legend class="screen-reader-text"><span><?php _e('Target') ?></span></legend> |
---|
923 | <p><label for="link_target_blank" class="selectit"> |
---|
924 | <input id="link_target_blank" type="radio" name="link_target" value="_blank" <?php echo ( isset( $link->link_target ) && ($link->link_target == '_blank') ? 'checked="checked"' : ''); ?> /> |
---|
925 | <?php _e('<code>_blank</code> — new window or tab.'); ?></label></p> |
---|
926 | <p><label for="link_target_top" class="selectit"> |
---|
927 | <input id="link_target_top" type="radio" name="link_target" value="_top" <?php echo ( isset( $link->link_target ) && ($link->link_target == '_top') ? 'checked="checked"' : ''); ?> /> |
---|
928 | <?php _e('<code>_top</code> — current window or tab, with no frames.'); ?></label></p> |
---|
929 | <p><label for="link_target_none" class="selectit"> |
---|
930 | <input id="link_target_none" type="radio" name="link_target" value="" <?php echo ( isset( $link->link_target ) && ($link->link_target == '') ? 'checked="checked"' : ''); ?> /> |
---|
931 | <?php _e('<code>_none</code> — same window or tab.'); ?></label></p> |
---|
932 | </fieldset> |
---|
933 | <p><?php _e('Choose the target frame for your link.'); ?></p> |
---|
934 | <?php |
---|
935 | } |
---|
936 | |
---|
937 | /** |
---|
938 | * Display checked checkboxes attribute for xfn microformat options. |
---|
939 | * |
---|
940 | * @since 1.0.1 |
---|
941 | * |
---|
942 | * @param string $class |
---|
943 | * @param string $value |
---|
944 | * @param mixed $deprecated Never used. |
---|
945 | */ |
---|
946 | function xfn_check( $class, $value = '', $deprecated = '' ) { |
---|
947 | global $link; |
---|
948 | |
---|
949 | if ( !empty( $deprecated ) ) |
---|
950 | _deprecated_argument( __FUNCTION__, '0.0' ); // Never implemented |
---|
951 | |
---|
952 | $link_rel = isset( $link->link_rel ) ? $link->link_rel : ''; // In PHP 5.3: $link_rel = $link->link_rel ?: ''; |
---|
953 | $rels = preg_split('/\s+/', $link_rel); |
---|
954 | |
---|
955 | if ('' != $value && in_array($value, $rels) ) { |
---|
956 | echo ' checked="checked"'; |
---|
957 | } |
---|
958 | |
---|
959 | if ('' == $value) { |
---|
960 | 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) echo ' checked="checked"'; |
---|
961 | if ('friendship' == $class && strpos($link_rel, 'friend') === false && strpos($link_rel, 'acquaintance') === false && strpos($link_rel, 'contact') === false) echo ' checked="checked"'; |
---|
962 | if ('geographical' == $class && strpos($link_rel, 'co-resident') === false && strpos($link_rel, 'neighbor') === false) echo ' checked="checked"'; |
---|
963 | if ('identity' == $class && in_array('me', $rels) ) echo ' checked="checked"'; |
---|
964 | } |
---|
965 | } |
---|
966 | |
---|
967 | /** |
---|
968 | * Display xfn form fields. |
---|
969 | * |
---|
970 | * @since 2.6.0 |
---|
971 | * |
---|
972 | * @param object $link |
---|
973 | */ |
---|
974 | function link_xfn_meta_box($link) { |
---|
975 | ?> |
---|
976 | <table class="links-table"> |
---|
977 | <tr> |
---|
978 | <th scope="row"><label for="link_rel"><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('rel:') ?></label></th> |
---|
979 | <td><input type="text" name="link_rel" id="link_rel" value="<?php echo ( isset( $link->link_rel ) ? esc_attr($link->link_rel) : ''); ?>" /></td> |
---|
980 | </tr> |
---|
981 | <tr> |
---|
982 | <th scope="row"><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('identity') ?></th> |
---|
983 | <td><fieldset><legend class="screen-reader-text"><span><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('identity') ?></span></legend> |
---|
984 | <label for="me"> |
---|
985 | <input type="checkbox" name="identity" value="me" id="me" <?php xfn_check('identity', 'me'); ?> /> |
---|
986 | <?php _e('another web address of mine') ?></label> |
---|
987 | </fieldset></td> |
---|
988 | </tr> |
---|
989 | <tr> |
---|
990 | <th scope="row"><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('friendship') ?></th> |
---|
991 | <td><fieldset><legend class="screen-reader-text"><span><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('friendship') ?></span></legend> |
---|
992 | <label for="contact"> |
---|
993 | <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') ?> |
---|
994 | </label> |
---|
995 | <label for="acquaintance"> |
---|
996 | <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') ?> |
---|
997 | </label> |
---|
998 | <label for="friend"> |
---|
999 | <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') ?> |
---|
1000 | </label> |
---|
1001 | <label for="friendship"> |
---|
1002 | <input name="friendship" type="radio" class="valinp" value="" id="friendship" <?php xfn_check('friendship'); ?> /> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('none') ?> |
---|
1003 | </label> |
---|
1004 | </fieldset></td> |
---|
1005 | </tr> |
---|
1006 | <tr> |
---|
1007 | <th scope="row"> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('physical') ?> </th> |
---|
1008 | <td><fieldset><legend class="screen-reader-text"><span><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('physical') ?></span></legend> |
---|
1009 | <label for="met"> |
---|
1010 | <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') ?> |
---|
1011 | </label> |
---|
1012 | </fieldset></td> |
---|
1013 | </tr> |
---|
1014 | <tr> |
---|
1015 | <th scope="row"> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('professional') ?> </th> |
---|
1016 | <td><fieldset><legend class="screen-reader-text"><span><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('professional') ?></span></legend> |
---|
1017 | <label for="co-worker"> |
---|
1018 | <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') ?> |
---|
1019 | </label> |
---|
1020 | <label for="colleague"> |
---|
1021 | <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') ?> |
---|
1022 | </label> |
---|
1023 | </fieldset></td> |
---|
1024 | </tr> |
---|
1025 | <tr> |
---|
1026 | <th scope="row"><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('geographical') ?></th> |
---|
1027 | <td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('geographical') ?> </span></legend> |
---|
1028 | <label for="co-resident"> |
---|
1029 | <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') ?> |
---|
1030 | </label> |
---|
1031 | <label for="neighbor"> |
---|
1032 | <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') ?> |
---|
1033 | </label> |
---|
1034 | <label for="geographical"> |
---|
1035 | <input class="valinp" type="radio" name="geographical" value="" id="geographical" <?php xfn_check('geographical'); ?> /> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('none') ?> |
---|
1036 | </label> |
---|
1037 | </fieldset></td> |
---|
1038 | </tr> |
---|
1039 | <tr> |
---|
1040 | <th scope="row"><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('family') ?></th> |
---|
1041 | <td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('family') ?> </span></legend> |
---|
1042 | <label for="child"> |
---|
1043 | <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') ?> |
---|
1044 | </label> |
---|
1045 | <label for="kin"> |
---|
1046 | <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') ?> |
---|
1047 | </label> |
---|
1048 | <label for="parent"> |
---|
1049 | <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') ?> |
---|
1050 | </label> |
---|
1051 | <label for="sibling"> |
---|
1052 | <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') ?> |
---|
1053 | </label> |
---|
1054 | <label for="spouse"> |
---|
1055 | <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') ?> |
---|
1056 | </label> |
---|
1057 | <label for="family"> |
---|
1058 | <input class="valinp" type="radio" name="family" value="" id="family" <?php xfn_check('family'); ?> /> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('none') ?> |
---|
1059 | </label> |
---|
1060 | </fieldset></td> |
---|
1061 | </tr> |
---|
1062 | <tr> |
---|
1063 | <th scope="row"><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('romantic') ?></th> |
---|
1064 | <td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('romantic') ?> </span></legend> |
---|
1065 | <label for="muse"> |
---|
1066 | <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') ?> |
---|
1067 | </label> |
---|
1068 | <label for="crush"> |
---|
1069 | <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') ?> |
---|
1070 | </label> |
---|
1071 | <label for="date"> |
---|
1072 | <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') ?> |
---|
1073 | </label> |
---|
1074 | <label for="romantic"> |
---|
1075 | <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') ?> |
---|
1076 | </label> |
---|
1077 | </fieldset></td> |
---|
1078 | </tr> |
---|
1079 | |
---|
1080 | </table> |
---|
1081 | <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> |
---|
1082 | <?php |
---|
1083 | } |
---|
1084 | |
---|
1085 | /** |
---|
1086 | * Display advanced link options form fields. |
---|
1087 | * |
---|
1088 | * @since 2.6.0 |
---|
1089 | * |
---|
1090 | * @param object $link |
---|
1091 | */ |
---|
1092 | function link_advanced_meta_box($link) { |
---|
1093 | ?> |
---|
1094 | <table class="links-table" cellpadding="0"> |
---|
1095 | <tr> |
---|
1096 | <th scope="row"><label for="link_image"><?php _e('Image Address') ?></label></th> |
---|
1097 | <td><input type="text" name="link_image" class="code" id="link_image" maxlength="255" value="<?php echo ( isset( $link->link_image ) ? esc_attr($link->link_image) : ''); ?>" /></td> |
---|
1098 | </tr> |
---|
1099 | <tr> |
---|
1100 | <th scope="row"><label for="rss_uri"><?php _e('RSS Address') ?></label></th> |
---|
1101 | <td><input name="link_rss" class="code" type="text" id="rss_uri" maxlength="255" value="<?php echo ( isset( $link->link_rss ) ? esc_attr($link->link_rss) : ''); ?>" /></td> |
---|
1102 | </tr> |
---|
1103 | <tr> |
---|
1104 | <th scope="row"><label for="link_notes"><?php _e('Notes') ?></label></th> |
---|
1105 | <td><textarea name="link_notes" id="link_notes" rows="10"><?php echo ( isset( $link->link_notes ) ? $link->link_notes : ''); // textarea_escaped ?></textarea></td> |
---|
1106 | </tr> |
---|
1107 | <tr> |
---|
1108 | <th scope="row"><label for="link_rating"><?php _e('Rating') ?></label></th> |
---|
1109 | <td><select name="link_rating" id="link_rating" size="1"> |
---|
1110 | <?php |
---|
1111 | for ( $r = 0; $r <= 10; $r++ ) { |
---|
1112 | echo '<option value="' . $r . '"'; |
---|
1113 | if ( isset($link->link_rating) && $link->link_rating == $r ) |
---|
1114 | echo ' selected="selected"'; |
---|
1115 | echo('>' . $r . '</option>'); |
---|
1116 | } |
---|
1117 | ?></select> <?php _e('(Leave at 0 for no rating.)') ?> |
---|
1118 | </td> |
---|
1119 | </tr> |
---|
1120 | </table> |
---|
1121 | <?php |
---|
1122 | } |
---|
1123 | |
---|
1124 | /** |
---|
1125 | * Display post thumbnail meta box. |
---|
1126 | * |
---|
1127 | * @since 2.9.0 |
---|
1128 | */ |
---|
1129 | function post_thumbnail_meta_box( $post ) { |
---|
1130 | $thumbnail_id = get_post_meta( $post->ID, '_thumbnail_id', true ); |
---|
1131 | echo _wp_post_thumbnail_html( $thumbnail_id, $post->ID ); |
---|
1132 | } |
---|
1133 | |
---|
1134 | /** |
---|
1135 | * Display fields for ID3 data |
---|
1136 | * |
---|
1137 | * @since 3.9.0 |
---|
1138 | * |
---|
1139 | * @param WP_Post $post |
---|
1140 | */ |
---|
1141 | function attachment_id3_data_meta_box( $post ) { |
---|
1142 | $meta = array(); |
---|
1143 | if ( ! empty( $post->ID ) ) { |
---|
1144 | $meta = wp_get_attachment_metadata( $post->ID ); |
---|
1145 | } |
---|
1146 | |
---|
1147 | foreach ( wp_get_attachment_id3_keys( $post, 'edit' ) as $key => $label ) : ?> |
---|
1148 | <p> |
---|
1149 | <label for="title"><?php echo $label ?></label><br /> |
---|
1150 | <input type="text" name="id3_<?php echo esc_attr( $key ) ?>" id="id3_<?php echo esc_attr( $key ) ?>" class="large-text" value="<?php |
---|
1151 | if ( ! empty( $meta[ $key ] ) ) { |
---|
1152 | echo esc_attr( $meta[ $key ] ); |
---|
1153 | } |
---|
1154 | ?>" /> |
---|
1155 | </p> |
---|
1156 | <?php |
---|
1157 | endforeach; |
---|
1158 | } |
---|