Make WordPress Core

Ticket #17470: 17470.diff

File 17470.diff, 8.1 KB (added by bootsz, 13 years ago)
  • wp-admin/edit-form-advanced.php

     
    121121                add_meta_box($tax_name . 'div', $label, 'post_categories_meta_box', null, 'side', 'core', array( 'taxonomy' => $tax_name ));
    122122}
    123123
     124
    124125if ( post_type_supports($post_type, 'page-attributes') )
    125         add_meta_box('pageparentdiv', 'page' == $post_type ? __('Page Attributes') : __('Attributes'), 'page_attributes_meta_box', null, 'side', 'core');
     126                add_meta_box('pageparentdiv', 'page' == $post_type ? __('Page Attributes') : __('Attributes'), 'page_attributes_meta_box', null, 'side', 'core');
    126127
    127 if ( current_theme_supports( 'post-thumbnails', $post_type ) && post_type_supports( $post_type, 'thumbnail' ) )
    128                 add_meta_box('postimagediv', __('Featured Image'), 'post_thumbnail_meta_box', null, 'side', 'low');
     128if ( get_post_meta($post->ID, '_system_page', true) != '1' ) {
    129129
    130 if ( post_type_supports($post_type, 'excerpt') )
    131         add_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', null, 'normal', 'core');
     130        if ( current_theme_supports( 'post-thumbnails', $post_type ) && post_type_supports( $post_type, 'thumbnail' ) )
     131                        add_meta_box('postimagediv', __('Featured Image'), 'post_thumbnail_meta_box', null, 'side', 'low');
    132132
    133 if ( post_type_supports($post_type, 'trackbacks') )
    134         add_meta_box('trackbacksdiv', __('Send Trackbacks'), 'post_trackback_meta_box', null, 'normal', 'core');
     133        if ( post_type_supports($post_type, 'excerpt') )
     134                add_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', null, 'normal', 'core');
    135135
    136 if ( post_type_supports($post_type, 'custom-fields') )
    137         add_meta_box('postcustom', __('Custom Fields'), 'post_custom_meta_box', null, 'normal', 'core');
     136        if ( post_type_supports($post_type, 'trackbacks') )
     137                add_meta_box('trackbacksdiv', __('Send Trackbacks'), 'post_trackback_meta_box', null, 'normal', 'core');
    138138
    139 do_action('dbx_post_advanced');
    140 if ( post_type_supports($post_type, 'comments') )
    141         add_meta_box('commentstatusdiv', __('Discussion'), 'post_comment_status_meta_box', null, 'normal', 'core');
     139        if ( post_type_supports($post_type, 'custom-fields') )
     140                add_meta_box('postcustom', __('Custom Fields'), 'post_custom_meta_box', null, 'normal', 'core');
    142141
    143 if ( ('publish' == $post->post_status || 'private' == $post->post_status) && post_type_supports($post_type, 'comments') )
    144         add_meta_box('commentsdiv', __('Comments'), 'post_comment_meta_box', null, 'normal', 'core');
     142        do_action('dbx_post_advanced');
     143        if ( post_type_supports($post_type, 'comments') )
     144                add_meta_box('commentstatusdiv', __('Discussion'), 'post_comment_status_meta_box', null, 'normal', 'core');
    145145
    146 if ( !( 'pending' == $post->post_status && !current_user_can( $post_type_object->cap->publish_posts ) ) )
    147         add_meta_box('slugdiv', __('Slug'), 'post_slug_meta_box', null, 'normal', 'core');
     146        if ( ('publish' == $post->post_status || 'private' == $post->post_status) && post_type_supports($post_type, 'comments') )
     147                add_meta_box('commentsdiv', __('Comments'), 'post_comment_meta_box', null, 'normal', 'core');
    148148
    149 if ( post_type_supports($post_type, 'author') ) {
    150         if ( is_super_admin() || current_user_can( $post_type_object->cap->edit_others_posts ) )
    151                 add_meta_box('authordiv', __('Author'), 'post_author_meta_box', null, 'normal', 'core');
     149        if ( !( 'pending' == $post->post_status && !current_user_can( $post_type_object->cap->publish_posts ) ) )
     150                add_meta_box('slugdiv', __('Slug'), 'post_slug_meta_box', null, 'normal', 'core');
     151
     152        if ( post_type_supports($post_type, 'author') ) {
     153                if ( is_super_admin() || current_user_can( $post_type_object->cap->edit_others_posts ) )
     154                        add_meta_box('authordiv', __('Author'), 'post_author_meta_box', null, 'normal', 'core');
     155        }
     156
     157        if ( post_type_supports($post_type, 'revisions') && 0 < $post_ID && wp_get_post_revisions( $post_ID ) )
     158                add_meta_box('revisionsdiv', __('Revisions'), 'post_revisions_meta_box', null, 'normal', 'core');
    152159}
    153160
    154 if ( post_type_supports($post_type, 'revisions') && 0 < $post_ID && wp_get_post_revisions( $post_ID ) )
    155         add_meta_box('revisionsdiv', __('Revisions'), 'post_revisions_meta_box', null, 'normal', 'core');
    156 
    157161do_action('add_meta_boxes', $post_type, $post);
    158162do_action('add_meta_boxes_' . $post_type, $post);
    159163
     
    309313</div>
    310314<?php } ?>
    311315
    312 <?php if ( post_type_supports($post_type, 'editor') ) { ?>
     316<?php if ( post_type_supports($post_type, 'editor') && ( get_post_meta($post->ID, '_system_page', true) != '1' ) ) { ?>
     317
    313318<div id="postdivrich" class="postarea">
    314319
    315320<?php wp_editor($post->post_content, 'content', array('dfw' => true, 'tabfocus_elements' => 'sample-permalink,post-preview') ); ?>
  • wp-admin/includes/class-wp-posts-list-table.php

     
    540540
    541541                                $actions = array();
    542542                                if ( $can_edit_post && 'trash' != $post->post_status ) {
    543                                         $actions['edit'] = '<a href="' . get_edit_post_link( $post->ID, true ) . '" title="' . esc_attr( __( 'Edit this item' ) ) . '">' . __( 'Edit' ) . '</a>';
     543                                       
     544                                        if ( get_post_meta($post->ID, '_system_page', true) != '1' )
     545                                                $actions['edit'] = '<a href="' . get_edit_post_link( $post->ID, true ) . '" title="' . esc_attr( __( 'Edit this item' ) ) . '">' . __( 'Edit' ) . '</a>';
     546
    544547                                        $actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr( __( 'Edit this item inline' ) ) . '">' . __( 'Quick&nbsp;Edit' ) . '</a>';
    545548                                }
    546549                                if ( current_user_can( $post_type_object->cap->delete_post, $post->ID ) ) {
  • wp-admin/includes/post.php

     
    12471247}
    12481248
    12491249/**
     1250 * Outputs the notice message to say that this page is used for posts and content will be ignored.
     1251 *
     1252 * @since 3.5
     1253 * @return none
     1254 */
     1255function _admin_notice_page_for_posts() {
     1256        $message = __( 'This page is used to display a list of posts; content here will not be displayed. You can change this in your <a href="%s">Reading Settings</a>.' );
     1257        echo '<div class="error"><p>' . sprintf( $message, esc_url( admin_url( 'options-reading.php' ) ) ) . '</p></div>';
     1258}
     1259
     1260
     1261/**
    12501262 * Creates autosave data for the specified post from $_POST data.
    12511263 *
    12521264 * @package WordPress
  • wp-admin/options-reading.php

     
    9090        if ( 'page' == get_option( 'show_on_front' ) && ! get_option( 'page_on_front' ) && ! get_option( 'page_for_posts' ) )
    9191                update_option( 'show_on_front', 'posts' );
    9292?>
     93
     94<?php
     95        if ( get_option('page_for_posts') != '0' ) :
     96
     97                if ( get_post_meta( get_option('page_for_posts'), '_system_page' ) ) :
     98                        update_post_meta( get_option('page_for_posts'), '_system_page', '1');
     99                else :
     100                        add_post_meta( get_option('page_for_posts'), '_system_page', '1', true );
     101                endif;
     102
     103                if ( get_option('page_for_posts') != get_option('page_for_posts_last') ) :
     104                        update_post_meta( get_option('page_for_posts_last'), '_system_page', '0');
     105                endif;
     106
     107                update_option('page_for_posts_last', get_option('page_for_posts') );
     108
     109        else:
     110
     111                update_post_meta( get_option('page_for_posts_last') , '_system_page', '0', '1');
     112                update_option('page_for_posts_last', '0');
     113
     114        endif;
     115?>
     116
    93117<table class="form-table">
    94118<tr valign="top">
    95119<th scope="row"><?php _e( 'Front page displays' ); ?></th>
  • wp-admin/post.php

     
    164164                wp_enqueue_script('autosave');
    165165        }
    166166
     167        if ( $post_id == get_option( 'page_for_posts' ) ) {
     168            add_action( 'admin_notices', '_admin_notice_page_for_posts' );
     169        }
     170
    167171        $title = $post_type_object->labels->edit_item;
    168172        $post = get_post_to_edit($post_id);
    169173