X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/76aea3697c6043c1613370f172395b4f65ee71f0..9c40b4d36daed9e28e48a5fe9205c32557195a4b:/wp-admin/edit-page-form.php diff --git a/wp-admin/edit-page-form.php b/wp-admin/edit-page-form.php index eb58d20c..2d436be7 100644 --- a/wp-admin/edit-page-form.php +++ b/wp-admin/edit-page-form.php @@ -1,10 +1,28 @@ go back.' ), attribute_escape( stripslashes( $_GET['_wp_original_http_referer'] ) ) ); +$messages[1] = sprintf(__('Page updated. View page'), get_permalink($post_ID)); $messages[2] = __('Custom field updated.'); $messages[3] = __('Custom field deleted.'); -$messages[4] = __('Page updated.'); +$messages[5] = sprintf(__('Page published. View page'), get_permalink($post_ID)); +$messages[6] = sprintf(__('Page submitted. Preview page'), add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ); if ( isset($_GET['revision']) ) $messages[5] = sprintf( __('Page restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) ); @@ -12,7 +30,7 @@ if ( isset($_GET['revision']) ) $notice = false; $notices[1] = __( 'There is an autosave of this page that is more recent than the version below. View the autosave.' ); -if (!isset($post_ID) || 0 == $post_ID) { +if ( 0 == $post_ID) { $form_action = 'post'; $nonce_action = 'add-page'; $temp_ID = -1 * time(); // don't change this formula without looking at wp_write_post() @@ -22,201 +40,291 @@ if (!isset($post_ID) || 0 == $post_ID) { $form_action = 'editpost'; $nonce_action = 'update-page_' . $post_ID; $form_extra = ""; - $autosave = wp_get_post_autosave( $post_id ); - if ( $autosave && mysql2date( 'U', $autosave->post_modified_gmt ) > mysql2date( 'U', $post->post_modified_gmt ) ) + $autosave = wp_get_post_autosave( $post_ID ); + if ( $autosave && mysql2date( 'U', $autosave->post_modified_gmt, false ) > mysql2date( 'U', $post->post_modified_gmt, false ) ) $notice = sprintf( $notices[1], get_edit_post_link( $autosave->ID ) ); } $temp_ID = (int) $temp_ID; $user_ID = (int) $user_ID; +/** + * Display submit form fields. + * + * @since 2.7.0 + * + * @param object $post + */ +function page_submit_meta_box($post) { + global $action; + + $can_publish = current_user_can('publish_pages'); ?> +
- -post_status == 'publish' AND current_user_can('edit_page', $post->ID) ) ) : + + +post_status ) { + case 'private': + _e('Privately Published'); + break; + case 'publish': + _e('Published'); + break; + case 'future': + _e('Scheduled'); + break; + case 'pending': + _e('Pending Review'); + break; + case 'draft': + _e('Draft'); + break; +} ?> -post_status, 'publish' ); selected( $post->post_status, 'private' );?> value='publish'> - -post_status ) : ?> -post_status, 'future' ); ?> value='future'> + +post_status || 'private' == $post->post_status || $can_publish ) { ?> +post_status ) { ?>style="display:none;" class="edit-post-status hide-if-no-js" tabindex='4'> + + + + +post_status ) : ?> +post_status, 'publish' ); ?> value='publish'> +post_status ) : ?> +post_status, 'private' ); ?> value='publish'> +post_status ) : ?> +post_status, 'future' ); ?> value='future'> post_status, 'pending' ); ?> value='pending'> -post_status, 'draft' ); ?> value='draft'> +post_status, 'draft' ); ?> value='draft'> - - -post_status, 'private'); ?> tabindex='4' /> - -post_status ) { // scheduled for publishing at a future date - $stamp = __('Scheduled for:%1$s at %2$s'); - } else if ( 'publish' == $post->post_status ) { // already published - $stamp = __('Published on:%1$s at %2$s'); - } else if ( '0000-00-00 00:00:00' == $post->post_date ) { // draft, 1 or more saves, no date specified - $stamp = __('Publish immediately'); - } else { // draft, 1 or more saves, date specified - $stamp = __('Publish on:%1$s at %2$s'); - } - $date = mysql2date(get_option('date_format'), $post->post_date); - $time = mysql2date(get_option('time_format'), $post->post_date); -} else { // draft (no saves, and thus no date specified) - $stamp = __('Publish immediately'); - $date = mysql2date(get_option('date_format'), current_time('mysql')); - $time = mysql2date(get_option('time_format'), current_time('mysql')); + + + + + + + + + post_status ) { + $post->post_password = ''; + $visibility = 'private'; + $visibility_trans = __('Private'); +} elseif ( !empty( $post->post_password ) ) { + $visibility = 'password'; + $visibility_trans = __('Password protected'); +} else { + $visibility = 'public'; + $visibility_trans = __('Public'); } -?> - - - +echo esc_html( $visibility_trans ); ?> + + + + + + + + /> + /> + + /> + + + - - -post_status, array('publish', 'future') ) || 0 == $post_ID ) { -?> - - - - - - -if ( ('edit' == $action) && current_user_can('delete_page', $post_ID) ) - echo "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;\">" . __('Delete page') . ""; -?> - - -display_name ), mysql2date(get_option('date_format'), $post->post_modified), mysql2date(get_option('time_format'), $post->post_modified)); -} else { - 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)); +ID ) { + if ( 'future' == $post->post_status ) { // scheduled for publishing at a future date + $stamp = __('Scheduled for: %1$s'); + } else if ( 'publish' == $post->post_status || 'private' == $post->post_status ) { // already published + $stamp = __('Published on: %1$s'); + } else if ( '0000-00-00 00:00:00' == $post->post_date_gmt ) { // draft, 1 or more saves, no date specified + $stamp = __('Publish immediately'); + } else if ( time() < strtotime( $post->post_date_gmt . ' +0000' ) ) { // draft, 1 or more saves, future date specified + $stamp = __('Schedule for: %1$s'); + } else { // draft, 1 or more saves, date specified + $stamp = __('Publish on: %1$s'); + } + $date = date_i18n( $datef, strtotime( $post->post_date ) ); +} else { // draft (no saves, and thus no date specified) + $stamp = __('Publish immediately'); + $date = date_i18n( $datef, strtotime( current_time('mysql') ) ); } -?> - - - - - - - +if ( $can_publish ) : // Contributors don't get to choose the date of publish ?> + + + + + - - - - - - - - - + - - - - - + + + +ID) ) { ?> +ID", 'delete-page_' . $post->ID); ?>" onclick="if ( confirm('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;"> + - -ID); ?> - -ID) && ! empty($sample_permalink_html) ) : - echo $sample_permalink_html; -endif; ?> - + + +post_status, array('publish', 'future', 'private') ) || 0 == $post->ID ) { ?> +post_date_gmt) && time() < strtotime( $post->post_date_gmt . ' +0000' ) ) : ?> + + + + + + + + + + + + + - - - -post_content); ?> - - - - - - - - - - - - - - - +post_status, 'private'); ?> tabindex='4' /> + + + ID); -list_meta($metadata); +} +// add_meta_box('pagepassworddiv', __('Privacy Options'), 'page_password_meta_box', 'page', 'side', 'core'); + +/** + * Display page attributes form fields. + * + * @since 2.7.0 + * + * @param object $post + */ +function page_attributes_meta_box($post){ ?> - - + + + $post->ID, 'selected' => $post->post_parent, 'name' => 'parent_id', 'show_option_none' => __('Main Page (no parent)'), 'sort_column'=> 'menu_order, post_title')); ?> + + + + +page_template); ?> + + + + + + + - + +ID); + list_meta($metadata); + meta_form(); ?> + use in your theme.'); ?> @@ -225,92 +333,162 @@ function page_comments_status_meta_box($post){ ping_status, 'open'); ?> /> trackbacks and pingbacks.'); ?> - - - - - - - - -post_parent); ?> - - - - - -page_template); ?> - - - - - + id ); // TODO: ROLE SYSTEM +$authors = get_editable_user_ids( $current_user->id, true, 'page' ); // TODO: ROLE SYSTEM if ( $post->post_author && !in_array($post->post_author, $authors) ) $authors[] = $post->post_author; if ( $authors && count( $authors ) > 1 ) { + /** + * Display page author form fields, when more than one author exists. + * + * @since 2.6.0 + * + * @param object $post + */ function page_author_meta_box($post){ global $current_user, $user_ID; - $authors = get_editable_user_ids( $current_user->id ); // TODO: ROLE SYSTEM + $authors = get_editable_user_ids( $current_user->id, true, 'page' ); // TODO: ROLE SYSTEM if ( $post->post_author && !in_array($post->post_author, $authors) ) $authors[] = $post->post_author; ?> - $authors, 'name' => 'post_author_override', 'selected' => empty($post->ID) ? $user_ID : $post->post_author) ); ?> + $authors, 'name' => 'post_author_override', 'selected' => empty($post->ID) ? $user_ID : $post->post_author) ); ?> + + + + + + + + + + + + +'; +?> + + + + + + + + +post_status ) wp_original_referer_field(true, 'previous'); ?> + + + + + + + + + + + + + +ID); ?> + +ID) && ! empty($sample_permalink_html) ) : + echo $sample_permalink_html; +endif; ?> + + + + + + +post_content); ?> + + + + +display_name ), mysql2date(get_option('date_format'), $post->post_modified), mysql2date(get_option('time_format'), $post->post_modified)); + } else { + 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)); + } + } +?> + + + + + + + + + + +
post_status, 'private'); ?> tabindex='4' />
-
+
- -post_status, array('publish', 'future') ) || 0 == $post_ID ) { -?> - - - - - - -if ( ('edit' == $action) && current_user_can('delete_page', $post_ID) ) - echo "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;\">" . __('Delete page') . ""; -?> - - -display_name ), mysql2date(get_option('date_format'), $post->post_modified), mysql2date(get_option('time_format'), $post->post_modified)); -} else { - 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)); +ID ) { + if ( 'future' == $post->post_status ) { // scheduled for publishing at a future date + $stamp = __('Scheduled for: %1$s'); + } else if ( 'publish' == $post->post_status || 'private' == $post->post_status ) { // already published + $stamp = __('Published on: %1$s'); + } else if ( '0000-00-00 00:00:00' == $post->post_date_gmt ) { // draft, 1 or more saves, no date specified + $stamp = __('Publish immediately'); + } else if ( time() < strtotime( $post->post_date_gmt . ' +0000' ) ) { // draft, 1 or more saves, future date specified + $stamp = __('Schedule for: %1$s'); + } else { // draft, 1 or more saves, date specified + $stamp = __('Publish on: %1$s'); + } + $date = date_i18n( $datef, strtotime( $post->post_date ) ); +} else { // draft (no saves, and thus no date specified) + $stamp = __('Publish immediately'); + $date = date_i18n( $datef, strtotime( current_time('mysql') ) ); } -?> - - - - -
use in your theme.'); ?>
ping_status, 'open'); ?> />
trackbacks and pingbacks.'); ?>