Make WordPress Core

Ticket #31858: 31858.3.patch

File 31858.3.patch, 4.9 KB (added by ramiy, 9 years ago)
  • wp-admin/edit-form-advanced.php

     
    8181}
    8282
    8383$messages = array();
    84 $post_preview_url = get_preview_post_link( $post );
    8584
    86 $preview_link_html = $scheduled_link_html = $view_post_html = '';
     85$preview_post_link_html = $scheduled_post_link_html = $view_post_link_html = '';
     86$preview_page_link_html = $scheduled_page_link_html = $view_page_link_html = '';
    8787
     88$preview_url = get_preview_post_link( $post );
     89
    8890$viewable = is_post_type_viewable( $post_type_object );
    8991
    9092if ( $viewable ) {
    91         // Preview link.
    92         $preview_link_html = sprintf( ' <a target="_blank" href="%s">%s</a>',
    93                 esc_url( $post_preview_url ),
     93
     94        // Preview post link.
     95        $preview_post_link_html = sprintf( ' <a target="_blank" href="%1$s">%2$s</a>',
     96                esc_url( $preview_url ),
    9497                __( 'Preview post' )
    9598        );
    9699
    97         // Scheduled preview link.
    98         $scheduled_link_html = sprintf( ' <a target="_blank" href="%s">%s</a>',
     100        // Scheduled post preview link.
     101        $scheduled_post_link_html = sprintf( ' <a target="_blank" href="%1$s">%2$s</a>',
    99102                esc_url( $permalink ),
    100103                __( 'Preview post' )
    101104        );
    102105
    103106        // View post link.
    104         $view_post_html = sprintf( ' <a href="%s">%s</a>',
     107        $view_post_link_html = sprintf( ' <a href="%1$s">%2$s</a>',
    105108                esc_url( $permalink ),
    106109                __( 'View post' )
    107110        );
     111
     112        // Preview page link.
     113        $preview_post_link_html = sprintf( ' <a target="_blank" href="%1$s">%2$s</a>',
     114                esc_url( $preview_url ),
     115                __( 'Preview page' )
     116        );
     117
     118        // Scheduled page preview link.
     119        $scheduled_post_link_html = sprintf( ' <a target="_blank" href="%1$s">%2$s</a>',
     120                esc_url( $permalink ),
     121                __( 'Preview page' )
     122        );
     123
     124        // View page link.
     125        $view_page_link_html = sprintf( ' <a href="%1$s">%2$s</a>',
     126                esc_url( $permalink ),
     127                __( 'View page' )
     128        );
     129
    108130}
    109131
    110132/* translators: Publish box date format, see http://php.net/date */
    111133$scheduled_date = date_i18n( __( 'M j, Y @ H:i' ), strtotime( $post->post_date ) );
     134
    112135$messages['post'] = array(
    113136         0 => '', // Unused. Messages start at index 1.
    114          1 => __( 'Post updated.' ) . $view_post_html,
    115          2 => __('Custom field updated.'),
    116          3 => __('Custom field deleted.'),
    117          4 => __('Post updated.'),
     137         1 => __( 'Post updated.' ) . $view_post_link_html,
     138         2 => __( 'Custom field updated.' ),
     139         3 => __( 'Custom field deleted.' ),
     140         4 => __( 'Post updated.' ),
    118141        /* translators: %s: date and time of the revision */
    119142         5 => isset($_GET['revision']) ? sprintf( __('Post restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
    120          6 => __( 'Post published.' ) . $view_post_html,
    121          7 => __('Post saved.'),
    122          8 => __( 'Post submitted.' ) . $preview_link_html,
    123          9 => sprintf( __( 'Post scheduled for: <strong>%1$s</strong>' ), $scheduled_date ) . $scheduled_link_html,
    124         10 => __( 'Post draft updated.' ) . $preview_link_html,
     143         6 => __( 'Post published.' ) . $view_post_link_html,
     144         7 => __( 'Post saved.' ),
     145         8 => __( 'Post submitted.' ) . $preview_post_link_html,
     146         9 => sprintf( __( 'Post scheduled for: %s.' ), '<strong>' . $scheduled_date . '</strong>' ) . $scheduled_post_link_html,
     147        10 => __( 'Post draft updated.' ) . $preview_post_link_html,
    125148);
    126 
    127 $page_preview_url = get_preview_post_link( $post );
    128 
    129149$messages['page'] = array(
    130150         0 => '', // Unused. Messages start at index 1.
    131          1 => sprintf( __('Page updated. <a href="%s">View page</a>'), esc_url( $permalink ) ),
    132          2 => __('Custom field updated.'),
    133          3 => __('Custom field deleted.'),
    134          4 => __('Page updated.'),
     151         1 => __( 'Page updated.' ) . $view_page_link_html,
     152         2 => __( 'Custom field updated.' ),
     153         3 => __( 'Custom field deleted.' ),
     154         4 => __( 'Page updated.' ),
     155        /* translators: %s: date and time of the revision */
    135156         5 => isset($_GET['revision']) ? sprintf( __('Page restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
    136          6 => sprintf( __('Page published. <a href="%s">View page</a>'), esc_url( $permalink ) ),
    137          7 => __('Page saved.'),
    138          8 => sprintf( __('Page submitted. <a target="_blank" href="%s">Preview page</a>'), esc_url( $page_preview_url ) ),
    139          9 => sprintf( __('Page scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview page</a>'), date_i18n( __( 'M j, Y @ H:i' ), strtotime( $post->post_date ) ), esc_url( $permalink ) ),
    140         10 => sprintf( __('Page draft updated. <a target="_blank" href="%s">Preview page</a>'), esc_url( $page_preview_url ) ),
     157         6 => __( 'Page published.' ) . $view_page_link_html,
     158         7 => __( 'Page saved.' ),
     159         8 => __( 'Page submitted.' ) . $preview_page_link_html,
     160         9 => sprintf( __( 'Page scheduled for: %s.' ), '<strong>' . $scheduled_date . '</strong>' ) . $scheduled_page_link_html,
     161        10 => __( 'Page draft updated.' ) . $preview_page_link_html,
    141162);
    142163$messages['attachment'] = array_fill( 1, 10, __( 'Media attachment updated.' ) ); // Hack, for now.
    143164