]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/includes/meta-boxes.php
WordPress 4.3
[autoinstalls/wordpress.git] / wp-admin / includes / meta-boxes.php
index 3e2c9de6b9c9a0816e5dbb56f4b5abf9b4e85121..a7a895a1947c5447a007a74d9d8bace112ca8da1 100644 (file)
@@ -7,6 +7,8 @@
  *
  * @since 2.7.0
  *
+ * @global string $action
+ *
  * @param object $post
  */
 function post_submit_meta_box($post, $args = array() ) {
@@ -162,15 +164,15 @@ echo esc_html( $visibility_trans ); ?></span>
 
 <?php
 /* translators: Publish box date format, see http://php.net/date */
-$datef = __( 'M j, Y @ G:i' );
+$datef = __( 'M j, Y @ H:i' );
 if ( 0 != $post->ID ) {
        if ( 'future' == $post->post_status ) { // scheduled for publishing at a future date
                $stamp = __('Scheduled for: <b>%1$s</b>');
-       } else if ( 'publish' == $post->post_status || 'private' == $post->post_status ) { // already published
+       } elseif ( 'publish' == $post->post_status || 'private' == $post->post_status ) { // already published
                $stamp = __('Published on: <b>%1$s</b>');
-       } else if ( '0000-00-00 00:00:00' == $post->post_date_gmt ) { // draft, 1 or more saves, no date specified
+       } elseif ( '0000-00-00 00:00:00' == $post->post_date_gmt ) { // draft, 1 or more saves, no date specified
                $stamp = __('Publish <b>immediately</b>');
-       } else if ( time() < strtotime( $post->post_date_gmt . ' +0000' ) ) { // draft, 1 or more saves, future date specified
+       } elseif ( time() < strtotime( $post->post_date_gmt . ' +0000' ) ) { // draft, 1 or more saves, future date specified
                $stamp = __('Schedule for: <b>%1$s</b>');
        } else { // draft, 1 or more saves, date specified
                $stamp = __('Publish on: <b>%1$s</b>');
@@ -204,7 +206,10 @@ if ( $can_publish ) : // Contributors don't get to choose the date of publish ?>
        <span id="timestamp">
        <?php printf($stamp, $date); ?></span>
        <a href="#edit_timestamp" class="edit-timestamp hide-if-no-js"><span aria-hidden="true"><?php _e( 'Edit' ); ?></span> <span class="screen-reader-text"><?php _e( 'Edit date and time' ); ?></span></a>
-       <div id="timestampdiv" class="hide-if-js"><?php touch_time(($action == 'edit'), 1); ?></div>
+       <fieldset id="timestampdiv" class="hide-if-js">
+       <legend class="screen-reader-text"><?php _e( 'Date and time' ); ?></legend>
+       <?php touch_time( ( $action === 'edit' ), 1 ); ?>
+       </fieldset>
 </div><?php // /misc-pub-section ?>
 <?php endif; ?>
 
@@ -248,19 +253,19 @@ if ( !in_array( $post->post_status, array('publish', 'future', 'private') ) || 0
        if ( $can_publish ) :
                if ( !empty($post->post_date_gmt) && time() < strtotime( $post->post_date_gmt . ' +0000' ) ) : ?>
                <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Schedule') ?>" />
-               <?php submit_button( __( 'Schedule' ), 'primary button-large', 'publish', false, array( 'accesskey' => 'p' ) ); ?>
+               <?php submit_button( __( 'Schedule' ), 'primary button-large', 'publish', false ); ?>
 <?php  else : ?>
                <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Publish') ?>" />
-               <?php submit_button( __( 'Publish' ), 'primary button-large', 'publish', false, array( 'accesskey' => 'p' ) ); ?>
+               <?php submit_button( __( 'Publish' ), 'primary button-large', 'publish', false ); ?>
 <?php  endif;
        else : ?>
                <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Submit for Review') ?>" />
-               <?php submit_button( __( 'Submit for Review' ), 'primary button-large', 'publish', false, array( 'accesskey' => 'p' ) ); ?>
+               <?php submit_button( __( 'Submit for Review' ), 'primary button-large', 'publish', false ); ?>
 <?php
        endif;
 } else { ?>
                <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Update') ?>" />
-               <input name="save" type="submit" class="button button-primary button-large" id="publish" accesskey="p" value="<?php esc_attr_e('Update') ?>" />
+               <input name="save" type="submit" class="button button-primary button-large" id="publish" value="<?php esc_attr_e( 'Update' ) ?>" />
 <?php
 } ?>
 </div>
@@ -293,7 +298,7 @@ function attachment_submit_meta_box( $post ) {
 <div id="misc-publishing-actions">
        <?php
        /* translators: Publish box date format, see http://php.net/date */
-       $datef = __( 'M j, Y @ G:i' );
+       $datef = __( 'M j, Y @ H:i' );
        $stamp = __('Uploaded on: <b>%1$s</b>');
        $date = date_i18n( $datef, strtotime( $post->post_date ) );
        ?>
@@ -330,7 +335,7 @@ function attachment_submit_meta_box( $post ) {
        <div id="publishing-action">
                <span class="spinner"></span>
                <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Update') ?>" />
-               <input name="save" type="submit" class="button-primary button-large" id="publish" accesskey="p" value="<?php esc_attr_e('Update') ?>" />
+               <input name="save" type="submit" class="button-primary button-large" id="publish" value="<?php esc_attr_e( 'Update' ) ?>" />
        </div>
        <div class="clear"></div>
 </div><!-- #major-publishing-actions -->
@@ -368,10 +373,13 @@ function post_format_meta_box( $post, $box ) {
                        $post_formats[0][] = $post_format;
        ?>
        <div id="post-formats-select">
-               <input type="radio" name="post_format" class="post-format" id="post-format-0" value="0" <?php checked( $post_format, '0' ); ?> /> <label for="post-format-0" class="post-format-icon post-format-standard"><?php echo get_post_format_string( 'standard' ); ?></label>
-               <?php foreach ( $post_formats[0] as $format ) : ?>
-               <br /><input type="radio" name="post_format" class="post-format" id="post-format-<?php echo esc_attr( $format ); ?>" value="<?php echo esc_attr( $format ); ?>" <?php checked( $post_format, $format ); ?> /> <label for="post-format-<?php echo esc_attr( $format ); ?>" class="post-format-icon post-format-<?php echo esc_attr( $format ); ?>"><?php echo esc_html( get_post_format_string( $format ) ); ?></label>
-               <?php endforeach; ?><br />
+               <fieldset>
+                       <legend class="screen-reader-text"><?php _e( 'Post Formats' ); ?></legend>
+                       <input type="radio" name="post_format" class="post-format" id="post-format-0" value="0" <?php checked( $post_format, '0' ); ?> /> <label for="post-format-0" class="post-format-icon post-format-standard"><?php echo get_post_format_string( 'standard' ); ?></label>
+                       <?php foreach ( $post_formats[0] as $format ) : ?>
+                       <br /><input type="radio" name="post_format" class="post-format" id="post-format-<?php echo esc_attr( $format ); ?>" value="<?php echo esc_attr( $format ); ?>" <?php checked( $post_format, $format ); ?> /> <label for="post-format-<?php echo esc_attr( $format ); ?>" class="post-format-icon post-format-<?php echo esc_attr( $format ); ?>"><?php echo esc_html( get_post_format_string( $format ) ); ?></label>
+                       <?php endforeach; ?>
+               </fieldset>
        </div>
        <?php endif; endif;
 }
@@ -418,7 +426,6 @@ function post_tags_meta_box( $post, $box ) {
        <?php if ( $user_can_assign_terms ) : ?>
        <div class="ajaxtag hide-if-no-js">
                <label class="screen-reader-text" for="new-tag-<?php echo $tax_name; ?>"><?php echo $box['title']; ?></label>
-               <div class="taghint"><?php echo $taxonomy->labels->add_new_item; ?></div>
                <p><input type="text" id="new-tag-<?php echo $tax_name; ?>" name="newtag[<?php echo $tax_name; ?>]" class="newtag form-input-tip" size="16" autocomplete="off" value="" />
                <input type="button" class="button tagadd" value="<?php esc_attr_e('Add'); ?>" /></p>
        </div>
@@ -523,7 +530,7 @@ function post_categories_meta_box( $post, $box ) {
 function post_excerpt_meta_box($post) {
 ?>
 <label class="screen-reader-text" for="excerpt"><?php _e('Excerpt') ?></label><textarea rows="1" cols="40" name="excerpt" id="excerpt"><?php echo $post->post_excerpt; // textarea_escaped ?></textarea>
-<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>
+<p><?php _e('Excerpts are optional hand-crafted summaries of your content that can be used in your theme. <a href="https://codex.wordpress.org/Excerpt" target="_blank">Learn more about manual excerpts.</a>'); ?></p>
 <?php
 }
 
@@ -547,7 +554,7 @@ function post_trackback_meta_box($post) {
 
 ?>
 <p><label for="trackback_url"><?php _e('Send trackbacks to:'); ?></label> <?php echo $form_trackback; ?><br /> (<?php _e('Separate multiple URLs with spaces'); ?>)</p>
-<p><?php _e('Trackbacks are a way to notify legacy blog systems that you&#8217;ve linked to them. If you link other WordPress sites they&#8217;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>
+<p><?php _e('Trackbacks are a way to notify legacy blog systems that you&#8217;ve linked to them. If you link other WordPress sites, they&#8217;ll be notified automatically using <a href="https://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments" target="_blank">pingbacks</a>, no other action necessary.'); ?></p>
 <?php
 if ( ! empty($pings) )
        echo $pings;
@@ -573,7 +580,7 @@ foreach ( $metadata as $key => $value ) {
 list_meta( $metadata );
 meta_form( $post ); ?>
 </div>
-<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>
+<p><?php _e('Custom fields can be used to add extra metadata to a post that you can <a href="https://codex.wordpress.org/Using_Custom_Fields" target="_blank">use in your theme</a>.'); ?></p>
 <?php
 }
 
@@ -589,7 +596,7 @@ function post_comment_status_meta_box($post) {
 <input name="advanced_view" type="hidden" value="1" />
 <p class="meta-options">
        <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 />
-       <label for="ping_status" class="selectit"><input name="ping_status" type="checkbox" id="ping_status" value="open" <?php checked($post->ping_status, 'open'); ?> /> <?php printf( __( 'Allow <a href="%s" target="_blank">trackbacks and pingbacks</a> on this page.' ), __( 'http://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments' ) ); ?></label>
+       <label for="ping_status" class="selectit"><input name="ping_status" type="checkbox" id="ping_status" value="open" <?php checked($post->ping_status, 'open'); ?> /> <?php printf( __( 'Allow <a href="%s" target="_blank">trackbacks and pingbacks</a> on this page.' ), __( 'https://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments' ) ); ?></label>
        <?php
        /**
         * Fires at the end of the Discussion meta box on the post editing screen.
@@ -671,6 +678,8 @@ function post_slug_meta_box($post) {
  *
  * @since 2.6.0
  *
+ * @global int $user_ID
+ *
  * @param object $post
  */
 function post_author_meta_box($post) {
@@ -739,20 +748,34 @@ function page_attributes_meta_box($post) {
 <?php
                } // end empty pages check
        } // end hierarchical check.
-       if ( 'page' == $post->post_type && 0 != count( get_page_templates( $post ) ) ) {
+       if ( 'page' == $post->post_type && 0 != count( get_page_templates( $post ) ) && get_option( 'page_for_posts' ) != $post->ID ) {
                $template = !empty($post->page_template) ? $post->page_template : false;
                ?>
 <p><strong><?php _e('Template') ?></strong></p>
 <label class="screen-reader-text" for="page_template"><?php _e('Page Template') ?></label><select name="page_template" id="page_template">
-<option value='default'><?php _e('Default Template'); ?></option>
+<?php
+/**
+ * Filter the title of the default page template displayed in the drop-down.
+ *
+ * @since 4.1.0
+ *
+ * @param string $label   The display value for the default page template title.
+ * @param string $context Where the option label is displayed. Possible values
+ *                        include 'meta-box' or 'quick-edit'.
+ */
+$default_title = apply_filters( 'default_page_template_title',  __( 'Default Template' ), 'meta-box' );
+?>
+<option value="default"><?php echo esc_html( $default_title ); ?></option>
 <?php page_template_dropdown($template); ?>
 </select>
 <?php
        } ?>
 <p><strong><?php _e('Order') ?></strong></p>
 <p><label class="screen-reader-text" for="menu_order"><?php _e('Order') ?></label><input name="menu_order" type="text" size="4" id="menu_order" value="<?php echo esc_attr($post->menu_order) ?>" /></p>
-<p><?php if ( 'page' == $post->post_type ) _e( 'Need help? Use the Help tab in the upper right of your screen.' ); ?></p>
+<?php if ( 'page' == $post->post_type && get_current_screen()->get_help_tabs() ) { ?>
+<p><?php _e( 'Need help? Use the Help tab in the upper right of your screen.' ); ?></p>
 <?php
+       }
 }
 
 // -- Link related Meta Boxes
@@ -800,15 +823,15 @@ do_action( 'post_submitbox_start' );
 <div id="delete-action">
 <?php
 if ( !empty($_GET['action']) && 'edit' == $_GET['action'] && current_user_can('manage_links') ) { ?>
-       <a class="submitdelete deletion" href="<?php echo wp_nonce_url("link.php?action=delete&amp;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>
+       <a class="submitdelete deletion" href="<?php echo wp_nonce_url("link.php?action=delete&amp;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>
 <?php } ?>
 </div>
 
 <div id="publishing-action">
 <?php if ( !empty($link->link_id) ) { ?>
-       <input name="save" type="submit" class="button-large button-primary" id="publish" accesskey="p" value="<?php esc_attr_e('Update Link') ?>" />
+       <input name="save" type="submit" class="button-large button-primary" id="publish" value="<?php esc_attr_e( 'Update Link' ) ?>" />
 <?php } else { ?>
-       <input name="save" type="submit" class="button-large button-primary" id="publish" accesskey="p" value="<?php esc_attr_e('Add Link') ?>" />
+       <input name="save" type="submit" class="button-large button-primary" id="publish" value="<?php esc_attr_e( 'Add Link' ) ?>" />
 <?php } ?>
 </div>
 <div class="clear"></div>
@@ -900,6 +923,8 @@ function link_target_meta_box($link) { ?>
  *
  * @since 1.0.1
  *
+ * @global object $link
+ *
  * @param string $class
  * @param string $value
  * @param mixed $deprecated Never used.