WordPress.org

Make WordPress Core

Ticket #17609: 17609.3.diff

File 17609.3.diff, 5.1 KB (added by wonderboymusic, 6 years ago)
  • src/wp-admin/edit-form-advanced.php

     
    8484/** This filter is documented in wp-admin/includes/meta-boxes.php */
    8585$post_preview_url = apply_filters( 'preview_post_link', add_query_arg( 'preview', 'true', $permalink ), $post );
    8686
     87$viewable = is_post_type_viewable( $post_type_object );
     88$preview_link_html = $viewable ? sprintf(
     89        ' <a target="_blank" href="%s">%s</a>',
     90        esc_url( $post_preview_url ),
     91        __( 'Preview post' )
     92) : '';
     93$scheduled_link_html = $viewable ? sprintf(
     94        ' <a target="_blank" href="%s">%s</a>',
     95        esc_url( $permalink ),
     96        __( 'Preview post' )
     97) : '';
     98$view_post_html = $viewable ? sprintf(
     99        ' <a href="%s">">%</a>',
     100        esc_url( $permalink ),
     101        __( 'View post' )
     102) : '';
     103/* translators: Publish box date format, see http://php.net/date */
     104$scheduled_date = date_i18n( __( 'M j, Y @ H:i' ), strtotime( $post->post_date ) );
    87105$messages['post'] = array(
    88106         0 => '', // Unused. Messages start at index 1.
    89          1 => sprintf( __('Post updated. <a href="%s">View post</a>'), esc_url( $permalink ) ),
     107         1 => __('Post updated.') . $view_post_html,
    90108         2 => __('Custom field updated.'),
    91109         3 => __('Custom field deleted.'),
    92110         4 => __('Post updated.'),
    93111        /* translators: %s: date and time of the revision */
    94112         5 => isset($_GET['revision']) ? sprintf( __('Post restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
    95          6 => sprintf( __('Post published. <a href="%s">View post</a>'), esc_url( $permalink ) ),
     113         6 => __('Post published.') . $view_post_html,
    96114         7 => __('Post saved.'),
    97          8 => sprintf( __('Post submitted. <a target="_blank" href="%s">Preview post</a>'), esc_url( $post_preview_url ) ),
    98          9 => sprintf( __('Post scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview post</a>'),
    99                 /* translators: Publish box date format, see http://php.net/date */
    100                 date_i18n( __( 'M j, Y @ H:i' ), strtotime( $post->post_date ) ), esc_url( $permalink ) ),
    101         10 => sprintf( __('Post draft updated. <a target="_blank" href="%s">Preview post</a>'), esc_url( $post_preview_url ) ),
     115         8 => __('Post submitted.') . $preview_link_html,
     116         9 => sprintf( __('Post scheduled for: <strong>%1$s</strong>'), $scheduled_date ) . $scheduled_link_html,
     117        10 => __('Post draft updated.') . $preview_link_html,
    102118);
    103119
    104120/** This filter is documented in wp-admin/includes/meta-boxes.php */
     
    508524?>
    509525<div class="inside">
    510526<?php
     527if ( $viewable ):
    511528$sample_permalink_html = $post_type_object->public ? get_sample_permalink_html($post->ID) : '';
    512529$shortlink = wp_get_shortlink($post->ID, 'post');
    513530
     
    525542        </div>
    526543<?php
    527544}
     545endif;
    528546?>
    529547</div>
    530548<?php
  • src/wp-admin/includes/class-wp-posts-list-table.php

     
    10721072                                $actions['delete'] = "<a class='submitdelete' title='" . esc_attr__( 'Delete this item permanently' ) . "' href='" . get_delete_post_link( $post->ID, '', true ) . "'>" . __( 'Delete Permanently' ) . "</a>";
    10731073                }
    10741074
    1075                 if ( $post_type_object->public ) {
     1075                if ( is_post_type_viewable( $post_type_object ) ) {
    10761076                        $title = _draft_or_post_title();
    10771077                        if ( in_array( $post->post_status, array( 'pending', 'draft', 'future' ) ) ) {
    10781078                                if ( $can_edit_post ) {
  • src/wp-admin/includes/meta-boxes.php

     
    3131<div id="save-action">
    3232<?php if ( 'publish' != $post->post_status && 'future' != $post->post_status && 'pending' != $post->post_status ) { ?>
    3333<input <?php if ( 'private' == $post->post_status ) { ?>style="display:none"<?php } ?> type="submit" name="save" id="save-post" value="<?php esc_attr_e('Save Draft'); ?>" class="button" />
     34<span class="spinner"></span>
    3435<?php } elseif ( 'pending' == $post->post_status && $can_publish ) { ?>
    3536<input type="submit" name="save" id="save-post" value="<?php esc_attr_e('Save as Pending'); ?>" class="button" />
     37<span class="spinner"></span>
    3638<?php } ?>
    37 <span class="spinner"></span>
    3839</div>
    39 <?php if ( $post_type_object->public ) : ?>
     40<?php
     41if ( is_post_type_viewable( $post_type_object ) ) : ?>
    4042<div id="preview-action">
    4143<?php
    4244if ( 'publish' == $post->post_status ) {
  • src/wp-includes/post.php

     
    18441844}
    18451845
    18461846/**
     1847 * @since 4.4.0
     1848 *
     1849 * @param object $post_type_object
     1850 * @return bool
     1851 */
     1852function is_post_type_viewable( $post_type_object ) {
     1853        return $post_type_object->publicly_queryable || ( $post_type_object->_builtin && $post_type_object->public );
     1854}
     1855
     1856/**
    18471857 * Retrieve list of latest posts or posts matching criteria.
    18481858 *
    18491859 * The defaults are as follows: