Make WordPress Core

Ticket #12706: 12706.8.patch

File 12706.8.patch, 6.3 KB (added by Mosterd3d, 7 years ago)

Final local tested

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

    diff --git a/wp-admin/includes/meta-boxes.php b/wp-admin/includes/meta-boxes.php
    index 703c1ab..586b04f 100644
    a b function post_submit_meta_box( $post, $args = array() ) { 
    3838<div id="minor-publishing-actions">
    3939<div id="save-action">
    4040<?php
    41 if ( 'publish' != $post->post_status && 'future' != $post->post_status && 'pending' != $post->post_status ) {
    42         $private_style = '';
    43         if ( 'private' == $post->post_status ) {
    44                 $private_style = 'style="display:none"';
    45         }
     41    $btnHideArray = array("publish","future","private");
     42    if ( !in_array( $post->post_status, $btnHideArray ) ) {
     43        submit_button('Save '.ucfirst($post->post_status),'secondary','save',false,array( 'id' => 'save-post' ));
     44    }
    4645?>
    47 <input <?php echo $private_style; ?> type="submit" name="save" id="save-post" value="<?php esc_attr_e( 'Save Draft' ); ?>" class="button" />
    48 <span class="spinner"></span>
    49 <?php } elseif ( 'pending' == $post->post_status && $can_publish ) { ?>
    50 <input type="submit" name="save" id="save-post" value="<?php esc_attr_e( 'Save as Pending' ); ?>" class="button" />
    5146<span class="spinner"></span>
    52 <?php } ?>
    5347</div>
    5448<?php if ( is_post_type_viewable( $post_type_object ) ) : ?>
    5549<div id="preview-action">
    do_action( 'post_submitbox_minor_actions', $post ); 
    8983
    9084<div class="misc-pub-section misc-pub-post-status">
    9185<?php _e( 'Status:' ); ?> <span id="post-status-display">
    92                         <?php
     86<?php
    9387
    94                         switch ( $post->post_status ) {
    95                                 case 'private':
    96                                         _e( 'Privately Published' );
    97                                         break;
    98                                 case 'publish':
    99                                         _e( 'Published' );
    100                                         break;
    101                                 case 'future':
    102                                         _e( 'Scheduled' );
    103                                         break;
    104                                 case 'pending':
    105                                         _e( 'Pending Review' );
    106                                         break;
    107                                 case 'draft':
    108                                 case 'auto-draft':
    109                                         _e( 'Draft' );
    110                                         break;
    111                         }
     88global $wp_post_statuses, $allowed_post_status;
     89foreach($wp_post_statuses as $key => $wp_post_status){
     90    if($key == $post->post_status){
     91        $allowed_post_status = $wp_post_status->show_in_admin_status_list;
     92        echo __($wp_post_status->label);
     93    }
     94}
    11295?>
    11396</span>
    114 <?php
    115 if ( 'publish' == $post->post_status || 'private' == $post->post_status || $can_publish ) {
    116         $private_style = '';
    117         if ( 'private' == $post->post_status ) {
    118                 $private_style = 'style="display:none"';
    119         }
    120 ?>
    121 <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>
     97<?php if ( $allowed_post_status && ('publish' == $post->post_status || 'private' == $post->post_status || $can_publish )) { ?>
     98<a href="#post_status" <?php if ( 'private' == $post->post_status ) { ?>style="display:none;" <?php } ?> 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>
    12299
    123100<div id="post-status-select" class="hide-if-js">
    124101<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 ); ?>" />
    125102<label for="post_status" class="screen-reader-text"><?php _e( 'Set status' ); ?></label>
    126103<select name="post_status" id="post_status">
    127 <?php if ( 'publish' == $post->post_status ) : ?>
    128 <option<?php selected( $post->post_status, 'publish' ); ?> value='publish'><?php _e( 'Published' ); ?></option>
    129 <?php elseif ( 'private' == $post->post_status ) : ?>
    130 <option<?php selected( $post->post_status, 'private' ); ?> value='publish'><?php _e( 'Privately Published' ); ?></option>
    131 <?php elseif ( 'future' == $post->post_status ) : ?>
    132 <option<?php selected( $post->post_status, 'future' ); ?> value='future'><?php _e( 'Scheduled' ); ?></option>
    133 <?php endif; ?>
    134 <option<?php selected( $post->post_status, 'pending' ); ?> value='pending'><?php _e( 'Pending Review' ); ?></option>
    135 <?php if ( 'auto-draft' == $post->post_status ) : ?>
    136 <option<?php selected( $post->post_status, 'auto-draft' ); ?> value='draft'><?php _e( 'Draft' ); ?></option>
    137 <?php else : ?>
    138 <option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php _e( 'Draft' ); ?></option>
    139 <?php endif; ?>
     104<?php
     105$ppf = array('publish','private','future');
     106foreach($wp_post_statuses as $key => $wp_post_status){
     107    $show = $wp_post_status->show_in_admin_status_list ? (in_array($key, $ppf) ? ($post->post_status === $key ? true : false) : ($key === 'trash' ? false : true)) : false ;
     108    if($show) {
     109        echo "<option " . selected($post->post_status, $key, false) . "  value='" . $key . "'>" . __($wp_post_status->label) . "</option>";
     110    }
     111}
     112?>
    140113</select>
    141114<a href="#post_status" class="save-post-status hide-if-no-js button"><?php _e( 'OK' ); ?></a>
    142115<a href="#post_status" class="cancel-post-status hide-if-no-js button-cancel"><?php _e( 'Cancel' ); ?></a>
    function post_comment_status_meta_box( $post ) { 
    757730<input name="advanced_view" type="hidden" value="1" />
    758731<p class="meta-options">
    759732        <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 />
    760         <label for="ping_status" class="selectit"><input name="ping_status" type="checkbox" id="ping_status" value="open" <?php checked( $post->ping_status, 'open' ); ?> /> 
     733        <label for="ping_status" class="selectit"><input name="ping_status" type="checkbox" id="ping_status" value="open" <?php checked( $post->ping_status, 'open' ); ?> />
    761734                                                                                                                                                                                                                                                                                                                <?php
    762735                                                                                                                                                                                                                                                                                                                printf(
    763736                                                                                                                                                                                                                                                                                                                        /* translators: %s: Codex URL */
  • wp-admin/js/post.js

    diff --git a/wp-admin/js/post.js b/wp-admin/js/post.js
    index 662c62b..deb6303 100644
    a b jQuery(document).ready( function($) { 
    797797                                if ( $('option:selected', postStatus).val() == 'pending' ) {
    798798                                        $('#save-post').show().val( postL10n.savePending );
    799799                                } else {
    800                                         $('#save-post').show().val( postL10n.saveDraft );
     800                    var phrase = 'Save '+$('option:selected', postStatus).val();
     801                    $('#save-post').show().val(phrase);
    801802                                }
    802803                        }
    803804                        return true;