WordPress.org

Make WordPress Core

Ticket #14827: post-type-cleanup.diff

File post-type-cleanup.diff, 6.9 KB (added by johnkolbert, 4 years ago)
  • wp-includes/post.php

     
    890890        return $args; 
    891891} 
    892892 
     893 
     894function get_post_type_updated_messages( $post_ID ){ 
     895         
     896        $post_type = get_post_type( $post_ID ); 
     897         
     898        if( !$post_type ) return false; 
     899         
     900        $post_type_object = get_post_type_object($post_type); 
     901        $post_type_labels = $post_type_object->labels; 
     902 
     903         
     904        $messages[$post_type] = array( 
     905                0 => '', // Unused. Messages start at index 1. 
     906                1 => ( $post_type_object->public == true ) ? sprintf( __( $post_type_labels->singular_name . ' updated. <a href="%s">View post</a>'), esc_url( get_permalink($post_ID) ) ) : __( $post_type_labels->singular_name . ' updated.' ), 
     907                2 => __('Custom field updated.'), 
     908                3 => __('Custom field deleted.'), 
     909                4 => __($post_type_labels->singular_name . ' updated.'), 
     910                5 => isset($_GET['revision']) ? sprintf( __($post_type_labels->singular_name . ' restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, 
     911                6 => ( $post_type_object->public == true ) ? sprintf( __( $post_type_labels->singular_name . ' published. <a href="%s">View ' . $post_type_labels->singular_name . '</a>'), esc_url( get_permalink($post_ID) ) ) : __( $post_type_labels->singular_name . ' published.' ),       
     912                7 => __($post_type_labels->singular_name . ' saved.'), 
     913                8 => ( $post_type_object->public == true ) ? sprintf( __( $post_type_labels->singular_name . ' submitted. <a href="%s">Preview ' . $post_type_labels->singular_name . '</a>'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) )  : __( $post_type_labels->singular_name . ' submitted.' ), 
     914                9 => ( $post_type_object->public == true ) ? sprintf( __( $post_type_labels->singular_name . ' scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview post</a>'),  
     915                                // translators: Publish box date format, see http://php.net/date 
     916                                date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ), esc_url( get_permalink($post_ID) ) ) : sprintf( __( $post_type_labels->singular_name . ' scheduled for: <strong>%1$s</strong>.'),  
     917                                date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ) ),      
     918                10 => ( $post_type_object->public == true ) ? sprintf( __( $post_type_labels->singular_name . ' draft updated. <a target="_blank" href="%s">Preview ' . $post_type_labels->singular_name . '</a>'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ) : __( $post_type_labels->singular_name . ' draft updated.' ), 
     919 
     920                ); 
     921                 
     922 
     923return apply_filters( "{$post_type}_updated_messages", $messages ); 
     924} 
     925 
     926 
    893927/** 
    894928 * Builds an object with all post type capabilities out of a post type object 
    895929 * 
  • wp-admin/includes/meta-boxes.php

     
    3434<?php } ?> 
    3535</div> 
    3636 
     37<?php if( $post_type_object->public == true ) : ?> 
    3738<div id="preview-action"> 
    3839<?php 
    3940if ( 'publish' == $post->post_status ) { 
     
    4748<a class="preview button" href="<?php echo $preview_link; ?>" target="wp-preview" id="post-preview" tabindex="4"><?php echo $preview_button; ?></a> 
    4849<input type="hidden" name="wp-preview" id="wp-preview" value="" /> 
    4950</div> 
     51<?php endif; //preview if public ?> 
    5052 
    5153<div class="clear"></div> 
    5254</div><?php // /minor-publishing-actions ?> 
  • wp-admin/edit-form-advanced.php

     
    3434$action = isset($action) ? $action : ''; 
    3535 
    3636$messages = array(); 
    37 $messages['post'] = array( 
    38          0 => '', // Unused. Messages start at index 1. 
    39          1 => sprintf( __('Post updated. <a href="%s">View post</a>'), esc_url( get_permalink($post_ID) ) ), 
    40          2 => __('Custom field updated.'), 
    41          3 => __('Custom field deleted.'), 
    42          4 => __('Post updated.'), 
    43         /* translators: %s: date and time of the revision */ 
    44          5 => isset($_GET['revision']) ? sprintf( __('Post restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, 
    45          6 => sprintf( __('Post published. <a href="%s">View post</a>'), esc_url( get_permalink($post_ID) ) ), 
    46          7 => __('Post saved.'), 
    47          8 => sprintf( __('Post submitted. <a target="_blank" href="%s">Preview post</a>'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ), 
    48          9 => sprintf( __('Post scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview post</a>'), 
    49                 // translators: Publish box date format, see http://php.net/date 
    50                 date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ), esc_url( get_permalink($post_ID) ) ), 
    51         10 => sprintf( __('Post draft updated. <a target="_blank" href="%s">Preview post</a>'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ), 
    52 ); 
    53 $messages['page'] = array( 
    54          0 => '', // Unused. Messages start at index 1. 
    55          1 => sprintf( __('Page updated. <a href="%s">View page</a>'), esc_url( get_permalink($post_ID) ) ), 
    56          2 => __('Custom field updated.'), 
    57          3 => __('Custom field deleted.'), 
    58          4 => __('Page updated.'), 
    59          5 => isset($_GET['revision']) ? sprintf( __('Page restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, 
    60          6 => sprintf( __('Page published. <a href="%s">View page</a>'), esc_url( get_permalink($post_ID) ) ), 
    61          7 => __('Page saved.'), 
    62          8 => sprintf( __('Page submitted. <a target="_blank" href="%s">Preview page</a>'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ), 
    63          9 => sprintf( __('Page scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview page</a>'), date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ), esc_url( get_permalink($post_ID) ) ), 
    64         10 => sprintf( __('Page draft updated. <a target="_blank" href="%s">Preview page</a>'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ), 
    65 ); 
    66  
     37$messages = get_post_type_updated_messages( $post_ID ); 
    6738$messages = apply_filters( 'post_updated_messages', $messages ); 
    6839 
    6940$message = false; 
     
    245216if ( !empty($shortlink) ) 
    246217    $sample_permalink_html .= '<input id="shortlink" type="hidden" value="' . esc_attr($shortlink) . '" /><a href="#" class="button" onclick="prompt(&#39;URL:&#39;, jQuery(\'#shortlink\').val()); return false;">' . __('Get Shortlink') . '</a>'; 
    247218 
    248 if ( !( 'pending' == $post->post_status && !current_user_can( $post_type_object->cap->publish_posts ) ) ) { ?> 
     219if ( $post_type_object->public == true && !( 'pending' == $post->post_status && !current_user_can( $post_type_object->cap->publish_posts ) ) ) { ?> 
    249220        <div id="edit-slug-box"> 
    250221        <?php 
    251222                if ( ! empty($post->ID) && ! empty($sample_permalink_html) && 'auto-draft' != $post->post_status )