Ticket #9674: meta_boxes.diff
| File meta_boxes.diff, 58.6 KB (added by wnorris, 4 years ago) |
|---|
-
includes/meta_boxes.php
1 <?php 2 3 // -- Post related Meta Boxes from edit-form-advanced.php 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) { 13 global $action; 14 15 $post_type = $post->post_type; 16 $can_publish = current_user_can("publish_${post_type}s"); 17 ?> 18 <div class="submitbox" id="submitpost"> 19 20 <div id="minor-publishing"> 21 22 <?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key ?> 23 <div style="display:none;"> 24 <input type="submit" name="save" value="<?php _ea('Save'); ?>" /> 25 </div> 26 27 <div id="minor-publishing-actions"> 28 <div id="save-action"> 29 <?php if ( 'publish' != $post->post_status && 'future' != $post->post_status && 'pending' != $post->post_status ) { ?> 30 <input <?php if ( 'private' == $post->post_status ) { ?>style="display:none"<?php } ?> type="submit" name="save" id="save-post" value="<?php _ea('Save Draft'); ?>" tabindex="4" class="button button-highlighted" /> 31 <?php } elseif ( 'pending' == $post->post_status && $can_publish ) { ?> 32 <input type="submit" name="save" id="save-post" value="<?php _ea('Save as Pending'); ?>" tabindex="4" class="button button-highlighted" /> 33 <?php } ?> 34 </div> 35 36 <div id="preview-action"> 37 <?php 38 if ( 'publish' == $post->post_status ) { 39 $preview_link = clean_url(get_permalink($post->ID)); 40 $preview_button = __('Preview Changes'); 41 } else { 42 $preview_link = clean_url(apply_filters('preview_post_link', add_query_arg('preview', 'true', get_permalink($post->ID)))); 43 $preview_button = __('Preview'); 44 } 45 ?> 46 <a class="preview button" href="<?php echo $preview_link; ?>" target="wp-preview" id="post-preview" tabindex="4"><?php echo $preview_button; ?></a> 47 <input type="hidden" name="wp-preview" id="wp-preview" value="" /> 48 </div> 49 50 <div class="clear"></div> 51 </div><?php // /minor-publishing-actions ?> 52 53 <div id="misc-publishing-actions"> 54 55 <div class="misc-pub-section<?php if ( !$can_publish ) { echo ' misc-pub-section-last'; } ?>"><label for="post_status"><?php _e('Status:') ?></label> 56 <b><span id="post-status-display"> 57 <?php 58 switch ( $post->post_status ) { 59 case 'private': 60 _e('Privately Published'); 61 break; 62 case 'publish': 63 _e('Published'); 64 break; 65 case 'future': 66 _e('Scheduled'); 67 break; 68 case 'pending': 69 _e('Pending Review'); 70 break; 71 case 'draft': 72 _e('Draft'); 73 break; 74 } 75 ?> 76 </span></b> 77 <?php if ( 'publish' == $post->post_status || 'private' == $post->post_status || $can_publish ) { ?> 78 <a href="#post_status" <?php if ( 'private' == $post->post_status ) { ?>style="display:none;" <?php } ?>class="edit-post-status hide-if-no-js" tabindex='4'><?php _e('Edit') ?></a> 79 80 <div id="post-status-select" class="hide-if-js"> 81 <input type="hidden" name="hidden_post_status" id="hidden_post_status" value="<?php echo attr($post->post_status); ?>" /> 82 <select name='post_status' id='post_status' tabindex='4'> 83 <?php if ( 'publish' == $post->post_status ) : ?> 84 <option<?php selected( $post->post_status, 'publish' ); ?> value='publish'><?php _e('Published') ?></option> 85 <?php elseif ( 'private' == $post->post_status ) : ?> 86 <option<?php selected( $post->post_status, 'private' ); ?> value='publish'><?php _e('Privately Published') ?></option> 87 <?php elseif ( 'future' == $post->post_status ) : ?> 88 <option<?php selected( $post->post_status, 'future' ); ?> value='future'><?php _e('Scheduled') ?></option> 89 <?php endif; ?> 90 <option<?php selected( $post->post_status, 'pending' ); ?> value='pending'><?php _e('Pending Review') ?></option> 91 <option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php _e('Draft') ?></option> 92 </select> 93 <a href="#post_status" class="save-post-status hide-if-no-js button"><?php _e('OK'); ?></a> 94 <a href="#post_status" class="cancel-post-status hide-if-no-js"><?php _e('Cancel'); ?></a> 95 </div> 96 97 <?php } ?> 98 </div><?php // /misc-pub-section ?> 99 100 <div class="misc-pub-section " id="visibility"> 101 <?php _e('Visibility:'); ?> <b><span id="post-visibility-display"><?php 102 103 if ( 'private' == $post->post_status ) { 104 $post->post_password = ''; 105 $visibility = 'private'; 106 $visibility_trans = __('Private'); 107 } elseif ( !empty( $post->post_password ) ) { 108 $visibility = 'password'; 109 $visibility_trans = __('Password protected'); 110 } elseif ( $post_type == 'post' && is_sticky( $post->ID ) ) { 111 $visibility = 'public'; 112 $visibility_trans = __('Public, Sticky'); 113 } else { 114 $visibility = 'public'; 115 $visibility_trans = __('Public'); 116 } 117 118 ?><?php echo wp_specialchars( $visibility_trans ); ?></span></b> <?php if ( $can_publish ) { ?> <a href="#visibility" class="edit-visibility hide-if-no-js"><?php _e('Edit'); ?></a> 119 120 <div id="post-visibility-select" class="hide-if-js"> 121 <input type="hidden" name="hidden_post_password" id="hidden-post-password" value="<?php echo attr($post->post_password); ?>" /> 122 <?php if ($post_type == 'post'): ?> 123 <input type="checkbox" style="display:none" name="hidden_post_sticky" id="hidden-post-sticky" value="sticky" <?php checked(is_sticky($post->ID)); ?> /> 124 <?php endif; ?> 125 <input type="hidden" name="hidden_post_visibility" id="hidden-post-visibility" value="<?php echo attr( $visibility ); ?>" /> 126 127 128 <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 /> 129 <?php if ($post_type == 'post'): ?> 130 <span id="sticky-span"><input id="sticky" name="sticky" type="checkbox" value="sticky" <?php checked(is_sticky($post->ID)); ?> tabindex="4" /> <label for="sticky" class="selectit"><?php _e('Stick this post to the front page') ?></label><br /></span> 131 <?php endif; ?> 132 <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 /> 133 <span id="password-span"><label for="post_password"><?php _e('Password:'); ?></label> <input type="text" name="post_password" id="post_password" value="<?php echo attr($post->post_password); ?>" /><br /></span> 134 <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 /> 135 136 <p> 137 <a href="#visibility" class="save-post-visibility hide-if-no-js button"><?php _e('OK'); ?></a> 138 <a href="#visibility" class="cancel-post-visibility hide-if-no-js"><?php _e('Cancel'); ?></a> 139 </p> 140 </div> 141 <?php } ?> 142 143 </div><?php // /misc-pub-section ?> 144 145 146 <?php 147 // translators: Publish box date formt, see http://php.net/date 148 $datef = __( 'M j, Y @ G:i' ); 149 if ( 0 != $post->ID ) { 150 if ( 'future' == $post->post_status ) { // scheduled for publishing at a future date 151 $stamp = __('Scheduled for: <b>%1$s</b>'); 152 } else if ( 'publish' == $post->post_status || 'private' == $post->post_status ) { // already published 153 $stamp = __('Published on: <b>%1$s</b>'); 154 } else if ( '0000-00-00 00:00:00' == $post->post_date_gmt ) { // draft, 1 or more saves, no date specified 155 $stamp = __('Publish <b>immediately</b>'); 156 } else if ( time() < strtotime( $post->post_date_gmt . ' +0000' ) ) { // draft, 1 or more saves, future date specified 157 $stamp = __('Schedule for: <b>%1$s</b>'); 158 } else { // draft, 1 or more saves, date specified 159 $stamp = __('Publish on: <b>%1$s</b>'); 160 } 161 $date = date_i18n( $datef, strtotime( $post->post_date ) ); 162 } else { // draft (no saves, and thus no date specified) 163 $stamp = __('Publish <b>immediately</b>'); 164 $date = date_i18n( $datef, strtotime( current_time('mysql') ) ); 165 } 166 ?> 167 <?php if ( $can_publish ) : // Contributors don't get to choose the date of publish ?> 168 <div class="misc-pub-section curtime misc-pub-section-last"> 169 <span id="timestamp"> 170 <?php printf($stamp, $date); ?></span> 171 <a href="#edit_timestamp" class="edit-timestamp hide-if-no-js" tabindex='4'><?php _e('Edit') ?></a> 172 <div id="timestampdiv" class="hide-if-js"><?php touch_time(($action == 'edit'),1,4); ?></div> 173 </div><?php // /misc-pub-section ?> 174 <?php endif; ?> 175 176 </div> 177 <div class="clear"></div> 178 </div> 179 180 <div id="major-publishing-actions"> 181 <?php do_action('post_submitbox_start'); ?> 182 <div id="delete-action"> 183 <?php 184 if ( ( 'edit' == $action ) && current_user_can("delete_${post_type}", $post->ID) ) { ?> 185 <?php $delete_url = add_query_arg( array('action'=>'delete', 'post'=>$post->ID) ); ?> 186 <a class="submitdelete deletion" href="<?php echo wp_nonce_url($delete_url, "delete-${post_type}_" . $post->ID); ?>" onclick="if ( confirm('<?php echo js_escape(sprintf( ('draft' == $post->post_status) ? __("You are about to delete this draft '%s'\n 'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this post '%s'\n 'Cancel' to stop, 'OK' to delete."), $post->post_title )); ?>') ) {return true;}return false;"><?php _e('Delete'); ?></a> 187 <?php } ?> 188 </div> 189 190 <div id="publishing-action"> 191 <?php 192 if ( !in_array( $post->post_status, array('publish', 'future', 'private') ) || 0 == $post->ID ) { ?> 193 <?php if ( $can_publish ) : ?> 194 <?php if ( !empty($post->post_date_gmt) && time() < strtotime( $post->post_date_gmt . ' +0000' ) ) : ?> 195 <input name="original_publish" type="hidden" id="original_publish" value="<?php _ea('Schedule') ?>" /> 196 <input name="publish" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php _ea('Schedule') ?>" /> 197 <?php else : ?> 198 <input name="original_publish" type="hidden" id="original_publish" value="<?php _ea('Publish') ?>" /> 199 <input name="publish" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php _ea('Publish') ?>" /> 200 <?php endif; ?> 201 <?php else : ?> 202 <input name="original_publish" type="hidden" id="original_publish" value="<?php _ea('Submit for Review') ?>" /> 203 <input name="publish" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php _ea('Submit for Review') ?>" /> 204 <?php endif; ?> 205 <?php } else { ?> 206 <input name="original_publish" type="hidden" id="original_publish" value="<?php _ea('Update') ?>" /> 207 <input name="save" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php _ea('Update') ?>" /> 208 <?php } ?> 209 </div> 210 <div class="clear"></div> 211 </div> 212 </div> 213 214 <?php 215 } 216 217 /** 218 * Display post tags form fields. 219 * 220 * @since 2.6.0 221 * 222 * @param object $post 223 */ 224 function post_tags_meta_box($post, $box) { 225 $tax_name = substr($box['id'], 8); 226 $taxonomy = get_taxonomy($tax_name); 227 $helps = isset($taxonomy->helps) ? attr($taxonomy->helps) : __('Separate tags with commas.'); 228 ?> 229 <div class="tagsdiv" id="<?php echo $tax_name; ?>"> 230 <p class="jaxtag"> 231 <label class="hidden" for="newtag"><?php _e( $box['title'] ); ?></label> 232 <input type="hidden" name="<?php echo "tax_input[$tax_name]"; ?>" class="the-tags" id="tax-input[<?php echo $tax_name; ?>]" value="<?php echo attr(get_terms_to_edit( $post->ID, $tax_name )); ?>" /> 233 234 <span class="ajaxtag"> 235 <input type="text" name="newtag[<?php echo $tax_name; ?>]" class="newtag form-input-tip" size="16" autocomplete="off" value="<?php _ea('Add new tag'); ?>" /> 236 <input type="button" class="button tagadd" value="<?php _ea('Add'); ?>" tabindex="3" /> 237 </span></p> 238 <p class="howto"><?php echo $helps; ?></p> 239 <div class="tagchecklist"></div> 240 </div> 241 <p class="tagcloud-link hide-if-no-js"><a href="#titlediv" class="tagcloud-link" id="link-<?php echo $tax_name; ?>"><?php printf( __('Choose from the most used tags in %s'), $box['title'] ); ?></a></p> 242 <?php 243 } 244 245 /** 246 * Display post categories form fields. 247 * 248 * @since 2.6.0 249 * 250 * @param object $post 251 */ 252 function post_categories_meta_box($post) { 253 ?> 254 <ul id="category-tabs"> 255 <li class="ui-tabs-selected"><a href="#categories-all" tabindex="3"><?php _e( 'All Categories' ); ?></a></li> 256 <li class="hide-if-no-js"><a href="#categories-pop" tabindex="3"><?php _e( 'Most Used' ); ?></a></li> 257 </ul> 258 259 <div id="categories-pop" class="ui-tabs-panel" style="display: none;"> 260 <ul id="categorychecklist-pop" class="categorychecklist form-no-clear" > 261 <?php $popular_ids = wp_popular_terms_checklist('category'); ?> 262 </ul> 263 </div> 264 265 <div id="categories-all" class="ui-tabs-panel"> 266 <ul id="categorychecklist" class="list:category categorychecklist form-no-clear"> 267 <?php wp_category_checklist($post->ID, false, false, $popular_ids) ?> 268 </ul> 269 </div> 270 271 <?php if ( current_user_can('manage_categories') ) : ?> 272 <div id="category-adder" class="wp-hidden-children"> 273 <h4><a id="category-add-toggle" href="#category-add" class="hide-if-no-js" tabindex="3"><?php _e( '+ Add New Category' ); ?></a></h4> 274 <p id="category-add" class="wp-hidden-child"> 275 <label class="hidden" for="newcat"><?php _e( 'Add New Category' ); ?></label><input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php _ea( 'New category name' ); ?>" tabindex="3" aria-required="true"/> 276 <label class="hidden" for="newcat_parent"><?php _e('Parent category'); ?>:</label><?php wp_dropdown_categories( array( 'hide_empty' => 0, 'name' => 'newcat_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => __('Parent category'), 'tab_index' => 3 ) ); ?> 277 <input type="button" id="category-add-sumbit" class="add:categorychecklist:category-add button" value="<?php _ea( 'Add' ); ?>" tabindex="3" /> 278 <?php wp_nonce_field( 'add-category', '_ajax_nonce', false ); ?> 279 <span id="category-ajax-response"></span> 280 </p> 281 </div> 282 <?php 283 endif; 284 285 } 286 287 /** 288 * Display post excerpt form fields. 289 * 290 * @since 2.6.0 291 * 292 * @param object $post 293 */ 294 function post_excerpt_meta_box($post) { 295 ?> 296 <label class="hidden" for="excerpt"><?php _e('Excerpt') ?></label><textarea rows="1" cols="40" name="excerpt" tabindex="6" id="excerpt"><?php echo $post->post_excerpt ?></textarea> 297 <p><?php _e('Excerpts are optional hand-crafted summaries of your content. You can <a href="http://codex.wordpress.org/Template_Tags/the_excerpt" target="_blank">use them in your template</a>'); ?></p> 298 <?php 299 } 300 301 /** 302 * Display trackback links form fields. 303 * 304 * @since 2.6.0 305 * 306 * @param object $post 307 */ 308 function post_trackback_meta_box($post) { 309 $form_trackback = '<input type="text" name="trackback_url" id="trackback_url" class="code" tabindex="7" value="'. attr( str_replace("\n", ' ', $post->to_ping) ) .'" />'; 310 if ('' != $post->pinged) { 311 $pings = '<p>'. __('Already pinged:') . '</p><ul>'; 312 $already_pinged = explode("\n", trim($post->pinged)); 313 foreach ($already_pinged as $pinged_url) { 314 $pings .= "\n\t<li>" . wp_specialchars($pinged_url) . "</li>"; 315 } 316 $pings .= '</ul>'; 317 } 318 319 ?> 320 <p><label for="trackback_url"><?php _e('Send trackbacks to:'); ?></label> <?php echo $form_trackback; ?><br /> (<?php _e('Separate multiple URLs with spaces'); ?>)</p> 321 <p><?php _e('Trackbacks are a way to notify legacy blog systems that you’ve linked to them. If you link other WordPress blogs 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> 322 <?php 323 if ( ! empty($pings) ) 324 echo $pings; 325 } 326 327 /** 328 * Display custom fields for the post form fields. 329 * 330 * @since 2.6.0 331 * 332 * @param object $post 333 */ 334 function post_custom_meta_box($post) { 335 ?> 336 <div id="postcustomstuff"> 337 <div id="ajax-response"></div> 338 <?php 339 $metadata = has_meta($post->ID); 340 list_meta($metadata); 341 meta_form(); 342 ?> 343 </div> 344 <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> 345 <?php 346 } 347 348 /** 349 * Display comment status for post form fields. 350 * 351 * @since 2.6.0 352 * 353 * @param object $post 354 */ 355 function post_comment_status_meta_box($post) { 356 ?> 357 <input name="advanced_view" type="hidden" value="1" /> 358 <p class="meta-options"> 359 <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 /> 360 <label for="ping_status" class="selectit"><input name="ping_status" type="checkbox" id="ping_status" value="open" <?php checked($post->ping_status, 'open'); ?> /> <?php _e('Allow <a href="http://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments" target="_blank">trackbacks and pingbacks</a>') ?></label> 361 </p> 362 <?php 363 } 364 365 /** 366 * Display comments for post. 367 * 368 * @since 2.8.0 369 * 370 * @param object $post 371 */ 372 function post_comment_meta_box($post) { 373 global $wpdb, $post_ID; 374 375 $total = $wpdb->get_var($wpdb->prepare("SELECT count(1) FROM $wpdb->comments WHERE comment_post_ID = '%d' AND ( comment_approved = '0' OR comment_approved = '1')", $post_ID)); 376 377 if ( 1 > $total ) { 378 echo '<p>' . __('No comments yet.') . '</p>'; 379 return; 380 } 381 382 wp_nonce_field( 'get-comments', 'add_comment_nonce', false ); 383 ?> 384 385 <table class="widefat comments-box fixed" cellspacing="0" style="display:none;"> 386 <thead> 387 <tr> 388 <th scope="col" class="column-author"><?php _e('Author') ?></th> 389 <th scope="col" class="column-comment"> 390 <?php /* translators: field name in comment form */ echo _x('Comment', 'noun'); ?> 391 </th> 392 </tr> 393 </thead> 394 <tbody id="the-comment-list" class="list:comment"> 395 </tbody> 396 </table> 397 <p class="hide-if-no-js"><a href="#commentstatusdiv" id="show-comments" onclick="commentsBox.get(<?php echo $total; ?>);return false;"><?php _e('Show comments'); ?></a> <img class="waiting" style="display:none;" src="images/loading.gif" alt="" /></p> 398 <?php 399 $hidden = get_hidden_meta_boxes('post'); 400 if ( ! in_array('commentsdiv', $hidden) ) { ?> 401 <script type="text/javascript">jQuery(document).ready(function(){commentsBox.get(<?php echo $total; ?>, 10);});</script> 402 <?php 403 } 404 } 405 406 /** 407 * Display post slug form fields. 408 * 409 * @since 2.6.0 410 * 411 * @param object $post 412 */ 413 function post_slug_meta_box($post, $box) { 414 ?> 415 <label class="hidden" for="post_name"><?php echo $box['title']; ?></label><input name="post_name" type="text" size="13" id="post_name" value="<?php echo attr( $post->post_name ); ?>" /> 416 <?php 417 } 418 419 /** 420 * Display list of post revisions. 421 * 422 * @since 2.6.0 423 * 424 * @param object $post 425 */ 426 function post_revisions_meta_box($post) { 427 wp_list_post_revisions(); 428 } 429 430 /** 431 * Display form field with list of authors. 432 * 433 * @since 2.6.0 434 * 435 * @param object $post 436 */ 437 function post_author_meta_box($post, $box) { 438 global $current_user, $user_ID; 439 $authors = get_editable_user_ids( $current_user->id, true, $post->post_type ); // TODO: ROLE SYSTEM 440 if ( $post->post_author && !in_array($post->post_author, $authors) ) 441 $authors[] = $post->post_author; 442 ?> 443 <label class="hidden" for="post_author_override"><?php echo $box['title']; ?></label><?php wp_dropdown_users( array('include' => $authors, 'name' => 'post_author_override', 'selected' => empty($post->ID) ? $user_ID : $post->post_author) ); ?> 444 <?php 445 } 446 447 448 // -- Page related Meta Boxes from edit-page-form.php 449 450 451 /** 452 * Display page attributes form fields. 453 * 454 * @since 2.7.0 455 * 456 * @param object $post 457 */ 458 function page_attributes_meta_box($post){ 459 ?> 460 <h5><?php _e('Parent') ?></h5> 461 <label class="hidden" for="parent_id"><?php _e('Page Parent') ?></label> 462 <?php wp_dropdown_pages(array('exclude_tree' => $post->ID, 'selected' => $post->post_parent, 'name' => 'parent_id', 'show_option_none' => __('Main Page (no parent)'), 'sort_column'=> 'menu_order, post_title')); ?> 463 <p><?php _e('You can arrange your pages in hierarchies, for example you could have an “About” page that has “Life Story” and “My Dog” pages under it. There are no limits to how deeply nested you can make pages.'); ?></p> 464 <?php 465 if ( 0 != count( get_page_templates() ) ) { 466 ?> 467 <h5><?php _e('Template') ?></h5> 468 <label class="hidden" for="page_template"><?php _e('Page Template') ?></label><select name="page_template" id="page_template"> 469 <option value='default'><?php _e('Default Template'); ?></option> 470 <?php page_template_dropdown($post->page_template); ?> 471 </select> 472 <p><?php _e('Some themes have custom templates you can use for certain pages that might have additional features or custom layouts. If so, you’ll see them above.'); ?></p> 473 <?php 474 } 475 ?> 476 <h5><?php _e('Order') ?></h5> 477 <p><label class="hidden" for="menu_order"><?php _e('Page Order') ?></label><input name="menu_order" type="text" size="4" id="menu_order" value="<?php echo attr($post->menu_order) ?>" /></p> 478 <p><?php _e('Pages are usually ordered alphabetically, but you can put a number above to change the order pages appear in. (We know this is a little janky, it’ll be better in future releases.)'); ?></p> 479 <?php 480 } -
edit-page-form.php
49 49 $temp_ID = (int) $temp_ID; 50 50 $user_ID = (int) $user_ID; 51 51 52 /** 53 * Display submit form fields. 54 * 55 * @since 2.7.0 56 * 57 * @param object $post 58 */ 59 function page_submit_meta_box($post) { 60 global $action; 52 require_once('includes/meta_boxes.php'); 61 53 62 $can_publish = current_user_can('publish_pages'); 63 ?> 64 <div class="submitbox" id="submitpage"> 65 66 <div id="minor-publishing"> 67 68 <?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key ?> 69 <div style="display:none;"> 70 <input type="submit" name="save" value="<?php _ea('Save'); ?>" /> 71 </div> 72 73 <div id="minor-publishing-actions"> 74 <div id="save-action"> 75 <?php if ( 'publish' != $post->post_status && 'future' != $post->post_status && 'pending' != $post->post_status ) { ?> 76 <input <?php if ( 'private' == $post->post_status ) { ?>style="display:none"<?php } ?> type="submit" name="save" id="save-post" value="<?php _ea('Save Draft'); ?>" tabindex="4" class="button button-highlighted" /> 77 <?php } elseif ( 'pending' == $post->post_status && $can_publish ) { ?> 78 <input type="submit" name="save" id="save-post" value="<?php _ea('Save as Pending'); ?>" tabindex="4" class="button button-highlighted" /> 79 <?php } ?> 80 </div> 81 82 <div id="preview-action"> 83 <?php 84 if ( 'publish' == $post->post_status ) { 85 $preview_link = clean_url(get_permalink($post->ID)); 86 $preview_button = __('Preview Changes'); 87 } else { 88 $preview_link = clean_url(apply_filters('preview_post_link', add_query_arg('preview', 'true', get_permalink($post->ID)))); 89 $preview_button = __('Preview'); 90 } 91 ?> 92 <a class="preview button" href="<?php echo $preview_link; ?>" target="wp-preview" id="post-preview" tabindex="4"><?php echo $preview_button; ?></a> 93 <input type="hidden" name="wp-preview" id="wp-preview" value="" /> 94 </div> 95 96 <div class="clear"></div> 97 </div><?php // /minor-publishing-actions ?> 98 99 <div id="misc-publishing-actions"> 100 101 <div class="misc-pub-section<?php if ( !$can_publish ) { echo ' misc-pub-section-last'; } ?>"><label for="post_status"><?php _e('Status:') ?></label> 102 <b><span id="post-status-display"> 103 <?php 104 switch ( $post->post_status ) { 105 case 'private': 106 _e('Privately Published'); 107 break; 108 case 'publish': 109 _e('Published'); 110 break; 111 case 'future': 112 _e('Scheduled'); 113 break; 114 case 'pending': 115 _e('Pending Review'); 116 break; 117 case 'draft': 118 _e('Draft'); 119 break; 120 } 121 ?> 122 </span></b> 123 <?php if ( 'publish' == $post->post_status || 'private' == $post->post_status || $can_publish ) { ?> 124 <a href="#post_status" <?php if ( 'private' == $post->post_status ) { ?>style="display:none;" <?php } ?>class="edit-post-status hide-if-no-js" tabindex='4'><?php _e('Edit') ?></a> 125 126 <div id="post-status-select" class="hide-if-js"> 127 <input type="hidden" name="hidden_post_status" id="hidden_post_status" value="<?php echo attr($post->post_status); ?>" /> 128 <select name='post_status' id='post_status' tabindex='4'> 129 <?php if ( 'publish' == $post->post_status ) : ?> 130 <option<?php selected( $post->post_status, 'publish' ); ?> value='publish'><?php _e('Published') ?></option> 131 <?php elseif ( 'private' == $post->post_status ) : ?> 132 <option<?php selected( $post->post_status, 'private' ); ?> value='publish'><?php _e('Privately Published') ?></option> 133 <?php elseif ( 'future' == $post->post_status ) : ?> 134 <option<?php selected( $post->post_status, 'future' ); ?> value='future'><?php _e('Scheduled') ?></option> 135 <?php endif; ?> 136 <option<?php selected( $post->post_status, 'pending' ); ?> value='pending'><?php _e('Pending Review') ?></option> 137 <option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php _e('Draft') ?></option> 138 </select> 139 140 <a href="#post_status" class="save-post-status hide-if-no-js button"><?php _e('OK'); ?></a> 141 <a href="#post_status" class="cancel-post-status hide-if-no-js"><?php _e('Cancel'); ?></a> 142 </div> 143 144 <?php } ?> 145 </div><?php // /misc-pub-section ?> 146 147 <div class="misc-pub-section " id="visibility"> 148 <?php _e('Visibility:'); ?> <b><span id="post-visibility-display"><?php 149 150 if ( 'private' == $post->post_status ) { 151 $post->post_password = ''; 152 $visibility = 'private'; 153 $visibility_trans = __('Private'); 154 } elseif ( !empty( $post->post_password ) ) { 155 $visibility = 'password'; 156 $visibility_trans = __('Password protected'); 157 } else { 158 $visibility = 'public'; 159 $visibility_trans = __('Public'); 160 } 161 162 ?><?php echo wp_specialchars( $visibility_trans ); ?></span></b> <?php if ( $can_publish ) { ?> <a href="#visibility" class="edit-visibility hide-if-no-js"><?php _e('Edit'); ?></a> 163 164 <div id="post-visibility-select" class="hide-if-js"> 165 <input type="hidden" name="hidden_post_password" id="hidden-post-password" value="<?php echo attr($post->post_password); ?>" /> 166 <input type="hidden" name="hidden_post_visibility" id="hidden-post-visibility" value="<?php echo attr( $visibility ); ?>" /> 167 168 169 <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 /> 170 <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 /> 171 <span id="password-span"><label for="post_password"><?php _e('Password:'); ?></label> <input type="text" name="post_password" id="post_password" value="<?php echo attr($post->post_password); ?>" /><br /></span> 172 <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 /> 173 174 <p> 175 <a href="#visibility" class="save-post-visibility hide-if-no-js button"><?php _e('OK'); ?></a> 176 <a href="#visibility" class="cancel-post-visibility hide-if-no-js"><?php _e('Cancel'); ?></a> 177 </p> 178 </div> 179 <?php } ?> 180 181 </div><?php // /misc-pub-section ?> 182 183 <?php 184 // translators: Publish box date formt, see http://php.net/date 185 $datef = __( 'M j, Y @ G:i' ); 186 if ( 0 != $post->ID ) { 187 if ( 'future' == $post->post_status ) { // scheduled for publishing at a future date 188 $stamp = __('Scheduled for: <b>%1$s</b>'); 189 } else if ( 'publish' == $post->post_status || 'private' == $post->post_status ) { // already published 190 $stamp = __('Published on: <b>%1$s</b>'); 191 } else if ( '0000-00-00 00:00:00' == $post->post_date_gmt ) { // draft, 1 or more saves, no date specified 192 $stamp = __('Publish <b>immediately</b>'); 193 } else if ( time() < strtotime( $post->post_date_gmt . ' +0000' ) ) { // draft, 1 or more saves, future date specified 194 $stamp = __('Schedule for: <b>%1$s</b>'); 195 } else { // draft, 1 or more saves, date specified 196 $stamp = __('Publish on: <b>%1$s</b>'); 197 } 198 $date = date_i18n( $datef, strtotime( $post->post_date ) ); 199 } else { // draft (no saves, and thus no date specified) 200 $stamp = __('Publish <b>immediately</b>'); 201 $date = date_i18n( $datef, strtotime( current_time('mysql') ) ); 202 } 203 ?> 204 <?php if ( $can_publish ) : // Contributors don't get to choose the date of publish ?> 205 <div class="misc-pub-section curtime misc-pub-section-last"> 206 <span id="timestamp"> 207 <?php printf($stamp, $date); ?></span> 208 <a href="#edit_timestamp" class="edit-timestamp hide-if-no-js" tabindex='4'><?php _e('Edit') ?></a> 209 <div id="timestampdiv" class="hide-if-js"><?php touch_time(($action == 'edit'),1,4); ?></div> 210 </div><?php // /misc-pub-section ?> 211 <?php endif; ?> 212 213 </div> 214 <div class="clear"></div> 215 </div> 216 217 <div id="major-publishing-actions"> 218 <?php do_action('post_submitbox_start'); ?> 219 <div id="delete-action"> 220 <?php 221 if ( ( 'edit' == $action ) && current_user_can('delete_page', $post->ID) ) { ?> 222 <a class="submitdelete deletion" href="<?php echo wp_nonce_url("page.php?action=delete&post=$post->ID", 'delete-page_' . $post->ID); ?>" onclick="if ( confirm('<?php echo js_escape(sprintf( ('draft' == $post->post_status) ? __("You are about to delete this draft '%s'\n 'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this page '%s'\n 'Cancel' to stop, 'OK' to delete."), $post->post_title )); ?>') ) {return true;}return false;"><?php _e('Delete'); ?></a> 223 <?php } ?> 224 </div> 225 226 <div id="publishing-action"> 227 <?php 228 if ( !in_array( $post->post_status, array('publish', 'future', 'private') ) || 0 == $post->ID ) { ?> 229 <?php if ( $can_publish ) : ?> 230 <?php if ( !empty($post->post_date_gmt) && time() < strtotime( $post->post_date_gmt . ' +0000' ) ) : ?> 231 <input name="original_publish" type="hidden" id="original_publish" value="<?php _ea('Schedule') ?>" /> 232 <input name="publish" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php _ea('Schedule') ?>" /> 233 <?php else : ?> 234 <input name="original_publish" type="hidden" id="original_publish" value="<?php _ea('Publish') ?>" /> 235 <input name="publish" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php _ea('Publish') ?>" /> 236 <?php endif; ?> 237 <?php else : ?> 238 <input name="original_publish" type="hidden" id="original_publish" value="<?php _ea('Submit for Review') ?>" /> 239 <input name="publish" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php _ea('Submit for Review') ?>" /> 240 <?php endif; ?> 241 <?php } else { ?> 242 <input name="original_publish" type="hidden" id="original_publish" value="<?php _ea('Update Page') ?>" /> 243 <input name="save" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php _ea('Update Page') ?>" /> 244 <?php } ?> 245 </div> 246 <div class="clear"></div> 247 </div> 248 </div> 249 <?php 250 } 251 add_meta_box('pagesubmitdiv', __('Publish'), 'page_submit_meta_box', 'page', 'side', 'core'); 252 253 /** 254 * Display page password form fields. 255 * 256 * @since 2.6.0 257 * 258 * @param object $post 259 */ 260 function page_password_meta_box($post){ 261 ?> 262 <p><label for="post_status_private" class="selectit"><input id="post_status_private" name="post_status" type="checkbox" value="private" <?php checked($post->post_status, 'private'); ?> tabindex='4' /> <?php _e('Keep this page private') ?></label></p> 263 <h4><?php _e( 'Page Password' ); ?></h4> 264 <p><label class="hidden" for="post_password"><?php _e('Password Protect This Page') ?></label><input name="post_password" type="text" size="25" id="post_password" value="<?php the_post_password(); ?>" /></p> 265 <p><?php _e('Setting a password will require people who visit your blog to enter the above password to view this page and its comments.'); ?></p> 266 <?php 267 } 268 // add_meta_box('pagepassworddiv', __('Privacy Options'), 'page_password_meta_box', 'page', 'side', 'core'); 269 270 /** 271 * Display page attributes form fields. 272 * 273 * @since 2.7.0 274 * 275 * @param object $post 276 */ 277 function page_attributes_meta_box($post){ 278 ?> 279 <h5><?php _e('Parent') ?></h5> 280 <label class="hidden" for="parent_id"><?php _e('Page Parent') ?></label> 281 <?php wp_dropdown_pages(array('exclude_tree' => $post->ID, 'selected' => $post->post_parent, 'name' => 'parent_id', 'show_option_none' => __('Main Page (no parent)'), 'sort_column'=> 'menu_order, post_title')); ?> 282 <p><?php _e('You can arrange your pages in hierarchies, for example you could have an “About” page that has “Life Story” and “My Dog” pages under it. There are no limits to how deeply nested you can make pages.'); ?></p> 283 <?php 284 if ( 0 != count( get_page_templates() ) ) { 285 ?> 286 <h5><?php _e('Template') ?></h5> 287 <label class="hidden" for="page_template"><?php _e('Page Template') ?></label><select name="page_template" id="page_template"> 288 <option value='default'><?php _e('Default Template'); ?></option> 289 <?php page_template_dropdown($post->page_template); ?> 290 </select> 291 <p><?php _e('Some themes have custom templates you can use for certain pages that might have additional features or custom layouts. If so, you’ll see them above.'); ?></p> 292 <?php 293 } 294 ?> 295 <h5><?php _e('Order') ?></h5> 296 <p><label class="hidden" for="menu_order"><?php _e('Page Order') ?></label><input name="menu_order" type="text" size="4" id="menu_order" value="<?php echo attr($post->menu_order) ?>" /></p> 297 <p><?php _e('Pages are usually ordered alphabetically, but you can put a number above to change the order pages appear in. (We know this is a little janky, it’ll be better in future releases.)'); ?></p> 298 <?php 299 } 54 add_meta_box('pagesubmitdiv', __('Publish'), 'post_submit_meta_box', 'page', 'side', 'core'); 300 55 add_meta_box('pageparentdiv', __('Attributes'), 'page_attributes_meta_box', 'page', 'side', 'core'); 56 add_meta_box('pagecustomdiv', __('Custom Fields'), 'post_custom_meta_box', 'page', 'normal', 'core'); 57 add_meta_box('pagecommentstatusdiv', __('Discussion'), 'post_comment_status_meta_box', 'page', 'normal', 'core'); 58 add_meta_box('pageslugdiv', __('Page Slug'), 'post_slug_meta_box', 'page', 'normal', 'core'); 301 59 302 /**303 * Display custom field for page form fields.304 *305 * @since 2.6.0306 *307 * @param object $post308 */309 function page_custom_meta_box($post){310 ?>311 <div id="postcustomstuff">312 <?php313 $metadata = has_meta($post->ID);314 list_meta($metadata);315 meta_form();316 ?>317 <div id="ajax-response"></div>318 </div>319 <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>320 <?php321 }322 add_meta_box('pagecustomdiv', __('Custom Fields'), 'page_custom_meta_box', 'page', 'normal', 'core');323 324 /**325 * Display comments status form fields.326 *327 * @since 2.6.0328 *329 * @param object $post330 */331 function page_comments_status_meta_box($post){332 ?>333 <input name="advanced_view" type="hidden" value="1" />334 <p><label for="comment_status" class="selectit">335 <input name="comment_status" type="checkbox" id="comment_status" value="open" <?php checked($post->comment_status, 'open'); ?> />336 <?php _e('Allow Comments') ?></label></p>337 <p><label for="ping_status" class="selectit"><input name="ping_status" type="checkbox" id="ping_status" value="open" <?php checked($post->ping_status, 'open'); ?> /> <?php _e('Allow Pings') ?></label></p>338 <p><?php _e('These settings apply to this page only. “Pings” are <a href="http://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments" target="_blank">trackbacks and pingbacks</a>.'); ?></p>339 <?php340 }341 add_meta_box('pagecommentstatusdiv', __('Discussion'), 'page_comments_status_meta_box', 'page', 'normal', 'core');342 343 /**344 * Display page slug form fields.345 *346 * @since 2.6.0347 *348 * @param object $post349 */350 function page_slug_meta_box($post){351 ?>352 <label class="hidden" for="post_name"><?php _e('Page Slug') ?></label><input name="post_name" type="text" size="13" id="post_name" value="<?php echo attr( $post->post_name ); ?>" />353 <?php354 }355 add_meta_box('pageslugdiv', __('Page Slug'), 'page_slug_meta_box', 'page', 'normal', 'core');356 357 60 $authors = get_editable_user_ids( $current_user->id, true, 'page' ); // TODO: ROLE SYSTEM 358 61 if ( $post->post_author && !in_array($post->post_author, $authors) ) 359 62 $authors[] = $post->post_author; 360 63 if ( $authors && count( $authors ) > 1 ) { 361 /** 362 * Display page author form fields, when more than one author exists. 363 * 364 * @since 2.6.0 365 * 366 * @param object $post 367 */ 368 function page_author_meta_box($post){ 369 global $current_user, $user_ID; 370 $authors = get_editable_user_ids( $current_user->id, true, 'page' ); // TODO: ROLE SYSTEM 371 if ( $post->post_author && !in_array($post->post_author, $authors) ) 372 $authors[] = $post->post_author; 373 ?> 374 <label class="hidden" for="post_author_override"><?php _e('Page Author'); ?></label><?php wp_dropdown_users( array('include' => $authors, 'name' => 'post_author_override', 'selected' => empty($post->ID) ? $user_ID : $post->post_author) ); ?> 375 <?php 376 } 377 add_meta_box('pageauthordiv', __('Page Author'), 'page_author_meta_box', 'page', 'normal', 'core'); 64 add_meta_box('pageauthordiv', __('Page Author'), 'post_author_meta_box', 'page', 'normal', 'core'); 378 65 } 379 66 380 67 if ( 0 < $post_ID && wp_get_post_revisions( $post_ID ) ) : 381 /** 382 * Display list of page revisions. 383 * 384 * @since 2.6.0 385 * 386 * @param object $post 387 */ 388 function page_revisions_meta_box($post) { 389 wp_list_post_revisions(); 390 } 391 add_meta_box('revisionsdiv', __('Page Revisions'), 'page_revisions_meta_box', 'page', 'normal', 'core'); 68 add_meta_box('revisionsdiv', __('Page Revisions'), 'post_revisions_meta_box', 'page', 'normal', 'core'); 392 69 endif; 393 70 394 71 do_action('do_meta_boxes', 'page', 'normal', $post); -
edit-form-advanced.php
53 53 } 54 54 55 55 // All meta boxes should be defined and added before the first do_meta_boxes() call (or potentially during the do_meta_boxes action). 56 require_once('includes/meta_boxes.php'); 56 57 57 /**58 * Display post submit form fields.59 *60 * @since 2.7.061 *62 * @param object $post63 */64 function post_submit_meta_box($post) {65 global $action;66 67 $can_publish = current_user_can('publish_posts');68 ?>69 <div class="submitbox" id="submitpost">70 71 <div id="minor-publishing">72 73 <?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key ?>74 <div style="display:none;">75 <input type="submit" name="save" value="<?php _ea('Save'); ?>" />76 </div>77 78 <div id="minor-publishing-actions">79 <div id="save-action">80 <?php if ( 'publish' != $post->post_status && 'future' != $post->post_status && 'pending' != $post->post_status ) { ?>81 <input <?php if ( 'private' == $post->post_status ) { ?>style="display:none"<?php } ?> type="submit" name="save" id="save-post" value="<?php _ea('Save Draft'); ?>" tabindex="4" class="button button-highlighted" />82 <?php } elseif ( 'pending' == $post->post_status && $can_publish ) { ?>83 <input type="submit" name="save" id="save-post" value="<?php _ea('Save as Pending'); ?>" tabindex="4" class="button button-highlighted" />84 <?php } ?>85 </div>86 87 <div id="preview-action">88 <?php89 if ( 'publish' == $post->post_status ) {90 $preview_link = clean_url(get_permalink($post->ID));91 $preview_button = __('Preview Changes');92 } else {93 $preview_link = clean_url(apply_filters('preview_post_link', add_query_arg('preview', 'true', get_permalink($post->ID))));94 $preview_button = __('Preview');95 }96 ?>97 <a class="preview button" href="<?php echo $preview_link; ?>" target="wp-preview" id="post-preview" tabindex="4"><?php echo $preview_button; ?></a>98 <input type="hidden" name="wp-preview" id="wp-preview" value="" />99 </div>100 101 <div class="clear"></div>102 </div><?php // /minor-publishing-actions ?>103 104 <div id="misc-publishing-actions">105 106 <div class="misc-pub-section<?php if ( !$can_publish ) { echo ' misc-pub-section-last'; } ?>"><label for="post_status"><?php _e('Status:') ?></label>107 <b><span id="post-status-display">108 <?php109 switch ( $post->post_status ) {110 case 'private':111 _e('Privately Published');112 break;113 case 'publish':114 _e('Published');115 break;116 case 'future':117 _e('Scheduled');118 break;119 case 'pending':120 _e('Pending Review');121 break;122 case 'draft':123 _e('Draft');124 break;125 }126 ?>127 </span></b>128 <?php if ( 'publish' == $post->post_status || 'private' == $post->post_status || $can_publish ) { ?>129 <a href="#post_status" <?php if ( 'private' == $post->post_status ) { ?>style="display:none;" <?php } ?>class="edit-post-status hide-if-no-js" tabindex='4'><?php _e('Edit') ?></a>130 131 <div id="post-status-select" class="hide-if-js">132 <input type="hidden" name="hidden_post_status" id="hidden_post_status" value="<?php echo attr($post->post_status); ?>" />133 <select name='post_status' id='post_status' tabindex='4'>134 <?php if ( 'publish' == $post->post_status ) : ?>135 <option<?php selected( $post->post_status, 'publish' ); ?> value='publish'><?php _e('Published') ?></option>136 <?php elseif ( 'private' == $post->post_status ) : ?>137 <option<?php selected( $post->post_status, 'private' ); ?> value='publish'><?php _e('Privately Published') ?></option>138 <?php elseif ( 'future' == $post->post_status ) : ?>139 <option<?php selected( $post->post_status, 'future' ); ?> value='future'><?php _e('Scheduled') ?></option>140 <?php endif; ?>141 <option<?php selected( $post->post_status, 'pending' ); ?> value='pending'><?php _e('Pending Review') ?></option>142 <option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php _e('Draft') ?></option>143 </select>144 <a href="#post_status" class="save-post-status hide-if-no-js button"><?php _e('OK'); ?></a>145 <a href="#post_status" class="cancel-post-status hide-if-no-js"><?php _e('Cancel'); ?></a>146 </div>147 148 <?php } ?>149 </div><?php // /misc-pub-section ?>150 151 <div class="misc-pub-section " id="visibility">152 <?php _e('Visibility:'); ?> <b><span id="post-visibility-display"><?php153 154 if ( 'private' == $post->post_status ) {155 $post->post_password = '';156 $visibility = 'private';157 $visibility_trans = __('Private');158 } elseif ( !empty( $post->post_password ) ) {159 $visibility = 'password';160 $visibility_trans = __('Password protected');161 } elseif ( is_sticky( $post->ID ) ) {162 $visibility = 'public';163 $visibility_trans = __('Public, Sticky');164 } else {165 $visibility = 'public';166 $visibility_trans = __('Public');167 }168 169 ?><?php echo wp_specialchars( $visibility_trans ); ?></span></b> <?php if ( $can_publish ) { ?> <a href="#visibility" class="edit-visibility hide-if-no-js"><?php _e('Edit'); ?></a>170 171 <div id="post-visibility-select" class="hide-if-js">172 <input type="hidden" name="hidden_post_password" id="hidden-post-password" value="<?php echo attr($post->post_password); ?>" />173 <input type="checkbox" style="display:none" name="hidden_post_sticky" id="hidden-post-sticky" value="sticky" <?php checked(is_sticky($post->ID)); ?> />174 <input type="hidden" name="hidden_post_visibility" id="hidden-post-visibility" value="<?php echo attr( $visibility ); ?>" />175 176 177 <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 />178 <span id="sticky-span"><input id="sticky" name="sticky" type="checkbox" value="sticky" <?php checked(is_sticky($post->ID)); ?> tabindex="4" /> <label for="sticky" class="selectit"><?php _e('Stick this post to the front page') ?></label><br /></span>179 <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 />180 <span id="password-span"><label for="post_password"><?php _e('Password:'); ?></label> <input type="text" name="post_password" id="post_password" value="<?php echo attr($post->post_password); ?>" /><br /></span>181 <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 />182 183 <p>184 <a href="#visibility" class="save-post-visibility hide-if-no-js button"><?php _e('OK'); ?></a>185 <a href="#visibility" class="cancel-post-visibility hide-if-no-js"><?php _e('Cancel'); ?></a>186 </p>187 </div>188 <?php } ?>189 190 </div><?php // /misc-pub-section ?>191 192 193 <?php194 // translators: Publish box date formt, see http://php.net/date195 $datef = __( 'M j, Y @ G:i' );196 if ( 0 != $post->ID ) {197 if ( 'future' == $post->post_status ) { // scheduled for publishing at a future date198 $stamp = __('Scheduled for: <b>%1$s</b>');199 } else if ( 'publish' == $post->post_status || 'private' == $post->post_status ) { // already published200 $stamp = __('Published on: <b>%1$s</b>');201 } else if ( '0000-00-00 00:00:00' == $post->post_date_gmt ) { // draft, 1 or more saves, no date specified202 $stamp = __('Publish <b>immediately</b>');203 } else if ( time() < strtotime( $post->post_date_gmt . ' +0000' ) ) { // draft, 1 or more saves, future date specified204 $stamp = __('Schedule for: <b>%1$s</b>');205 } else { // draft, 1 or more saves, date specified206 $stamp = __('Publish on: <b>%1$s</b>');207 }208 $date = date_i18n( $datef, strtotime( $post->post_date ) );209 } else { // draft (no saves, and thus no date specified)210 $stamp = __('Publish <b>immediately</b>');211 $date = date_i18n( $datef, strtotime( current_time('mysql') ) );212 }213 ?>214 <?php if ( $can_publish ) : // Contributors don't get to choose the date of publish ?>215 <div class="misc-pub-section curtime misc-pub-section-last">216 <span id="timestamp">217 <?php printf($stamp, $date); ?></span>218 <a href="#edit_timestamp" class="edit-timestamp hide-if-no-js" tabindex='4'><?php _e('Edit') ?></a>219 <div id="timestampdiv" class="hide-if-js"><?php touch_time(($action == 'edit'),1,4); ?></div>220 </div><?php // /misc-pub-section ?>221 <?php endif; ?>222 223 </div>224 <div class="clear"></div>225 </div>226 227 <div id="major-publishing-actions">228 <?php do_action('post_submitbox_start'); ?>229 <div id="delete-action">230 <?php231 if ( ( 'edit' == $action ) && current_user_can('delete_post', $post->ID) ) { ?>232 <a class="submitdelete deletion" href="<?php echo wp_nonce_url("post.php?action=delete&post=$post->ID", 'delete-post_' . $post->ID); ?>" onclick="if ( confirm('<?php echo js_escape(sprintf( ('draft' == $post->post_status) ? __("You are about to delete this draft '%s'\n 'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this post '%s'\n 'Cancel' to stop, 'OK' to delete."), $post->post_title )); ?>') ) {return true;}return false;"><?php _e('Delete'); ?></a>233 <?php } ?>234 </div>235 236 <div id="publishing-action">237 <?php238 if ( !in_array( $post->post_status, array('publish', 'future', 'private') ) || 0 == $post->ID ) { ?>239 <?php if ( current_user_can('publish_posts') ) : ?>240 <?php if ( !empty($post->post_date_gmt) && time() < strtotime( $post->post_date_gmt . ' +0000' ) ) : ?>241 <input name="original_publish" type="hidden" id="original_publish" value="<?php _ea('Schedule') ?>" />242 <input name="publish" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php _ea('Schedule') ?>" />243 <?php else : ?>244 <input name="original_publish" type="hidden" id="original_publish" value="<?php _ea('Publish') ?>" />245 <input name="publish" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php _ea('Publish') ?>" />246 <?php endif; ?>247 <?php else : ?>248 <input name="original_publish" type="hidden" id="original_publish" value="<?php _ea('Submit for Review') ?>" />249 <input name="publish" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php _ea('Submit for Review') ?>" />250 <?php endif; ?>251 <?php } else { ?>252 <input name="original_publish" type="hidden" id="original_publish" value="<?php _ea('Update Post') ?>" />253 <input name="save" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php _ea('Update Post') ?>" />254 <?php } ?>255 </div>256 <div class="clear"></div>257 </div>258 </div>259 260 <?php261 }262 58 add_meta_box('submitdiv', __('Publish'), 'post_submit_meta_box', 'post', 'side', 'core'); 263 59 264 /**265 * Display post tags form fields.266 *267 * @since 2.6.0268 *269 * @param object $post270 */271 function post_tags_meta_box($post, $box) {272 $tax_name = substr($box['id'], 8);273 $taxonomy = get_taxonomy($tax_name);274 $helps = isset($taxonomy->helps) ? attr($taxonomy->helps) : __('Separate tags with commas.');275 ?>276 <div class="tagsdiv" id="<?php echo $tax_name; ?>">277 <p class="jaxtag">278 <label class="hidden" for="newtag"><?php _e( $box['title'] ); ?></label>279 <input type="hidden" name="<?php echo "tax_input[$tax_name]"; ?>" class="the-tags" id="tax-input[<?php echo $tax_name; ?>]" value="<?php echo attr(get_terms_to_edit( $post->ID, $tax_name )); ?>" />280 60 281 <span class="ajaxtag">282 <input type="text" name="newtag[<?php echo $tax_name; ?>]" class="newtag form-input-tip" size="16" autocomplete="off" value="<?php _ea('Add new tag'); ?>" />283 <input type="button" class="button tagadd" value="<?php _ea('Add'); ?>" tabindex="3" />284 </span></p>285 <p class="howto"><?php echo $helps; ?></p>286 <div class="tagchecklist"></div>287 </div>288 <p class="tagcloud-link hide-if-no-js"><a href="#titlediv" class="tagcloud-link" id="link-<?php echo $tax_name; ?>"><?php printf( __('Choose from the most used tags in %s'), $box['title'] ); ?></a></p>289 <?php290 }291 292 61 // all tag-style post taxonomies 293 62 foreach ( get_object_taxonomies('post') as $tax_name ) { 294 63 if ( !is_taxonomy_hierarchical($tax_name) ) { … … 299 68 } 300 69 } 301 70 302 /**303 * Display post categories form fields.304 *305 * @since 2.6.0306 *307 * @param object $post308 */309 function post_categories_meta_box($post) {310 ?>311 <ul id="category-tabs">312 <li class="ui-tabs-selected"><a href="#categories-all" tabindex="3"><?php _e( 'All Categories' ); ?></a></li>313 <li class="hide-if-no-js"><a href="#categories-pop" tabindex="3"><?php _e( 'Most Used' ); ?></a></li>314 </ul>315 316 <div id="categories-pop" class="ui-tabs-panel" style="display: none;">317 <ul id="categorychecklist-pop" class="categorychecklist form-no-clear" >318 <?php $popular_ids = wp_popular_terms_checklist('category'); ?>319 </ul>320 </div>321 322 <div id="categories-all" class="ui-tabs-panel">323 <ul id="categorychecklist" class="list:category categorychecklist form-no-clear">324 <?php wp_category_checklist($post->ID, false, false, $popular_ids) ?>325 </ul>326 </div>327 328 <?php if ( current_user_can('manage_categories') ) : ?>329 <div id="category-adder" class="wp-hidden-children">330 <h4><a id="category-add-toggle" href="#category-add" class="hide-if-no-js" tabindex="3"><?php _e( '+ Add New Category' ); ?></a></h4>331 <p id="category-add" class="wp-hidden-child">332 <label class="hidden" for="newcat"><?php _e( 'Add New Category' ); ?></label><input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php _ea( 'New category name' ); ?>" tabindex="3" aria-required="true"/>333 <label class="hidden" for="newcat_parent"><?php _e('Parent category'); ?>:</label><?php wp_dropdown_categories( array( 'hide_empty' => 0, 'name' => 'newcat_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => __('Parent category'), 'tab_index' => 3 ) ); ?>334 <input type="button" id="category-add-sumbit" class="add:categorychecklist:category-add button" value="<?php _ea( 'Add' ); ?>" tabindex="3" />335 <?php wp_nonce_field( 'add-category', '_ajax_nonce', false ); ?>336 <span id="category-ajax-response"></span>337 </p>338 </div>339 <?php340 endif;341 342 }343 71 add_meta_box('categorydiv', __('Categories'), 'post_categories_meta_box', 'post', 'side', 'core'); 344 345 /**346 * Display post password form fields.347 *348 * @since 2.6.0349 *350 * @param object $post351 */352 function post_password_meta_box($post) {353 ?>354 <p>355 <label for="post_status_private" class="selectit"><input id="post_status_private" name="post_status" type="checkbox" value="private" <?php checked($post->post_status, 'private'); ?> tabindex="4" /> <?php _e('Keep this post private') ?></label>356 </p>357 <h4><?php _e( 'Post Password' ); ?></h4>358 <p><label class="hidden" for="post_password"><?php _e('Password Protect This Post') ?></label><input name="post_password" type="text" size="25" id="post_password" value="<?php the_post_password(); ?>" /></p>359 <p><?php _e('Setting a password will require people who visit your blog to enter the above password to view this post and its comments.'); ?></p>360 <?php361 }362 // add_meta_box('passworddiv', __('Privacy Options'), 'post_password_meta_box', 'post', 'side', 'core');363 364 /**365 * Display post excerpt form fields.366 *367 * @since 2.6.0368 *369 * @param object $post370 */371 function post_excerpt_meta_box($post) {372 ?>373 <label class="hidden" for="excerpt"><?php _e('Excerpt') ?></label><textarea rows="1" cols="40" name="excerpt" tabindex="6" id="excerpt"><?php echo $post->post_excerpt ?></textarea>374 <p><?php _e('Excerpts are optional hand-crafted summaries of your content. You can <a href="http://codex.wordpress.org/Template_Tags/the_excerpt" target="_blank">use them in your template</a>'); ?></p>375 <?php376 }377 72 add_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', 'post', 'normal', 'core'); 378 379 /**380 * Display trackback links form fields.381 *382 * @since 2.6.0383 *384 * @param object $post385 */386 function post_trackback_meta_box($post) {387 $form_trackback = '<input type="text" name="trackback_url" id="trackback_url" class="code" tabindex="7" value="'. attr( str_replace("\n", ' ', $post->to_ping) ) .'" />';388 if ('' != $post->pinged) {389 $pings = '<p>'. __('Already pinged:') . '</p><ul>';390 $already_pinged = explode("\n", trim($post->pinged));391 foreach ($already_pinged as $pinged_url) {392 $pings .= "\n\t<li>" . wp_specialchars($pinged_url) . "</li>";393 }394 $pings .= '</ul>';395 }396 397 ?>398 <p><label for="trackback_url"><?php _e('Send trackbacks to:'); ?></label> <?php echo $form_trackback; ?><br /> (<?php _e('Separate multiple URLs with spaces'); ?>)</p>399 <p><?php _e('Trackbacks are a way to notify legacy blog systems that you’ve linked to them. If you link other WordPress blogs 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>400 <?php401 if ( ! empty($pings) )402 echo $pings;403 }404 73 add_meta_box('trackbacksdiv', __('Send Trackbacks'), 'post_trackback_meta_box', 'post', 'normal', 'core'); 405 406 /**407 * Display custom fields for the post form fields.408 *409 * @since 2.6.0410 *411 * @param object $post412 */413 function post_custom_meta_box($post) {414 ?>415 <div id="postcustomstuff">416 <div id="ajax-response"></div>417 <?php418 $metadata = has_meta($post->ID);419 list_meta($metadata);420 meta_form();421 ?>422 </div>423 <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>424 <?php425 }426 74 add_meta_box('postcustom', __('Custom Fields'), 'post_custom_meta_box', 'post', 'normal', 'core'); 427 428 75 do_action('dbx_post_advanced'); 429 430 /**431 * Display comment status for post form fields.432 *433 * @since 2.6.0434 *435 * @param object $post436 */437 function post_comment_status_meta_box($post) {438 ?>439 <input name="advanced_view" type="hidden" value="1" />440 <p class="meta-options">441 <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 on this post') ?></label><br />442 <label for="ping_status" class="selectit"><input name="ping_status" type="checkbox" id="ping_status" value="open" <?php checked($post->ping_status, 'open'); ?> /> <?php _e('Allow <a href="http://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments" target="_blank">trackbacks and pingbacks</a> on this post') ?></label>443 </p>444 <?php445 }446 76 add_meta_box('commentstatusdiv', __('Discussion'), 'post_comment_status_meta_box', 'post', 'normal', 'core'); 447 77 448 /**449 * Display comments for post.450 *451 * @since 2.8.0452 *453 * @param object $post454 */455 function post_comment_meta_box($post) {456 global $wpdb, $post_ID;457 458 $total = $wpdb->get_var($wpdb->prepare("SELECT count(1) FROM $wpdb->comments WHERE comment_post_ID = '%d' AND ( comment_approved = '0' OR comment_approved = '1')", $post_ID));459 460 if ( 1 > $total ) {461 echo '<p>' . __('No comments yet.') . '</p>';462 return;463 }464 465 wp_nonce_field( 'get-comments', 'add_comment_nonce', false );466 ?>467 468 <table class="widefat comments-box fixed" cellspacing="0" style="display:none;">469 <thead>470 <tr>471 <th scope="col" class="column-author"><?php _e('Author') ?></th>472 <th scope="col" class="column-comment">473 <?php /* translators: field name in comment form */ echo _x('Comment', 'noun'); ?>474 </th>475 </tr>476 </thead>477 <tbody id="the-comment-list" class="list:comment">478 </tbody>479 </table>480 <p class="hide-if-no-js"><a href="#commentstatusdiv" id="show-comments" onclick="commentsBox.get(<?php echo $total; ?>);return false;"><?php _e('Show comments'); ?></a> <img class="waiting" style="display:none;" src="images/loading.gif" alt="" /></p>481 <?php482 $hidden = get_hidden_meta_boxes('post');483 if ( ! in_array('commentsdiv', $hidden) ) { ?>484 <script type="text/javascript">jQuery(document).ready(function(){commentsBox.get(<?php echo $total; ?>, 10);});</script>485 <?php486 }487 }488 78 if ( 'publish' == $post->post_status || 'private' == $post->post_status ) 489 79 add_meta_box('commentsdiv', __('Comments'), 'post_comment_meta_box', 'post', 'normal', 'core'); 490 80 491 /**492 * Display post slug form fields.493 *494 * @since 2.6.0495 *496 * @param object $post497 */498 function post_slug_meta_box($post) {499 ?>500 <label class="hidden" for="post_name"><?php _e('Post Slug') ?></label><input name="post_name" type="text" size="13" id="post_name" value="<?php echo attr( $post->post_name ); ?>" />501 <?php502 }503 81 if ( !( 'pending' == $post->post_status && !current_user_can( 'publish_posts' ) ) ) 504 82 add_meta_box('slugdiv', __('Post Slug'), 'post_slug_meta_box', 'post', 'normal', 'core'); 505 83 … … 507 85 if ( $post->post_author && !in_array($post->post_author, $authors) ) 508 86 $authors[] = $post->post_author; 509 87 if ( $authors && count( $authors ) > 1 ) : 510 /**511 * Display form field with list of authors.512 *513 * @since 2.6.0514 *515 * @param object $post516 */517 function post_author_meta_box($post) {518 global $current_user, $user_ID;519 $authors = get_editable_user_ids( $current_user->id ); // TODO: ROLE SYSTEM520 if ( $post->post_author && !in_array($post->post_author, $authors) )521 $authors[] = $post->post_author;522 ?>523 <label class="hidden" for="post_author_override"><?php _e('Post Author'); ?></label><?php wp_dropdown_users( array('include' => $authors, 'name' => 'post_author_override', 'selected' => empty($post->ID) ? $user_ID : $post->post_author) ); ?>524 <?php525 }526 88 add_meta_box('authordiv', __('Post Author'), 'post_author_meta_box', 'post', 'normal', 'core'); 527 89 endif; 528 90 529 91 if ( 0 < $post_ID && wp_get_post_revisions( $post_ID ) ) : 530 /**531 * Display list of post revisions.532 *533 * @since 2.6.0534 *535 * @param object $post536 */537 function post_revisions_meta_box($post) {538 wp_list_post_revisions();539 }540 92 add_meta_box('revisionsdiv', __('Post Revisions'), 'post_revisions_meta_box', 'post', 'normal', 'core'); 541 93 endif; 542 94
