WordPress.org

Make WordPress Core

Ticket #18860: 18860.diff

File 18860.diff, 6.8 KB (added by scribu, 7 years ago)
  • wp-admin/edit-form-advanced.php

    diff --git wp-admin/edit-form-advanced.php wp-admin/edit-form-advanced.php
    index 991a029..9762c2e 100644
    $post_type_object = get_post_type_object($post_type); 
    9999// All meta boxes should be defined and added before the first do_meta_boxes() call (or potentially during the do_meta_boxes action).
    100100require_once('./includes/meta-boxes.php');
    101101
     102if ( post_type_supports( $post_type, 'title' ) ) {
     103        add_action( 'before_post_meta_boxes', 'post_title_meta_box', 10 );
     104}
     105
     106if ( post_type_supports( $post_type, 'editor' ) ) {
     107        add_action( 'before_post_meta_boxes', 'post_editor_meta_box', 12 );
     108}
     109
    102110add_meta_box('submitdiv', __('Publish'), 'post_submit_meta_box', $post_type, 'side', 'core');
    103111
    104112if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post_type, 'post-formats' ) )
    do_action('do_meta_boxes', $post_type, 'side', $post); 
    160168
    161169$current_screen->add_option('layout_columns', array('max' => 2, 'default' => 2) );
    162170
    163 $current_screen->add_option_context( 
     171$current_screen->add_option_context(
    164172'<p>test</p>'
    165173);
    166174
    if ( 1 != $screen_layout_columns ) { 
    273281
    274282<div id="post-body">
    275283<div id="post-body-content">
    276 <?php if ( post_type_supports($post_type, 'title') ) { ?>
    277 <div id="titlediv">
    278 <div id="titlewrap">
    279         <label class="hide-if-no-js" style="visibility:hidden" id="title-prompt-text" for="title"><?php echo apply_filters( 'enter_title_here', __( 'Enter title here' ), $post ); ?></label>
    280         <input type="text" name="post_title" size="30" tabindex="1" value="<?php echo esc_attr( htmlspecialchars( $post->post_title ) ); ?>" id="title" autocomplete="off" />
    281 </div>
    282 <div class="inside">
    283 <?php
    284 $sample_permalink_html = $post_type_object->public ? get_sample_permalink_html($post->ID) : '';
    285 $shortlink = wp_get_shortlink($post->ID, 'post');
    286 if ( !empty($shortlink) )
    287     $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>';
    288 
    289 if ( $post_type_object->public && ! ( 'pending' == $post->post_status && !current_user_can( $post_type_object->cap->publish_posts ) ) ) { ?>
    290         <div id="edit-slug-box">
    291         <?php
    292                 if ( ! empty($post->ID) && ! empty($sample_permalink_html) && 'auto-draft' != $post->post_status )
    293                         echo $sample_permalink_html;
    294         ?>
    295         </div>
    296 <?php
    297 }
    298 ?>
    299 </div>
    300 <?php
    301 wp_nonce_field( 'samplepermalink', 'samplepermalinknonce', false );
    302 ?>
    303 </div>
    304 <?php } ?>
    305 
    306 <?php if ( post_type_supports($post_type, 'editor') ) { ?>
    307 <div id="postdivrich" class="postarea">
    308 
    309 <?php wp_editor($post->post_content, 'content', array('dfw' => true) ); ?>
    310 
    311 <table id="post-status-info" cellspacing="0"><tbody><tr>
    312         <td id="wp-word-count"><?php printf( __( 'Word count: %s' ), '<span class="word-count">0</span>' ); ?></td>
    313         <td class="autosave-info">
    314         <span class="autosave-message">&nbsp;</span>
    315284<?php
    316         if ( 'auto-draft' != $post->post_status ) {
    317                 echo '<span id="last-edit">';
    318                 if ( $last_id = get_post_meta($post_ID, '_edit_last', true) ) {
    319                         $last_user = get_userdata($last_id);
    320                         printf(__('Last edited by %1$s on %2$s at %3$s'), esc_html( $last_user->display_name ), mysql2date(get_option('date_format'), $post->post_modified), mysql2date(get_option('time_format'), $post->post_modified));
    321                 } else {
    322                         printf(__('Last edited on %1$s at %2$s'), mysql2date(get_option('date_format'), $post->post_modified), mysql2date(get_option('time_format'), $post->post_modified));
    323                 }
    324                 echo '</span>';
    325         } ?>
    326         </td>
    327 </tr></tbody></table>
    328 
    329 </div>
    330 
    331 <?php
    332 }
     285do_action( 'before_post_meta_boxes', $post );
    333286
    334287if ( 1 == $screen_layout_columns ) {
    335288        ('page' == $post_type) ? do_action('submitpage_box') : do_action('submitpost_box');
  • wp-admin/includes/meta-boxes.php

    diff --git wp-admin/includes/meta-boxes.php wp-admin/includes/meta-boxes.php
    index ddb3e9d..1ce25e2 100644
     
    33// -- Post related Meta Boxes
    44
    55/**
     6 * Display post title elements.
     7 *
     8 * @since 3.4.0
     9 *
     10 * @param object $post
     11 */
     12function post_title_meta_box( $post ) {
     13        global $post_type_object;
     14
     15?>
     16<div id="titlediv">
     17<div id="titlewrap">
     18        <label class="hide-if-no-js" style="visibility:hidden" id="title-prompt-text" for="title"><?php echo apply_filters( 'enter_title_here', __( 'Enter title here' ), $post ); ?></label>
     19        <input type="text" name="post_title" size="30" tabindex="1" value="<?php echo esc_attr( htmlspecialchars( $post->post_title ) ); ?>" id="title" autocomplete="off" />
     20</div>
     21<div class="inside">
     22<?php
     23$sample_permalink_html = $post_type_object->public ? get_sample_permalink_html($post->ID) : '';
     24$shortlink = wp_get_shortlink($post->ID, 'post');
     25if ( !empty($shortlink) )
     26    $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>';
     27
     28if ( $post_type_object->public && ! ( 'pending' == $post->post_status && !current_user_can( $post_type_object->cap->publish_posts ) ) ) { ?>
     29        <div id="edit-slug-box">
     30        <?php
     31                if ( ! empty($post->ID) && ! empty($sample_permalink_html) && 'auto-draft' != $post->post_status )
     32                        echo $sample_permalink_html;
     33        ?>
     34        </div>
     35<?php
     36}
     37?>
     38</div>
     39<?php
     40wp_nonce_field( 'samplepermalink', 'samplepermalinknonce', false );
     41?>
     42</div>
     43<?php
     44}
     45
     46
     47/**
     48 * Display post editor.
     49 *
     50 * @since 3.4.0
     51 *
     52 * @param object $post
     53 */
     54function post_editor_meta_box( $post ) {
     55?>
     56<div id="postdivrich" class="postarea">
     57
     58<?php wp_editor($post->post_content, 'content', array('dfw' => true) ); ?>
     59
     60<table id="post-status-info" cellspacing="0"><tbody><tr>
     61        <td id="wp-word-count"><?php printf( __( 'Word count: %s' ), '<span class="word-count">0</span>' ); ?></td>
     62        <td class="autosave-info">
     63        <span class="autosave-message">&nbsp;</span>
     64<?php
     65        if ( 'auto-draft' != $post->post_status ) {
     66                echo '<span id="last-edit">';
     67                if ( $last_id = get_post_meta($post->ID, '_edit_last', true) ) {
     68                        $last_user = get_userdata($last_id);
     69                        printf(__('Last edited by %1$s on %2$s at %3$s'), esc_html( $last_user->display_name ), mysql2date(get_option('date_format'), $post->post_modified), mysql2date(get_option('time_format'), $post->post_modified));
     70                } else {
     71                        printf(__('Last edited on %1$s at %2$s'), mysql2date(get_option('date_format'), $post->post_modified), mysql2date(get_option('time_format'), $post->post_modified));
     72                }
     73                echo '</span>';
     74        } ?>
     75        </td>
     76</tr></tbody></table>
     77
     78</div>
     79<?php
     80}
     81
     82
     83/**
    684 * Display post submit form fields.
    785 *
    886 * @since 2.7.0
    if ( !in_array( $post->post_status, array('publish', 'future', 'private') ) || 0 
    233311<?php
    234312}
    235313
     314
    236315/**
    237316 * Display post format form elements.
    238317 *