1 | <?php
|
---|
2 | /**
|
---|
3 | * Edit page form for inclusion in the administration panels.
|
---|
4 | *
|
---|
5 | * @package WordPress
|
---|
6 | * @subpackage Administration
|
---|
7 | */
|
---|
8 |
|
---|
9 | /**
|
---|
10 | * Post ID global.
|
---|
11 | * @name $post_ID
|
---|
12 | * @var int
|
---|
13 | */
|
---|
14 | if ( ! isset( $post_ID ) )
|
---|
15 | $post_ID = 0;
|
---|
16 | if ( ! isset( $temp_ID ) )
|
---|
17 | $temp_ID = 0;
|
---|
18 |
|
---|
19 | if ( isset($_GET['message']) )
|
---|
20 | $_GET['message'] = absint( $_GET['message'] );
|
---|
21 | $messages[1] = sprintf(__('Page updated. <a href="%s">View page</a>'), get_permalink($post_ID));
|
---|
22 | $messages[2] = __('Custom field updated.');
|
---|
23 | $messages[3] = __('Custom field deleted.');
|
---|
24 | $messages[5] = sprintf(__('Page published. <a href="%s">View page</a>'), get_permalink($post_ID));
|
---|
25 | $messages[6] = sprintf(__('Page submitted. <a href="%s">Preview page</a>'), add_query_arg( 'preview', 'true', get_permalink($post_ID) ) );
|
---|
26 |
|
---|
27 | if ( isset($_GET['revision']) )
|
---|
28 | $messages[5] = sprintf( __('Page restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) );
|
---|
29 |
|
---|
30 | $notice = false;
|
---|
31 | $notices[1] = __( 'There is an autosave of this page that is more recent than the version below. <a href="%s">View the autosave</a>.' );
|
---|
32 |
|
---|
33 | if ( 0 == $post_ID) {
|
---|
34 | $form_action = 'post';
|
---|
35 | $nonce_action = 'add-page';
|
---|
36 | $temp_ID = -1 * time(); // don't change this formula without looking at wp_write_post()
|
---|
37 | $form_extra = "<input type='hidden' id='post_ID' name='temp_ID' value='$temp_ID' />";
|
---|
38 | } else {
|
---|
39 | $post_ID = (int) $post_ID;
|
---|
40 | $form_action = 'editpost';
|
---|
41 | $nonce_action = 'update-page_' . $post_ID;
|
---|
42 | $form_extra = "<input type='hidden' id='post_ID' name='post_ID' value='$post_ID' />";
|
---|
43 | $autosave = wp_get_post_autosave( $post_ID );
|
---|
44 | if ( $autosave && mysql2date( 'U', $autosave->post_modified_gmt, false ) > mysql2date( 'U', $post->post_modified_gmt, false ) )
|
---|
45 | $notice = sprintf( $notices[1], get_edit_post_link( $autosave->ID ) );
|
---|
46 | }
|
---|
47 |
|
---|
48 | $temp_ID = (int) $temp_ID;
|
---|
49 | $user_ID = (int) $user_ID;
|
---|
50 |
|
---|
51 | /**
|
---|
52 | * Display submit form fields.
|
---|
53 | *
|
---|
54 | * @since 2.7.0
|
---|
55 | *
|
---|
56 | * @param object $post
|
---|
57 | */
|
---|
58 | function page_submit_meta_box($post) {
|
---|
59 | global $action;
|
---|
60 |
|
---|
61 | $can_publish = current_user_can('publish_pages');
|
---|
62 | ?>
|
---|
63 | <div class="submitbox" id="submitpage">
|
---|
64 |
|
---|
65 | <div id="minor-publishing">
|
---|
66 |
|
---|
67 | <?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key ?>
|
---|
68 | <div style="display:none;">
|
---|
69 | <input type="submit" name="save" value="<?php esc_attr_e('Save'); ?>" />
|
---|
70 | </div>
|
---|
71 |
|
---|
72 | <div id="minor-publishing-actions">
|
---|
73 | <div id="save-action">
|
---|
74 | <?php if ( 'publish' != $post->post_status && 'future' != $post->post_status && 'pending' != $post->post_status ) { ?>
|
---|
75 | <input <?php if ( 'private' == $post->post_status ) { ?>style="display:none"<?php } ?> type="submit" name="save" id="save-post" value="<?php esc_attr_e('Save Draft'); ?>" tabindex="4" class="button button-highlighted" />
|
---|
76 | <?php } elseif ( 'pending' == $post->post_status && $can_publish ) { ?>
|
---|
77 | <input type="submit" name="save" id="save-post" value="<?php esc_attr_e('Save as Pending'); ?>" tabindex="4" class="button button-highlighted" />
|
---|
78 | <?php } ?>
|
---|
79 | </div>
|
---|
80 |
|
---|
81 | <div id="preview-action">
|
---|
82 | <?php
|
---|
83 | if ( 'publish' == $post->post_status ) {
|
---|
84 | $preview_link = esc_url(get_permalink($post->ID));
|
---|
85 | $preview_button = __('Preview Changes');
|
---|
86 | } else {
|
---|
87 | $preview_link = esc_url(apply_filters('preview_post_link', add_query_arg('preview', 'true', get_permalink($post->ID))));
|
---|
88 | $preview_button = __('Preview');
|
---|
89 | }
|
---|
90 | ?>
|
---|
91 | <a class="preview button" href="<?php echo $preview_link; ?>" target="wp-preview" id="post-preview" tabindex="4"><?php echo $preview_button; ?></a>
|
---|
92 | <input type="hidden" name="wp-preview" id="wp-preview" value="" />
|
---|
93 | </div>
|
---|
94 |
|
---|
95 | <div class="clear"></div>
|
---|
96 | </div><?php // /minor-publishing-actions ?>
|
---|
97 |
|
---|
98 | <div id="misc-publishing-actions">
|
---|
99 |
|
---|
100 | <div class="misc-pub-section<?php if ( !$can_publish ) { echo ' misc-pub-section-last'; } ?>"><label for="post_status"><?php _e('Status:') ?></label>
|
---|
101 | <span id="post-status-display">
|
---|
102 | <?php
|
---|
103 | switch ( $post->post_status ) {
|
---|
104 | case 'private':
|
---|
105 | _e('Privately Published');
|
---|
106 | break;
|
---|
107 | case 'publish':
|
---|
108 | _e('Published');
|
---|
109 | break;
|
---|
110 | case 'future':
|
---|
111 | _e('Scheduled');
|
---|
112 | break;
|
---|
113 | case 'pending':
|
---|
114 | _e('Pending Review');
|
---|
115 | break;
|
---|
116 | case 'draft':
|
---|
117 | _e('Draft');
|
---|
118 | break;
|
---|
119 | }
|
---|
120 | ?>
|
---|
121 | </span>
|
---|
122 | <?php if ( 'publish' == $post->post_status || 'private' == $post->post_status || $can_publish ) { ?>
|
---|
123 | <a href="#post_status" <?php if ( 'private' == $post->post_status ) { ?>style="display:none;" <?php } ?>class="edit-post-status hide-if-no-js" tabindex='4'><?php _e('Edit') ?></a>
|
---|
124 |
|
---|
125 | <div id="post-status-select" class="hide-if-js">
|
---|
126 | <input type="hidden" name="hidden_post_status" id="hidden_post_status" value="<?php echo esc_attr($post->post_status); ?>" />
|
---|
127 | <select name='post_status' id='post_status' tabindex='4'>
|
---|
128 | <?php if ( 'publish' == $post->post_status ) : ?>
|
---|
129 | <option<?php selected( $post->post_status, 'publish' ); ?> value='publish'><?php _e('Published') ?></option>
|
---|
130 | <?php elseif ( 'private' == $post->post_status ) : ?>
|
---|
131 | <option<?php selected( $post->post_status, 'private' ); ?> value='publish'><?php _e('Privately Published') ?></option>
|
---|
132 | <?php elseif ( 'future' == $post->post_status ) : ?>
|
---|
133 | <option<?php selected( $post->post_status, 'future' ); ?> value='future'><?php _e('Scheduled') ?></option>
|
---|
134 | <?php endif; ?>
|
---|
135 | <option<?php selected( $post->post_status, 'pending' ); ?> value='pending'><?php _e('Pending Review') ?></option>
|
---|
136 | <option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php _e('Draft') ?></option>
|
---|
137 | </select>
|
---|
138 |
|
---|
139 | <a href="#post_status" class="save-post-status hide-if-no-js button"><?php _e('OK'); ?></a>
|
---|
140 | <a href="#post_status" class="cancel-post-status hide-if-no-js"><?php _e('Cancel'); ?></a>
|
---|
141 | </div>
|
---|
142 |
|
---|
143 | <?php } ?>
|
---|
144 | </div><?php // /misc-pub-section ?>
|
---|
145 |
|
---|
146 | <div class="misc-pub-section " id="visibility">
|
---|
147 | <?php _e('Visibility:'); ?> <span id="post-visibility-display"><?php
|
---|
148 |
|
---|
149 | if ( 'private' == $post->post_status ) {
|
---|
150 | $post->post_password = '';
|
---|
151 | $visibility = 'private';
|
---|
152 | $visibility_trans = __('Private');
|
---|
153 | } elseif ( !empty( $post->post_password ) ) {
|
---|
154 | $visibility = 'password';
|
---|
155 | $visibility_trans = __('Password protected');
|
---|
156 | } else {
|
---|
157 | $visibility = 'public';
|
---|
158 | $visibility_trans = __('Public');
|
---|
159 | }
|
---|
160 |
|
---|
161 | echo esc_html( $visibility_trans ); ?></span>
|
---|
162 | <?php if ( $can_publish ) { ?>
|
---|
163 | <a href="#visibility" class="edit-visibility hide-if-no-js"><?php _e('Edit'); ?></a>
|
---|
164 |
|
---|
165 | <div id="post-visibility-select" class="hide-if-js">
|
---|
166 | <input type="hidden" name="hidden_post_password" id="hidden-post-password" value="<?php echo esc_attr($post->post_password); ?>" />
|
---|
167 | <input type="hidden" name="hidden_post_visibility" id="hidden-post-visibility" value="<?php echo esc_attr( $visibility ); ?>" />
|
---|
168 |
|
---|
169 | <input type="radio" name="visibility" id="visibility-radio-public" value="public" <?php checked( $visibility, 'public' ); ?> /> <label for="visibility-radio-public" class="selectit"><?php _e('Public'); ?></label><br />
|
---|
170 | <input type="radio" name="visibility" id="visibility-radio-password" value="password" <?php checked( $visibility, 'password' ); ?> /> <label for="visibility-radio-password" class="selectit"><?php _e('Password protected'); ?></label><br />
|
---|
171 | <span id="password-span"><label for="post_password"><?php _e('Password:'); ?></label> <input type="text" name="post_password" id="post_password" value="<?php echo esc_attr($post->post_password); ?>" /><br /></span>
|
---|
172 | <input type="radio" name="visibility" id="visibility-radio-private" value="private" <?php checked( $visibility, 'private' ); ?> /> <label for="visibility-radio-private" class="selectit"><?php _e('Private'); ?></label><br />
|
---|
173 |
|
---|
174 | <p><a href="#visibility" class="save-post-visibility hide-if-no-js button"><?php _e('OK'); ?></a>
|
---|
175 | <a href="#visibility" class="cancel-post-visibility hide-if-no-js"><?php _e('Cancel'); ?></a></p>
|
---|
176 | </div>
|
---|
177 | <?php } ?>
|
---|
178 |
|
---|
179 | </div><?php // /misc-pub-section ?>
|
---|
180 |
|
---|
181 | <?php
|
---|
182 | // translators: Publish box date formt, see http://php.net/date
|
---|
183 | $datef = __( 'M j, Y @ G:i' );
|
---|
184 | if ( 0 != $post->ID ) {
|
---|
185 | if ( 'future' == $post->post_status ) { // scheduled for publishing at a future date
|
---|
186 | $stamp = __('Scheduled for: <b>%1$s</b>');
|
---|
187 | } else if ( 'publish' == $post->post_status || 'private' == $post->post_status ) { // already published
|
---|
188 | $stamp = __('Published on: <b>%1$s</b>');
|
---|
189 | } else if ( '0000-00-00 00:00:00' == $post->post_date_gmt ) { // draft, 1 or more saves, no date specified
|
---|
190 | $stamp = __('Publish <b>immediately</b>');
|
---|
191 | } else if ( time() < strtotime( $post->post_date_gmt . ' +0000' ) ) { // draft, 1 or more saves, future date specified
|
---|
192 | $stamp = __('Schedule for: <b>%1$s</b>');
|
---|
193 | } else { // draft, 1 or more saves, date specified
|
---|
194 | $stamp = __('Publish on: <b>%1$s</b>');
|
---|
195 | }
|
---|
196 | $date = date_i18n( $datef, strtotime( $post->post_date ) );
|
---|
197 | } else { // draft (no saves, and thus no date specified)
|
---|
198 | $stamp = __('Publish <b>immediately</b>');
|
---|
199 | $date = date_i18n( $datef, strtotime( current_time('mysql') ) );
|
---|
200 | }
|
---|
201 |
|
---|
202 | if ( $can_publish ) : // Contributors don't get to choose the date of publish ?>
|
---|
203 | <div class="misc-pub-section curtime misc-pub-section-last">
|
---|
204 | <span id="timestamp"><?php printf($stamp, $date); ?></span>
|
---|
205 | <a href="#edit_timestamp" class="edit-timestamp hide-if-no-js" tabindex='4'><?php _e('Edit') ?></a>
|
---|
206 | <div id="timestampdiv" class="hide-if-js"><?php touch_time(($action == 'edit'),1,4); ?></div>
|
---|
207 | </div><?php // /misc-pub-section
|
---|
208 | endif; ?>
|
---|
209 |
|
---|
210 | </div>
|
---|
211 | <div class="clear"></div>
|
---|
212 | </div>
|
---|
213 |
|
---|
214 | <div id="major-publishing-actions">
|
---|
215 | <?php do_action('post_submitbox_start'); ?>
|
---|
216 | <div id="delete-action">
|
---|
217 | <?php
|
---|
218 | if ( ( 'edit' == $action ) && current_user_can('delete_page', $post->ID) ) { ?>
|
---|
219 | <a class="submitdelete deletion" href="<?php echo wp_nonce_url("page.php?action=delete&post=$post->ID", 'delete-page_' . $post->ID); ?>" onclick="if ( confirm('<?php echo esc_js(sprintf( ('draft' == $post->post_status) ? __("You are about to delete this draft '%s'\n 'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this page '%s'\n 'Cancel' to stop, 'OK' to delete."), $post->post_title )); ?>') ) {return true;}return false;"><?php _e('Delete'); ?></a>
|
---|
220 | <?php } ?>
|
---|
221 | </div>
|
---|
222 |
|
---|
223 | <div id="publishing-action">
|
---|
224 | <?php
|
---|
225 | if ( !in_array( $post->post_status, array('publish', 'future', 'private') ) || 0 == $post->ID ) { ?>
|
---|
226 | <?php
|
---|
227 | if ( $can_publish ) :
|
---|
228 | if ( !empty($post->post_date_gmt) && time() < strtotime( $post->post_date_gmt . ' +0000' ) ) : ?>
|
---|
229 | <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Schedule') ?>" />
|
---|
230 | <input name="publish" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php esc_attr_e('Schedule') ?>" />
|
---|
231 | <?php else : ?>
|
---|
232 | <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Publish') ?>" />
|
---|
233 | <input name="publish" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php esc_attr_e('Publish') ?>" />
|
---|
234 | <?php endif;
|
---|
235 | else : ?>
|
---|
236 | <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Submit for Review') ?>" />
|
---|
237 | <input name="publish" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php esc_attr_e('Submit for Review') ?>" />
|
---|
238 | <?php
|
---|
239 | endif;
|
---|
240 | } else { ?>
|
---|
241 | <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Update Page') ?>" />
|
---|
242 | <input name="save" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php esc_attr_e('Update Page') ?>" />
|
---|
243 | <?php
|
---|
244 | } ?>
|
---|
245 | </div>
|
---|
246 | <div class="clear"></div>
|
---|
247 | </div>
|
---|
248 | </div>
|
---|
249 | <?php
|
---|
250 | }
|
---|
251 | add_meta_box('pagesubmitdiv', __('Publish'), 'page_submit_meta_box', 'page', 'side', 'core');
|
---|
252 |
|
---|
253 | /**
|
---|
254 | * Display page password form fields.
|
---|
255 | *
|
---|
256 | * @since 2.6.0
|
---|
257 | *
|
---|
258 | * @param object $post
|
---|
259 | */
|
---|
260 | function page_password_meta_box($post){
|
---|
261 | ?>
|
---|
262 | <p><label for="post_status_private" class="selectit"><input id="post_status_private" name="post_status" type="checkbox" value="private" <?php checked($post->post_status, 'private'); ?> tabindex='4' /> <?php _e('Keep this page private') ?></label></p>
|
---|
263 | <h4><?php _e( 'Page Password' ); ?></h4>
|
---|
264 | <p><label class="screen-reader-text" for="post_password"><?php _e('Password Protect This Page') ?></label><input name="post_password" type="text" size="25" id="post_password" value="<?php the_post_password(); ?>" /></p>
|
---|
265 | <p><?php _e('Setting a password will require people who visit your blog to enter the above password to view this page and its comments.'); ?></p>
|
---|
266 | <?php
|
---|
267 | }
|
---|
268 | // add_meta_box('pagepassworddiv', __('Privacy Options'), 'page_password_meta_box', 'page', 'side', 'core');
|
---|
269 |
|
---|
270 | /**
|
---|
271 | * Display page attributes form fields.
|
---|
272 | *
|
---|
273 | * @since 2.7.0
|
---|
274 | *
|
---|
275 | * @param object $post
|
---|
276 | */
|
---|
277 | function page_attributes_meta_box($post){
|
---|
278 | ?>
|
---|
279 | <h5><?php _e('Parent') ?></h5>
|
---|
280 | <label class="screen-reader-text" for="parent_id"><?php _e('Page Parent') ?></label>
|
---|
281 | <?php wp_dropdown_pages(array('exclude_tree' => $post->ID, 'selected' => $post->post_parent, 'name' => 'parent_id', 'show_option_none' => __('Main Page (no parent)'), 'sort_column'=> 'menu_order, post_title')); ?>
|
---|
282 | <p><?php _e('You can arrange your pages in hierarchies, for example you could have an “About” page that has “Life Story” and “My Dog” pages under it. There are no limits to how deeply nested you can make pages.'); ?></p>
|
---|
283 | <?php
|
---|
284 | if ( 0 != count( get_page_templates() ) ) { ?>
|
---|
285 | <h5><?php _e('Template') ?></h5>
|
---|
286 | <label class="screen-reader-text" for="page_template"><?php _e('Page Template') ?></label><select name="page_template" id="page_template">
|
---|
287 | <option value='default'><?php _e('Default Template'); ?></option>
|
---|
288 | <?php page_template_dropdown($post->page_template); ?>
|
---|
289 | </select>
|
---|
290 | <p><?php _e('Some themes have custom templates you can use for certain pages that might have additional features or custom layouts. If so, you’ll see them above.'); ?></p>
|
---|
291 | <?php
|
---|
292 | } ?>
|
---|
293 | <h5><?php _e('Order') ?></h5>
|
---|
294 | <p><label class="screen-reader-text" for="menu_order"><?php _e('Page Order') ?></label><input name="menu_order" type="text" size="4" id="menu_order" value="<?php echo esc_attr($post->menu_order) ?>" /></p>
|
---|
295 | <p><?php _e('Pages are usually ordered alphabetically, but you can put a number above to change the order pages appear in. (We know this is a little janky, it’ll be better in future releases.)'); ?></p>
|
---|
296 | <?php
|
---|
297 | }
|
---|
298 | add_meta_box('pageparentdiv', __('Attributes'), 'page_attributes_meta_box', 'page', 'side', 'core');
|
---|
299 |
|
---|
300 | /**
|
---|
301 | * Display custom field for page form fields.
|
---|
302 | *
|
---|
303 | * @since 2.6.0
|
---|
304 | *
|
---|
305 | * @param object $post
|
---|
306 | */
|
---|
307 | function page_custom_meta_box($post){
|
---|
308 | ?>
|
---|
309 | <div id="postcustomstuff">
|
---|
310 | <?php
|
---|
311 | $metadata = has_meta($post->ID);
|
---|
312 | list_meta($metadata);
|
---|
313 | meta_form(); ?>
|
---|
314 | <div id="ajax-response"></div>
|
---|
315 | </div>
|
---|
316 | <p><?php _e('Custom fields can be used to add extra metadata to a post that you can <a href="http://codex.wordpress.org/Using_Custom_Fields" target="_blank">use in your theme</a>.'); ?></p>
|
---|
317 | <?php
|
---|
318 | }
|
---|
319 | add_meta_box('pagecustomdiv', __('Custom Fields'), 'page_custom_meta_box', 'page', 'normal', 'core');
|
---|
320 |
|
---|
321 | /**
|
---|
322 | * Display comments status form fields.
|
---|
323 | *
|
---|
324 | * @since 2.6.0
|
---|
325 | *
|
---|
326 | * @param object $post
|
---|
327 | */
|
---|
328 | function page_comments_status_meta_box($post){
|
---|
329 | ?>
|
---|
330 | <input name="advanced_view" type="hidden" value="1" />
|
---|
331 | <p><label for="comment_status" class="selectit">
|
---|
332 | <input name="comment_status" type="checkbox" id="comment_status" value="open" <?php checked($post->comment_status, 'open'); ?> />
|
---|
333 | <?php _e('Allow Comments') ?></label></p>
|
---|
334 | <p><label for="ping_status" class="selectit"><input name="ping_status" type="checkbox" id="ping_status" value="open" <?php checked($post->ping_status, 'open'); ?> /> <?php _e('Allow Pings') ?></label></p>
|
---|
335 | <p><?php _e('These settings apply to this page only. “Pings” are <a href="http://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments" target="_blank">trackbacks and pingbacks</a>.'); ?></p>
|
---|
336 | <?php
|
---|
337 | }
|
---|
338 | add_meta_box('pagecommentstatusdiv', __('Discussion'), 'page_comments_status_meta_box', 'page', 'normal', 'core');
|
---|
339 |
|
---|
340 | /**
|
---|
341 | * Display page slug form fields.
|
---|
342 | *
|
---|
343 | * @since 2.6.0
|
---|
344 | *
|
---|
345 | * @param object $post
|
---|
346 | */
|
---|
347 | function page_slug_meta_box($post){
|
---|
348 | ?>
|
---|
349 | <label class="screen-reader-text" for="post_name"><?php _e('Page Slug') ?></label><input name="post_name" type="text" size="13" id="post_name" value="<?php echo esc_attr( $post->post_name ); ?>" />
|
---|
350 | <?php
|
---|
351 | }
|
---|
352 | add_meta_box('pageslugdiv', __('Page Slug'), 'page_slug_meta_box', 'page', 'normal', 'core');
|
---|
353 |
|
---|
354 | $authors = get_editable_user_ids( $current_user->id, true, 'page' ); // TODO: ROLE SYSTEM
|
---|
355 | if ( $post->post_author && !in_array($post->post_author, $authors) )
|
---|
356 | $authors[] = $post->post_author;
|
---|
357 | if ( $authors && count( $authors ) > 1 ) {
|
---|
358 | /**
|
---|
359 | * Display page author form fields, when more than one author exists.
|
---|
360 | *
|
---|
361 | * @since 2.6.0
|
---|
362 | *
|
---|
363 | * @param object $post
|
---|
364 | */
|
---|
365 | function page_author_meta_box($post){
|
---|
366 | global $current_user, $user_ID;
|
---|
367 | $authors = get_editable_user_ids( $current_user->id, true, 'page' ); // TODO: ROLE SYSTEM
|
---|
368 | if ( $post->post_author && !in_array($post->post_author, $authors) )
|
---|
369 | $authors[] = $post->post_author;
|
---|
370 | ?>
|
---|
371 | <label class="screen-reader-text" for="post_author_override"><?php _e('Page Author'); ?></label><?php wp_dropdown_users( array('include' => $authors, 'name' => 'post_author_override', 'selected' => empty($post->ID) ? $user_ID : $post->post_author) ); ?>
|
---|
372 | <?php
|
---|
373 | }
|
---|
374 | add_meta_box('pageauthordiv', __('Page Author'), 'page_author_meta_box', 'page', 'normal', 'core');
|
---|
375 | }
|
---|
376 |
|
---|
377 | if ( 0 < $post_ID && wp_get_post_revisions( $post_ID ) ) :
|
---|
378 | /**
|
---|
379 | * Display list of page revisions.
|
---|
380 | *
|
---|
381 | * @since 2.6.0
|
---|
382 | *
|
---|
383 | * @param object $post
|
---|
384 | */
|
---|
385 | function page_revisions_meta_box($post) {
|
---|
386 | wp_list_post_revisions();
|
---|
387 | }
|
---|
388 | add_meta_box('revisionsdiv', __('Page Revisions'), 'page_revisions_meta_box', 'page', 'normal', 'core');
|
---|
389 | endif;
|
---|
390 |
|
---|
391 | do_action('do_meta_boxes', 'page', 'normal', $post);
|
---|
392 | do_action('do_meta_boxes', 'page', 'advanced', $post);
|
---|
393 | do_action('do_meta_boxes', 'page', 'side', $post);
|
---|
394 |
|
---|
395 | require_once('admin-header.php');
|
---|
396 | ?>
|
---|
397 |
|
---|
398 | <div class="wrap">
|
---|
399 | <?php screen_icon(); ?>
|
---|
400 | <h2><?php echo esc_html( $title ); ?></h2>
|
---|
401 |
|
---|
402 | <form name="post" action="page.php" method="post" id="post">
|
---|
403 | <?php if ( $notice ) : ?>
|
---|
404 | <div id="notice" class="error"><p><?php echo $notice ?></p></div>
|
---|
405 | <?php endif; ?>
|
---|
406 | <?php if (isset($_GET['message'])) : ?>
|
---|
407 | <div id="message" class="updated fade"><p><?php echo $messages[$_GET['message']]; ?></p></div>
|
---|
408 | <?php endif; ?>
|
---|
409 |
|
---|
410 | <?php
|
---|
411 | wp_nonce_field($nonce_action);
|
---|
412 |
|
---|
413 | if (isset($mode) && 'bookmarklet' == $mode)
|
---|
414 | echo '<input type="hidden" name="mode" value="bookmarklet" />';
|
---|
415 | ?>
|
---|
416 | <input type="hidden" id="user-id" name="user_ID" value="<?php echo $user_ID ?>" />
|
---|
417 | <input type="hidden" id="hiddenaction" name="action" value='<?php echo esc_attr($form_action) ?>' />
|
---|
418 | <input type="hidden" id="originalaction" name="originalaction" value="<?php echo esc_attr($form_action) ?>" />
|
---|
419 | <input type="hidden" id="post_author" name="post_author" value="<?php echo esc_attr( $post->post_author ); ?>" />
|
---|
420 | <?php echo $form_extra ?>
|
---|
421 | <input type="hidden" id="post_type" name="post_type" value="<?php echo esc_attr($post->post_type) ?>" />
|
---|
422 | <input type="hidden" id="original_post_status" name="original_post_status" value="<?php echo esc_attr($post->post_status) ?>" />
|
---|
423 | <input name="referredby" type="hidden" id="referredby" value="<?php echo esc_url(stripslashes(wp_get_referer())); ?>" />
|
---|
424 | <?php if ( 'draft' != $post->post_status ) wp_original_referer_field(true, 'previous'); ?>
|
---|
425 |
|
---|
426 | <div id="poststuff" class="metabox-holder<?php echo 2 == $screen_layout_columns ? ' has-right-sidebar' : ''; ?>">
|
---|
427 |
|
---|
428 | <div id="side-info-column" class="inner-sidebar">
|
---|
429 | <?php
|
---|
430 | do_action('submitpage_box');
|
---|
431 | $side_meta_boxes = do_meta_boxes('page', 'side', $post); ?>
|
---|
432 | </div>
|
---|
433 |
|
---|
434 | <div id="post-body">
|
---|
435 | <div id="post-body-content">
|
---|
436 | <div id="titlediv">
|
---|
437 | <div id="titlewrap">
|
---|
438 | <label class="screen-reader-text" for="title"><?php _e('Title') ?></label>
|
---|
439 | <input type="text" name="post_title" size="30" tabindex="1" value="<?php echo esc_attr( htmlspecialchars( $post->post_title ) ); ?>" id="title" autocomplete="off" />
|
---|
440 | </div>
|
---|
441 | <div class="inside">
|
---|
442 | <?php $sample_permalink_html = get_sample_permalink_html($post->ID); ?>
|
---|
443 | <div id="edit-slug-box">
|
---|
444 | <?php if ( ! empty($post->ID) && ! empty($sample_permalink_html) ) :
|
---|
445 | echo $sample_permalink_html;
|
---|
446 | endif; ?>
|
---|
447 | </div>
|
---|
448 | </div>
|
---|
449 | </div>
|
---|
450 |
|
---|
451 | <div id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>" class="postarea">
|
---|
452 |
|
---|
453 | <?php the_editor($post->post_content); ?>
|
---|
454 | <table id="post-status-info" cellspacing="0"><tbody><tr>
|
---|
455 | <td id="wp-word-count"></td>
|
---|
456 | <td class="autosave-info">
|
---|
457 | <span id="autosave"> </span>
|
---|
458 |
|
---|
459 | <?php
|
---|
460 | if ($post_ID) {
|
---|
461 | if ( $last_id = get_post_meta($post_ID, '_edit_last', true) ) {
|
---|
462 | $last_user = get_userdata($last_id);
|
---|
463 | 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));
|
---|
464 | } else {
|
---|
465 | 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));
|
---|
466 | }
|
---|
467 | }
|
---|
468 | ?>
|
---|
469 | </td>
|
---|
470 | </tr></tbody></table>
|
---|
471 |
|
---|
472 | <?php
|
---|
473 | wp_nonce_field( 'autosave', 'autosavenonce', false );
|
---|
474 | wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
|
---|
475 | wp_nonce_field( 'getpermalink', 'getpermalinknonce', false );
|
---|
476 | wp_nonce_field( 'samplepermalink', 'samplepermalinknonce', false );
|
---|
477 | wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?>
|
---|
478 | </div>
|
---|
479 |
|
---|
480 | <?php
|
---|
481 | do_meta_boxes('page', 'normal', $post);
|
---|
482 | do_action('edit_page_form');
|
---|
483 | do_meta_boxes('page', 'advanced', $post);
|
---|
484 | ?>
|
---|
485 |
|
---|
486 | </div>
|
---|
487 | </div>
|
---|
488 | </div>
|
---|
489 |
|
---|
490 | </form>
|
---|
491 | </div>
|
---|
492 |
|
---|
493 | <script type="text/javascript">
|
---|
494 | try{document.post.title.focus();}catch(e){}
|
---|
495 | </script>
|
---|