Ticket #9674: meta-boxes.diff
File meta-boxes.diff, 91.4 KB (added by , 16 years ago) |
---|
-
includes/meta-boxes.php
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) { 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 esc_attr_e('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 esc_attr_e('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 esc_attr_e('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 = esc_url(get_permalink($post->ID)); 40 $preview_button = __('Preview Changes'); 41 } else { 42 $preview_link = esc_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 <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> 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 esc_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:'); ?> <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 echo esc_html( $visibility_trans ); ?></span> 119 <?php if ( $can_publish ) { ?> 120 <a href="#visibility" class="edit-visibility hide-if-no-js"><?php _e('Edit'); ?></a> 121 122 <div id="post-visibility-select" class="hide-if-js"> 123 <input type="hidden" name="hidden_post_password" id="hidden-post-password" value="<?php echo esc_attr($post->post_password); ?>" /> 124 <?php if ($post_type == 'post'): ?> 125 <input type="checkbox" style="display:none" name="hidden_post_sticky" id="hidden-post-sticky" value="sticky" <?php checked(is_sticky($post->ID)); ?> /> 126 <?php endif; ?> 127 <input type="hidden" name="hidden_post_visibility" id="hidden-post-visibility" value="<?php echo esc_attr( $visibility ); ?>" /> 128 129 130 <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 /> 131 <?php if ($post_type == 'post'): ?> 132 <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> 133 <?php endif; ?> 134 <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 /> 135 <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); ?>" /><br /></span> 136 <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 /> 137 138 <p> 139 <a href="#visibility" class="save-post-visibility hide-if-no-js button"><?php _e('OK'); ?></a> 140 <a href="#visibility" class="cancel-post-visibility hide-if-no-js"><?php _e('Cancel'); ?></a> 141 </p> 142 </div> 143 <?php } ?> 144 145 </div><?php // /misc-pub-section ?> 146 147 148 <?php 149 // translators: Publish box date formt, see http://php.net/date 150 $datef = __( 'M j, Y @ G:i' ); 151 if ( 0 != $post->ID ) { 152 if ( 'future' == $post->post_status ) { // scheduled for publishing at a future date 153 $stamp = __('Scheduled for: <b>%1$s</b>'); 154 } else if ( 'publish' == $post->post_status || 'private' == $post->post_status ) { // already published 155 $stamp = __('Published on: <b>%1$s</b>'); 156 } else if ( '0000-00-00 00:00:00' == $post->post_date_gmt ) { // draft, 1 or more saves, no date specified 157 $stamp = __('Publish <b>immediately</b>'); 158 } else if ( time() < strtotime( $post->post_date_gmt . ' +0000' ) ) { // draft, 1 or more saves, future date specified 159 $stamp = __('Schedule for: <b>%1$s</b>'); 160 } else { // draft, 1 or more saves, date specified 161 $stamp = __('Publish on: <b>%1$s</b>'); 162 } 163 $date = date_i18n( $datef, strtotime( $post->post_date ) ); 164 } else { // draft (no saves, and thus no date specified) 165 $stamp = __('Publish <b>immediately</b>'); 166 $date = date_i18n( $datef, strtotime( current_time('mysql') ) ); 167 } 168 169 if ( $can_publish ) : // Contributors don't get to choose the date of publish ?> 170 <div class="misc-pub-section curtime misc-pub-section-last"> 171 <span id="timestamp"> 172 <?php printf($stamp, $date); ?></span> 173 <a href="#edit_timestamp" class="edit-timestamp hide-if-no-js" tabindex='4'><?php _e('Edit') ?></a> 174 <div id="timestampdiv" class="hide-if-js"><?php touch_time(($action == 'edit'),1,4); ?></div> 175 </div><?php // /misc-pub-section ?> 176 <?php endif; ?> 177 178 </div> 179 <div class="clear"></div> 180 </div> 181 182 <div id="major-publishing-actions"> 183 <?php do_action('post_submitbox_start'); ?> 184 <div id="delete-action"> 185 <?php 186 if ( ( 'edit' == $action ) && current_user_can("delete_${post_type}", $post->ID) ) { ?> 187 <?php $delete_url = add_query_arg( array('action'=>'trash', 'post'=>$post->ID) ); ?> 188 <a class="submitdelete deletion" href="<?php echo wp_nonce_url($delete_url, "trash-${post_type}_" . $post->ID); ?>"><?php _e('Move to Trash'); ?></a> 189 <?php } ?> 190 </div> 191 192 <div id="publishing-action"> 193 <?php 194 if ( !in_array( $post->post_status, array('publish', 'future', 'private') ) || 0 == $post->ID ) { 195 if ( $can_publish ) : 196 if ( !empty($post->post_date_gmt) && time() < strtotime( $post->post_date_gmt . ' +0000' ) ) : ?> 197 <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Schedule') ?>" /> 198 <input name="publish" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php esc_attr_e('Schedule') ?>" /> 199 <?php else : ?> 200 <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Publish') ?>" /> 201 <input name="publish" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php esc_attr_e('Publish') ?>" /> 202 <?php endif; 203 else : ?> 204 <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Submit for Review') ?>" /> 205 <input name="publish" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php esc_attr_e('Submit for Review') ?>" /> 206 <?php 207 endif; 208 } else { ?> 209 <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Update') ?>" /> 210 <input name="save" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php esc_attr_e('Update') ?>" /> 211 <?php 212 } ?> 213 </div> 214 <div class="clear"></div> 215 </div> 216 </div> 217 218 <?php 219 } 220 221 222 /** 223 * Display post tags form fields. 224 * 225 * @since 2.6.0 226 * 227 * @param object $post 228 */ 229 function post_tags_meta_box($post, $box) { 230 $tax_name = esc_attr(substr($box['id'], 8)); 231 $taxonomy = get_taxonomy($tax_name); 232 $helps = isset($taxonomy->helps) ? esc_attr($taxonomy->helps) : __('Separate tags with commas.'); 233 ?> 234 <div class="tagsdiv" id="<?php echo $tax_name; ?>"> 235 <div class="jaxtag"> 236 <div class="nojs-tags hide-if-js"> 237 <p><?php _e('Add or remove tags'); ?></p> 238 <textarea name="<?php echo "tax_input[$tax_name]"; ?>" class="the-tags" id="tax-input[<?php echo $tax_name; ?>]"><?php echo esc_attr(get_terms_to_edit( $post->ID, $tax_name )); ?></textarea></div> 239 240 <span class="ajaxtag hide-if-no-js"> 241 <label class="screen-reader-text" for="new-tag-<?php echo $tax_name; ?>"><?php echo $box['title']; ?></label> 242 <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="<?php esc_attr_e('Add new tag'); ?>" /> 243 <input type="button" class="button tagadd" value="<?php esc_attr_e('Add'); ?>" tabindex="3" /> 244 </span></div> 245 <p class="howto"><?php echo $helps; ?></p> 246 <div class="tagchecklist"></div> 247 </div> 248 <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> 249 <?php 250 } 251 252 253 /** 254 * Display post categories form fields. 255 * 256 * @since 2.6.0 257 * 258 * @param object $post 259 */ 260 function post_categories_meta_box($post) { 261 ?> 262 <ul id="category-tabs"> 263 <li class="tabs"><a href="#categories-all" tabindex="3"><?php _e( 'All Categories' ); ?></a></li> 264 <li class="hide-if-no-js"><a href="#categories-pop" tabindex="3"><?php _e( 'Most Used' ); ?></a></li> 265 </ul> 266 267 <div id="categories-pop" class="tabs-panel" style="display: none;"> 268 <ul id="categorychecklist-pop" class="categorychecklist form-no-clear" > 269 <?php $popular_ids = wp_popular_terms_checklist('category'); ?> 270 </ul> 271 </div> 272 273 <div id="categories-all" class="tabs-panel"> 274 <ul id="categorychecklist" class="list:category categorychecklist form-no-clear"> 275 <?php wp_category_checklist($post->ID, false, false, $popular_ids) ?> 276 </ul> 277 </div> 278 279 <?php if ( current_user_can('manage_categories') ) : ?> 280 <div id="category-adder" class="wp-hidden-children"> 281 <h4><a id="category-add-toggle" href="#category-add" class="hide-if-no-js" tabindex="3"><?php _e( '+ Add New Category' ); ?></a></h4> 282 <p id="category-add" class="wp-hidden-child"> 283 <label class="screen-reader-text" for="newcat"><?php _e( 'Add New Category' ); ?></label><input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php esc_attr_e( 'New category name' ); ?>" tabindex="3" aria-required="true"/> 284 <label class="screen-reader-text" 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 ) ); ?> 285 <input type="button" id="category-add-sumbit" class="add:categorychecklist:category-add button" value="<?php esc_attr_e( 'Add' ); ?>" tabindex="3" /> 286 <?php wp_nonce_field( 'add-category', '_ajax_nonce', false ); ?> 287 <span id="category-ajax-response"></span></p> 288 </div> 289 <?php 290 endif; 291 292 } 293 294 295 /** 296 * Display post excerpt form fields. 297 * 298 * @since 2.6.0 299 * 300 * @param object $post 301 */ 302 function post_excerpt_meta_box($post) { 303 ?> 304 <label class="screen-reader-text" for="excerpt"><?php _e('Excerpt') ?></label><textarea rows="1" cols="40" name="excerpt" tabindex="6" id="excerpt"><?php echo $post->post_excerpt ?></textarea> 305 <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> 306 <?php 307 } 308 309 310 /** 311 * Display trackback links form fields. 312 * 313 * @since 2.6.0 314 * 315 * @param object $post 316 */ 317 function post_trackback_meta_box($post) { 318 $form_trackback = '<input type="text" name="trackback_url" id="trackback_url" class="code" tabindex="7" value="'. esc_attr( str_replace("\n", ' ', $post->to_ping) ) .'" />'; 319 if ('' != $post->pinged) { 320 $pings = '<p>'. __('Already pinged:') . '</p><ul>'; 321 $already_pinged = explode("\n", trim($post->pinged)); 322 foreach ($already_pinged as $pinged_url) { 323 $pings .= "\n\t<li>" . esc_html($pinged_url) . "</li>"; 324 } 325 $pings .= '</ul>'; 326 } 327 328 ?> 329 <p><label for="trackback_url"><?php _e('Send trackbacks to:'); ?></label> <?php echo $form_trackback; ?><br /> (<?php _e('Separate multiple URLs with spaces'); ?>)</p> 330 <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> 331 <?php 332 if ( ! empty($pings) ) 333 echo $pings; 334 } 335 336 337 /** 338 * Display custom fields form fields. 339 * 340 * @since 2.6.0 341 * 342 * @param object $post 343 */ 344 function post_custom_meta_box($post) { 345 ?> 346 <div id="postcustomstuff"> 347 <div id="ajax-response"></div> 348 <?php 349 $metadata = has_meta($post->ID); 350 list_meta($metadata); 351 meta_form(); ?> 352 </div> 353 <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> 354 <?php 355 } 356 357 358 /** 359 * Display comments status form fields. 360 * 361 * @since 2.6.0 362 * 363 * @param object $post 364 */ 365 function post_comment_status_meta_box($post) { 366 ?> 367 <input name="advanced_view" type="hidden" value="1" /> 368 <p class="meta-options"> 369 <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 /> 370 <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> 371 </p> 372 <?php 373 } 374 375 376 /** 377 * Display comments for post. 378 * 379 * @since 2.8.0 380 * 381 * @param object $post 382 */ 383 function post_comment_meta_box($post) { 384 global $wpdb, $post_ID; 385 386 $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)); 387 388 if ( 1 > $total ) { 389 echo '<p>' . __('No comments yet.') . '</p>'; 390 return; 391 } 392 393 wp_nonce_field( 'get-comments', 'add_comment_nonce', false ); 394 ?> 395 396 <table class="widefat comments-box fixed" cellspacing="0" style="display:none;"> 397 <thead><tr> 398 <th scope="col" class="column-author"><?php _e('Author') ?></th> 399 <th scope="col" class="column-comment"> 400 <?php /* translators: field name in comment form */ echo _x('Comment', 'noun'); ?></th> 401 </tr></thead> 402 <tbody id="the-comment-list" class="list:comment"></tbody> 403 </table> 404 <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/wpspin_light.gif" alt="" /></p> 405 <?php 406 $hidden = get_hidden_meta_boxes('post'); 407 if ( ! in_array('commentsdiv', $hidden) ) { ?> 408 <script type="text/javascript">jQuery(document).ready(function(){commentsBox.get(<?php echo $total; ?>, 10);});</script> 409 <?php 410 } 411 } 412 413 414 /** 415 * Display slug form fields. 416 * 417 * @since 2.6.0 418 * 419 * @param object $post 420 */ 421 function post_slug_meta_box($post) { 422 ?> 423 <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( $post->post_name ); ?>" /> 424 <?php 425 } 426 427 428 /** 429 * Display form field with list of authors. 430 * 431 * @since 2.6.0 432 * 433 * @param object $post 434 */ 435 function post_author_meta_box($post) { 436 global $current_user, $user_ID; 437 $authors = get_editable_user_ids( $current_user->id, true, $post->post_type ); // TODO: ROLE SYSTEM 438 if ( $post->post_author && !in_array($post->post_author, $authors) ) 439 $authors[] = $post->post_author; 440 ?> 441 <label class="screen-reader-text" for="post_author_override"><?php _e('Author'); ?></label><?php wp_dropdown_users( array('include' => $authors, 'name' => 'post_author_override', 'selected' => empty($post->ID) ? $user_ID : $post->post_author) ); ?> 442 <?php 443 } 444 445 446 /** 447 * Display list of revisions. 448 * 449 * @since 2.6.0 450 * 451 * @param object $post 452 */ 453 function post_revisions_meta_box($post) { 454 wp_list_post_revisions(); 455 } 456 457 458 // -- Page related Meta Boxes 459 460 /** 461 * Display page attributes form fields. 462 * 463 * @since 2.7.0 464 * 465 * @param object $post 466 */ 467 function page_attributes_meta_box($post){ 468 ?> 469 <h5><?php _e('Parent') ?></h5> 470 <label class="screen-reader-text" for="parent_id"><?php _e('Page Parent') ?></label> 471 <?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')); ?> 472 <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> 473 <?php 474 if ( 0 != count( get_page_templates() ) ) { ?> 475 <h5><?php _e('Template') ?></h5> 476 <label class="screen-reader-text" for="page_template"><?php _e('Page Template') ?></label><select name="page_template" id="page_template"> 477 <option value='default'><?php _e('Default Template'); ?></option> 478 <?php page_template_dropdown($post->page_template); ?> 479 </select> 480 <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> 481 <?php 482 } ?> 483 <h5><?php _e('Order') ?></h5> 484 <p><label class="screen-reader-text" for="menu_order"><?php _e('Page Order') ?></label><input name="menu_order" type="text" size="4" id="menu_order" value="<?php echo esc_attr($post->menu_order) ?>" /></p> 485 <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> 486 <?php 487 } 488 489 490 // -- Link related Meta Boxes 491 492 /** 493 * Display link create form fields. 494 * 495 * @since 2.7.0 496 * 497 * @param object $link 498 */ 499 function link_submit_meta_box($link) { 500 ?> 501 <div class="submitbox" id="submitlink"> 502 503 <div id="minor-publishing"> 504 505 <?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key ?> 506 <div style="display:none;"> 507 <input type="submit" name="save" value="<?php esc_attr_e('Save'); ?>" /> 508 </div> 509 510 <div id="minor-publishing-actions"> 511 <div id="preview-action"> 512 <?php if ( !empty($link->link_id) ) { ?> 513 <a class="preview button" href="<?php echo $link->link_url; ?>" target="_blank" tabindex="4"><?php _e('Visit Link'); ?></a> 514 <?php } ?> 515 </div> 516 <div class="clear"></div> 517 </div> 518 519 <div id="misc-publishing-actions"> 520 <div class="misc-pub-section misc-pub-section-last"> 521 <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> 522 </div> 523 </div> 524 525 </div> 526 527 <div id="major-publishing-actions"> 528 <?php do_action('post_submitbox_start'); ?> 529 <div id="delete-action"> 530 <?php 531 if ( !empty($_GET['action']) && 'edit' == $_GET['action'] && current_user_can('manage_links') ) { ?> 532 <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> 533 <?php } ?> 534 </div> 535 536 <div id="publishing-action"> 537 <?php if ( !empty($link->link_id) ) { ?> 538 <input name="save" type="submit" class="button-primary" id="publish" tabindex="4" accesskey="p" value="<?php esc_attr_e('Update Link') ?>" /> 539 <?php } else { ?> 540 <input name="save" type="submit" class="button-primary" id="publish" tabindex="4" accesskey="p" value="<?php esc_attr_e('Add Link') ?>" /> 541 <?php } ?> 542 </div> 543 <div class="clear"></div> 544 </div> 545 <?php do_action('submitlink_box'); ?> 546 <div class="clear"></div> 547 </div> 548 <?php 549 } 550 551 552 /** 553 * Display link categories form fields. 554 * 555 * @since 2.6.0 556 * 557 * @param object $link 558 */ 559 function link_categories_meta_box($link) { ?> 560 <ul id="category-tabs"> 561 <li class="tabs"><a href="#categories-all"><?php _e( 'All Categories' ); ?></a></li> 562 <li class="hide-if-no-js"><a href="#categories-pop"><?php _e( 'Most Used' ); ?></a></li> 563 </ul> 564 565 <div id="categories-all" class="tabs-panel"> 566 <ul id="categorychecklist" class="list:category categorychecklist form-no-clear"> 567 <?php 568 if ( isset($link->link_id) ) 569 wp_link_category_checklist($link->link_id); 570 else 571 wp_link_category_checklist(); 572 ?> 573 </ul> 574 </div> 575 576 <div id="categories-pop" class="tabs-panel" style="display: none;"> 577 <ul id="categorychecklist-pop" class="categorychecklist form-no-clear"> 578 <?php wp_popular_terms_checklist('link_category'); ?> 579 </ul> 580 </div> 581 582 <div id="category-adder" class="wp-hidden-children"> 583 <h4><a id="category-add-toggle" href="#category-add"><?php _e( '+ Add New Category' ); ?></a></h4> 584 <p id="link-category-add" class="wp-hidden-child"> 585 <label class="screen-reader-text" for="newcat"><?php _e( '+ Add New Category' ); ?></label> 586 <input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php esc_attr_e( 'New category name' ); ?>" aria-required="true" /> 587 <input type="button" id="category-add-submit" class="add:categorychecklist:linkcategorydiv button" value="<?php esc_attr_e( 'Add' ); ?>" /> 588 <?php wp_nonce_field( 'add-link-category', '_ajax_nonce', false ); ?> 589 <span id="category-ajax-response"></span> 590 </p> 591 </div> 592 <?php 593 } 594 595 596 /** 597 * Display form fields for changing link target. 598 * 599 * @since 2.6.0 600 * 601 * @param object $link 602 */ 603 function link_target_meta_box($link) { ?> 604 <fieldset><legend class="screen-reader-text"><span><?php _e('Target') ?></span></legend> 605 <p><label for="link_target_blank" class="selectit"> 606 <input id="link_target_blank" type="radio" name="link_target" value="_blank" <?php echo ( isset( $link->link_target ) && ($link->link_target == '_blank') ? 'checked="checked"' : ''); ?> /> 607 <?php _e('<code>_blank</code> - new window or tab.'); ?></label></p> 608 <p><label for="link_target_top" class="selectit"> 609 <input id="link_target_top" type="radio" name="link_target" value="_top" <?php echo ( isset( $link->link_target ) && ($link->link_target == '_top') ? 'checked="checked"' : ''); ?> /> 610 <?php _e('<code>_top</code> - current window or tab, with no frames.'); ?></label></p> 611 <p><label for="link_target_none" class="selectit"> 612 <input id="link_target_none" type="radio" name="link_target" value="" <?php echo ( isset( $link->link_target ) && ($link->link_target == '') ? 'checked="checked"' : ''); ?> /> 613 <?php _e('<code>_none</code> - same window or tab.'); ?></label></p> 614 </fieldset> 615 <p><?php _e('Choose the target frame for your link.'); ?></p> 616 <?php 617 } 618 619 620 /** 621 * Display checked checkboxes attribute for xfn microformat options. 622 * 623 * @since 1.0.1 624 * 625 * @param string $class 626 * @param string $value 627 * @param mixed $deprecated Not used. 628 */ 629 function xfn_check($class, $value = '', $deprecated = '') { 630 global $link; 631 632 $link_rel = isset( $link->link_rel ) ? $link->link_rel : ''; // In PHP 5.3: $link_rel = $link->link_rel ?: ''; 633 $rels = preg_split('/\s+/', $link_rel); 634 635 if ('' != $value && in_array($value, $rels) ) { 636 echo ' checked="checked"'; 637 } 638 639 if ('' == $value) { 640 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"'; 641 if ('friendship' == $class && strpos($link_rel, 'friend') === false && strpos($link_rel, 'acquaintance') === false && strpos($link_rel, 'contact') === false) echo ' checked="checked"'; 642 if ('geographical' == $class && strpos($link_rel, 'co-resident') === false && strpos($link_rel, 'neighbor') === false) echo ' checked="checked"'; 643 if ('identity' == $class && in_array('me', $rels) ) echo ' checked="checked"'; 644 } 645 } 646 647 648 /** 649 * Display xfn form fields. 650 * 651 * @since 2.6.0 652 * 653 * @param object $link 654 */ 655 function link_xfn_meta_box($link) { 656 ?> 657 <table class="editform" style="width: 100%;" cellspacing="2" cellpadding="5"> 658 <tr> 659 <th style="width: 20%;" scope="row"><label for="link_rel"><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('rel:') ?></label></th> 660 <td style="width: 80%;"><input type="text" name="link_rel" id="link_rel" size="50" value="<?php echo ( isset( $link->link_rel ) ? esc_attr($link->link_rel) : ''); ?>" /></td> 661 </tr> 662 <tr> 663 <td colspan="2"> 664 <table cellpadding="3" cellspacing="5" class="form-table"> 665 <tr> 666 <th scope="row"> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('identity') ?> </th> 667 <td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('identity') ?> </span></legend> 668 <label for="me"> 669 <input type="checkbox" name="identity" value="me" id="me" <?php xfn_check('identity', 'me'); ?> /> 670 <?php _e('another web address of mine') ?></label> 671 </fieldset></td> 672 </tr> 673 <tr> 674 <th scope="row"> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('friendship') ?> </th> 675 <td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('friendship') ?> </span></legend> 676 <label for="contact"> 677 <input class="valinp" type="radio" name="friendship" value="contact" id="contact" <?php xfn_check('friendship', 'contact', 'radio'); ?> /> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('contact') ?></label> 678 <label for="acquaintance"> 679 <input class="valinp" type="radio" name="friendship" value="acquaintance" id="acquaintance" <?php xfn_check('friendship', 'acquaintance', 'radio'); ?> /> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('acquaintance') ?></label> 680 <label for="friend"> 681 <input class="valinp" type="radio" name="friendship" value="friend" id="friend" <?php xfn_check('friendship', 'friend', 'radio'); ?> /> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('friend') ?></label> 682 <label for="friendship"> 683 <input name="friendship" type="radio" class="valinp" value="" id="friendship" <?php xfn_check('friendship', '', 'radio'); ?> /> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('none') ?></label> 684 </fieldset></td> 685 </tr> 686 <tr> 687 <th scope="row"> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('physical') ?> </th> 688 <td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('physical') ?> </span></legend> 689 <label for="met"> 690 <input class="valinp" type="checkbox" name="physical" value="met" id="met" <?php xfn_check('physical', 'met'); ?> /> 691 <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('met') ?></label> 692 </fieldset></td> 693 </tr> 694 <tr> 695 <th scope="row"> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('professional') ?> </th> 696 <td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('professional') ?> </span></legend> 697 <label for="co-worker"> 698 <input class="valinp" type="checkbox" name="professional" value="co-worker" id="co-worker" <?php xfn_check('professional', 'co-worker'); ?> /> 699 <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('co-worker') ?></label> 700 <label for="colleague"> 701 <input class="valinp" type="checkbox" name="professional" value="colleague" id="colleague" <?php xfn_check('professional', 'colleague'); ?> /> 702 <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('colleague') ?></label> 703 </fieldset></td> 704 </tr> 705 <tr> 706 <th scope="row"> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('geographical') ?> </th> 707 <td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('geographical') ?> </span></legend> 708 <label for="co-resident"> 709 <input class="valinp" type="radio" name="geographical" value="co-resident" id="co-resident" <?php xfn_check('geographical', 'co-resident', 'radio'); ?> /> 710 <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('co-resident') ?></label> 711 <label for="neighbor"> 712 <input class="valinp" type="radio" name="geographical" value="neighbor" id="neighbor" <?php xfn_check('geographical', 'neighbor', 'radio'); ?> /> 713 <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('neighbor') ?></label> 714 <label for="geographical"> 715 <input class="valinp" type="radio" name="geographical" value="" id="geographical" <?php xfn_check('geographical', '', 'radio'); ?> /> 716 <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('none') ?></label> 717 </fieldset></td> 718 </tr> 719 <tr> 720 <th scope="row"> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('family') ?> </th> 721 <td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('family') ?> </span></legend> 722 <label for="child"> 723 <input class="valinp" type="radio" name="family" value="child" id="child" <?php xfn_check('family', 'child', 'radio'); ?> /> 724 <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('child') ?></label> 725 <label for="kin"> 726 <input class="valinp" type="radio" name="family" value="kin" id="kin" <?php xfn_check('family', 'kin', 'radio'); ?> /> 727 <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('kin') ?></label> 728 <label for="parent"> 729 <input class="valinp" type="radio" name="family" value="parent" id="parent" <?php xfn_check('family', 'parent', 'radio'); ?> /> 730 <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('parent') ?></label> 731 <label for="sibling"> 732 <input class="valinp" type="radio" name="family" value="sibling" id="sibling" <?php xfn_check('family', 'sibling', 'radio'); ?> /> 733 <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('sibling') ?></label> 734 <label for="spouse"> 735 <input class="valinp" type="radio" name="family" value="spouse" id="spouse" <?php xfn_check('family', 'spouse', 'radio'); ?> /> 736 <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('spouse') ?></label> 737 <label for="family"> 738 <input class="valinp" type="radio" name="family" value="" id="family" <?php xfn_check('family', '', 'radio'); ?> /> 739 <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('none') ?></label> 740 </fieldset></td> 741 </tr> 742 <tr> 743 <th scope="row"> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('romantic') ?> </th> 744 <td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('romantic') ?> </span></legend> 745 <label for="muse"> 746 <input class="valinp" type="checkbox" name="romantic" value="muse" id="muse" <?php xfn_check('romantic', 'muse'); ?> /> 747 <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('muse') ?></label> 748 <label for="crush"> 749 <input class="valinp" type="checkbox" name="romantic" value="crush" id="crush" <?php xfn_check('romantic', 'crush'); ?> /> 750 <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('crush') ?></label> 751 <label for="date"> 752 <input class="valinp" type="checkbox" name="romantic" value="date" id="date" <?php xfn_check('romantic', 'date'); ?> /> 753 <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('date') ?></label> 754 <label for="romantic"> 755 <input class="valinp" type="checkbox" name="romantic" value="sweetheart" id="romantic" <?php xfn_check('romantic', 'sweetheart'); ?> /> 756 <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('sweetheart') ?></label> 757 </fieldset></td> 758 </tr> 759 </table> 760 </td> 761 </tr> 762 </table> 763 <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> 764 <?php 765 } 766 767 768 /** 769 * Display advanced link options form fields. 770 * 771 * @since 2.6.0 772 * 773 * @param object $link 774 */ 775 function link_advanced_meta_box($link) { 776 ?> 777 <table class="form-table" style="width: 100%;" cellspacing="2" cellpadding="5"> 778 <tr class="form-field"> 779 <th valign="top" scope="row"><label for="link_image"><?php _e('Image Address') ?></label></th> 780 <td><input type="text" name="link_image" class="code" id="link_image" size="50" value="<?php echo ( isset( $link->link_image ) ? esc_attr($link->link_image) : ''); ?>" style="width: 95%" /></td> 781 </tr> 782 <tr class="form-field"> 783 <th valign="top" scope="row"><label for="rss_uri"><?php _e('RSS Address') ?></label></th> 784 <td><input name="link_rss" class="code" type="text" id="rss_uri" value="<?php echo ( isset( $link->link_rss ) ? esc_attr($link->link_rss) : ''); ?>" size="50" style="width: 95%" /></td> 785 </tr> 786 <tr class="form-field"> 787 <th valign="top" scope="row"><label for="link_notes"><?php _e('Notes') ?></label></th> 788 <td><textarea name="link_notes" id="link_notes" cols="50" rows="10" style="width: 95%"><?php echo ( isset( $link->link_notes ) ? $link->link_notes : ''); ?></textarea></td> 789 </tr> 790 <tr class="form-field"> 791 <th valign="top" scope="row"><label for="link_rating"><?php _e('Rating') ?></label></th> 792 <td><select name="link_rating" id="link_rating" size="1"> 793 <?php 794 for ($r = 0; $r < 10; $r++) { 795 echo(' <option value="'. esc_attr($r) .'" '); 796 if ( isset($link->link_rating) && $link->link_rating == $r) 797 echo 'selected="selected"'; 798 echo('>'.$r.'</option>'); 799 } 800 ?></select> <?php _e('(Leave at 0 for no rating.)') ?> 801 </td> 802 </tr> 803 </table> 804 <?php 805 } -
edit-page-form.php
52 52 $temp_ID = (int) $temp_ID; 53 53 $user_ID = (int) $user_ID; 54 54 55 /** 56 * Display submit form fields. 57 * 58 * @since 2.7.0 59 * 60 * @param object $post 61 */ 62 function page_submit_meta_box($post) { 63 global $action; 55 require_once('includes/meta-boxes.php'); 64 56 65 $can_publish = current_user_can('publish_pages'); 66 ?> 67 <div class="submitbox" id="submitpage"> 68 69 <div id="minor-publishing"> 70 71 <?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key ?> 72 <div style="display:none;"> 73 <input type="submit" name="save" value="<?php esc_attr_e('Save'); ?>" /> 74 </div> 75 76 <div id="minor-publishing-actions"> 77 <div id="save-action"> 78 <?php if ( 'publish' != $post->post_status && 'future' != $post->post_status && 'pending' != $post->post_status ) { ?> 79 <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'); ?>" tabindex="4" class="button button-highlighted" /> 80 <?php } elseif ( 'pending' == $post->post_status && $can_publish ) { ?> 81 <input type="submit" name="save" id="save-post" value="<?php esc_attr_e('Save as Pending'); ?>" tabindex="4" class="button button-highlighted" /> 82 <?php } ?> 83 </div> 84 85 <div id="preview-action"> 86 <?php 87 if ( 'publish' == $post->post_status ) { 88 $preview_link = esc_url(get_permalink($post->ID)); 89 $preview_button = __('Preview Changes'); 90 } else { 91 $preview_link = esc_url(apply_filters('preview_post_link', add_query_arg('preview', 'true', get_permalink($post->ID)))); 92 $preview_button = __('Preview'); 93 } 94 ?> 95 <a class="preview button" href="<?php echo $preview_link; ?>" target="wp-preview" id="post-preview" tabindex="4"><?php echo $preview_button; ?></a> 96 <input type="hidden" name="wp-preview" id="wp-preview" value="" /> 97 </div> 98 99 <div class="clear"></div> 100 </div><?php // /minor-publishing-actions ?> 101 102 <div id="misc-publishing-actions"> 103 104 <div class="misc-pub-section<?php if ( !$can_publish ) { echo ' misc-pub-section-last'; } ?>"><label for="post_status"><?php _e('Status:') ?></label> 105 <span id="post-status-display"> 106 <?php 107 switch ( $post->post_status ) { 108 case 'private': 109 _e('Privately Published'); 110 break; 111 case 'publish': 112 _e('Published'); 113 break; 114 case 'future': 115 _e('Scheduled'); 116 break; 117 case 'pending': 118 _e('Pending Review'); 119 break; 120 case 'draft': 121 _e('Draft'); 122 break; 123 } 124 ?> 125 </span> 126 <?php if ( 'publish' == $post->post_status || 'private' == $post->post_status || $can_publish ) { ?> 127 <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> 128 129 <div id="post-status-select" class="hide-if-js"> 130 <input type="hidden" name="hidden_post_status" id="hidden_post_status" value="<?php echo esc_attr($post->post_status); ?>" /> 131 <select name='post_status' id='post_status' tabindex='4'> 132 <?php if ( 'publish' == $post->post_status ) : ?> 133 <option<?php selected( $post->post_status, 'publish' ); ?> value='publish'><?php _e('Published') ?></option> 134 <?php elseif ( 'private' == $post->post_status ) : ?> 135 <option<?php selected( $post->post_status, 'private' ); ?> value='publish'><?php _e('Privately Published') ?></option> 136 <?php elseif ( 'future' == $post->post_status ) : ?> 137 <option<?php selected( $post->post_status, 'future' ); ?> value='future'><?php _e('Scheduled') ?></option> 138 <?php endif; ?> 139 <option<?php selected( $post->post_status, 'pending' ); ?> value='pending'><?php _e('Pending Review') ?></option> 140 <option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php _e('Draft') ?></option> 141 </select> 142 143 <a href="#post_status" class="save-post-status hide-if-no-js button"><?php _e('OK'); ?></a> 144 <a href="#post_status" class="cancel-post-status hide-if-no-js"><?php _e('Cancel'); ?></a> 145 </div> 146 147 <?php } ?> 148 </div><?php // /misc-pub-section ?> 149 150 <div class="misc-pub-section " id="visibility"> 151 <?php _e('Visibility:'); ?> <span id="post-visibility-display"><?php 152 153 if ( 'private' == $post->post_status ) { 154 $post->post_password = ''; 155 $visibility = 'private'; 156 $visibility_trans = __('Private'); 157 } elseif ( !empty( $post->post_password ) ) { 158 $visibility = 'password'; 159 $visibility_trans = __('Password protected'); 160 } else { 161 $visibility = 'public'; 162 $visibility_trans = __('Public'); 163 } 164 165 echo esc_html( $visibility_trans ); ?></span> 166 <?php if ( $can_publish ) { ?> 167 <a href="#visibility" class="edit-visibility hide-if-no-js"><?php _e('Edit'); ?></a> 168 169 <div id="post-visibility-select" class="hide-if-js"> 170 <input type="hidden" name="hidden_post_password" id="hidden-post-password" value="<?php echo esc_attr($post->post_password); ?>" /> 171 <input type="hidden" name="hidden_post_visibility" id="hidden-post-visibility" value="<?php echo esc_attr( $visibility ); ?>" /> 172 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 <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 /> 175 <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); ?>" /><br /></span> 176 <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 /> 177 178 <p><a href="#visibility" class="save-post-visibility hide-if-no-js button"><?php _e('OK'); ?></a> 179 <a href="#visibility" class="cancel-post-visibility hide-if-no-js"><?php _e('Cancel'); ?></a></p> 180 </div> 181 <?php } ?> 182 183 </div><?php // /misc-pub-section ?> 184 185 <?php 186 // translators: Publish box date formt, see http://php.net/date 187 $datef = __( 'M j, Y @ G:i' ); 188 if ( 0 != $post->ID ) { 189 if ( 'future' == $post->post_status ) { // scheduled for publishing at a future date 190 $stamp = __('Scheduled for: <b>%1$s</b>'); 191 } else if ( 'publish' == $post->post_status || 'private' == $post->post_status ) { // already published 192 $stamp = __('Published on: <b>%1$s</b>'); 193 } else if ( '0000-00-00 00:00:00' == $post->post_date_gmt ) { // draft, 1 or more saves, no date specified 194 $stamp = __('Publish <b>immediately</b>'); 195 } else if ( time() < strtotime( $post->post_date_gmt . ' +0000' ) ) { // draft, 1 or more saves, future date specified 196 $stamp = __('Schedule for: <b>%1$s</b>'); 197 } else { // draft, 1 or more saves, date specified 198 $stamp = __('Publish on: <b>%1$s</b>'); 199 } 200 $date = date_i18n( $datef, strtotime( $post->post_date ) ); 201 } else { // draft (no saves, and thus no date specified) 202 $stamp = __('Publish <b>immediately</b>'); 203 $date = date_i18n( $datef, strtotime( current_time('mysql') ) ); 204 } 205 206 if ( $can_publish ) : // Contributors don't get to choose the date of publish ?> 207 <div class="misc-pub-section curtime misc-pub-section-last"> 208 <span id="timestamp"><?php printf($stamp, $date); ?></span> 209 <a href="#edit_timestamp" class="edit-timestamp hide-if-no-js" tabindex='4'><?php _e('Edit') ?></a> 210 <div id="timestampdiv" class="hide-if-js"><?php touch_time(($action == 'edit'),1,4); ?></div> 211 </div><?php // /misc-pub-section 212 endif; ?> 213 214 </div> 215 <div class="clear"></div> 216 </div> 217 218 <div id="major-publishing-actions"> 219 <?php do_action('post_submitbox_start'); ?> 220 <div id="delete-action"> 221 <?php 222 if ( ( 'edit' == $action ) && current_user_can('delete_page', $post->ID) ) { ?> 223 <a class="submitdelete deletion" href="<?php echo wp_nonce_url("page.php?action=trash&post=$post->ID", 'trash-page_' . $post->ID); ?>"><?php _e('Move to Trash'); ?></a> 224 <?php } ?> 225 </div> 226 227 <div id="publishing-action"> 228 <?php 229 if ( !in_array( $post->post_status, array('publish', 'future', 'private') ) || 0 == $post->ID ) { ?> 230 <?php 231 if ( $can_publish ) : 232 if ( !empty($post->post_date_gmt) && time() < strtotime( $post->post_date_gmt . ' +0000' ) ) : ?> 233 <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Schedule') ?>" /> 234 <input name="publish" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php esc_attr_e('Schedule') ?>" /> 235 <?php else : ?> 236 <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Publish') ?>" /> 237 <input name="publish" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php esc_attr_e('Publish') ?>" /> 238 <?php endif; 239 else : ?> 240 <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Submit for Review') ?>" /> 241 <input name="publish" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php esc_attr_e('Submit for Review') ?>" /> 242 <?php 243 endif; 244 } else { ?> 245 <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Update Page') ?>" /> 246 <input name="save" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php esc_attr_e('Update Page') ?>" /> 247 <?php 248 } ?> 249 </div> 250 <div class="clear"></div> 251 </div> 252 </div> 253 <?php 254 } 255 add_meta_box('pagesubmitdiv', __('Publish'), 'page_submit_meta_box', 'page', 'side', 'core'); 256 257 /** 258 * Display page password form fields. 259 * 260 * @since 2.6.0 261 * 262 * @param object $post 263 */ 264 function page_password_meta_box($post){ 265 ?> 266 <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> 267 <h4><?php _e( 'Page Password' ); ?></h4> 268 <p><label class="screen-reader-text" 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> 269 <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> 270 <?php 271 } 272 // add_meta_box('pagepassworddiv', __('Privacy Options'), 'page_password_meta_box', 'page', 'side', 'core'); 273 274 /** 275 * Display page attributes form fields. 276 * 277 * @since 2.7.0 278 * 279 * @param object $post 280 */ 281 function page_attributes_meta_box($post){ 282 ?> 283 <h5><?php _e('Parent') ?></h5> 284 <label class="screen-reader-text" for="parent_id"><?php _e('Page Parent') ?></label> 285 <?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')); ?> 286 <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> 287 <?php 288 if ( 0 != count( get_page_templates() ) ) { ?> 289 <h5><?php _e('Template') ?></h5> 290 <label class="screen-reader-text" for="page_template"><?php _e('Page Template') ?></label><select name="page_template" id="page_template"> 291 <option value='default'><?php _e('Default Template'); ?></option> 292 <?php page_template_dropdown($post->page_template); ?> 293 </select> 294 <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> 295 <?php 296 } ?> 297 <h5><?php _e('Order') ?></h5> 298 <p><label class="screen-reader-text" for="menu_order"><?php _e('Page Order') ?></label><input name="menu_order" type="text" size="4" id="menu_order" value="<?php echo esc_attr($post->menu_order) ?>" /></p> 299 <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> 300 <?php 301 } 57 add_meta_box('pagesubmitdiv', __('Publish'), 'post_submit_meta_box', 'page', 'side', 'core'); 58 // add_meta_box('pagepassworddiv', __('Privacy Options'), 'post_password_meta_box', 'page', 'side', 'core'); 302 59 add_meta_box('pageparentdiv', __('Attributes'), 'page_attributes_meta_box', 'page', 'side', 'core'); 60 add_meta_box('pagecustomdiv', __('Custom Fields'), 'post_custom_meta_box', 'page', 'normal', 'core'); 61 add_meta_box('pagecommentstatusdiv', __('Discussion'), 'post_comment_status_meta_box', 'page', 'normal', 'core'); 62 add_meta_box('pageslugdiv', __('Page Slug'), 'post_slug_meta_box', 'page', 'normal', 'core'); 303 63 304 /**305 * Display custom field for page form fields.306 *307 * @since 2.6.0308 *309 * @param object $post310 */311 function page_custom_meta_box($post){312 ?>313 <div id="postcustomstuff">314 <?php315 $metadata = has_meta($post->ID);316 list_meta($metadata);317 meta_form(); ?>318 <div id="ajax-response"></div>319 </div>320 <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>321 <?php322 }323 add_meta_box('pagecustomdiv', __('Custom Fields'), 'page_custom_meta_box', 'page', 'normal', 'core');324 325 /**326 * Display comments status form fields.327 *328 * @since 2.6.0329 *330 * @param object $post331 */332 function page_comments_status_meta_box($post){333 ?>334 <input name="advanced_view" type="hidden" value="1" />335 <p><label for="comment_status" class="selectit">336 <input name="comment_status" type="checkbox" id="comment_status" value="open" <?php checked($post->comment_status, 'open'); ?> />337 <?php _e('Allow Comments') ?></label></p>338 <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>339 <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>340 <?php341 }342 add_meta_box('pagecommentstatusdiv', __('Discussion'), 'page_comments_status_meta_box', 'page', 'normal', 'core');343 344 /**345 * Display page slug form fields.346 *347 * @since 2.6.0348 *349 * @param object $post350 */351 function page_slug_meta_box($post){352 ?>353 <label class="screen-reader-text" for="post_name"><?php _e('Page Slug') ?></label><input name="post_name" type="text" size="13" id="post_name" value="<?php echo esc_attr( $post->post_name ); ?>" />354 <?php355 }356 add_meta_box('pageslugdiv', __('Page Slug'), 'page_slug_meta_box', 'page', 'normal', 'core');357 358 64 $authors = get_editable_user_ids( $current_user->id, true, 'page' ); // TODO: ROLE SYSTEM 359 65 if ( $post->post_author && !in_array($post->post_author, $authors) ) 360 66 $authors[] = $post->post_author; 361 if ( $authors && count( $authors ) > 1 ) { 362 /** 363 * Display page author form fields, when more than one author exists. 364 * 365 * @since 2.6.0 366 * 367 * @param object $post 368 */ 369 function page_author_meta_box($post){ 370 global $current_user, $user_ID; 371 $authors = get_editable_user_ids( $current_user->id, true, 'page' ); // TODO: ROLE SYSTEM 372 if ( $post->post_author && !in_array($post->post_author, $authors) ) 373 $authors[] = $post->post_author; 374 ?> 375 <label class="screen-reader-text" 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) ); ?> 376 <?php 377 } 378 add_meta_box('pageauthordiv', __('Page Author'), 'page_author_meta_box', 'page', 'normal', 'core'); 379 } 67 if ( $authors && count( $authors ) > 1 ) 68 add_meta_box('pageauthordiv', __('Page Author'), 'post_author_meta_box', 'page', 'normal', 'core'); 380 69 381 if ( 0 < $post_ID && wp_get_post_revisions( $post_ID ) ) : 382 /** 383 * Display list of page revisions. 384 * 385 * @since 2.6.0 386 * 387 * @param object $post 388 */ 389 function page_revisions_meta_box($post) { 390 wp_list_post_revisions(); 391 } 392 add_meta_box('revisionsdiv', __('Page Revisions'), 'page_revisions_meta_box', 'page', 'normal', 'core'); 393 endif; 70 if ( 0 < $post_ID && wp_get_post_revisions( $post_ID ) ) 71 add_meta_box('revisionsdiv', __('Page Revisions'), 'post_revisions_meta_box', 'page', 'normal', 'core'); 394 72 395 73 do_action('do_meta_boxes', 'page', 'normal', $post); 396 74 do_action('do_meta_boxes', 'page', 'advanced', $post); -
edit-link-form.php
22 22 $nonce_action = 'add-bookmark'; 23 23 } 24 24 25 /** 26 * Display checked checkboxes attribute for xfn microformat options. 27 * 28 * @since 1.0.1 29 * 30 * @param string $class 31 * @param string $value 32 * @param mixed $deprecated Not used. 33 */ 34 function xfn_check($class, $value = '', $deprecated = '') { 35 global $link; 25 require_once('includes/meta-boxes.php'); 36 26 37 $link_rel = isset( $link->link_rel ) ? $link->link_rel : ''; // In PHP 5.3: $link_rel = $link->link_rel ?: '';38 $rels = preg_split('/\s+/', $link_rel);39 40 if ('' != $value && in_array($value, $rels) ) {41 echo ' checked="checked"';42 }43 44 if ('' == $value) {45 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"';46 if ('friendship' == $class && strpos($link_rel, 'friend') === false && strpos($link_rel, 'acquaintance') === false && strpos($link_rel, 'contact') === false) echo ' checked="checked"';47 if ('geographical' == $class && strpos($link_rel, 'co-resident') === false && strpos($link_rel, 'neighbor') === false) echo ' checked="checked"';48 if ('identity' == $class && in_array('me', $rels) ) echo ' checked="checked"';49 }50 }51 52 /**53 * Display link create form fields.54 *55 * @since 2.7.056 *57 * @param object $link58 */59 function link_submit_meta_box($link) {60 ?>61 <div class="submitbox" id="submitlink">62 63 <div id="minor-publishing">64 65 <?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key ?>66 <div style="display:none;">67 <input type="submit" name="save" value="<?php esc_attr_e('Save'); ?>" />68 </div>69 70 <div id="minor-publishing-actions">71 <div id="preview-action">72 <?php if ( !empty($link->link_id) ) { ?>73 <a class="preview button" href="<?php echo $link->link_url; ?>" target="_blank" tabindex="4"><?php _e('Visit Link'); ?></a>74 <?php } ?>75 </div>76 <div class="clear"></div>77 </div>78 79 <div id="misc-publishing-actions">80 <div class="misc-pub-section misc-pub-section-last">81 <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>82 </div>83 </div>84 85 </div>86 87 <div id="major-publishing-actions">88 <?php do_action('post_submitbox_start'); ?>89 <div id="delete-action">90 <?php91 if ( !empty($_GET['action']) && 'edit' == $_GET['action'] && current_user_can('manage_links') ) { ?>92 <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>93 <?php } ?>94 </div>95 96 <div id="publishing-action">97 <?php if ( !empty($link->link_id) ) { ?>98 <input name="save" type="submit" class="button-primary" id="publish" tabindex="4" accesskey="p" value="<?php esc_attr_e('Update Link') ?>" />99 <?php } else { ?>100 <input name="save" type="submit" class="button-primary" id="publish" tabindex="4" accesskey="p" value="<?php esc_attr_e('Add Link') ?>" />101 <?php } ?>102 </div>103 <div class="clear"></div>104 </div>105 <?php do_action('submitlink_box'); ?>106 <div class="clear"></div>107 </div>108 <?php109 }110 27 add_meta_box('linksubmitdiv', __('Save'), 'link_submit_meta_box', 'link', 'side', 'core'); 111 112 /**113 * Display link categories form fields.114 *115 * @since 2.6.0116 *117 * @param object $link118 */119 function link_categories_meta_box($link) { ?>120 <ul id="category-tabs">121 <li class="tabs"><a href="#categories-all"><?php _e( 'All Categories' ); ?></a></li>122 <li class="hide-if-no-js"><a href="#categories-pop"><?php _e( 'Most Used' ); ?></a></li>123 </ul>124 125 <div id="categories-all" class="tabs-panel">126 <ul id="categorychecklist" class="list:category categorychecklist form-no-clear">127 <?php128 if ( isset($link->link_id) )129 wp_link_category_checklist($link->link_id);130 else131 wp_link_category_checklist();132 ?>133 </ul>134 </div>135 136 <div id="categories-pop" class="tabs-panel" style="display: none;">137 <ul id="categorychecklist-pop" class="categorychecklist form-no-clear">138 <?php wp_popular_terms_checklist('link_category'); ?>139 </ul>140 </div>141 142 <div id="category-adder" class="wp-hidden-children">143 <h4><a id="category-add-toggle" href="#category-add"><?php _e( '+ Add New Category' ); ?></a></h4>144 <p id="link-category-add" class="wp-hidden-child">145 <label class="screen-reader-text" for="newcat"><?php _e( '+ Add New Category' ); ?></label>146 <input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php esc_attr_e( 'New category name' ); ?>" aria-required="true" />147 <input type="button" id="category-add-submit" class="add:categorychecklist:linkcategorydiv button" value="<?php esc_attr_e( 'Add' ); ?>" />148 <?php wp_nonce_field( 'add-link-category', '_ajax_nonce', false ); ?>149 <span id="category-ajax-response"></span>150 </p>151 </div>152 <?php153 }154 28 add_meta_box('linkcategorydiv', __('Categories'), 'link_categories_meta_box', 'link', 'normal', 'core'); 155 156 /**157 * Display form fields for changing link target.158 *159 * @since 2.6.0160 *161 * @param object $link162 */163 function link_target_meta_box($link) { ?>164 <fieldset><legend class="screen-reader-text"><span><?php _e('Target') ?></span></legend>165 <p><label for="link_target_blank" class="selectit">166 <input id="link_target_blank" type="radio" name="link_target" value="_blank" <?php echo ( isset( $link->link_target ) && ($link->link_target == '_blank') ? 'checked="checked"' : ''); ?> />167 <?php _e('<code>_blank</code> - new window or tab.'); ?></label></p>168 <p><label for="link_target_top" class="selectit">169 <input id="link_target_top" type="radio" name="link_target" value="_top" <?php echo ( isset( $link->link_target ) && ($link->link_target == '_top') ? 'checked="checked"' : ''); ?> />170 <?php _e('<code>_top</code> - current window or tab, with no frames.'); ?></label></p>171 <p><label for="link_target_none" class="selectit">172 <input id="link_target_none" type="radio" name="link_target" value="" <?php echo ( isset( $link->link_target ) && ($link->link_target == '') ? 'checked="checked"' : ''); ?> />173 <?php _e('<code>_none</code> - same window or tab.'); ?></label></p>174 </fieldset>175 <p><?php _e('Choose the target frame for your link.'); ?></p>176 <?php177 }178 29 add_meta_box('linktargetdiv', __('Target'), 'link_target_meta_box', 'link', 'normal', 'core'); 179 180 /**181 * Display xfn form fields.182 *183 * @since 2.6.0184 *185 * @param object $link186 */187 function link_xfn_meta_box($link) {188 ?>189 <table class="editform" style="width: 100%;" cellspacing="2" cellpadding="5">190 <tr>191 <th style="width: 20%;" scope="row"><label for="link_rel"><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('rel:') ?></label></th>192 <td style="width: 80%;"><input type="text" name="link_rel" id="link_rel" size="50" value="<?php echo ( isset( $link->link_rel ) ? esc_attr($link->link_rel) : ''); ?>" /></td>193 </tr>194 <tr>195 <td colspan="2">196 <table cellpadding="3" cellspacing="5" class="form-table">197 <tr>198 <th scope="row"> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('identity') ?> </th>199 <td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('identity') ?> </span></legend>200 <label for="me">201 <input type="checkbox" name="identity" value="me" id="me" <?php xfn_check('identity', 'me'); ?> />202 <?php _e('another web address of mine') ?></label>203 </fieldset></td>204 </tr>205 <tr>206 <th scope="row"> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('friendship') ?> </th>207 <td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('friendship') ?> </span></legend>208 <label for="contact">209 <input class="valinp" type="radio" name="friendship" value="contact" id="contact" <?php xfn_check('friendship', 'contact', 'radio'); ?> /> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('contact') ?></label>210 <label for="acquaintance">211 <input class="valinp" type="radio" name="friendship" value="acquaintance" id="acquaintance" <?php xfn_check('friendship', 'acquaintance', 'radio'); ?> /> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('acquaintance') ?></label>212 <label for="friend">213 <input class="valinp" type="radio" name="friendship" value="friend" id="friend" <?php xfn_check('friendship', 'friend', 'radio'); ?> /> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('friend') ?></label>214 <label for="friendship">215 <input name="friendship" type="radio" class="valinp" value="" id="friendship" <?php xfn_check('friendship', '', 'radio'); ?> /> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('none') ?></label>216 </fieldset></td>217 </tr>218 <tr>219 <th scope="row"> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('physical') ?> </th>220 <td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('physical') ?> </span></legend>221 <label for="met">222 <input class="valinp" type="checkbox" name="physical" value="met" id="met" <?php xfn_check('physical', 'met'); ?> />223 <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('met') ?></label>224 </fieldset></td>225 </tr>226 <tr>227 <th scope="row"> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('professional') ?> </th>228 <td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('professional') ?> </span></legend>229 <label for="co-worker">230 <input class="valinp" type="checkbox" name="professional" value="co-worker" id="co-worker" <?php xfn_check('professional', 'co-worker'); ?> />231 <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('co-worker') ?></label>232 <label for="colleague">233 <input class="valinp" type="checkbox" name="professional" value="colleague" id="colleague" <?php xfn_check('professional', 'colleague'); ?> />234 <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('colleague') ?></label>235 </fieldset></td>236 </tr>237 <tr>238 <th scope="row"> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('geographical') ?> </th>239 <td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('geographical') ?> </span></legend>240 <label for="co-resident">241 <input class="valinp" type="radio" name="geographical" value="co-resident" id="co-resident" <?php xfn_check('geographical', 'co-resident', 'radio'); ?> />242 <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('co-resident') ?></label>243 <label for="neighbor">244 <input class="valinp" type="radio" name="geographical" value="neighbor" id="neighbor" <?php xfn_check('geographical', 'neighbor', 'radio'); ?> />245 <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('neighbor') ?></label>246 <label for="geographical">247 <input class="valinp" type="radio" name="geographical" value="" id="geographical" <?php xfn_check('geographical', '', 'radio'); ?> />248 <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('none') ?></label>249 </fieldset></td>250 </tr>251 <tr>252 <th scope="row"> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('family') ?> </th>253 <td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('family') ?> </span></legend>254 <label for="child">255 <input class="valinp" type="radio" name="family" value="child" id="child" <?php xfn_check('family', 'child', 'radio'); ?> />256 <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('child') ?></label>257 <label for="kin">258 <input class="valinp" type="radio" name="family" value="kin" id="kin" <?php xfn_check('family', 'kin', 'radio'); ?> />259 <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('kin') ?></label>260 <label for="parent">261 <input class="valinp" type="radio" name="family" value="parent" id="parent" <?php xfn_check('family', 'parent', 'radio'); ?> />262 <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('parent') ?></label>263 <label for="sibling">264 <input class="valinp" type="radio" name="family" value="sibling" id="sibling" <?php xfn_check('family', 'sibling', 'radio'); ?> />265 <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('sibling') ?></label>266 <label for="spouse">267 <input class="valinp" type="radio" name="family" value="spouse" id="spouse" <?php xfn_check('family', 'spouse', 'radio'); ?> />268 <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('spouse') ?></label>269 <label for="family">270 <input class="valinp" type="radio" name="family" value="" id="family" <?php xfn_check('family', '', 'radio'); ?> />271 <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('none') ?></label>272 </fieldset></td>273 </tr>274 <tr>275 <th scope="row"> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('romantic') ?> </th>276 <td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('romantic') ?> </span></legend>277 <label for="muse">278 <input class="valinp" type="checkbox" name="romantic" value="muse" id="muse" <?php xfn_check('romantic', 'muse'); ?> />279 <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('muse') ?></label>280 <label for="crush">281 <input class="valinp" type="checkbox" name="romantic" value="crush" id="crush" <?php xfn_check('romantic', 'crush'); ?> />282 <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('crush') ?></label>283 <label for="date">284 <input class="valinp" type="checkbox" name="romantic" value="date" id="date" <?php xfn_check('romantic', 'date'); ?> />285 <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('date') ?></label>286 <label for="romantic">287 <input class="valinp" type="checkbox" name="romantic" value="sweetheart" id="romantic" <?php xfn_check('romantic', 'sweetheart'); ?> />288 <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('sweetheart') ?></label>289 </fieldset></td>290 </tr>291 </table>292 </td>293 </tr>294 </table>295 <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>296 <?php297 }298 30 add_meta_box('linkxfndiv', __('Link Relationship (XFN)'), 'link_xfn_meta_box', 'link', 'normal', 'core'); 299 300 /**301 * Display advanced link options form fields.302 *303 * @since 2.6.0304 *305 * @param object $link306 */307 function link_advanced_meta_box($link) {308 ?>309 <table class="form-table" style="width: 100%;" cellspacing="2" cellpadding="5">310 <tr class="form-field">311 <th valign="top" scope="row"><label for="link_image"><?php _e('Image Address') ?></label></th>312 <td><input type="text" name="link_image" class="code" id="link_image" size="50" value="<?php echo ( isset( $link->link_image ) ? esc_attr($link->link_image) : ''); ?>" style="width: 95%" /></td>313 </tr>314 <tr class="form-field">315 <th valign="top" scope="row"><label for="rss_uri"><?php _e('RSS Address') ?></label></th>316 <td><input name="link_rss" class="code" type="text" id="rss_uri" value="<?php echo ( isset( $link->link_rss ) ? esc_attr($link->link_rss) : ''); ?>" size="50" style="width: 95%" /></td>317 </tr>318 <tr class="form-field">319 <th valign="top" scope="row"><label for="link_notes"><?php _e('Notes') ?></label></th>320 <td><textarea name="link_notes" id="link_notes" cols="50" rows="10" style="width: 95%"><?php echo ( isset( $link->link_notes ) ? $link->link_notes : ''); ?></textarea></td>321 </tr>322 <tr class="form-field">323 <th valign="top" scope="row"><label for="link_rating"><?php _e('Rating') ?></label></th>324 <td><select name="link_rating" id="link_rating" size="1">325 <?php326 for ($r = 0; $r < 10; $r++) {327 echo(' <option value="'. esc_attr($r) .'" ');328 if ( isset($link->link_rating) && $link->link_rating == $r)329 echo 'selected="selected"';330 echo('>'.$r.'</option>');331 }332 ?></select> <?php _e('(Leave at 0 for no rating.)') ?>333 </td>334 </tr>335 </table>336 <?php337 }338 31 add_meta_box('linkadvanceddiv', __('Advanced'), 'link_advanced_meta_box', 'link', 'normal', 'core'); 339 32 340 33 do_action('do_meta_boxes', 'link', 'normal', $link); -
edit-form-advanced.php
57 57 } 58 58 59 59 // All meta boxes should be defined and added before the first do_meta_boxes() call (or potentially during the do_meta_boxes action). 60 require_once('includes/meta-boxes.php'); 60 61 61 /**62 * Display post submit form fields.63 *64 * @since 2.7.065 *66 * @param object $post67 */68 function post_submit_meta_box($post) {69 global $action;70 71 $can_publish = current_user_can('publish_posts');72 ?>73 <div class="submitbox" id="submitpost">74 75 <div id="minor-publishing">76 77 <?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key ?>78 <div style="display:none;">79 <input type="submit" name="save" value="<?php esc_attr_e('Save'); ?>" />80 </div>81 82 <div id="minor-publishing-actions">83 <div id="save-action">84 <?php if ( 'publish' != $post->post_status && 'future' != $post->post_status && 'pending' != $post->post_status ) { ?>85 <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'); ?>" tabindex="4" class="button button-highlighted" />86 <?php } elseif ( 'pending' == $post->post_status && $can_publish ) { ?>87 <input type="submit" name="save" id="save-post" value="<?php esc_attr_e('Save as Pending'); ?>" tabindex="4" class="button button-highlighted" />88 <?php } ?>89 </div>90 91 <div id="preview-action">92 <?php93 if ( 'publish' == $post->post_status ) {94 $preview_link = esc_url(get_permalink($post->ID));95 $preview_button = __('Preview Changes');96 } else {97 $preview_link = esc_url(apply_filters('preview_post_link', add_query_arg('preview', 'true', get_permalink($post->ID))));98 $preview_button = __('Preview');99 }100 ?>101 <a class="preview button" href="<?php echo $preview_link; ?>" target="wp-preview" id="post-preview" tabindex="4"><?php echo $preview_button; ?></a>102 <input type="hidden" name="wp-preview" id="wp-preview" value="" />103 </div>104 105 <div class="clear"></div>106 </div><?php // /minor-publishing-actions ?>107 108 <div id="misc-publishing-actions">109 110 <div class="misc-pub-section<?php if ( !$can_publish ) { echo ' misc-pub-section-last'; } ?>"><label for="post_status"><?php _e('Status:') ?></label>111 <span id="post-status-display">112 <?php113 switch ( $post->post_status ) {114 case 'private':115 _e('Privately Published');116 break;117 case 'publish':118 _e('Published');119 break;120 case 'future':121 _e('Scheduled');122 break;123 case 'pending':124 _e('Pending Review');125 break;126 case 'draft':127 _e('Draft');128 break;129 }130 ?>131 </span>132 <?php if ( 'publish' == $post->post_status || 'private' == $post->post_status || $can_publish ) { ?>133 <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>134 135 <div id="post-status-select" class="hide-if-js">136 <input type="hidden" name="hidden_post_status" id="hidden_post_status" value="<?php echo esc_attr($post->post_status); ?>" />137 <select name='post_status' id='post_status' tabindex='4'>138 <?php if ( 'publish' == $post->post_status ) : ?>139 <option<?php selected( $post->post_status, 'publish' ); ?> value='publish'><?php _e('Published') ?></option>140 <?php elseif ( 'private' == $post->post_status ) : ?>141 <option<?php selected( $post->post_status, 'private' ); ?> value='publish'><?php _e('Privately Published') ?></option>142 <?php elseif ( 'future' == $post->post_status ) : ?>143 <option<?php selected( $post->post_status, 'future' ); ?> value='future'><?php _e('Scheduled') ?></option>144 <?php endif; ?>145 <option<?php selected( $post->post_status, 'pending' ); ?> value='pending'><?php _e('Pending Review') ?></option>146 <option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php _e('Draft') ?></option>147 </select>148 <a href="#post_status" class="save-post-status hide-if-no-js button"><?php _e('OK'); ?></a>149 <a href="#post_status" class="cancel-post-status hide-if-no-js"><?php _e('Cancel'); ?></a>150 </div>151 152 <?php } ?>153 </div><?php // /misc-pub-section ?>154 155 <div class="misc-pub-section " id="visibility">156 <?php _e('Visibility:'); ?> <span id="post-visibility-display"><?php157 158 if ( 'private' == $post->post_status ) {159 $post->post_password = '';160 $visibility = 'private';161 $visibility_trans = __('Private');162 } elseif ( !empty( $post->post_password ) ) {163 $visibility = 'password';164 $visibility_trans = __('Password protected');165 } elseif ( is_sticky( $post->ID ) ) {166 $visibility = 'public';167 $visibility_trans = __('Public, Sticky');168 } else {169 $visibility = 'public';170 $visibility_trans = __('Public');171 }172 173 ?><?php echo esc_html( $visibility_trans ); ?></span> <?php if ( $can_publish ) { ?> <a href="#visibility" class="edit-visibility hide-if-no-js"><?php _e('Edit'); ?></a>174 175 <div id="post-visibility-select" class="hide-if-js">176 <input type="hidden" name="hidden_post_password" id="hidden-post-password" value="<?php echo esc_attr($post->post_password); ?>" />177 <input type="checkbox" style="display:none" name="hidden_post_sticky" id="hidden-post-sticky" value="sticky" <?php checked(is_sticky($post->ID)); ?> />178 <input type="hidden" name="hidden_post_visibility" id="hidden-post-visibility" value="<?php echo esc_attr( $visibility ); ?>" />179 180 181 <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 />182 <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>183 <input type="radio" name="visibility" id="visibility-radio-password" value="password" <?php checked( $visibility, 'password' ); ?> /> <label for="visibility-radio-password" class="selectit"><?php _e('Password protected'); ?></label><br />184 <span id="password-span"><label for="post_password"><?php _e('Password:'); ?></label> <input type="text" name="post_password" id="post_password" value="<?php echo esc_attr($post->post_password); ?>" /><br /></span>185 <input type="radio" name="visibility" id="visibility-radio-private" value="private" <?php checked( $visibility, 'private' ); ?> /> <label for="visibility-radio-private" class="selectit"><?php _e('Private'); ?></label><br />186 187 <p>188 <a href="#visibility" class="save-post-visibility hide-if-no-js button"><?php _e('OK'); ?></a>189 <a href="#visibility" class="cancel-post-visibility hide-if-no-js"><?php _e('Cancel'); ?></a>190 </p>191 </div>192 <?php } ?>193 194 </div><?php // /misc-pub-section ?>195 196 197 <?php198 // translators: Publish box date formt, see http://php.net/date199 $datef = __( 'M j, Y @ G:i' );200 if ( 0 != $post->ID ) {201 if ( 'future' == $post->post_status ) { // scheduled for publishing at a future date202 $stamp = __('Scheduled for: <b>%1$s</b>');203 } else if ( 'publish' == $post->post_status || 'private' == $post->post_status ) { // already published204 $stamp = __('Published on: <b>%1$s</b>');205 } else if ( '0000-00-00 00:00:00' == $post->post_date_gmt ) { // draft, 1 or more saves, no date specified206 $stamp = __('Publish <b>immediately</b>');207 } else if ( time() < strtotime( $post->post_date_gmt . ' +0000' ) ) { // draft, 1 or more saves, future date specified208 $stamp = __('Schedule for: <b>%1$s</b>');209 } else { // draft, 1 or more saves, date specified210 $stamp = __('Publish on: <b>%1$s</b>');211 }212 $date = date_i18n( $datef, strtotime( $post->post_date ) );213 } else { // draft (no saves, and thus no date specified)214 $stamp = __('Publish <b>immediately</b>');215 $date = date_i18n( $datef, strtotime( current_time('mysql') ) );216 }217 218 if ( $can_publish ) : // Contributors don't get to choose the date of publish ?>219 <div class="misc-pub-section curtime misc-pub-section-last">220 <span id="timestamp">221 <?php printf($stamp, $date); ?></span>222 <a href="#edit_timestamp" class="edit-timestamp hide-if-no-js" tabindex='4'><?php _e('Edit') ?></a>223 <div id="timestampdiv" class="hide-if-js"><?php touch_time(($action == 'edit'),1,4); ?></div>224 </div><?php // /misc-pub-section ?>225 <?php endif; ?>226 227 </div>228 <div class="clear"></div>229 </div>230 231 <div id="major-publishing-actions">232 <?php do_action('post_submitbox_start'); ?>233 <div id="delete-action">234 <?php235 if ( ( 'edit' == $action ) && current_user_can('delete_post', $post->ID) ) { ?>236 <a class="submitdelete deletion" href="<?php echo wp_nonce_url("post.php?action=trash&post=$post->ID", 'trash-post_' . $post->ID); ?>"><?php _e('Move to Trash'); ?></a>237 <?php } ?>238 </div>239 240 <div id="publishing-action">241 <?php242 if ( !in_array( $post->post_status, array('publish', 'future', 'private') ) || 0 == $post->ID ) {243 if ( current_user_can('publish_posts') ) :244 if ( !empty($post->post_date_gmt) && time() < strtotime( $post->post_date_gmt . ' +0000' ) ) : ?>245 <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Schedule') ?>" />246 <input name="publish" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php esc_attr_e('Schedule') ?>" />247 <?php else : ?>248 <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Publish') ?>" />249 <input name="publish" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php esc_attr_e('Publish') ?>" />250 <?php endif;251 else : ?>252 <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Submit for Review') ?>" />253 <input name="publish" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php esc_attr_e('Submit for Review') ?>" />254 <?php255 endif;256 } else { ?>257 <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Update Post') ?>" />258 <input name="save" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php esc_attr_e('Update Post') ?>" />259 <?php260 } ?>261 </div>262 <div class="clear"></div>263 </div>264 </div>265 266 <?php267 }268 62 add_meta_box('submitdiv', __('Publish'), 'post_submit_meta_box', 'post', 'side', 'core'); 269 63 270 /**271 * Display post tags form fields.272 *273 * @since 2.6.0274 *275 * @param object $post276 */277 function post_tags_meta_box($post, $box) {278 $tax_name = esc_attr(substr($box['id'], 8));279 $taxonomy = get_taxonomy($tax_name);280 $helps = isset($taxonomy->helps) ? esc_attr($taxonomy->helps) : __('Separate tags with commas.');281 ?>282 <div class="tagsdiv" id="<?php echo $tax_name; ?>">283 <div class="jaxtag">284 <div class="nojs-tags hide-if-js">285 <p><?php _e('Add or remove tags'); ?></p>286 <textarea name="<?php echo "tax_input[$tax_name]"; ?>" class="the-tags" id="tax-input[<?php echo $tax_name; ?>]"><?php echo esc_attr(get_terms_to_edit( $post->ID, $tax_name )); ?></textarea></div>287 288 <span class="ajaxtag hide-if-no-js">289 <label class="screen-reader-text" for="new-tag-<?php echo $tax_name; ?>"><?php echo $box['title']; ?></label>290 <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="<?php esc_attr_e('Add new tag'); ?>" />291 <input type="button" class="button tagadd" value="<?php esc_attr_e('Add'); ?>" tabindex="3" />292 </span></div>293 <p class="howto"><?php echo $helps; ?></p>294 <div class="tagchecklist"></div>295 </div>296 <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>297 <?php298 }299 300 64 // all tag-style post taxonomies 301 65 foreach ( get_object_taxonomies('post') as $tax_name ) { 302 66 if ( !is_taxonomy_hierarchical($tax_name) ) { … … 307 71 } 308 72 } 309 73 310 /**311 * Display post categories form fields.312 *313 * @since 2.6.0314 *315 * @param object $post316 */317 function post_categories_meta_box($post) {318 ?>319 <ul id="category-tabs">320 <li class="tabs"><a href="#categories-all" tabindex="3"><?php _e( 'All Categories' ); ?></a></li>321 <li class="hide-if-no-js"><a href="#categories-pop" tabindex="3"><?php _e( 'Most Used' ); ?></a></li>322 </ul>323 324 <div id="categories-pop" class="tabs-panel" style="display: none;">325 <ul id="categorychecklist-pop" class="categorychecklist form-no-clear" >326 <?php $popular_ids = wp_popular_terms_checklist('category'); ?>327 </ul>328 </div>329 330 <div id="categories-all" class="tabs-panel">331 <ul id="categorychecklist" class="list:category categorychecklist form-no-clear">332 <?php wp_category_checklist($post->ID, false, false, $popular_ids) ?>333 </ul>334 </div>335 336 <?php if ( current_user_can('manage_categories') ) : ?>337 <div id="category-adder" class="wp-hidden-children">338 <h4><a id="category-add-toggle" href="#category-add" class="hide-if-no-js" tabindex="3"><?php _e( '+ Add New Category' ); ?></a></h4>339 <p id="category-add" class="wp-hidden-child">340 <label class="screen-reader-text" for="newcat"><?php _e( 'Add New Category' ); ?></label><input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php esc_attr_e( 'New category name' ); ?>" tabindex="3" aria-required="true"/>341 <label class="screen-reader-text" 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 ) ); ?>342 <input type="button" id="category-add-sumbit" class="add:categorychecklist:category-add button" value="<?php esc_attr_e( 'Add' ); ?>" tabindex="3" />343 <?php wp_nonce_field( 'add-category', '_ajax_nonce', false ); ?>344 <span id="category-ajax-response"></span></p>345 </div>346 <?php347 endif;348 349 }350 74 add_meta_box('categorydiv', __('Categories'), 'post_categories_meta_box', 'post', 'side', 'core'); 351 352 /**353 * Display post password form fields.354 *355 * @since 2.6.0356 *357 * @param object $post358 */359 function post_password_meta_box($post) {360 ?>361 <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 post private') ?></label></p>362 <h4><?php _e( 'Post Password' ); ?></h4>363 <p><label class="screen-reader-text" 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>364 <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>365 <?php366 }367 75 // add_meta_box('passworddiv', __('Privacy Options'), 'post_password_meta_box', 'post', 'side', 'core'); 368 369 /**370 * Display post excerpt form fields.371 *372 * @since 2.6.0373 *374 * @param object $post375 */376 function post_excerpt_meta_box($post) {377 ?>378 <label class="screen-reader-text" for="excerpt"><?php _e('Excerpt') ?></label><textarea rows="1" cols="40" name="excerpt" tabindex="6" id="excerpt"><?php echo $post->post_excerpt ?></textarea>379 <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>380 <?php381 }382 76 add_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', 'post', 'normal', 'core'); 383 384 /**385 * Display trackback links form fields.386 *387 * @since 2.6.0388 *389 * @param object $post390 */391 function post_trackback_meta_box($post) {392 $form_trackback = '<input type="text" name="trackback_url" id="trackback_url" class="code" tabindex="7" value="'. esc_attr( str_replace("\n", ' ', $post->to_ping) ) .'" />';393 if ('' != $post->pinged) {394 $pings = '<p>'. __('Already pinged:') . '</p><ul>';395 $already_pinged = explode("\n", trim($post->pinged));396 foreach ($already_pinged as $pinged_url) {397 $pings .= "\n\t<li>" . esc_html($pinged_url) . "</li>";398 }399 $pings .= '</ul>';400 }401 402 ?>403 <p><label for="trackback_url"><?php _e('Send trackbacks to:'); ?></label> <?php echo $form_trackback; ?><br /> (<?php _e('Separate multiple URLs with spaces'); ?>)</p>404 <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>405 <?php406 if ( ! empty($pings) )407 echo $pings;408 }409 77 add_meta_box('trackbacksdiv', __('Send Trackbacks'), 'post_trackback_meta_box', 'post', 'normal', 'core'); 410 411 /**412 * Display custom fields for the post form fields.413 *414 * @since 2.6.0415 *416 * @param object $post417 */418 function post_custom_meta_box($post) {419 ?>420 <div id="postcustomstuff">421 <div id="ajax-response"></div>422 <?php423 $metadata = has_meta($post->ID);424 list_meta($metadata);425 meta_form(); ?>426 </div>427 <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>428 <?php429 }430 78 add_meta_box('postcustom', __('Custom Fields'), 'post_custom_meta_box', 'post', 'normal', 'core'); 431 432 79 do_action('dbx_post_advanced'); 433 434 /**435 * Display comment status for post form fields.436 *437 * @since 2.6.0438 *439 * @param object $post440 */441 function post_comment_status_meta_box($post) {442 ?>443 <input name="advanced_view" type="hidden" value="1" />444 <p class="meta-options">445 <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 />446 <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></p>447 <?php448 }449 80 add_meta_box('commentstatusdiv', __('Discussion'), 'post_comment_status_meta_box', 'post', 'normal', 'core'); 450 81 451 /**452 * Display comments for post.453 *454 * @since 2.8.0455 *456 * @param object $post457 */458 function post_comment_meta_box($post) {459 global $wpdb, $post_ID;460 461 $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));462 463 if ( 1 > $total ) {464 echo '<p>' . __('No comments yet.') . '</p>';465 return;466 }467 468 wp_nonce_field( 'get-comments', 'add_comment_nonce', false );469 ?>470 471 <table class="widefat comments-box fixed" cellspacing="0" style="display:none;">472 <thead><tr>473 <th scope="col" class="column-author"><?php _e('Author') ?></th>474 <th scope="col" class="column-comment">475 <?php /* translators: field name in comment form */ echo _x('Comment', 'noun'); ?></th>476 </tr></thead>477 <tbody id="the-comment-list" class="list:comment"></tbody>478 </table>479 <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/wpspin_light.gif" alt="" /></p>480 <?php481 $hidden = get_hidden_meta_boxes('post');482 if ( ! in_array('commentsdiv', $hidden) ) { ?>483 <script type="text/javascript">jQuery(document).ready(function(){commentsBox.get(<?php echo $total; ?>, 10);});</script>484 <?php485 }486 }487 82 if ( 'publish' == $post->post_status || 'private' == $post->post_status ) 488 83 add_meta_box('commentsdiv', __('Comments'), 'post_comment_meta_box', 'post', 'normal', 'core'); 489 84 490 /**491 * Display post slug form fields.492 *493 * @since 2.6.0494 *495 * @param object $post496 */497 function post_slug_meta_box($post) {498 ?>499 <label class="screen-reader-text" for="post_name"><?php _e('Post Slug') ?></label><input name="post_name" type="text" size="13" id="post_name" value="<?php echo esc_attr( $post->post_name ); ?>" />500 <?php501 }502 85 if ( !( 'pending' == $post->post_status && !current_user_can( 'publish_posts' ) ) ) 503 86 add_meta_box('slugdiv', __('Post Slug'), 'post_slug_meta_box', 'post', 'normal', 'core'); 504 87 505 88 $authors = get_editable_user_ids( $current_user->id ); // TODO: ROLE SYSTEM 506 89 if ( $post->post_author && !in_array($post->post_author, $authors) ) 507 90 $authors[] = $post->post_author; 508 if ( $authors && count( $authors ) > 1 ) : 509 /** 510 * Display form field with list of authors. 511 * 512 * @since 2.6.0 513 * 514 * @param object $post 515 */ 516 function post_author_meta_box($post) { 517 global $current_user, $user_ID; 518 $authors = get_editable_user_ids( $current_user->id ); // TODO: ROLE SYSTEM 519 if ( $post->post_author && !in_array($post->post_author, $authors) ) 520 $authors[] = $post->post_author; 521 ?> 522 <label class="screen-reader-text" 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) ); ?> 523 <?php 524 } 525 add_meta_box('authordiv', __('Post Author'), 'post_author_meta_box', 'post', 'normal', 'core'); 526 endif; 91 if ( $authors && count( $authors ) > 1 ) 92 add_meta_box('authordiv', __('Post Author'), 'post_author_meta_box', 'post', 'normal', 'core'); 527 93 528 if ( 0 < $post_ID && wp_get_post_revisions( $post_ID ) ) : 529 /** 530 * Display list of post revisions. 531 * 532 * @since 2.6.0 533 * 534 * @param object $post 535 */ 536 function post_revisions_meta_box($post) { 537 wp_list_post_revisions(); 538 } 539 add_meta_box('revisionsdiv', __('Post Revisions'), 'post_revisions_meta_box', 'post', 'normal', 'core'); 540 endif; 94 if ( 0 < $post_ID && wp_get_post_revisions( $post_ID ) ) 95 add_meta_box('revisionsdiv', __('Post Revisions'), 'post_revisions_meta_box', 'post', 'normal', 'core'); 541 96 542 97 do_action('do_meta_boxes', 'post', 'normal', $post); 543 98 do_action('do_meta_boxes', 'post', 'advanced', $post);