Autosave: refactor autosave.js, use heartbeat for transport and move all "Add/Edit Post" related functionality to post.js. See #25272.

git-svn-id: https://develop.svn.wordpress.org/trunk@26995 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz
2014-01-22 04:55:37 +00:00
parent df613abbec
commit 9aba880b53
11 changed files with 969 additions and 848 deletions

View File

@@ -215,7 +215,7 @@ function wp_is_post_autosave( $post ) {
*
* @param int|object|array $post Post ID, post object OR post array.
* @param bool $autosave Optional. Is the revision an autosave?
* @return mixed Null or 0 if error, new revision ID if success.
* @return mixed WP_Error or 0 if error, new revision ID if success.
*/
function _wp_put_post_revision( $post = null, $autosave = false ) {
if ( is_object($post) )
@@ -223,8 +223,8 @@ function _wp_put_post_revision( $post = null, $autosave = false ) {
elseif ( !is_array($post) )
$post = get_post($post, ARRAY_A);
if ( !$post || empty($post['ID']) )
return;
if ( ! $post || empty($post['ID']) )
return new WP_Error( 'invalid_post', __( 'Invalid post ID' ) );
if ( isset($post['post_type']) && 'revision' == $post['post_type'] )
return new WP_Error( 'post_type', __( 'Cannot create a revision of a revision' ) );