Make WordPress Core

Ticket #31858: 31858.2.patch

File 31858.2.patch, 4.7 KB (added by ramiy, 9 years ago)
  • 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_url = get_preview_post_link( $post );
    8786
     87$preview_post_link_html = $scheduled_post_link_html = $view_post_html = '';
     88$preview_page_link_html = $scheduled_page_link_html = $view_page_html = '';
     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        // Preview post link.
     94        $preview_post_link_html = sprintf( ' <a target="_blank" href="%1$s">%2$s</a>',
     95                esc_url( $preview_url ),
    9496                __( 'Preview post' )
    9597        );
    9698
    97         // Scheduled preview link.
    98         $scheduled_link_html = sprintf( ' <a target="_blank" href="%s">%s</a>',
     99        // Scheduled post preview link.
     100        $scheduled_post_link_html = sprintf( ' <a target="_blank" href="%1$s">%2$s</a>',
    99101                esc_url( $permalink ),
    100102                __( 'Preview post' )
    101103        );
    102104
    103105        // View post link.
    104         $view_post_html = sprintf( ' <a href="%s">%s</a>',
     106        $view_post_html = sprintf( ' <a href="%1$s">%2$s</a>',
    105107                esc_url( $permalink ),
    106108                __( 'View post' )
    107109        );
     110
     111        // Preview page link.
     112        $preview_post_link_html = sprintf( ' <a target="_blank" href="%1$s">%2$s</a>',
     113                esc_url( $preview_url ),
     114                __( 'Preview page' )
     115        );
     116
     117        // Scheduled page preview link.
     118        $scheduled_post_link_html = sprintf( ' <a target="_blank" href="%1$s">%2$s</a>',
     119                esc_url( $permalink ),
     120                __( 'Preview page' )
     121        );
     122
     123        // View page link.
     124        $view_page_html = sprintf( ' <a href="%1$s">%2$s</a>',
     125                esc_url( $permalink ),
     126                __( 'View page' )
     127        );
     128
    108129}
    109130
    110131/* translators: Publish box date format, see http://php.net/date */
    111132$scheduled_date = date_i18n( __( 'M j, Y @ H:i' ), strtotime( $post->post_date ) );
     133
    112134$messages['post'] = array(
    113135         0 => '', // Unused. Messages start at index 1.
    114136         1 => __( 'Post updated.' ) . $view_post_html,
    115          2 => __('Custom field updated.'),
    116          3 => __('Custom field deleted.'),
    117          4 => __('Post updated.'),
     137         2 => __( 'Custom field updated.' ),
     138         3 => __( 'Custom field deleted.' ),
     139         4 => __( 'Post updated.' ),
    118140        /* translators: %s: date and time of the revision */
    119141         5 => isset($_GET['revision']) ? sprintf( __('Post restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
    120142         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         7 => __( 'Post saved.' ),
     144         8 => __( 'Post submitted.' ) . $preview_post_link_html,
     145         9 => sprintf( __( 'Post scheduled for: %s' ), '<strong>' . $scheduled_date . '</strong>' ) . $scheduled_post_link_html,
     146        10 => __( 'Post draft updated.' ) . $preview_post_link_html,
    125147);
    126 
    127 $page_preview_url = get_preview_post_link( $post );
    128 
    129148$messages['page'] = array(
    130149         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.'),
     150         1 => __( 'Page updated.' ) . $view_page_html,
     151         2 => __( 'Custom field updated.' ),
     152         3 => __( 'Custom field deleted.' ),
     153         4 => __( 'Page updated.' ),
     154        /* translators: %s: date and time of the revision */
    135155         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 ) ),
     156         6 => __( 'Page published.' ) . $view_page_html,
     157         7 => __( 'Page saved.' ),
     158         8 => __( 'Page submitted.' ) . $preview_page_link_html,
     159         9 => sprintf( __( 'Page scheduled for: %s' ), '<strong>' . $scheduled_date . '</strong>' ) . $scheduled_page_link_html,
     160        10 => __( 'Page draft updated.' ) . $preview_page_link_html,
    141161);
    142162$messages['attachment'] = array_fill( 1, 10, __( 'Media attachment updated.' ) ); // Hack, for now.
    143163