WordPress.org

Make WordPress Core

Ticket #23352: publish-options-box.diff

File publish-options-box.diff, 10.8 KB (added by adamsilverstein, 5 years ago)

breakout publish options box

  • wp-admin/includes/meta-boxes.php

     
    11<?php
    2 
    32// -- Post related Meta Boxes
    4 
    53/**
    64 * Display post submit form fields.
    75 *
     
    5351<div class="clear"></div>
    5452</div><!-- #minor-publishing-actions -->
    5553
    56 <div id="misc-publishing-actions">
    5754
    58 <div class="misc-pub-section"><label for="post_status"><?php _e('Status:') ?></label>
    59 <span id="post-status-display">
     55</div>
     56
     57<div id="major-publishing-actions">
     58<?php do_action('post_submitbox_start'); ?>
     59<div id="delete-action">
    6060<?php
    61 switch ( $post->post_status ) {
    62         case 'private':
    63                 _e('Privately Published');
    64                 break;
    65         case 'publish':
    66                 _e('Published');
    67                 break;
    68         case 'future':
    69                 _e('Scheduled');
    70                 break;
    71         case 'pending':
    72                 _e('Pending Review');
    73                 break;
    74         case 'draft':
    75         case 'auto-draft':
    76                 _e('Draft');
    77                 break;
    78 }
    79 ?>
    80 </span>
    81 <?php if ( 'publish' == $post->post_status || 'private' == $post->post_status || $can_publish ) { ?>
    82 <a href="#post_status" <?php if ( 'private' == $post->post_status ) { ?>style="display:none;" <?php } ?>class="edit-post-status hide-if-no-js"><?php _e('Edit') ?></a>
     61if ( current_user_can( "delete_post", $post->ID ) ) {
     62        if ( !EMPTY_TRASH_DAYS )
     63                $delete_text = __('Delete Permanently');
     64        else
     65                $delete_text = __('Move to Trash');
     66        ?>
     67<a class="submitdelete deletion" href="<?php echo get_delete_post_link($post->ID); ?>"><?php echo $delete_text; ?></a><?php
     68} ?>
     69</div>
    8370
    84 <div id="post-status-select" class="hide-if-js">
    85 <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); ?>" />
    86 <select name='post_status' id='post_status'>
    87 <?php if ( 'publish' == $post->post_status ) : ?>
    88 <option<?php selected( $post->post_status, 'publish' ); ?> value='publish'><?php _e('Published') ?></option>
    89 <?php elseif ( 'private' == $post->post_status ) : ?>
    90 <option<?php selected( $post->post_status, 'private' ); ?> value='publish'><?php _e('Privately Published') ?></option>
    91 <?php elseif ( 'future' == $post->post_status ) : ?>
    92 <option<?php selected( $post->post_status, 'future' ); ?> value='future'><?php _e('Scheduled') ?></option>
    93 <?php endif; ?>
    94 <option<?php selected( $post->post_status, 'pending' ); ?> value='pending'><?php _e('Pending Review') ?></option>
    95 <?php if ( 'auto-draft' == $post->post_status ) : ?>
    96 <option<?php selected( $post->post_status, 'auto-draft' ); ?> value='draft'><?php _e('Draft') ?></option>
    97 <?php else : ?>
    98 <option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php _e('Draft') ?></option>
    99 <?php endif; ?>
    100 </select>
    101  <a href="#post_status" class="save-post-status hide-if-no-js button"><?php _e('OK'); ?></a>
    102  <a href="#post_status" class="cancel-post-status hide-if-no-js"><?php _e('Cancel'); ?></a>
     71<div id="publishing-action">
     72<span class="spinner"></span>
     73<?php
     74if ( !in_array( $post->post_status, array('publish', 'future', 'private') ) || 0 == $post->ID ) {
     75        if ( $can_publish ) :
     76                if ( !empty($post->post_date_gmt) && time() < strtotime( $post->post_date_gmt . ' +0000' ) ) : ?>
     77                <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Schedule') ?>" />
     78                <?php submit_button( __( 'Schedule' ), 'primary button-large', 'publish', false, array( 'accesskey' => 'p' ) ); ?>
     79<?php   else : ?>
     80                <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Publish') ?>" />
     81                <?php submit_button( __( 'Publish' ), 'primary button-large', 'publish', false, array( 'accesskey' => 'p' ) ); ?>
     82<?php   endif;
     83        else : ?>
     84                <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Submit for Review') ?>" />
     85                <?php submit_button( __( 'Submit for Review' ), 'primary button-large', 'publish', false, array( 'accesskey' => 'p' ) ); ?>
     86<?php
     87        endif;
     88} else { ?>
     89                <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Update') ?>" />
     90                <input name="save" type="submit" class="button button-primary button-large" id="publish" accesskey="p" value="<?php esc_attr_e('Update') ?>" />
     91<?php
     92} ?>
    10393</div>
     94<div class="clear"></div>
     95</div>
     96</div>
    10497
    105 <?php } ?>
    106 </div><!-- .misc-pub-section -->
     98<?php
     99}
     100/**
     101 * Display post submit option fields.
     102 *
     103 * @since 3.6
     104 *
     105 * @param object $post
     106 */
     107function post_submit_options_meta_box($post) {
    107108
     109        $post_type = $post->post_type;
     110        $post_type_object = get_post_type_object($post_type);
     111        $can_publish = current_user_can($post_type_object->cap->publish_posts);
     112        ?>
     113        <div class="submitbox" id="submitpost">
     114                <div id="misc-publishing-actions">
     115                <div class="misc-pub-section">
     116                        <label for="post_status"><?php _e('Status:') ?></label>
     117                <span id="post-status-display">
     118        <?php
     119                switch ( $post->post_status ) {
     120                        case 'private':
     121                                _e('Privately Published');
     122                                break;
     123                        case 'publish':
     124                                _e('Published');
     125                                break;
     126                        case 'future':
     127                                _e('Scheduled');
     128                                break;
     129                        case 'pending':
     130                                _e('Pending Review');
     131                                break;
     132                        case 'draft':
     133                        case 'auto-draft':
     134                                _e('Draft');
     135                                break;
     136                }
     137        ?>
     138                </span>
     139        <?php if ( 'publish' == $post->post_status || 'private' == $post->post_status || $can_publish ) { ?>
     140                <a href="#post_status" <?php if ( 'private' == $post->post_status ) { ?>style="display:none;" <?php } ?>class="edit-post-status hide-if-no-js"><?php _e('Edit') ?></a>
     141                        <div id="post-status-select" class="hide-if-js">
     142                                <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); ?>" />
     143                                <select name='post_status' id='post_status'>
     144                                <?php if ( 'publish' == $post->post_status ) : ?>
     145                                        <option<?php selected( $post->post_status, 'publish' ); ?> value='publish'><?php _e('Published') ?></option>
     146                                <?php elseif ( 'private' == $post->post_status ) : ?>
     147                                        <option<?php selected( $post->post_status, 'private' ); ?> value='publish'><?php _e('Privately Published') ?></option>
     148                                <?php elseif ( 'future' == $post->post_status ) : ?>
     149                                        <option<?php selected( $post->post_status, 'future' ); ?> value='future'><?php _e('Scheduled') ?></option>
     150                                <?php endif; ?>
     151                                <option<?php selected( $post->post_status, 'pending' ); ?> value='pending'><?php _e('Pending Review') ?></option>
     152                                <?php if ( 'auto-draft' == $post->post_status ) : ?>
     153                                        <option<?php selected( $post->post_status, 'auto-draft' ); ?> value='draft'><?php _e('Draft') ?></option>
     154                                <?php else : ?>
     155                                        <option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php _e('Draft') ?></option>
     156                                <?php endif; ?>
     157                                </select>
     158                                 <a href="#post_status" class="save-post-status hide-if-no-js button"><?php _e('OK'); ?></a>
     159                                 <a href="#post_status" class="cancel-post-status hide-if-no-js"><?php _e('Cancel'); ?></a>
     160                        </div>
     161                <?php
     162                }
     163                ?>
     164        </div><!-- .misc-pub-section -->
     165
    108166<div class="misc-pub-section" id="visibility">
    109167<?php _e('Visibility:'); ?> <span id="post-visibility-display"><?php
    110168
     
    178236        <a href="#edit_timestamp" class="edit-timestamp hide-if-no-js"><?php _e('Edit') ?></a>
    179237        <div id="timestampdiv" class="hide-if-js"><?php touch_time(($action == 'edit'), 1); ?></div>
    180238</div><?php // /misc-pub-section ?>
    181 <?php endif; ?>
     239<?php endif;
    182240
    183 <?php do_action('post_submitbox_misc_actions'); ?>
    184 </div>
     241        $the_revisions = wp_get_post_revisions( $post->ID );
     242        $revision_count = count( $the_revisions );
     243        if ( post_type_supports( $post_type, 'revisions' ) && 0 < $revision_count ) :
     244?>
     245<div id="major-publishing-actions" >
     246        <span id="revisions-link"><?php printf( _n( '%d Revision', '%d Revisions', $revision_count ), $revision_count ); ?></span>
     247        <a href="revision.php?revision=<?php echo key( $the_revisions ) ?>&action=edit" class="edit-revisions hide-if-no-js"><?php _e( 'View' ) ?></a>
    185248<div class="clear"></div>
    186249</div>
    187 
    188 <div id="major-publishing-actions">
    189 <?php do_action('post_submitbox_start'); ?>
    190 <div id="delete-action">
    191 <?php
    192 if ( current_user_can( "delete_post", $post->ID ) ) {
    193         if ( !EMPTY_TRASH_DAYS )
    194                 $delete_text = __('Delete Permanently');
    195         else
    196                 $delete_text = __('Move to Trash');
    197         ?>
    198 <a class="submitdelete deletion" href="<?php echo get_delete_post_link($post->ID); ?>"><?php echo $delete_text; ?></a><?php
    199 } ?>
    200250</div>
    201 
    202 <div id="publishing-action">
    203 <span class="spinner"></span>
    204 <?php
    205 if ( !in_array( $post->post_status, array('publish', 'future', 'private') ) || 0 == $post->ID ) {
    206         if ( $can_publish ) :
    207                 if ( !empty($post->post_date_gmt) && time() < strtotime( $post->post_date_gmt . ' +0000' ) ) : ?>
    208                 <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Schedule') ?>" />
    209                 <?php submit_button( __( 'Schedule' ), 'primary button-large', 'publish', false, array( 'accesskey' => 'p' ) ); ?>
    210 <?php   else : ?>
    211                 <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Publish') ?>" />
    212                 <?php submit_button( __( 'Publish' ), 'primary button-large', 'publish', false, array( 'accesskey' => 'p' ) ); ?>
    213 <?php   endif;
    214         else : ?>
    215                 <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Submit for Review') ?>" />
    216                 <?php submit_button( __( 'Submit for Review' ), 'primary button-large', 'publish', false, array( 'accesskey' => 'p' ) ); ?>
    217 <?php
    218         endif;
    219 } else { ?>
    220                 <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Update') ?>" />
    221                 <input name="save" type="submit" class="button button-primary button-large" id="publish" accesskey="p" value="<?php esc_attr_e('Update') ?>" />
    222 <?php
    223 } ?>
     251<?php endif; ?>
     252<?php do_action('post_submitbox_misc_actions'); ?>
    224253</div>
    225 <div class="clear"></div>
    226 </div>
    227 </div>
    228 
    229254<?php
    230255}
    231256
  • wp-admin/edit-form-advanced.php

     
    110110        add_action( 'edit_form_after_title', 'edit_form_image_editor' );
    111111} else {
    112112        add_meta_box( 'submitdiv', __( 'Publish' ), 'post_submit_meta_box', null, 'side', 'core' );
     113        add_meta_box( 'submitoptionsdiv', __( 'Publish Options' ), 'post_submit_options_meta_box', null, 'side', 'core' );
    113114}
    114115
    115116if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post_type, 'post-formats' ) )
  • wp-admin/css/wp-admin.css

     
    10411041}
    10421042
    10431043#minor-publishing-actions {
    1044         padding: 10px 10px 2px 8px;
     1044        padding: 10px 10px 10px 10px;
    10451045        text-align: right;
    10461046}
    10471047