Make WordPress Core

Changeset 48041


Ignore:
Timestamp:
06/14/2020 04:29:33 PM (6 years ago)
Author:
ocean90
Message:

Coding Standards: Fix code indentation in post_submit_meta_box() to improve readability.

See #49542.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/meta-boxes.php

    r47808 r48041  
    3131        global $action;
    3232
     33        $post_id          = (int) $post->ID;
    3334        $post_type        = $post->post_type;
    3435        $post_type_object = get_post_type_object( $post_type );
     
    4041
    4142        <?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key. ?>
    42 <div style="display:none;">
    43         <?php submit_button( __( 'Save' ), '', 'save' ); ?>
    44 </div>
    45 
    46 <div id="minor-publishing-actions">
    47 <div id="save-action">
    48         <?php
    49         if ( ! in_array( $post->post_status, array( 'publish', 'future', 'pending' ), true ) ) {
    50                 $private_style = '';
    51                 if ( 'private' === $post->post_status ) {
    52                         $private_style = 'style="display:none"';
    53                 }
     43        <div style="display:none;">
     44                <?php submit_button( __( 'Save' ), '', 'save' ); ?>
     45        </div>
     46
     47        <div id="minor-publishing-actions">
     48                <div id="save-action">
     49                        <?php
     50                        if ( ! in_array( $post->post_status, array( 'publish', 'future', 'pending' ), true ) ) {
     51                                $private_style = '';
     52                                if ( 'private' === $post->post_status ) {
     53                                        $private_style = 'style="display:none"';
     54                                }
     55                                ?>
     56                                <input <?php echo $private_style; ?> type="submit" name="save" id="save-post" value="<?php esc_attr_e( 'Save Draft' ); ?>" class="button" />
     57                                <span class="spinner"></span>
     58                        <?php } elseif ( 'pending' === $post->post_status && $can_publish ) { ?>
     59                                <input type="submit" name="save" id="save-post" value="<?php esc_attr_e( 'Save as Pending' ); ?>" class="button" />
     60                                <span class="spinner"></span>
     61                        <?php } ?>
     62                </div>
     63
     64                <?php
     65                if ( is_post_type_viewable( $post_type_object ) ) :
     66                        ?>
     67                        <div id="preview-action">
     68                                <?php
     69                                $preview_link = esc_url( get_preview_post_link( $post ) );
     70                                if ( 'publish' === $post->post_status ) {
     71                                        $preview_button_text = __( 'Preview Changes' );
     72                                } else {
     73                                        $preview_button_text = __( 'Preview' );
     74                                }
     75
     76                                $preview_button = sprintf(
     77                                        '%1$s<span class="screen-reader-text"> %2$s</span>',
     78                                        $preview_button_text,
     79                                        /* translators: Accessibility text. */
     80                                        __( '(opens in a new tab)' )
     81                                );
     82                                ?>
     83                                <a class="preview button" href="<?php echo $preview_link; ?>" target="wp-preview-<?php echo $post_id; ?>" id="post-preview"><?php echo $preview_button; ?></a>
     84                                <input type="hidden" name="wp-preview" id="wp-preview" value="" />
     85                        </div>
     86                        <?php
     87                endif;
     88
     89                /**
     90                 * Fires before the post time/date setting in the Publish meta box.
     91                 *
     92                 * @since 4.4.0
     93                 *
     94                 * @param WP_Post $post WP_Post object for the current post.
     95                 */
     96                do_action( 'post_submitbox_minor_actions', $post );
    5497                ?>
    55 <input <?php echo $private_style; ?> type="submit" name="save" id="save-post" value="<?php esc_attr_e( 'Save Draft' ); ?>" class="button" />
    56 <span class="spinner"></span>
    57 <?php } elseif ( 'pending' === $post->post_status && $can_publish ) { ?>
    58 <input type="submit" name="save" id="save-post" value="<?php esc_attr_e( 'Save as Pending' ); ?>" class="button" />
    59 <span class="spinner"></span>
    60 <?php } ?>
    61 </div>
    62         <?php if ( is_post_type_viewable( $post_type_object ) ) : ?>
    63 <div id="preview-action">
    64                 <?php
    65                 $preview_link = esc_url( get_preview_post_link( $post ) );
    66                 if ( 'publish' === $post->post_status ) {
    67                         $preview_button_text = __( 'Preview Changes' );
    68                 } else {
    69                         $preview_button_text = __( 'Preview' );
    70                 }
    71 
    72                 $preview_button = sprintf(
    73                         '%1$s<span class="screen-reader-text"> %2$s</span>',
    74                         $preview_button_text,
    75                         /* translators: Accessibility text. */
    76                         __( '(opens in a new tab)' )
    77                 );
    78                 ?>
    79 <a class="preview button" href="<?php echo $preview_link; ?>" target="wp-preview-<?php echo (int) $post->ID; ?>" id="post-preview"><?php echo $preview_button; ?></a>
    80 <input type="hidden" name="wp-preview" id="wp-preview" value="" />
    81 </div>
    82 <?php endif; // is_post_type_viewable() ?>
    83         <?php
    84         /**
    85          * Fires before the post time/date setting in the Publish meta box.
    86          *
    87          * @since 4.4.0
    88          *
    89          * @param WP_Post $post WP_Post object for the current post.
    90          */
    91         do_action( 'post_submitbox_minor_actions', $post );
    92         ?>
    93 <div class="clear"></div>
    94 </div><!-- #minor-publishing-actions -->
    95 
    96 <div id="misc-publishing-actions">
    97 
    98 <div class="misc-pub-section misc-pub-post-status">
    99         <?php _e( 'Status:' ); ?> <span id="post-status-display">
     98                <div class="clear"></div>
     99        </div>
     100
     101        <div id="misc-publishing-actions">
     102                <div class="misc-pub-section misc-pub-post-status">
     103                        <?php _e( 'Status:' ); ?>
     104                        <span id="post-status-display">
     105                                <?php
     106                                switch ( $post->post_status ) {
     107                                        case 'private':
     108                                                _e( 'Privately Published' );
     109                                                break;
     110                                        case 'publish':
     111                                                _e( 'Published' );
     112                                                break;
     113                                        case 'future':
     114                                                _e( 'Scheduled' );
     115                                                break;
     116                                        case 'pending':
     117                                                _e( 'Pending Review' );
     118                                                break;
     119                                        case 'draft':
     120                                        case 'auto-draft':
     121                                                _e( 'Draft' );
     122                                                break;
     123                                }
     124                                ?>
     125                        </span>
     126
    100127                        <?php
    101 
    102                         switch ( $post->post_status ) {
    103                                 case 'private':
    104                                         _e( 'Privately Published' );
    105                                         break;
    106                                 case 'publish':
    107                                         _e( 'Published' );
    108                                         break;
    109                                 case 'future':
    110                                         _e( 'Scheduled' );
    111                                         break;
    112                                 case 'pending':
    113                                         _e( 'Pending Review' );
    114                                         break;
    115                                 case 'draft':
    116                                 case 'auto-draft':
    117                                         _e( 'Draft' );
    118                                         break;
     128                        if ( 'publish' === $post->post_status || 'private' === $post->post_status || $can_publish ) {
     129                                $private_style = '';
     130                                if ( 'private' === $post->post_status ) {
     131                                        $private_style = 'style="display:none"';
     132                                }
     133                                ?>
     134                                <a href="#post_status" <?php echo $private_style; ?> class="edit-post-status hide-if-no-js" role="button"><span aria-hidden="true"><?php _e( 'Edit' ); ?></span> <span class="screen-reader-text"><?php _e( 'Edit status' ); ?></span></a>
     135
     136                                <div id="post-status-select" class="hide-if-js">
     137                                        <input type="hidden" name="hidden_post_status" id="hidden_post_status" value="<?php echo esc_attr( ( 'auto-draft' === $post->post_status ) ? 'draft' : $post->post_status ); ?>" />
     138                                        <label for="post_status" class="screen-reader-text"><?php _e( 'Set status' ); ?></label>
     139                                        <select name="post_status" id="post_status">
     140                                                <?php if ( 'publish' === $post->post_status ) : ?>
     141                                                        <option<?php selected( $post->post_status, 'publish' ); ?> value='publish'><?php _e( 'Published' ); ?></option>
     142                                                <?php elseif ( 'private' === $post->post_status ) : ?>
     143                                                        <option<?php selected( $post->post_status, 'private' ); ?> value='publish'><?php _e( 'Privately Published' ); ?></option>
     144                                                <?php elseif ( 'future' === $post->post_status ) : ?>
     145                                                        <option<?php selected( $post->post_status, 'future' ); ?> value='future'><?php _e( 'Scheduled' ); ?></option>
     146                                                <?php endif; ?>
     147                                                        <option<?php selected( $post->post_status, 'pending' ); ?> value='pending'><?php _e( 'Pending Review' ); ?></option>
     148                                                <?php if ( 'auto-draft' === $post->post_status ) : ?>
     149                                                        <option<?php selected( $post->post_status, 'auto-draft' ); ?> value='draft'><?php _e( 'Draft' ); ?></option>
     150                                                <?php else : ?>
     151                                                        <option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php _e( 'Draft' ); ?></option>
     152                                                <?php endif; ?>
     153                                        </select>
     154                                        <a href="#post_status" class="save-post-status hide-if-no-js button"><?php _e( 'OK' ); ?></a>
     155                                        <a href="#post_status" class="cancel-post-status hide-if-no-js button-cancel"><?php _e( 'Cancel' ); ?></a>
     156                                </div>
     157                                <?php
    119158                        }
    120159                        ?>
    121 </span>
    122         <?php
    123         if ( 'publish' === $post->post_status || 'private' === $post->post_status || $can_publish ) {
    124                 $private_style = '';
    125                 if ( 'private' === $post->post_status ) {
    126                         $private_style = 'style="display:none"';
    127                 }
     160                </div>
     161
     162                <div class="misc-pub-section misc-pub-visibility" id="visibility">
     163                        <?php _e( 'Visibility:' ); ?>
     164                        <span id="post-visibility-display">
     165                                <?php
     166                                if ( 'private' === $post->post_status ) {
     167                                        $post->post_password = '';
     168                                        $visibility          = 'private';
     169                                        $visibility_trans    = __( 'Private' );
     170                                } elseif ( ! empty( $post->post_password ) ) {
     171                                        $visibility       = 'password';
     172                                        $visibility_trans = __( 'Password protected' );
     173                                } elseif ( 'post' === $post_type && is_sticky( $post_id ) ) {
     174                                        $visibility       = 'public';
     175                                        $visibility_trans = __( 'Public, Sticky' );
     176                                } else {
     177                                        $visibility       = 'public';
     178                                        $visibility_trans = __( 'Public' );
     179                                }
     180
     181                                echo esc_html( $visibility_trans );
     182                                ?>
     183                        </span>
     184
     185                        <?php if ( $can_publish ) { ?>
     186                                <a href="#visibility" class="edit-visibility hide-if-no-js" role="button"><span aria-hidden="true"><?php _e( 'Edit' ); ?></span> <span class="screen-reader-text"><?php _e( 'Edit visibility' ); ?></span></a>
     187
     188                                <div id="post-visibility-select" class="hide-if-js">
     189                                        <input type="hidden" name="hidden_post_password" id="hidden-post-password" value="<?php echo esc_attr( $post->post_password ); ?>" />
     190                                        <?php if ( 'post' === $post_type ) : ?>
     191                                                <input type="checkbox" style="display:none" name="hidden_post_sticky" id="hidden-post-sticky" value="sticky" <?php checked( is_sticky( $post_id ) ); ?> />
     192                                        <?php endif; ?>
     193
     194                                        <input type="hidden" name="hidden_post_visibility" id="hidden-post-visibility" value="<?php echo esc_attr( $visibility ); ?>" />
     195                                        <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 />
     196
     197                                        <?php if ( 'post' === $post_type && current_user_can( 'edit_others_posts' ) ) : ?>
     198                                                <span id="sticky-span"><input id="sticky" name="sticky" type="checkbox" value="sticky" <?php checked( is_sticky( $post_id ) ); ?> /> <label for="sticky" class="selectit"><?php _e( 'Stick this post to the front page' ); ?></label><br /></span>
     199                                        <?php endif; ?>
     200
     201                                        <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 />
     202                                        <span id="password-span"><label for="post_password"><?php _e( 'Password:' ); ?></label> <input type="text" name="post_password" id="post_password" value="<?php echo esc_attr( $post->post_password ); ?>"  maxlength="255" /><br /></span>
     203
     204                                        <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 />
     205
     206                                        <p>
     207                                                <a href="#visibility" class="save-post-visibility hide-if-no-js button"><?php _e( 'OK' ); ?></a>
     208                                                <a href="#visibility" class="cancel-post-visibility hide-if-no-js button-cancel"><?php _e( 'Cancel' ); ?></a>
     209                                        </p>
     210                                </div>
     211                        <?php } ?>
     212                </div>
     213
     214                <?php
     215                /* translators: Publish box date string. 1: Date, 2: Time. See https://www.php.net/date */
     216                $date_string = __( '%1$s at %2$s' );
     217                /* translators: Publish box date format, see https://www.php.net/date */
     218                $date_format = _x( 'M j, Y', 'publish box date format' );
     219                /* translators: Publish box time format, see https://www.php.net/date */
     220                $time_format = _x( 'H:i', 'publish box time format' );
     221
     222                if ( 0 !== $post_id ) {
     223                        if ( 'future' === $post->post_status ) { // Scheduled for publishing at a future date.
     224                                /* translators: Post date information. %s: Date on which the post is currently scheduled to be published. */
     225                                $stamp = __( 'Scheduled for: %s' );
     226                        } elseif ( 'publish' === $post->post_status || 'private' === $post->post_status ) { // Already published.
     227                                /* translators: Post date information. %s: Date on which the post was published. */
     228                                $stamp = __( 'Published on: %s' );
     229                        } elseif ( '0000-00-00 00:00:00' === $post->post_date_gmt ) { // Draft, 1 or more saves, no date specified.
     230                                $stamp = __( 'Publish <b>immediately</b>' );
     231                        } elseif ( time() < strtotime( $post->post_date_gmt . ' +0000' ) ) { // Draft, 1 or more saves, future date specified.
     232                                /* translators: Post date information. %s: Date on which the post is to be published. */
     233                                $stamp = __( 'Schedule for: %s' );
     234                        } else { // Draft, 1 or more saves, date specified.
     235                                /* translators: Post date information. %s: Date on which the post is to be published. */
     236                                $stamp = __( 'Publish on: %s' );
     237                        }
     238                        $date = sprintf(
     239                                $date_string,
     240                                date_i18n( $date_format, strtotime( $post->post_date ) ),
     241                                date_i18n( $time_format, strtotime( $post->post_date ) )
     242                        );
     243                } else { // Draft (no saves, and thus no date specified).
     244                        $stamp = __( 'Publish <b>immediately</b>' );
     245                        $date  = sprintf(
     246                                $date_string,
     247                                date_i18n( $date_format, strtotime( current_time( 'mysql' ) ) ),
     248                                date_i18n( $time_format, strtotime( current_time( 'mysql' ) ) )
     249                        );
     250                }
     251
     252                if ( ! empty( $args['args']['revisions_count'] ) ) :
     253                        ?>
     254                        <div class="misc-pub-section misc-pub-revisions">
     255                                <?php
     256                                /* translators: Post revisions heading. %s: The number of available revisions. */
     257                                printf( __( 'Revisions: %s' ), '<b>' . number_format_i18n( $args['args']['revisions_count'] ) . '</b>' );
     258                                ?>
     259                                <a class="hide-if-no-js" href="<?php echo esc_url( get_edit_post_link( $args['args']['revision_id'] ) ); ?>"><span aria-hidden="true"><?php _ex( 'Browse', 'revisions' ); ?></span> <span class="screen-reader-text"><?php _e( 'Browse revisions' ); ?></span></a>
     260                        </div>
     261                        <?php
     262                endif;
     263
     264                if ( $can_publish ) : // Contributors don't get to choose the date of publish.
     265                        ?>
     266                        <div class="misc-pub-section curtime misc-pub-curtime">
     267                                <span id="timestamp">
     268                                        <?php printf( $stamp, '<b>' . $date . '</b>' ); ?>
     269                                </span>
     270                                <a href="#edit_timestamp" class="edit-timestamp hide-if-no-js" role="button">
     271                                        <span aria-hidden="true"><?php _e( 'Edit' ); ?></span>
     272                                        <span class="screen-reader-text"><?php _e( 'Edit date and time' ); ?></span>
     273                                </a>
     274                                <fieldset id="timestampdiv" class="hide-if-js">
     275                                        <legend class="screen-reader-text"><?php _e( 'Date and time' ); ?></legend>
     276                                        <?php touch_time( ( 'edit' === $action ), 1 ); ?>
     277                                </fieldset>
     278                        </div>
     279                        <?php
     280                endif;
     281
     282                if ( 'draft' === $post->post_status && get_post_meta( $post_id, '_customize_changeset_uuid', true ) ) :
     283                        ?>
     284                        <div class="notice notice-info notice-alt inline">
     285                                <p>
     286                                        <?php
     287                                        printf(
     288                                                /* translators: %s: URL to the Customizer. */
     289                                                __( 'This draft comes from your <a href="%s">unpublished customization changes</a>. You can edit, but there&#8217;s no need to publish now. It will be published automatically with those changes.' ),
     290                                                esc_url(
     291                                                        add_query_arg(
     292                                                                'changeset_uuid',
     293                                                                rawurlencode( get_post_meta( $post_id, '_customize_changeset_uuid', true ) ),
     294                                                                admin_url( 'customize.php' )
     295                                                        )
     296                                                )
     297                                        );
     298                                        ?>
     299                                </p>
     300                        </div>
     301                        <?php
     302                endif;
     303
     304                /**
     305                 * Fires after the post time/date setting in the Publish meta box.
     306                 *
     307                 * @since 2.9.0
     308                 * @since 4.4.0 Added the `$post` parameter.
     309                 *
     310                 * @param WP_Post $post WP_Post object for the current post.
     311                 */
     312                do_action( 'post_submitbox_misc_actions', $post );
    128313                ?>
    129 <a href="#post_status" <?php echo $private_style; ?> class="edit-post-status hide-if-no-js" role="button"><span aria-hidden="true"><?php _e( 'Edit' ); ?></span> <span class="screen-reader-text"><?php _e( 'Edit status' ); ?></span></a>
    130 
    131 <div id="post-status-select" class="hide-if-js">
    132 <input type="hidden" name="hidden_post_status" id="hidden_post_status" value="<?php echo esc_attr( ( 'auto-draft' === $post->post_status ) ? 'draft' : $post->post_status ); ?>" />
    133 <label for="post_status" class="screen-reader-text"><?php _e( 'Set status' ); ?></label>
    134 <select name="post_status" id="post_status">
    135                 <?php if ( 'publish' === $post->post_status ) : ?>
    136 <option<?php selected( $post->post_status, 'publish' ); ?> value='publish'><?php _e( 'Published' ); ?></option>
    137 <?php elseif ( 'private' === $post->post_status ) : ?>
    138 <option<?php selected( $post->post_status, 'private' ); ?> value='publish'><?php _e( 'Privately Published' ); ?></option>
    139 <?php elseif ( 'future' === $post->post_status ) : ?>
    140 <option<?php selected( $post->post_status, 'future' ); ?> value='future'><?php _e( 'Scheduled' ); ?></option>
    141 <?php endif; ?>
    142 <option<?php selected( $post->post_status, 'pending' ); ?> value='pending'><?php _e( 'Pending Review' ); ?></option>
    143                 <?php if ( 'auto-draft' === $post->post_status ) : ?>
    144 <option<?php selected( $post->post_status, 'auto-draft' ); ?> value='draft'><?php _e( 'Draft' ); ?></option>
    145 <?php else : ?>
    146 <option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php _e( 'Draft' ); ?></option>
    147 <?php endif; ?>
    148 </select>
    149 <a href="#post_status" class="save-post-status hide-if-no-js button"><?php _e( 'OK' ); ?></a>
    150 <a href="#post_status" class="cancel-post-status hide-if-no-js button-cancel"><?php _e( 'Cancel' ); ?></a>
    151 </div>
    152 
    153 <?php } ?>
    154 </div><!-- .misc-pub-section -->
    155 
    156 <div class="misc-pub-section misc-pub-visibility" id="visibility">
    157         <?php _e( 'Visibility:' ); ?> <span id="post-visibility-display">
    158                                                         <?php
    159 
    160                                                         if ( 'private' === $post->post_status ) {
    161                                                                 $post->post_password = '';
    162                                                                 $visibility          = 'private';
    163                                                                 $visibility_trans    = __( 'Private' );
    164                                                         } elseif ( ! empty( $post->post_password ) ) {
    165                                                                 $visibility       = 'password';
    166                                                                 $visibility_trans = __( 'Password protected' );
    167                                                         } elseif ( 'post' === $post_type && is_sticky( $post->ID ) ) {
    168                                                                 $visibility       = 'public';
    169                                                                 $visibility_trans = __( 'Public, Sticky' );
    170                                                         } else {
    171                                                                 $visibility       = 'public';
    172                                                                 $visibility_trans = __( 'Public' );
    173                                                         }
    174 
    175                                                         echo esc_html( $visibility_trans );
    176                                                         ?>
    177 </span>
    178         <?php if ( $can_publish ) { ?>
    179 <a href="#visibility" class="edit-visibility hide-if-no-js" role="button"><span aria-hidden="true"><?php _e( 'Edit' ); ?></span> <span class="screen-reader-text"><?php _e( 'Edit visibility' ); ?></span></a>
    180 
    181 <div id="post-visibility-select" class="hide-if-js">
    182 <input type="hidden" name="hidden_post_password" id="hidden-post-password" value="<?php echo esc_attr( $post->post_password ); ?>" />
    183                 <?php if ( 'post' === $post_type ) : ?>
    184 <input type="checkbox" style="display:none" name="hidden_post_sticky" id="hidden-post-sticky" value="sticky" <?php checked( is_sticky( $post->ID ) ); ?> />
    185 <?php endif; ?>
    186 <input type="hidden" name="hidden_post_visibility" id="hidden-post-visibility" value="<?php echo esc_attr( $visibility ); ?>" />
    187 <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 />
    188                 <?php if ( 'post' === $post_type && current_user_can( 'edit_others_posts' ) ) : ?>
    189 <span id="sticky-span"><input id="sticky" name="sticky" type="checkbox" value="sticky" <?php checked( is_sticky( $post->ID ) ); ?> /> <label for="sticky" class="selectit"><?php _e( 'Stick this post to the front page' ); ?></label><br /></span>
    190 <?php endif; ?>
    191 <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 />
    192 <span id="password-span"><label for="post_password"><?php _e( 'Password:' ); ?></label> <input type="text" name="post_password" id="post_password" value="<?php echo esc_attr( $post->post_password ); ?>"  maxlength="255" /><br /></span>
    193 <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 />
    194 
    195 <p>
    196         <a href="#visibility" class="save-post-visibility hide-if-no-js button"><?php _e( 'OK' ); ?></a>
    197         <a href="#visibility" class="cancel-post-visibility hide-if-no-js button-cancel"><?php _e( 'Cancel' ); ?></a>
    198 </p>
    199 </div>
    200 <?php } ?>
    201 
    202 </div><!-- .misc-pub-section -->
    203 
    204         <?php
    205         /* translators: Publish box date string. 1: Date, 2: Time. See https://www.php.net/date */
    206         $date_string = __( '%1$s at %2$s' );
    207         /* translators: Publish box date format, see https://www.php.net/date */
    208         $date_format = _x( 'M j, Y', 'publish box date format' );
    209         /* translators: Publish box time format, see https://www.php.net/date */
    210         $time_format = _x( 'H:i', 'publish box time format' );
    211 
    212         if ( 0 != $post->ID ) {
    213                 if ( 'future' === $post->post_status ) { // Scheduled for publishing at a future date.
    214                         /* translators: Post date information. %s: Date on which the post is currently scheduled to be published. */
    215                         $stamp = __( 'Scheduled for: %s' );
    216                 } elseif ( 'publish' === $post->post_status || 'private' === $post->post_status ) { // Already published.
    217                         /* translators: Post date information. %s: Date on which the post was published. */
    218                         $stamp = __( 'Published on: %s' );
    219                 } elseif ( '0000-00-00 00:00:00' === $post->post_date_gmt ) { // Draft, 1 or more saves, no date specified.
    220                         $stamp = __( 'Publish <b>immediately</b>' );
    221                 } elseif ( time() < strtotime( $post->post_date_gmt . ' +0000' ) ) { // Draft, 1 or more saves, future date specified.
    222                         /* translators: Post date information. %s: Date on which the post is to be published. */
    223                         $stamp = __( 'Schedule for: %s' );
    224                 } else { // Draft, 1 or more saves, date specified.
    225                         /* translators: Post date information. %s: Date on which the post is to be published. */
    226                         $stamp = __( 'Publish on: %s' );
    227                 }
    228                 $date = sprintf(
    229                         $date_string,
    230                         date_i18n( $date_format, strtotime( $post->post_date ) ),
    231                         date_i18n( $time_format, strtotime( $post->post_date ) )
    232                 );
    233         } else { // Draft (no saves, and thus no date specified).
    234                 $stamp = __( 'Publish <b>immediately</b>' );
    235                 $date  = sprintf(
    236                         $date_string,
    237                         date_i18n( $date_format, strtotime( current_time( 'mysql' ) ) ),
    238                         date_i18n( $time_format, strtotime( current_time( 'mysql' ) ) )
    239                 );
    240         }
    241 
    242         if ( ! empty( $args['args']['revisions_count'] ) ) :
    243                 ?>
    244 <div class="misc-pub-section misc-pub-revisions">
    245                 <?php
    246                 /* translators: Post revisions heading. %s: The number of available revisions. */
    247                 printf( __( 'Revisions: %s' ), '<b>' . number_format_i18n( $args['args']['revisions_count'] ) . '</b>' );
    248                 ?>
    249         <a class="hide-if-no-js" href="<?php echo esc_url( get_edit_post_link( $args['args']['revision_id'] ) ); ?>"><span aria-hidden="true"><?php _ex( 'Browse', 'revisions' ); ?></span> <span class="screen-reader-text"><?php _e( 'Browse revisions' ); ?></span></a>
    250 </div>
    251                 <?php
    252 endif;
    253 
    254         if ( $can_publish ) : // Contributors don't get to choose the date of publish.
    255                 ?>
    256 <div class="misc-pub-section curtime misc-pub-curtime">
    257         <span id="timestamp">
    258                 <?php printf( $stamp, '<b>' . $date . '</b>' ); ?>
    259         </span>
    260         <a href="#edit_timestamp" class="edit-timestamp hide-if-no-js" role="button">
    261                 <span aria-hidden="true"><?php _e( 'Edit' ); ?></span>
    262                 <span class="screen-reader-text"><?php _e( 'Edit date and time' ); ?></span>
    263         </a>
    264         <fieldset id="timestampdiv" class="hide-if-js">
    265                 <legend class="screen-reader-text"><?php _e( 'Date and time' ); ?></legend>
    266                 <?php touch_time( ( 'edit' === $action ), 1 ); ?>
    267         </fieldset>
    268 </div><?php // /misc-pub-section ?>
    269 <?php endif; ?>
    270 
    271         <?php if ( 'draft' === $post->post_status && get_post_meta( $post->ID, '_customize_changeset_uuid', true ) ) : ?>
    272         <div class="notice notice-info notice-alt inline">
    273                 <p>
    274                         <?php
    275                         echo sprintf(
    276                                 /* translators: %s: URL to the Customizer. */
    277                                 __( 'This draft comes from your <a href="%s">unpublished customization changes</a>. You can edit, but there&#8217;s no need to publish now. It will be published automatically with those changes.' ),
    278                                 esc_url(
    279                                         add_query_arg(
    280                                                 'changeset_uuid',
    281                                                 rawurlencode( get_post_meta( $post->ID, '_customize_changeset_uuid', true ) ),
    282                                                 admin_url( 'customize.php' )
    283                                         )
    284                                 )
    285                         );
    286                         ?>
    287                 </p>
    288314        </div>
    289         <?php endif; ?>
    290 
    291         <?php
    292         /**
    293          * Fires after the post time/date setting in the Publish meta box.
    294          *
    295          * @since 2.9.0
    296          * @since 4.4.0 Added the `$post` parameter.
    297          *
    298          * @param WP_Post $post WP_Post object for the current post.
    299          */
    300         do_action( 'post_submitbox_misc_actions', $post );
    301         ?>
    302 </div>
    303 <div class="clear"></div>
     315        <div class="clear"></div>
    304316</div>
    305317
     
    317329        do_action( 'post_submitbox_start', $post );
    318330        ?>
    319 <div id="delete-action">
    320         <?php
    321         if ( current_user_can( 'delete_post', $post->ID ) ) {
    322                 if ( ! EMPTY_TRASH_DAYS ) {
    323                         $delete_text = __( 'Delete Permanently' );
     331        <div id="delete-action">
     332                <?php
     333                if ( current_user_can( 'delete_post', $post_id ) ) {
     334                        if ( ! EMPTY_TRASH_DAYS ) {
     335                                $delete_text = __( 'Delete Permanently' );
     336                        } else {
     337                                $delete_text = __( 'Move to Trash' );
     338                        }
     339                        ?>
     340                        <a class="submitdelete deletion" href="<?php echo get_delete_post_link( $post_id ); ?>"><?php echo $delete_text; ?></a>
     341                        <?php
     342                }
     343                ?>
     344        </div>
     345
     346        <div id="publishing-action">
     347                <span class="spinner"></span>
     348                <?php
     349                if ( ! in_array( $post->post_status, array( 'publish', 'future', 'private' ), true ) || 0 === $post_id ) {
     350                        if ( $can_publish ) :
     351                                if ( ! empty( $post->post_date_gmt ) && time() < strtotime( $post->post_date_gmt . ' +0000' ) ) :
     352                                        ?>
     353                                        <input name="original_publish" type="hidden" id="original_publish" value="<?php echo esc_attr_x( 'Schedule', 'post action/button label' ); ?>" />
     354                                        <?php submit_button( _x( 'Schedule', 'post action/button label' ), 'primary large', 'publish', false ); ?>
     355                                        <?php
     356                                else :
     357                                        ?>
     358                                        <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e( 'Publish' ); ?>" />
     359                                        <?php submit_button( __( 'Publish' ), 'primary large', 'publish', false ); ?>
     360                                        <?php
     361                                endif;
     362                        else :
     363                                ?>
     364                                <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e( 'Submit for Review' ); ?>" />
     365                                <?php submit_button( __( 'Submit for Review' ), 'primary large', 'publish', false ); ?>
     366                                <?php
     367                        endif;
    324368                } else {
    325                         $delete_text = __( 'Move to Trash' );
     369                        ?>
     370                        <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e( 'Update' ); ?>" />
     371                        <?php submit_button( __( 'Update' ), 'primary large', 'save', false, array( 'id' => 'publish' ) ); ?>
     372                        <?php
    326373                }
    327374                ?>
    328 <a class="submitdelete deletion" href="<?php echo get_delete_post_link( $post->ID ); ?>"><?php echo $delete_text; ?></a>
    329                                                                                                         <?php
    330         }
    331         ?>
    332 </div>
    333 
    334 <div id="publishing-action">
    335 <span class="spinner"></span>
    336         <?php
    337         if ( ! in_array( $post->post_status, array( 'publish', 'future', 'private' ), true ) || 0 == $post->ID ) {
    338                 if ( $can_publish ) :
    339                         if ( ! empty( $post->post_date_gmt ) && time() < strtotime( $post->post_date_gmt . ' +0000' ) ) :
    340                                 ?>
    341                 <input name="original_publish" type="hidden" id="original_publish" value="<?php echo esc_attr_x( 'Schedule', 'post action/button label' ); ?>" />
    342                                 <?php submit_button( _x( 'Schedule', 'post action/button label' ), 'primary large', 'publish', false ); ?>
    343         <?php   else : ?>
    344                 <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e( 'Publish' ); ?>" />
    345                 <?php submit_button( __( 'Publish' ), 'primary large', 'publish', false ); ?>
    346                 <?php
    347         endif;
    348         else :
    349                 ?>
    350                 <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e( 'Submit for Review' ); ?>" />
    351                 <?php submit_button( __( 'Submit for Review' ), 'primary large', 'publish', false ); ?>
    352                 <?php
    353                 endif;
    354         } else {
    355                 ?>
    356                 <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e( 'Update' ); ?>" />
    357                 <input name="save" type="submit" class="button button-primary button-large" id="publish" value="<?php esc_attr_e( 'Update' ); ?>" />
    358                 <?php
    359         }
    360         ?>
    361 </div>
    362 <div class="clear"></div>
    363 </div>
    364 </div>
    365 
     375        </div>
     376        <div class="clear"></div>
     377</div>
     378
     379</div>
    366380        <?php
    367381}
Note: See TracChangeset for help on using the changeset viewer.