Changeset 11815
- Timestamp:
- 08/14/2009 05:37:40 PM (15 years ago)
- Location:
- trunk/wp-admin
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/edit-form-advanced.php
r11768 r11815 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 61 /** 62 * Display post submit form fields. 63 * 64 * @since 2.7.0 65 * 66 * @param object $post 67 */ 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 <?php 93 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 <?php 113 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"><?php 157 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 <?php 198 // translators: Publish box date formt, see http://php.net/date 199 $datef = __( 'M j, Y @ G:i' ); 200 if ( 0 != $post->ID ) { 201 if ( 'future' == $post->post_status ) { // scheduled for publishing at a future date 202 $stamp = __('Scheduled for: <b>%1$s</b>'); 203 } else if ( 'publish' == $post->post_status || 'private' == $post->post_status ) { // already published 204 $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 specified 206 $stamp = __('Publish <b>immediately</b>'); 207 } else if ( time() < strtotime( $post->post_date_gmt . ' +0000' ) ) { // draft, 1 or more saves, future date specified 208 $stamp = __('Schedule for: <b>%1$s</b>'); 209 } else { // draft, 1 or more saves, date specified 210 $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 <?php 235 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 <?php 242 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 <?php 255 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 <?php 260 } ?> 261 </div> 262 <div class="clear"></div> 263 </div> 264 </div> 265 266 <?php 267 } 60 require_once('includes/meta-boxes.php'); 61 268 62 add_meta_box('submitdiv', __('Publish'), 'post_submit_meta_box', 'post', 'side', 'core'); 269 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 63 300 64 // all tag-style post taxonomies … … 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'); … … 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; 527 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; 91 if ( $authors && count( $authors ) > 1 ) 92 add_meta_box('authordiv', __('Post Author'), 'post_author_meta_box', 'post', 'normal', 'core'); 93 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); -
trunk/wp-admin/edit-link-form.php
r11768 r11815 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 -
trunk/wp-admin/edit-page-form.php
r11768 r11815 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'); 303 304 /** 305 * Display custom field for page form fields. 306 * 307 * @since 2.6.0 308 * 309 * @param object $post 310 */ 311 function page_custom_meta_box($post){ 312 ?> 313 <div id="postcustomstuff"> 314 <?php 315 $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 <?php 322 } 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.0 329 * 330 * @param object $post 331 */ 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 <?php 341 } 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.0 348 * 349 * @param object $post 350 */ 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 <?php 355 } 356 add_meta_box('pageslugdiv', __('Page Slug'), 'page_slug_meta_box', 'page', 'normal', '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'); 357 63 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);
Note: See TracChangeset
for help on using the changeset viewer.