X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/177fd6fefd2e3d5a0ea6591c71d660cabdb3c1a4..refs/tags/wordpress-2.6.2:/wp-admin/edit-form-advanced.php diff --git a/wp-admin/edit-form-advanced.php b/wp-admin/edit-form-advanced.php index 85042a14..983bc27d 100644 --- a/wp-admin/edit-form-advanced.php +++ b/wp-admin/edit-form-advanced.php @@ -1,12 +1,46 @@ - go back.' ), attribute_escape( stripslashes( $_GET['_wp_original_http_referer'] ) ) ); $messages[2] = __('Custom field updated.'); $messages[3] = __('Custom field deleted.'); $messages[4] = __('Post updated.'); + +if ( isset($_GET['revision']) ) + $messages[5] = sprintf( __('Post restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) ); + +$notice = false; +$notices[1] = __( 'There is an autosave of this post that is more recent than the version below. View the autosave.' ); + +if ( !isset($post_ID) || 0 == $post_ID ) { + $form_action = 'post'; + $temp_ID = -1 * time(); // don't change this formula without looking at wp_write_post() + $form_extra = ""; + $autosave = false; +} else { + $post_ID = (int) $post_ID; + $form_action = 'editpost'; + $form_extra = ""; + $autosave = wp_get_post_autosave( $post_id ); + + // Detect if there exists an autosave newer than the post and if that autosave is different than the post + if ( $autosave && mysql2date( 'U', $autosave->post_modified_gmt ) > mysql2date( 'U', $post->post_modified_gmt ) ) { + foreach ( _wp_post_revision_fields() as $autosave_field => $_autosave_field ) { + if ( wp_text_diff( $autosave->$autosave_field, $post->$autosave_field ) ) { + $notice = sprintf( $notices[1], get_edit_post_link( $autosave->ID ) ); + break; + } + } + unset($autosave_field, $_autosave_field); + } +} + ?> + +

+

@@ -20,33 +54,15 @@ $messages[4] = __('Post updated.');

"; +if ( !isset($post_ID) || 0 == $post_ID) wp_nonce_field('add-post'); -} else { - $post_ID = (int) $post_ID; - $form_action = 'editpost'; - $form_extra = ""; +else wp_nonce_field('update-post_' . $post_ID); -} $form_pingback = ''; $form_prevstatus = ''; -$form_trackback = 'to_ping) ) .'" />'; - -if ('' != $post->pinged) { - $pings = '

'. __('Already pinged:') . '

'; -} - $saveasdraft = ''; ?> @@ -57,14 +73,7 @@ $saveasdraft = ' - + post_status ) wp_original_referer_field(true, 'previous'); ?> @@ -83,10 +92,13 @@ else
-

+

- +post_status == 'publish' AND current_user_can('edit_post', $post->ID) ) ) : +?> post_status, 'publish' ); selected( $post->post_status, 'private' );?> value='publish'> post_status ) : ?> post_status, 'future' ); ?> value='future'> @@ -98,7 +110,7 @@ else

-

+

+

@@ -172,6 +185,9 @@ if ( ( 'edit' == $action) && current_user_can('delete_post', $post_ID) )
  • + +
    +

    @@ -179,7 +195,7 @@ if ( ( 'edit' == $action) && current_user_can('delete_post', $post_ID) )
    -

    +

    @@ -194,7 +210,7 @@ endif; ?>
    -

    +

    post_content); ?> @@ -205,23 +221,22 @@ endif; ?> -
    -

    -
    -

    + +

    -
    -
    - -
    -

    -
    +

    - - 0, 'name' => 'newcat_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => __('Parent category'), 'tab_index' => 3 ) ); ?> + + 0, 'name' => 'newcat_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => __('Parent category'), 'tab_index' => 3 ) ); ?> @@ -241,12 +256,13 @@ endif; ?>

      - + ID, false, false, $popular_ids) ?>
    - -
    -
    + @@ -254,32 +270,41 @@ endif; ?>

    -
    -

    -
    + +

    use them in your template'); ?>

    -
    -
    +to_ping) ) .'" />'; + if ('' != $post->pinged) { + $pings = '

    '. __('Already pinged:') . '

      '; + $already_pinged = explode("\n", trim($post->pinged)); + foreach ($already_pinged as $pinged_url) { + $pings .= "\n\t
    • " . wp_specialchars($pinged_url) . "
    • "; + } + $pings .= '
    '; + } -
    -

    -
    -


    ()

    +?> +


    ()

    pingbacks, no other action necessary.'); ?>

    -
    -
    +} +add_meta_box('trackbacksdiv', __('Trackbacks'), 'post_trackback_meta_box', 'post', 'advanced', 'core'); -
    -

    -
    +function post_custom_meta_box($post) { +?>
    ID); list_meta($metadata); ?> @@ -290,55 +315,66 @@ list_meta($metadata);

    use in your theme.'); ?>

    - - + +do_action('dbx_post_advanced'); -
    -

    -
    +function post_comment_status_meta_box($post) { +?>

    trackbacks and pingbacks.'); ?>

    -
    -
    +"> -

    -
    -

    +function post_password_meta_box($post) { +?> +

    -
    - - -
    -

    -
    - -
    -
    + +id ); // TODO: ROLE SYSTEM if ( $post->post_author && !in_array($post->post_author, $authors) ) $authors[] = $post->post_author; if ( $authors && count( $authors ) > 1 ) : +function post_author_meta_box($post) { + global $current_user, $user_ID; + $authors = get_editable_user_ids( $current_user->id ); // 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) ); ?> + +if ( isset($post_ID) && 0 < $post_ID && wp_get_post_revisions( $post_ID ) ) : +function post_revisions_meta_box($post) { + wp_list_post_revisions(); +} +add_meta_box('revisionsdiv', __('Post Revisions'), 'post_revisions_meta_box', 'post', 'advanced', 'core'); +endif; - +do_meta_boxes('post', 'advanced', $post); + +do_action('dbx_post_sidebar'); +?>