Ticket #17470: 17470.diff

File 17470.diff, 8.1 KB (added by bootsz, 9 months ago)
Line 
1Index: wp-admin/edit-form-advanced.php
2===================================================================
3--- wp-admin/edit-form-advanced.php     (revision 21575)
4+++ wp-admin/edit-form-advanced.php     (working copy)
5@@ -121,39 +121,43 @@
6                add_meta_box($tax_name . 'div', $label, 'post_categories_meta_box', null, 'side', 'core', array( 'taxonomy' => $tax_name ));
7 }
8 
9+
10 if ( post_type_supports($post_type, 'page-attributes') )
11-       add_meta_box('pageparentdiv', 'page' == $post_type ? __('Page Attributes') : __('Attributes'), 'page_attributes_meta_box', null, 'side', 'core');
12+               add_meta_box('pageparentdiv', 'page' == $post_type ? __('Page Attributes') : __('Attributes'), 'page_attributes_meta_box', null, 'side', 'core');
13 
14-if ( current_theme_supports( 'post-thumbnails', $post_type ) && post_type_supports( $post_type, 'thumbnail' ) )
15-               add_meta_box('postimagediv', __('Featured Image'), 'post_thumbnail_meta_box', null, 'side', 'low');
16+if ( get_post_meta($post->ID, '_system_page', true) != '1' ) {
17 
18-if ( post_type_supports($post_type, 'excerpt') )
19-       add_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', null, 'normal', 'core');
20+       if ( current_theme_supports( 'post-thumbnails', $post_type ) && post_type_supports( $post_type, 'thumbnail' ) )
21+                       add_meta_box('postimagediv', __('Featured Image'), 'post_thumbnail_meta_box', null, 'side', 'low');
22 
23-if ( post_type_supports($post_type, 'trackbacks') )
24-       add_meta_box('trackbacksdiv', __('Send Trackbacks'), 'post_trackback_meta_box', null, 'normal', 'core');
25+       if ( post_type_supports($post_type, 'excerpt') )
26+               add_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', null, 'normal', 'core');
27 
28-if ( post_type_supports($post_type, 'custom-fields') )
29-       add_meta_box('postcustom', __('Custom Fields'), 'post_custom_meta_box', null, 'normal', 'core');
30+       if ( post_type_supports($post_type, 'trackbacks') )
31+               add_meta_box('trackbacksdiv', __('Send Trackbacks'), 'post_trackback_meta_box', null, 'normal', 'core');
32 
33-do_action('dbx_post_advanced');
34-if ( post_type_supports($post_type, 'comments') )
35-       add_meta_box('commentstatusdiv', __('Discussion'), 'post_comment_status_meta_box', null, 'normal', 'core');
36+       if ( post_type_supports($post_type, 'custom-fields') )
37+               add_meta_box('postcustom', __('Custom Fields'), 'post_custom_meta_box', null, 'normal', 'core');
38 
39-if ( ('publish' == $post->post_status || 'private' == $post->post_status) && post_type_supports($post_type, 'comments') )
40-       add_meta_box('commentsdiv', __('Comments'), 'post_comment_meta_box', null, 'normal', 'core');
41+       do_action('dbx_post_advanced');
42+       if ( post_type_supports($post_type, 'comments') )
43+               add_meta_box('commentstatusdiv', __('Discussion'), 'post_comment_status_meta_box', null, 'normal', 'core');
44 
45-if ( !( 'pending' == $post->post_status && !current_user_can( $post_type_object->cap->publish_posts ) ) )
46-       add_meta_box('slugdiv', __('Slug'), 'post_slug_meta_box', null, 'normal', 'core');
47+       if ( ('publish' == $post->post_status || 'private' == $post->post_status) && post_type_supports($post_type, 'comments') )
48+               add_meta_box('commentsdiv', __('Comments'), 'post_comment_meta_box', null, 'normal', 'core');
49 
50-if ( post_type_supports($post_type, 'author') ) {
51-       if ( is_super_admin() || current_user_can( $post_type_object->cap->edit_others_posts ) )
52-               add_meta_box('authordiv', __('Author'), 'post_author_meta_box', null, 'normal', 'core');
53+       if ( !( 'pending' == $post->post_status && !current_user_can( $post_type_object->cap->publish_posts ) ) )
54+               add_meta_box('slugdiv', __('Slug'), 'post_slug_meta_box', null, 'normal', 'core');
55+
56+       if ( post_type_supports($post_type, 'author') ) {
57+               if ( is_super_admin() || current_user_can( $post_type_object->cap->edit_others_posts ) )
58+                       add_meta_box('authordiv', __('Author'), 'post_author_meta_box', null, 'normal', 'core');
59+       }
60+
61+       if ( post_type_supports($post_type, 'revisions') && 0 < $post_ID && wp_get_post_revisions( $post_ID ) )
62+               add_meta_box('revisionsdiv', __('Revisions'), 'post_revisions_meta_box', null, 'normal', 'core');
63 }
64 
65-if ( post_type_supports($post_type, 'revisions') && 0 < $post_ID && wp_get_post_revisions( $post_ID ) )
66-       add_meta_box('revisionsdiv', __('Revisions'), 'post_revisions_meta_box', null, 'normal', 'core');
67-
68 do_action('add_meta_boxes', $post_type, $post);
69 do_action('add_meta_boxes_' . $post_type, $post);
70 
71@@ -309,7 +313,8 @@
72 </div>
73 <?php } ?>
74 
75-<?php if ( post_type_supports($post_type, 'editor') ) { ?>
76+<?php if ( post_type_supports($post_type, 'editor') && ( get_post_meta($post->ID, '_system_page', true) != '1' ) ) { ?>
77+
78 <div id="postdivrich" class="postarea">
79 
80 <?php wp_editor($post->post_content, 'content', array('dfw' => true, 'tabfocus_elements' => 'sample-permalink,post-preview') ); ?>
81Index: wp-admin/includes/class-wp-posts-list-table.php
82===================================================================
83--- wp-admin/includes/class-wp-posts-list-table.php     (revision 21575)
84+++ wp-admin/includes/class-wp-posts-list-table.php     (working copy)
85@@ -540,7 +540,10 @@
86 
87                                $actions = array();
88                                if ( $can_edit_post && 'trash' != $post->post_status ) {
89-                                       $actions['edit'] = '<a href="' . get_edit_post_link( $post->ID, true ) . '" title="' . esc_attr( __( 'Edit this item' ) ) . '">' . __( 'Edit' ) . '</a>';
90+                                       
91+                                       if ( get_post_meta($post->ID, '_system_page', true) != '1' )
92+                                               $actions['edit'] = '<a href="' . get_edit_post_link( $post->ID, true ) . '" title="' . esc_attr( __( 'Edit this item' ) ) . '">' . __( 'Edit' ) . '</a>';
93+
94                                        $actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr( __( 'Edit this item inline' ) ) . '">' . __( 'Quick&nbsp;Edit' ) . '</a>';
95                                }
96                                if ( current_user_can( $post_type_object->cap->delete_post, $post->ID ) ) {
97Index: wp-admin/includes/post.php
98===================================================================
99--- wp-admin/includes/post.php  (revision 21575)
100+++ wp-admin/includes/post.php  (working copy)
101@@ -1247,6 +1247,18 @@
102 }
103 
104 /**
105+ * Outputs the notice message to say that this page is used for posts and content will be ignored.
106+ *
107+ * @since 3.5
108+ * @return none
109+ */
110+function _admin_notice_page_for_posts() {
111+        $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>.' );
112+        echo '<div class="error"><p>' . sprintf( $message, esc_url( admin_url( 'options-reading.php' ) ) ) . '</p></div>';
113+}
114+
115+
116+/**
117  * Creates autosave data for the specified post from $_POST data.
118  *
119  * @package WordPress
120Index: wp-admin/options-reading.php
121===================================================================
122--- wp-admin/options-reading.php        (revision 21575)
123+++ wp-admin/options-reading.php        (working copy)
124@@ -90,6 +90,30 @@
125        if ( 'page' == get_option( 'show_on_front' ) && ! get_option( 'page_on_front' ) && ! get_option( 'page_for_posts' ) )
126                update_option( 'show_on_front', 'posts' );
127 ?>
128+
129+<?php
130+       if ( get_option('page_for_posts') != '0' ) :
131+
132+               if ( get_post_meta( get_option('page_for_posts'), '_system_page' ) ) :
133+                       update_post_meta( get_option('page_for_posts'), '_system_page', '1');
134+               else :
135+                       add_post_meta( get_option('page_for_posts'), '_system_page', '1', true );
136+               endif;
137+
138+               if ( get_option('page_for_posts') != get_option('page_for_posts_last') ) :
139+                       update_post_meta( get_option('page_for_posts_last'), '_system_page', '0');
140+               endif;
141+
142+               update_option('page_for_posts_last', get_option('page_for_posts') );
143+
144+       else:
145+
146+               update_post_meta( get_option('page_for_posts_last') , '_system_page', '0', '1');
147+               update_option('page_for_posts_last', '0');
148+
149+       endif;
150+?>
151+
152 <table class="form-table">
153 <tr valign="top">
154 <th scope="row"><?php _e( 'Front page displays' ); ?></th>
155Index: wp-admin/post.php
156===================================================================
157--- wp-admin/post.php   (revision 21575)
158+++ wp-admin/post.php   (working copy)
159@@ -164,6 +164,10 @@
160                wp_enqueue_script('autosave');
161        }
162 
163+       if ( $post_id == get_option( 'page_for_posts' ) ) {
164+           add_action( 'admin_notices', '_admin_notice_page_for_posts' );
165+       }
166+
167        $title = $post_type_object->labels->edit_item;
168        $post = get_post_to_edit($post_id);
169