<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[12987] trunk: Create post_status=auto-draft when creating a new post item.</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/12987">12987</a></dd>
<dt>Author</dt> <dd>markjaquith</dd>
<dt>Date</dt> <dd>2010-02-06 10:07:57 +0000 (Sat, 06 Feb 2010)</dd>
</dl>
<h3>Log Message</h3>
<pre>Create post_status=auto-draft when creating a new post item. status changes to draft on first auto-save. now we always have a real post ID to work with. see <a href="http://trac.wordpress.org/ticket/11889">#11889</a>. fixes <a href="http://trac.wordpress.org/ticket/11145">#11145</a>. fixes <a href="http://trac.wordpress.org/ticket/11990">#11990</a></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminadminajaxphp">trunk/wp-admin/admin-ajax.php</a></li>
<li><a href="#trunkwpadmineditformadvancedphp">trunk/wp-admin/edit-form-advanced.php</a></li>
<li><a href="#trunkwpadminincludesmetaboxesphp">trunk/wp-admin/includes/meta-boxes.php</a></li>
<li><a href="#trunkwpadminincludespostphp">trunk/wp-admin/includes/post.php</a></li>
<li><a href="#trunkwpadminpostnewphp">trunk/wp-admin/post-new.php</a></li>
<li><a href="#trunkwpincludesjsautosavedevjs">trunk/wp-includes/js/autosave.dev.js</a></li>
<li><a href="#trunkwpincludesjsautosavejs">trunk/wp-includes/js/autosave.js</a></li>
<li><a href="#trunkwpincludeslinktemplatephp">trunk/wp-includes/link-template.php</a></li>
<li><a href="#trunkwpincludespostphp">trunk/wp-includes/post.php</a></li>
<li><a href="#trunkwpincludesscriptloaderphp">trunk/wp-includes/script-loader.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminadminajaxphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/admin-ajax.php (12986 => 12987)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/admin-ajax.php        2010-02-06 07:31:38 UTC (rev 12986)
+++ trunk/wp-admin/admin-ajax.php        2010-02-06 10:07:57 UTC (rev 12987)
</span><span class="lines">@@ -887,57 +887,54 @@
</span><span class="cx">                 $supplemental['session_expired'] = add_query_arg( 'interim-login', 1, wp_login_url() );
</span><span class="cx">
</span><span class="cx">         $id = $revision_id = 0;
</span><del>-        if ( $_POST['post_ID'] < 0 ) {
</del><ins>+
+        $post_ID = (int) $_POST['post_ID'];
+        $_POST['ID'] = $post_ID;
+        $post = get_post($post_ID);
+        if ( 'auto-draft' == $post->post_status )
</ins><span class="cx">                 $_POST['post_status'] = 'draft';
</span><del>-                $_POST['temp_ID'] = $_POST['post_ID'];
-                if ( $do_autosave ) {
-                        $id = wp_write_post();
-                        $data = $message;
-                }
-        } else {
-                $post_ID = (int) $_POST['post_ID'];
-                $_POST['ID'] = $post_ID;
-                $post = get_post($post_ID);
</del><span class="cx">
</span><del>-                if ( $last = wp_check_post_lock( $post->ID ) ) {
-                        $do_autosave = $do_lock = false;
</del><ins>+        if ( $last = wp_check_post_lock( $post->ID ) ) {
+                $do_autosave = $do_lock = false;
</ins><span class="cx">
</span><del>-                        $last_user = get_userdata( $last );
-                        $last_user_name = $last_user ? $last_user->display_name : __( 'Someone' );
-                        $data = new WP_Error( 'locked', sprintf(
-                                $_POST['post_type'] == 'page' ? __( 'Autosave disabled: %s is currently editing this page.' ) : __( 'Autosave disabled: %s is currently editing this post.' ),
-                                esc_html( $last_user_name )
-                        ) );
</del><ins>+                $last_user = get_userdata( $last );
+                $last_user_name = $last_user ? $last_user->display_name : __( 'Someone' );
+                $data = new WP_Error( 'locked', sprintf(
+                        $_POST['post_type'] == 'page' ? __( 'Autosave disabled: %s is currently editing this page.' ) : __( 'Autosave disabled: %s is currently editing this post.' ),
+                        esc_html( $last_user_name )
+                ) );
</ins><span class="cx">
</span><del>-                        $supplemental['disable_autosave'] = 'disable';
-                }
</del><ins>+                $supplemental['disable_autosave'] = 'disable';
+        }
</ins><span class="cx">
</span><del>-                if ( 'page' == $post->post_type ) {
-                        if ( !current_user_can('edit_page', $post_ID) )
-                                die(__('You are not allowed to edit this page.'));
-                } else {
-                        if ( !current_user_can('edit_post', $post_ID) )
-                                die(__('You are not allowed to edit this post.'));
-                }
</del><ins>+        if ( 'page' == $post->post_type ) {
+                if ( !current_user_can('edit_page', $post_ID) )
+                        die(__('You are not allowed to edit this page.'));
+        } else {
+                if ( !current_user_can('edit_post', $post_ID) )
+                        die(__('You are not allowed to edit this post.'));
+        }
</ins><span class="cx">
</span><del>-                if ( $do_autosave ) {
-                        // Drafts are just overwritten by autosave
-                        if ( 'draft' == $post->post_status ) {
-                                $id = edit_post();
-                        } else { // Non drafts are not overwritten. The autosave is stored in a special post revision.
-                                $revision_id = wp_create_post_autosave( $post->ID );
-                                if ( is_wp_error($revision_id) )
-                                        $id = $revision_id;
-                                else
-                                        $id = $post->ID;
-                        }
-                        $data = $message;
-                } else {
-                        $id = $post->ID;
</del><ins>+        if ( $do_autosave ) {
+                // Drafts and auto-drafts are just overwritten by autosave
+                if ( 'auto-draft' == $post->post_status || 'draft' == $post->post_status ) {
+                        $id = edit_post();
+                } else { // Non drafts are not overwritten. The autosave is stored in a special post revision.
+                        $revision_id = wp_create_post_autosave( $post->ID );
+                        if ( is_wp_error($revision_id) )
+                                $id = $revision_id;
+                        else
+                                $id = $post->ID;
</ins><span class="cx">                 }
</span><ins>+                $data = $message;
+        } else {
+                if ( '1' == $_POST['auto_draft'] )
+                        $id = 0; // This tells us it didn't actually save
+                else
+                        $id = $post->ID;
</ins><span class="cx">         }
</span><span class="cx">
</span><del>-        if ( $do_lock && $id && is_numeric($id) )
</del><ins>+        if ( $do_lock && $_POST['auto_draft'] != '1' && $id && is_numeric($id) )
</ins><span class="cx">                 wp_set_post_lock( $id );
</span><span class="cx">
</span><span class="cx">         if ( $nonce_age == 2 ) {
</span><span class="lines">@@ -961,18 +958,6 @@
</span><span class="cx">         ) );
</span><span class="cx">         $x->send();
</span><span class="cx">         break;
</span><del>-case 'autosave-generate-nonces' :
-        check_ajax_referer( 'autosave', 'autosavenonce' );
-        $ID = (int) $_POST['post_ID'];
-        $post_type = $_POST['post_type'];
-        $post_type_object = get_post_type_object($post_type);
-        if ( !$post_type_object )
-                die('0');
-        if ( current_user_can( $post_type_object->edit_cap, $ID ) )
-                die( json_encode( array( 'updateNonce' => wp_create_nonce( "update-{$post_type}_{$ID}" ), 'deleteURL' => str_replace( '&amp;', '&', wp_nonce_url( admin_url( $post_type . '.php?action=trash&post=' . $ID ), "trash-{$post_type}_{$ID}" ) ) ) ) );
-        do_action('autosave_generate_nonces');
-        die('0');
-break;
</del><span class="cx"> case 'closed-postboxes' :
</span><span class="cx">         check_ajax_referer( 'closedpostboxes', 'closedpostboxesnonce' );
</span><span class="cx">         $closed = isset( $_POST['closed'] ) ? $_POST['closed'] : '';
</span></span></pre></div>
<a id="trunkwpadmineditformadvancedphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/edit-form-advanced.php (12986 => 12987)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/edit-form-advanced.php        2010-02-06 07:31:38 UTC (rev 12986)
+++ trunk/wp-admin/edit-form-advanced.php        2010-02-06 10:07:57 UTC (rev 12987)
</span><span class="lines">@@ -60,28 +60,29 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> $notice = false;
</span><del>-if ( 0 == $post_ID ) {
-        $form_action = 'post';
-        $nonce_action = 'add-' . $post_type;
-        $temp_ID = -1 * time(); // don't change this formula without looking at wp_write_post()
-        $form_extra = "<input type='hidden' id='post_ID' name='temp_ID' value='" . esc_attr($temp_ID) . "' />";
</del><ins>+$form_extra = '';
+if ( 'auto-draft' == $post->post_status ) {
+        if ( 'edit' == $action )
+                $post->post_title = '';
</ins><span class="cx">         $autosave = false;
</span><ins>+        $form_extra .= "<input type='hidden' id='auto_draft' name='auto_draft' value='1' />";
</ins><span class="cx"> } else {
</span><del>-        $form_action = 'editpost';
-        $nonce_action = 'update-' . $post_type . '_' . $post_ID;
-        $form_extra = "<input type='hidden' id='post_ID' name='post_ID' value='" . esc_attr($post_ID) . "' />";
</del><span class="cx">         $autosave = wp_get_post_autosave( $post_ID );
</span><ins>+}
</ins><span class="cx">
</span><del>-        // 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, false ) > mysql2date( 'U', $post->post_modified_gmt, false ) ) {
-                foreach ( _wp_post_revision_fields() as $autosave_field => $_autosave_field ) {
-                        if ( normalize_whitespace( $autosave->$autosave_field ) != normalize_whitespace( $post->$autosave_field ) ) {
-                                $notice = sprintf( __( 'There is an autosave of this post that is more recent than the version below. <a href="%s">View the autosave</a>' ), get_edit_post_link( $autosave->ID ) );
-                                break;
-                        }
</del><ins>+$form_action = 'editpost';
+$nonce_action = 'update-' . $post_type . '_' . $post_ID;
+$form_extra .= "<input type='hidden' id='post_ID' name='post_ID' value='" . esc_attr($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, false ) > mysql2date( 'U', $post->post_modified_gmt, false ) ) {
+        foreach ( _wp_post_revision_fields() as $autosave_field => $_autosave_field ) {
+                if ( normalize_whitespace( $autosave->$autosave_field ) != normalize_whitespace( $post->$autosave_field ) ) {
+                        $notice = sprintf( __( 'There is an autosave of this post that is more recent than the version below. <a href="%s">View the autosave</a>' ), get_edit_post_link( $autosave->ID ) );
+                        break;
</ins><span class="cx">                 }
</span><del>-                unset($autosave_field, $_autosave_field);
</del><span class="cx">         }
</span><ins>+        unset($autosave_field, $_autosave_field);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> $post_type_object = get_post_type_object($post_type);
</span><span class="lines">@@ -197,7 +198,7 @@
</span><span class="cx"> if ( !( 'pending' == $post->post_status && !current_user_can( $post_type_object->publish_cap ) ) ) { ?>
</span><span class="cx">         <div id="edit-slug-box">
</span><span class="cx"> <?php
</span><del>-        if ( ! empty($post->ID) && ! empty($sample_permalink_html) ) :
</del><ins>+        if ( ! empty($post->ID) && ! empty($sample_permalink_html) && 'auto-draft' != $post->post_status ) :
</ins><span class="cx">                 echo $sample_permalink_html;
</span><span class="cx"> endif; ?>
</span><span class="cx">         </div>
</span><span class="lines">@@ -215,7 +216,7 @@
</span><span class="cx">         <td class="autosave-info">
</span><span class="cx">         <span id="autosave">&nbsp;</span>
</span><span class="cx"> <?php
</span><del>-        if ( $post_ID ) {
</del><ins>+        if ( 'auto-draft' != $post->post_status ) {
</ins><span class="cx">                 echo '<span id="last-edit">';
</span><span class="cx">                 if ( $last_id = get_post_meta($post_ID, '_edit_last', true) ) {
</span><span class="cx">                         $last_user = get_userdata($last_id);
</span></span></pre></div>
<a id="trunkwpadminincludesmetaboxesphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/meta-boxes.php (12986 => 12987)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/meta-boxes.php        2010-02-06 07:31:38 UTC (rev 12986)
+++ trunk/wp-admin/includes/meta-boxes.php        2010-02-06 10:07:57 UTC (rev 12987)
</span><span class="lines">@@ -71,8 +71,12 @@
</span><span class="cx">                 _e('Pending Review');
</span><span class="cx">                 break;
</span><span class="cx">         case 'draft':
</span><ins>+        case 'auto-draft':
</ins><span class="cx">                 _e('Draft');
</span><span class="cx">                 break;
</span><ins>+        case 'auto-draft':
+                _e('Unsaved');
+                break;
</ins><span class="cx"> }
</span><span class="cx"> ?>
</span><span class="cx"> </span>
</span><span class="lines">@@ -80,7 +84,7 @@
</span><span class="cx"> <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>
</span><span class="cx">
</span><span class="cx"> <div id="post-status-select" class="hide-if-js">
</span><del>-<input type="hidden" name="hidden_post_status" id="hidden_post_status" value="<?php echo esc_attr($post->post_status); ?>" />
</del><ins>+<input type="hidden" name="hidden_post_status" id="hidden_post_status" value="<?php echo esc_attr( ('auto-draft' == $post->post_status ) ? 'draft' : $post->post_status); ?>" />
</ins><span class="cx"> <select name='post_status' id='post_status' tabindex='4'>
</span><span class="cx"> <?php if ( 'publish' == $post->post_status ) : ?>
</span><span class="cx"> <option<?php selected( $post->post_status, 'publish' ); ?> value='publish'><?php _e('Published') ?></option>
</span><span class="lines">@@ -90,7 +94,11 @@
</span><span class="cx"> <option<?php selected( $post->post_status, 'future' ); ?> value='future'><?php _e('Scheduled') ?></option>
</span><span class="cx"> <?php endif; ?>
</span><span class="cx"> <option<?php selected( $post->post_status, 'pending' ); ?> value='pending'><?php _e('Pending Review') ?></option>
</span><ins>+<?php if ( 'auto-draft' == $post->post_status ) : ?>
+<option<?php selected( $post->post_status, 'auto-draft' ); ?> value='draft'><?php _e('Draft') ?></option>
+<?php else : ?>
</ins><span class="cx"> <option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php _e('Draft') ?></option>
</span><ins>+<?php endif; ?>
</ins><span class="cx"> </select>
</span><span class="cx"> <a href="#post_status" class="save-post-status hide-if-no-js button"><?php _e('OK'); ?></a>
</span><span class="cx"> <a href="#post_status" class="cancel-post-status hide-if-no-js"><?php _e('Cancel'); ?></a>
</span></span></pre></div>
<a id="trunkwpadminincludespostphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/post.php (12986 => 12987)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/post.php        2010-02-06 07:31:38 UTC (rev 12986)
+++ trunk/wp-admin/includes/post.php        2010-02-06 10:07:57 UTC (rev 12987)
</span><span class="lines">@@ -76,8 +76,6 @@
</span><span class="cx">
</span><span class="cx">         if ( isset( $post_data['ID'] ) )
</span><span class="cx">                 $post_id = $post_data['ID'];
</span><del>-        elseif ( isset( $post_data['temp_ID'] ) )
-                $post_id = $post_data['temp_ID'];
</del><span class="cx">         else
</span><span class="cx">                 $post_id = false;
</span><span class="cx">         $previous_status = $post_id ? get_post_field( 'post_status', $post_id ) : false;
</span><span class="lines">@@ -336,7 +334,8 @@
</span><span class="cx"> *@param string A post type string, defaults to 'post'.
</span><span class="cx"> * @return object stdClass object containing all the default post data as attributes
</span><span class="cx"> */
</span><del>-function get_default_post_to_edit( $post_type = 'post' ) {
</del><ins>+function get_default_post_to_edit( $post_type = 'post', $create_in_db = false ) {
+        global $wpdb;
</ins><span class="cx">
</span><span class="cx">         $post_title = '';
</span><span class="cx">         if ( !empty( $_REQUEST['post_title'] ) )
</span><span class="lines">@@ -350,26 +349,35 @@
</span><span class="cx">         if ( !empty( $_REQUEST['excerpt'] ) )
</span><span class="cx">                 $post_excerpt = esc_html( stripslashes( $_REQUEST['excerpt'] ));
</span><span class="cx">
</span><del>-        $post->ID = 0;
</del><ins>+        if ( $create_in_db ) {
+                // Cleanup old auto-drafts more than 7 days old
+                $old_posts = $wpdb->get_col( "SELECT ID FROM $wpdb->posts WHERE post_status = 'auto-draft' AND DATE_SUB( NOW(), INTERVAL 7 DAY ) > post_date" );
+                foreach ( (array) $old_posts as $delete )
+                        wp_delete_post( $delete, true ); // Force delete
+                $post = get_post( wp_insert_post( array( 'post_title' => __( 'Auto Draft' ), 'post_type' => $post_type, 'post_status' => 'auto-draft' ) ) );
+        } else {
+                $post->ID = 0;
+                $post->post_author = '';
+                $post->post_date = '';
+                $post->post_date_gmt = '';
+                $post->post_password = '';
+                $post->post_type = $post_type;
+                $post->post_status = 'draft';
+                $post->to_ping = '';
+                $post->pinged = '';
+                $post->comment_status = get_option( 'default_comment_status' );
+                $post->ping_status = get_option( 'default_ping_status' );
+                $post->post_pingback = get_option( 'default_pingback_flag' );
+                $post->post_category = get_option( 'default_category' );
+                $post->page_template = 'default';
+                $post->post_parent = 0;
+                $post->menu_order = 0;
+        }
+
+        $post->post_content = apply_filters( 'default_content', $post_content );
+        $post->post_title = apply_filters( 'default_title', $post_title );
+        $post->post_excerpt = apply_filters( 'default_excerpt', $post_excerpt );
</ins><span class="cx">         $post->post_name = '';
</span><del>-        $post->post_author = '';
-        $post->post_date = '';
-        $post->post_date_gmt = '';
-        $post->post_password = '';
-        $post->post_status = 'draft';
-        $post->post_type = $post_type;
-        $post->to_ping = '';
-        $post->pinged = '';
-        $post->comment_status = get_option( 'default_comment_status' );
-        $post->ping_status = get_option( 'default_ping_status' );
-        $post->post_pingback = get_option( 'default_pingback_flag' );
-        $post->post_category = get_option( 'default_category' );
-        $post->post_content = apply_filters( 'default_content', $post_content);
-        $post->post_title = apply_filters( 'default_title', $post_title );
-        $post->post_excerpt = apply_filters( 'default_excerpt', $post_excerpt);
-        $post->page_template = 'default';
-        $post->post_parent = 0;
-        $post->menu_order = 0;
</del><span class="cx">
</span><span class="cx">         return $post;
</span><span class="cx"> }
</span><span class="lines">@@ -465,6 +473,7 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         // Check for autosave collisions
</span><ins>+        // Does this need to be updated? ~ Mark
</ins><span class="cx">         $temp_id = false;
</span><span class="cx">         if ( isset($_POST['temp_ID']) ) {
</span><span class="cx">                 $temp_id = (int) $_POST['temp_ID'];
</span><span class="lines">@@ -473,7 +482,7 @@
</span><span class="cx">                 foreach ( $draft_ids as $temp => $real )
</span><span class="cx">                         if ( time() + $temp > 86400 ) // 1 day: $temp is equal to -1 * time( then )
</span><span class="cx">                                 unset($draft_ids[$temp]);
</span><del>-
</del><ins>+        
</ins><span class="cx">                 if ( isset($draft_ids[$temp_id]) ) { // Edit, don't write
</span><span class="cx">                         $_POST['post_ID'] = $draft_ids[$temp_id];
</span><span class="cx">                         unset($_POST['temp_ID']);
</span><span class="lines">@@ -513,6 +522,7 @@
</span><span class="cx">         add_meta( $post_ID );
</span><span class="cx">
</span><span class="cx">         // Reunite any orphaned attachments with their parent
</span><ins>+        // Does this need to be udpated? ~ Mark
</ins><span class="cx">         if ( !$draft_ids = get_user_option( 'autosave_draft_ids' ) )
</span><span class="cx">                 $draft_ids = array();
</span><span class="cx">         if ( $draft_temp_id = (int) array_search( $post_ID, $draft_ids ) )
</span></span></pre></div>
<a id="trunkwpadminpostnewphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/post-new.php (12986 => 12987)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/post-new.php        2010-02-06 07:31:38 UTC (rev 12986)
+++ trunk/wp-admin/post-new.php        2010-02-06 10:07:57 UTC (rev 12987)
</span><span class="lines">@@ -50,7 +50,8 @@
</span><span class="cx">
</span><span class="cx"> // Show post form.
</span><span class="cx"> if ( current_user_can($post_type_object->edit_type_cap) ) {
</span><del>-        $post = get_default_post_to_edit( $post_type );
</del><ins>+        $post = get_default_post_to_edit( $post_type, true );
+        $post_ID = $post->ID;
</ins><span class="cx">         include('edit-form-advanced.php');
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkwpincludesjsautosavedevjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/js/autosave.dev.js (12986 => 12987)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/js/autosave.dev.js        2010-02-06 07:31:38 UTC (rev 12986)
+++ trunk/wp-includes/js/autosave.dev.js        2010-02-06 10:07:57 UTC (rev 12987)
</span><span class="lines">@@ -39,7 +39,7 @@
</span><span class="cx">
</span><span class="cx">         // preview
</span><span class="cx">         $('#post-preview').click(function(){
</span><del>-                if ( 1 > $('#post_ID').val() && notSaved ) {
</del><ins>+                if ( $('#auto_draft').val() == '1' && notSaved ) {
</ins><span class="cx">                         autosaveDelayPreview = true;
</span><span class="cx">                         autosave();
</span><span class="cx">                         return false;
</span><span class="lines">@@ -58,7 +58,7 @@
</span><span class="cx">         if ( typeof tinyMCE != 'undefined' ) {
</span><span class="cx">                 $('#title')[$.browser.opera ? 'keypress' : 'keydown'](function (e) {
</span><span class="cx">                         if ( e.which == 9 && !e.shiftKey && !e.controlKey && !e.altKey ) {
</span><del>-                                if ( ($("#post_ID").val() < 1) && ($("#title").val().length > 0) ) { autosave(); }
</del><ins>+                                if ( ($('#auto_draft').val() == '1') && ($("#title").val().length > 0) ) { autosave(); }
</ins><span class="cx">                                 if ( tinyMCE.activeEditor && ! tinyMCE.activeEditor.isHidden() && dotabkey ) {
</span><span class="cx">                                         e.preventDefault();
</span><span class="cx">                                         dotabkey = false;
</span><span class="lines">@@ -70,11 +70,10 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         // autosave new posts after a title is typed but not if Publish or Save Draft is clicked
</span><del>-        if ( 0 > $('#post_ID').val() ) {
</del><ins>+        if ( '1' == $('#auto_draft').val() ) {
</ins><span class="cx">                 $('#title').blur( function() {
</span><del>-                        if ( !this.value || 0 < $('#post_ID').val() )
</del><ins>+                        if ( !this.value || $('#auto_draft').val() != '1' )
</ins><span class="cx">                                 return;
</span><del>-
</del><span class="cx">                         delayed_autosave();
</span><span class="cx">                 });
</span><span class="cx">         }
</span><span class="lines">@@ -121,24 +120,19 @@
</span><span class="cx">
</span><span class="cx"> // called when autosaving pre-existing post
</span><span class="cx"> function autosave_saved(response) {
</span><ins>+        blockSave = false;
</ins><span class="cx">         autosave_parse_response(response); // parse the ajax response
</span><span class="cx">         autosave_enable_buttons(); // re-enable disabled form buttons
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // called when autosaving new post
</span><span class="cx"> function autosave_saved_new(response) {
</span><ins>+        blockSave = false;
</ins><span class="cx">         var res = autosave_parse_response(response), tempID, postID;
</span><del>-        // if no errors: update post_ID from the temporary value, grab new save-nonce for that new ID
</del><span class="cx">         if ( res && res.responses.length && !res.errors ) {
</span><del>-                tempID = jQuery('#post_ID').val();
</del><ins>+                // An ID is sent only for real auto-saves, not for autosave=0 "keepalive" saves
</ins><span class="cx">                 postID = parseInt( res.responses[0].id, 10 );
</span><span class="cx">                 autosave_update_post_ID( postID ); // disabled form buttons are re-enabled here
</span><del>-                if ( tempID < 0 && postID > 0 ) { // update media buttons
-                        notSaved = false;
-                        jQuery('#media-buttons a').each(function(){
-                                this.href = this.href.replace(tempID, postID);
-                        });
-                }
</del><span class="cx">                 if ( autosaveDelayPreview ) {
</span><span class="cx">                         autosaveDelayPreview = false;
</span><span class="cx">                         doPreview();
</span><span class="lines">@@ -151,22 +145,11 @@
</span><span class="cx"> function autosave_update_post_ID( postID ) {
</span><span class="cx">         if ( !isNaN(postID) && postID > 0 ) {
</span><span class="cx">                 if ( postID == parseInt(jQuery('#post_ID').val(), 10) ) { return; } // no need to do this more than once
</span><del>-                jQuery('#post_ID').attr({name: "post_ID"});
-                jQuery('#post_ID').val(postID);
-                // We need new nonces
-                jQuery.post(autosaveL10n.requestFile, {
-                        action: "autosave-generate-nonces",
-                        post_ID: postID,
-                        autosavenonce: jQuery('#autosavenonce').val(),
-                        post_type: jQuery('#post_type').val()
-                }, function(html) {
-                        jQuery('#_wpnonce').val(html.updateNonce);
-                        jQuery('#delete-action a.submitdelete').attr('href', html.deleteURL);
-                        autosave_enable_buttons(); // re-enable disabled form buttons
-                        jQuery('#delete-action a.submitdelete').fadeIn();
-                },
-                'json');
</del><ins>+                notSaved = false;
+                autosave_enable_buttons();
+                jQuery('#delete-action a.submitdelete').fadeIn();
</ins><span class="cx">                 jQuery('#hiddenaction').val('editpost');
</span><ins>+                jQuery('#auto_draft').val('0'); // No longer an auto-draft
</ins><span class="cx">         }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -217,6 +200,7 @@
</span><span class="cx">
</span><span class="cx"> autosave = function() {
</span><span class="cx">         // (bool) is rich editor enabled and active
</span><ins>+        blockSave = true;
</ins><span class="cx">         var rich = (typeof tinyMCE != "undefined") && tinyMCE.activeEditor && !tinyMCE.activeEditor.isHidden(), post_data, doAutoSave, ed, origStatus, successCallback;
</span><span class="cx">
</span><span class="cx">         autosave_disable_buttons();
</span><span class="lines">@@ -281,6 +265,8 @@
</span><span class="cx">         if ( jQuery("#post_author").size() )
</span><span class="cx">                 post_data["post_author"] = jQuery("#post_author").val();
</span><span class="cx">         post_data["user_ID"] = jQuery("#user-id").val();
</span><ins>+        if ( jQuery('#auto_draft').val() == '1' )
+                post_data["auto_draft"] = '1';
</ins><span class="cx">
</span><span class="cx">         if ( doAutoSave ) {
</span><span class="cx">                 autosaveLast = jQuery("#title").val()+jQuery("#content").val();
</span><span class="lines">@@ -288,15 +274,13 @@
</span><span class="cx">                 post_data['autosave'] = 0;
</span><span class="cx">         }
</span><span class="cx">
</span><del>-        if ( parseInt(post_data["post_ID"], 10) < 1 ) {
-                post_data["temp_ID"] = post_data["post_ID"];
</del><ins>+        if ( post_data["auto_draft"] == '1' ) {
</ins><span class="cx">                 successCallback = autosave_saved_new; // new post
</span><span class="cx">         } else {
</span><span class="cx">                 successCallback = autosave_saved; // pre-existing post
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         autosaveOldMessage = jQuery('#autosave').html();
</span><del>-
</del><span class="cx">         jQuery.ajax({
</span><span class="cx">                 data: post_data,
</span><span class="cx">                 beforeSend: doAutoSave ? autosave_loading : null,
</span></span></pre></div>
<a id="trunkwpincludesjsautosavejs"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/js/autosave.js (12986 => 12987)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/js/autosave.js        2010-02-06 07:31:38 UTC (rev 12986)
+++ trunk/wp-includes/js/autosave.js        2010-02-06 10:07:57 UTC (rev 12987)
</span><span class="lines">@@ -1 +1 @@
</span><del>-var autosave,autosaveLast="",autosavePeriodical,autosaveOldMessage="",autosaveDelayPreview=false,notSaved=true,blockSave=false,interimLogin=false;jQuery(document).ready(function(b){var a=true;autosaveLast=b("#post #title").val()+b("#post #content").val();autosavePeriodical=b.schedule({time:autosaveL10n.autosaveInterval*1000,func:function(){autosave()},repeat:true,protect:true});b("#post").submit(function(){b.cancel(autosavePeriodical)});b('input[type="submit"], a.submitdelete',"#submitpost").click(function(){blockSave=true;window.onbeforeunload=null;b(":button, :submit","#submitpost").each(function(){var c=b(this);if(c.hasClass("button-primary")){c.addClass("button-primary-disabled")}else{c.addClass("button-disabled")}});b("#ajax-loading").css("visibility","visible")});window.onbeforeunload=function(){var c=typeof(tinyMCE)!="undefined"?tinyMCE.activeEditor:false,e,d;if(c&&!c.isHidden()){if(c.isDirty()){return autosaveL10n.saveAlert}}else{e=b("#post #title").val(),d=b("#post #content").val();if((e||d)&&e+d!=autosaveLast){return autosaveL10n.saveAlert}}};b("#post-preview").click(function(){if(1>b("#post_ID").val()&&notSaved){autosaveDelayPreview=true;autosave();return false}doPreview();return false});doPreview=function(){b("input#wp-preview").val("dopreview");b("form#post").attr("target","wp-preview").submit().attr("target","");b("input#wp-preview").val("")};if(typeof tinyMCE!="undefined"){b("#title")[b.browser.opera?"keypress":"keydown"](function(c){if(c.which==9&&!c.shiftKey&&!c.controlKey&&!c.altKey){if((b("#post_ID").val()<1)&&(b("#title").val().length>0)){autosave()}if(tinyMCE.activeEditor&&!tinyMCE.activeEditor.isHidden()&&a){c.preventDefault();a=false;tinyMCE.activeEditor.focus();return false}}})}if(0>b("#post_ID").val()){b("#title").blur(function(){if(!this.value||0<b("#post_ID").val()){return}delayed_autosave()})}});function autosave_parse_response(c){var e=wpAjax.parseAjaxResponse(c,"autosave"),f="",a,b,d;if(e&&e.responses&&e.responses.length){f=e.responses[0].data;if(e.responses[0].supplemental){b=e.responses[0].supplemental;if("disable"==b.disable_autosave){autosave=function(){};e={errors:true}}if(b.session_expired&&(d=b.session_expired)){if(!interimLogin||interimLogin.closed){interimLogin=window.open(d,"login","width=600,height=450,resizable=yes,scrollbars=yes,status=yes");interimLogin.focus()}delete b.session_expired}jQuery.each(b,function(g,h){if(g.match(/^replace-/)){jQuery("#"+g.replace("replace-","")).val(h)}})}if(!e.errors){a=parseInt(e.responses[0].id,10);if(!isNaN(a)&&a>0){autosave_update_slug(a)}}}if(f){jQuery("#autosave").html(f)}else{if(autosaveOldMessage&&e){jQuery("#autosave").html(autosaveOldMessage)}}return e}function autosave_saved(a){autosave_parse_response(a);autosave_enable_buttons()}function autosave_saved_new(b){var d=autosave_parse_response(b),c,a;if(d&&d.responses.length&&!d.errors){c=jQuery("#post_ID").val();a=parseInt(d.responses[0].id,10);autosave_update_post_ID(a);if(c<0&&a>0){notSaved=false;jQuery("#media-buttons a").each(function(){this.href=this.href.replace(c,a)})}if(autosaveDelayPreview){autosaveDelayPreview=false;doPreview()}}else{autosave_enable_buttons()}}function autosave_update_post_ID(a){if(!isNaN(a)&&a>0){if(a==parseInt(jQuery("#post_ID").val(),10)){return}jQuery("#post_ID").attr({name:"post_ID"});jQuery("#post_ID").val(a);jQuery.post(autosaveL10n.requestFile,{action:"autosave-generate-nonces",post_ID:a,autosavenonce:jQuery("#autosavenonce").val(),post_type:jQuery("#post_type").val()},function(b){jQuery("#_wpnonce").val(b.updateNonce);jQuery("#delete-action a.submitdelete").attr("href",b.deleteURL);autosave_enable_buttons();jQuery("#delete-action a.submitdelete").fadeIn()},"json");jQuery("#hiddenaction").val("editpost")}}function autosave_update_slug(a){if("undefined"!=makeSlugeditClickable&&jQuery.isFunction(makeSlugeditClickable)&&!jQuery("#edit-slug-box > *").size()){jQuery.post(ajaxurl,{action:"sample-permalink",post_id:a,new_title:jQuery("#title").val(),samplepermalinknonce:jQuery("#samplepermalinknonce").val()},function(b){jQuery("#edit-slug-box").html(b);makeSlugeditClickable()})}}function autosave_loading(){jQuery("#autosave").html(autosaveL10n.savingText)}function autosave_enable_buttons(){setTimeout(function(){jQuery(":button, :submit","#submitpost").removeAttr("disabled");jQuery("#ajax-loading").css("visibility","hidden")},500)}function autosave_disable_buttons(){jQuery(":button, :submit","#submitpost").attr("disabled","disabled");setTimeout(autosave_enable_buttons,5000)}function delayed_autosave(){setTimeout(function(){if(blockSave){return}autosave()},200)}autosave=function(){var c=(typeof tinyMCE!="undefined")&&tinyMCE.activeEditor&&!tinyMCE.activeEditor.isHidden(),d,f,b,e,a;autosave_disable_buttons();d={action:"autosave",post_ID:jQuery("#post_ID").val()||0,post_title:jQuery("#title").val()||"",autosavenonce:jQuery("#autosavenonce").val(),post_type:jQuery("#post_type").val()||"",autosave:1};jQuery(".tags-input").each(function(){d[this.name]=this.value});f=true;if(jQuery("#TB_window").css("display")=="block"){f=false}if(c&&f){b=tinyMCE.activeEditor;if(b.plugins.spellchecker&&b.plugins.spellchecker.active){f=false}else{if("mce_fullscreen"==b.id){tinyMCE.get("content").setContent(b.getContent({format:"raw"}),{format:"raw"})}tinyMCE.get("content").save()}}d.content=jQuery("#content").val();if(jQuery("#post_name").val()){d.post_name=jQuery("#post_name").val()}if((d.post_title.length==0&&d.content.length==0)||d.post_title+d.content==autosaveLast){f=false}e=jQuery("#original_post_status").val();goodcats=([]);jQuery("[name='post_category[]']:checked").each(function(g){goodcats.push(this.value)});d.catslist=goodcats.join(",");if(jQuery("#comment_status").attr("checked")){d.comment_status="open"}if(jQuery("#ping_status").attr("checked")){d.ping_status="open"}if(jQuery("#excerpt").size()){d.excerpt=jQuery("#excerpt").val()}if(jQuery("#post_author").size()){d.post_author=jQuery("#post_author").val()}d.user_ID=jQuery("#user-id").val();if(f){autosaveLast=jQuery("#title").val()+jQuery("#content").val()}else{d.autosave=0}if(parseInt(d.post_ID,10)<1){d.temp_ID=d.post_ID;a=autosave_saved_new}else{a=autosave_saved}autosaveOldMessage=jQuery("#autosave").html();jQuery.ajax({data:d,beforeSend:f?autosave_loading:null,type:"POST",url:autosaveL10n.requestFile,success:a})};
</del><span class="cx">\ No newline at end of file
</span><ins>+var autosave,autosaveLast="",autosavePeriodical,autosaveOldMessage="",autosaveDelayPreview=false,notSaved=true,blockSave=false,interimLogin=false;jQuery(document).ready(function($){var dotabkey=true;autosaveLast=$("#post #title").val()+$("#post #content").val();autosavePeriodical=$.schedule({time:autosaveL10n.autosaveInterval*1000,func:function(){autosave()},repeat:true,protect:true});$("#post").submit(function(){$.cancel(autosavePeriodical)});$('input[type="submit"], a.submitdelete',"#submitpost").click(function(){blockSave=true;window.onbeforeunload=null;$(":button, :submit","#submitpost").each(function(){var t=$(this);if(t.hasClass("button-primary")){t.addClass("button-primary-disabled")}else{t.addClass("button-disabled")}});$("#ajax-loading").css("visibility","visible")});window.onbeforeunload=function(){var mce=typeof(tinyMCE)!="undefined"?tinyMCE.activeEditor:false,title,content;if(mce&&!mce.isHidden()){if(mce.isDirty()){return autosaveL10n.saveAlert}}else{title=$("#post #title").val(),content=$("#post #content").val();if((title||content)&&title+content!=autosaveLast){return autosaveL10n.saveAlert}}};$("#post-preview").click(function(){if($("#auto_draft").val()=="1"&&notSaved){autosaveDelayPreview=true;autosave();return false}doPreview();return false});doPreview=function(){$("input#wp-preview").val("dopreview");$("form#post").attr("target","wp-preview").submit().attr("target","");$("input#wp-preview").val("")};if(typeof tinyMCE!="undefined"){$("#title")[$.browser.opera?"keypress":"keydown"](function(e){if(e.which==9&&!e.shiftKey&&!e.controlKey&&!e.altKey){if(($("#auto_draft").val()=="1")&&($("#title").val().length>0)){autosave()}if(tinyMCE.activeEditor&&!tinyMCE.activeEditor.isHidden()&&dotabkey){e.preventDefault();dotabkey=false;tinyMCE.activeEditor.focus();return false}}})}if("1"==$("#auto_draft").val()){$("#title").blur(function(){if(!this.value||$("#auto_draft").val()!="1"){return}delayed_autosave()})}});function autosave_parse_response(response){var res=wpAjax.parseAjaxResponse(response,"autosave"),message="",postID,sup,url;if(res&&res.responses&&res.responses.length){message=res.responses[0].data;if(res.responses[0].supplemental){sup=res.responses[0].supplemental;if("disable"==sup.disable_autosave){autosave=function(){};res={errors:true}}if(sup.session_expired&&(url=sup.session_expired)){if(!interimLogin||interimLogin.closed){interimLogin=window.open(url,"login","width=600,height=450,resizable=yes,scrollbars=yes,status=yes");interimLogin.focus()}delete sup.session_expired}jQuery.each(sup,function(selector,value){if(selector.match(/^replace-/)){jQuery("#"+selector.replace("replace-","")).val(value)}})}if(!res.errors){postID=parseInt(res.responses[0].id,10);if(!isNaN(postID)&&postID>0){autosave_update_slug(postID)}}}if(message){jQuery("#autosave").html(message)}else{if(autosaveOldMessage&&res){jQuery("#autosave").html(autosaveOldMessage)}}return res}function autosave_saved(response){blockSave=false;autosave_parse_response(response);autosave_enable_buttons()}function autosave_saved_new(response){blockSave=false;var res=autosave_parse_response(response),tempID,postID;if(res&&res.responses.length&&!res.errors){postID=parseInt(res.responses[0].id,10);autosave_update_post_ID(postID);if(autosaveDelayPreview){autosaveDelayPreview=false;doPreview()}}else{autosave_enable_buttons()}}function autosave_update_post_ID(postID){if(!isNaN(postID)&&postID>0){if(postID==parseInt(jQuery("#post_ID").val(),10)){return}notSaved=false;autosave_enable_buttons();jQuery("#delete-action a.submitdelete").fadeIn();jQuery("#hiddenaction").val("editpost");jQuery("#auto_draft").val("0")}}function autosave_update_slug(post_id){if("undefined"!=makeSlugeditClickable&&jQuery.isFunction(makeSlugeditClickable)&&!jQuery("#edit-slug-box > *").size()){jQuery.post(ajaxurl,{action:"sample-permalink",post_id:post_id,new_title:jQuery("#title").val(),samplepermalinknonce:jQuery("#samplepermalinknonce").val()},function(data){jQuery("#edit-slug-box").html(data);makeSlugeditClickable()})}}function autosave_loading(){jQuery("#autosave").html(autosaveL10n.savingText)}function autosave_enable_buttons(){setTimeout(function(){jQuery(":button, :submit","#submitpost").removeAttr("disabled");jQuery("#ajax-loading").css("visibility","hidden")},500)}function autosave_disable_buttons(){jQuery(":button, :submit","#submitpost").attr("disabled","disabled");setTimeout(autosave_enable_buttons,5000)}function delayed_autosave(){setTimeout(function(){if(blockSave){return}autosave()},200)}autosave=function(){blockSave=true;var rich=(typeof tinyMCE!="undefined")&&tinyMCE.activeEditor&&!tinyMCE.activeEditor.isHidden(),post_data,doAutoSave,ed,origStatus,successCallback;autosave_disable_buttons();post_data={action:"autosave",post_ID:jQuery("#post_ID").val()||0,post_title:jQuery("#title").val()||"",autosavenonce:jQuery("#autosavenonce").val(),post_type:jQuery("#post_type").val()||"",autosave:1};jQuery(".tags-input").each(function(){post_data[this.name]=this.value});doAutoSave=true;if(jQuery("#TB_window").css("display")=="block"){doAutoSave=false}if(rich&&doAutoSave){ed=tinyMCE.activeEditor;if(ed.plugins.spellchecker&&ed.plugins.spellchecker.active){doAutoSave=false}else{if("mce_fullscreen"==ed.id){tinyMCE.get("content").setContent(ed.getContent({format:"raw"}),{format:"raw"})}tinyMCE.get("content").save()}}post_data.content=jQuery("#content").val();if(jQuery("#post_name").val()){post_data.post_name=jQuery("#post_name").val()}if((post_data.post_title.length==0&&post_data.content.length==0)||post_data.post_title+post_data.content==autosaveLast){doAutoSave=false}origStatus=jQuery("#original_post_status").val();goodcats=([]);jQuery("[name='post_category[]']:checked").each(function(i){goodcats.push(this.value)});post_data.catslist=goodcats.join(",");if(jQuery("#comment_status").attr("checked")){post_data.comment_status="open"}if(jQuery("#ping_status").attr("checked")){post_data.ping_status="open"}if(jQuery("#excerpt").size()){post_data.excerpt=jQuery("#excerpt").val()}if(jQuery("#post_author").size()){post_data.post_author=jQuery("#post_author").val()}post_data.user_ID=jQuery("#user-id").val();if(jQuery("#auto_draft").val()=="1"){post_data.auto_draft="1"}if(doAutoSave){autosaveLast=jQuery("#title").val()+jQuery("#content").val()}else{post_data.autosave=0}if(post_data.auto_draft=="1"){successCallback=autosave_saved_new}else{successCallback=autosave_saved}autosaveOldMessage=jQuery("#autosave").html();jQuery.ajax({data:post_data,beforeSend:doAutoSave?autosave_loading:null,type:"POST",url:autosaveL10n.requestFile,success:successCallback})};
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpincludeslinktemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/link-template.php (12986 => 12987)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/link-template.php        2010-02-06 07:31:38 UTC (rev 12986)
+++ trunk/wp-includes/link-template.php        2010-02-06 10:07:57 UTC (rev 12987)
</span><span class="lines">@@ -111,7 +111,7 @@
</span><span class="cx">
</span><span class="cx">         $permalink = get_option('permalink_structure');
</span><span class="cx">
</span><del>-        if ( '' != $permalink && !in_array($post->post_status, array('draft', 'pending')) ) {
</del><ins>+        if ( '' != $permalink && !in_array($post->post_status, array('draft', 'pending', 'auto-draft')) ) {
</ins><span class="cx">                 $unixtime = strtotime($post->post_date);
</span><span class="cx">
</span><span class="cx">                 $category = '';
</span></span></pre></div>
<a id="trunkwpincludespostphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/post.php (12986 => 12987)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/post.php        2010-02-06 07:31:38 UTC (rev 12986)
+++ trunk/wp-includes/post.php        2010-02-06 10:07:57 UTC (rev 12987)
</span><span class="lines">@@ -1976,7 +1976,7 @@
</span><span class="cx">         // Create a valid post name. Drafts and pending posts are allowed to have an empty
</span><span class="cx">         // post name.
</span><span class="cx">         if ( !isset($post_name) || empty($post_name) ) {
</span><del>-                if ( !in_array( $post_status, array( 'draft', 'pending' ) ) )
</del><ins>+                if ( !in_array( $post_status, array( 'draft', 'pending', 'auto-draft' ) ) )
</ins><span class="cx">                         $post_name = sanitize_title($post_title);
</span><span class="cx">                 else
</span><span class="cx">                         $post_name = '';
</span><span class="lines">@@ -1989,7 +1989,7 @@
</span><span class="cx">                 $post_date = current_time('mysql');
</span><span class="cx">
</span><span class="cx">         if ( empty($post_date_gmt) || '0000-00-00 00:00:00' == $post_date_gmt ) {
</span><del>-                if ( !in_array( $post_status, array( 'draft', 'pending' ) ) )
</del><ins>+                if ( !in_array( $post_status, array( 'draft', 'pending', 'auto-draft' ) ) )
</ins><span class="cx">                         $post_date_gmt = get_gmt_from_date($post_date);
</span><span class="cx">                 else
</span><span class="cx">                         $post_date_gmt = '0000-00-00 00:00:00';
</span><span class="lines">@@ -2089,7 +2089,7 @@
</span><span class="cx">                 $where = array( 'ID' => $post_ID );
</span><span class="cx">         }
</span><span class="cx">
</span><del>-        if ( empty($data['post_name']) && !in_array( $data['post_status'], array( 'draft', 'pending' ) ) ) {
</del><ins>+        if ( empty($data['post_name']) && !in_array( $data['post_status'], array( 'draft', 'pending', 'auto-draft' ) ) ) {
</ins><span class="cx">                 $data['post_name'] = sanitize_title($data['post_title'], $post_ID);
</span><span class="cx">                 $wpdb->update( $wpdb->posts, array( 'post_name' => $data['post_name'] ), $where );
</span><span class="cx">         }
</span><span class="lines">@@ -2172,7 +2172,7 @@
</span><span class="cx">                 $post_cats = $post['post_category'];
</span><span class="cx">
</span><span class="cx">         // Drafts shouldn't be assigned a date unless explicitly done so by the user
</span><del>-        if ( in_array($post['post_status'], array('draft', 'pending')) && empty($postarr['edit_date']) &&
</del><ins>+        if ( in_array($post['post_status'], array('draft', 'pending', 'auto-draft')) && empty($postarr['edit_date']) &&
</ins><span class="cx">                          ('0000-00-00 00:00:00' == $post['post_date_gmt']) )
</span><span class="cx">                 $clear_date = true;
</span><span class="cx">         else
</span><span class="lines">@@ -2276,7 +2276,7 @@
</span><span class="cx"> * @return string unique slug for the post, based on $post_name (with a -1, -2, etc. suffix)
</span><span class="cx"> */
</span><span class="cx"> function wp_unique_post_slug($slug, $post_ID, $post_status, $post_type, $post_parent) {
</span><del>-        if ( in_array( $post_status, array( 'draft', 'pending' ) ) )
</del><ins>+        if ( in_array( $post_status, array( 'draft', 'pending', 'auto-draft' ) ) )
</ins><span class="cx">                 return $slug;
</span><span class="cx">
</span><span class="cx">         global $wpdb, $wp_rewrite;
</span></span></pre></div>
<a id="trunkwpincludesscriptloaderphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/script-loader.php (12986 => 12987)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/script-loader.php        2010-02-06 07:31:38 UTC (rev 12986)
+++ trunk/wp-includes/script-loader.php        2010-02-06 10:07:57 UTC (rev 12987)
</span><span class="lines">@@ -99,7 +99,7 @@
</span><span class="cx">                 'l10n_print_after' => 'try{convertEntities(wpAjax);}catch(e){};'
</span><span class="cx">         ) );
</span><span class="cx">
</span><del>-        $scripts->add( 'autosave', "/wp-includes/js/autosave$suffix.js", array('schedule', 'wp-ajax-response'), '20091012' );
</del><ins>+        $scripts->add( 'autosave', "/wp-includes/js/autosave$suffix.js", array('schedule', 'wp-ajax-response'), '20100205' );
</ins><span class="cx">         $scripts->add_data( 'autosave', 'group', 1 );
</span><span class="cx">
</span><span class="cx">         $scripts->add( 'wp-lists', "/wp-includes/js/wp-lists$suffix.js", array('wp-ajax-response'), '20091128' );
</span></span></pre>
</div>
</div>
</body>
</html>