Ticket #12706: 12706.7.patch
File 12706.7.patch, 6.3 KB (added by , 7 years ago) |
---|
-
wp-admin/includes/meta-boxes.php
diff --git a/wp-admin/includes/meta-boxes.php b/wp-admin/includes/meta-boxes.php index 703c1ab..f8dbdbe 100644
a b function post_submit_meta_box( $post, $args = array() ) { 38 38 <div id="minor-publishing-actions"> 39 39 <div id="save-action"> 40 40 <?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 } 46 45 ?> 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" />51 <span class="spinner"></span>52 <?php } ?>53 46 </div> 54 47 <?php if ( is_post_type_viewable( $post_type_object ) ) : ?> 55 48 <div id="preview-action"> … … do_action( 'post_submitbox_minor_actions', $post ); 89 82 90 83 <div class="misc-pub-section misc-pub-post-status"> 91 84 <?php _e( 'Status:' ); ?> <span id="post-status-display"> 92 85 <?php 93 86 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 } 87 global $wp_post_statuses, $allowed_post_status; 88 foreach($wp_post_statuses as $key => $wp_post_status){ 89 if($key == $post->post_status){ 90 $allowed_post_status = $wp_post_status->show_in_admin_status_list; 91 echo __($wp_post_status->label); 92 } 93 } 112 94 ?> 113 95 </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> 96 <?php if ( $allowed_post_status && ('publish' == $post->post_status || 'private' == $post->post_status || $can_publish )) { ?> 97 <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> 122 98 123 99 <div id="post-status-select" class="hide-if-js"> 124 100 <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 ); ?>" /> 125 101 <label for="post_status" class="screen-reader-text"><?php _e( 'Set status' ); ?></label> 126 102 <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; ?> 103 <?php 104 $ppf = array('publish','private','future'); 105 foreach($wp_post_statuses as $key => $wp_post_status){ 106 $show = $wp_post_status->show_in_admin_status_list ? (in_array($key, $ppf) ? ($post->post_status === $key ? true : false) : ($key === 'trash' ? false : true)) : false ; 107 if($show) { 108 echo "<option " . selected($post->post_status, $key, false) . " value='" . $key . "'>" . __($wp_post_status->label) . "</option>"; 109 } 110 } 111 ?> 140 112 </select> 141 113 <a href="#post_status" class="save-post-status hide-if-no-js button"><?php _e( 'OK' ); ?></a> 142 114 <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 ) { 757 729 <input name="advanced_view" type="hidden" value="1" /> 758 730 <p class="meta-options"> 759 731 <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' ); ?> /> 732 <label for="ping_status" class="selectit"><input name="ping_status" type="checkbox" id="ping_status" value="open" <?php checked( $post->ping_status, 'open' ); ?> /> 761 733 <?php 762 734 printf( 763 735 /* 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($) { 797 797 if ( $('option:selected', postStatus).val() == 'pending' ) { 798 798 $('#save-post').show().val( postL10n.savePending ); 799 799 } else { 800 $('#save-post').show().val( postL10n.saveDraft ); 800 var phrase = 'Save '+$('option:selected', postStatus).val(); 801 $('#save-post').show().val(phrase); 801 802 } 802 803 } 803 804 return true;