Changeset 18823
- Timestamp:
- 09/29/2011 09:47:52 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
-
wp-admin/edit-form-advanced.php (modified) (1 diff)
-
wp-admin/includes/media.php (modified) (1 diff)
-
wp-admin/includes/post.php (modified) (6 diffs)
-
wp-includes/post.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/edit-form-advanced.php
r18796 r18823 24 24 */ 25 25 $post_ID = isset($post_ID) ? (int) $post_ID : 0; 26 $temp_ID = isset($temp_ID) ? (int) $temp_ID : 0;27 26 $user_ID = isset($user_ID) ? (int) $user_ID : 0; 28 27 $action = isset($action) ? $action : ''; -
trunk/wp-admin/includes/media.php
r18802 r18823 402 402 403 403 function get_upload_iframe_src($type) { 404 global $post_ID, $temp_ID; 405 $uploading_iframe_ID = (int) (0 == $post_ID ? $temp_ID : $post_ID); 404 global $post_ID; 405 406 $uploading_iframe_ID = (int) $post_ID; 406 407 $upload_iframe_src = add_query_arg( 'post_id', $uploading_iframe_ID, admin_url('media-upload.php') ); 407 408 408 409 if ( 'media' != $type ) 409 410 $upload_iframe_src = add_query_arg('type', $type, $upload_iframe_src); 411 410 412 $upload_iframe_src = apply_filters($type . '_upload_iframe_src', $upload_iframe_src); 411 413 -
trunk/wp-admin/includes/post.php
r18796 r18823 229 229 230 230 wp_update_post( $post_data ); 231 232 // Reunite any orphaned attachments with their parent233 if ( !$draft_ids = get_user_option( 'autosave_draft_ids' ) )234 $draft_ids = array();235 if ( $draft_temp_id = (int) array_search( $post_ID, $draft_ids ) )236 _relocate_children( $draft_temp_id, $post_ID );237 231 238 232 // Now that we have an ID we can fix any attachment anchor hrefs … … 539 533 global $user_ID; 540 534 541 542 535 if ( isset($_POST['post_type']) ) 543 536 $ptype = get_post_type_object($_POST['post_type']); … … 557 550 unset( $_POST['filter'] ); 558 551 559 // Check for autosave collisions560 // Does this need to be updated? ~ Mark561 $temp_id = false;562 if ( isset($_POST['temp_ID']) ) {563 $temp_id = (int) $_POST['temp_ID'];564 if ( !$draft_ids = get_user_option( 'autosave_draft_ids' ) )565 $draft_ids = array();566 foreach ( $draft_ids as $temp => $real )567 if ( time() + $temp > 86400 ) // 1 day: $temp is equal to -1 * time( then )568 unset($draft_ids[$temp]);569 570 if ( isset($draft_ids[$temp_id]) ) { // Edit, don't write571 $_POST['post_ID'] = $draft_ids[$temp_id];572 unset($_POST['temp_ID']);573 update_user_option( $user_ID, 'autosave_draft_ids', $draft_ids );574 return edit_post();575 }576 }577 578 552 // Edit don't write if we have a post id. 579 if ( isset( $_POST['ID'] ) ) { 580 $_POST['post_ID'] = $_POST['ID']; 581 unset ( $_POST['ID'] ); 582 } 583 if ( isset( $_POST['post_ID'] ) ) { 553 if ( isset( $_POST['post_ID'] ) ) 584 554 return edit_post(); 585 }586 555 587 556 $translated = _wp_translate_postdata( false ); … … 617 586 add_post_meta( $post_ID, '_edit_last', $GLOBALS['current_user']->ID ); 618 587 619 // Reunite any orphaned attachments with their parent620 // Does this need to be updated? ~ Mark621 if ( !$draft_ids = get_user_option( 'autosave_draft_ids' ) )622 $draft_ids = array();623 if ( $draft_temp_id = (int) array_search( $post_ID, $draft_ids ) )624 _relocate_children( $draft_temp_id, $post_ID );625 if ( $temp_id && $temp_id != $draft_temp_id )626 _relocate_children( $temp_id, $post_ID );627 628 // Update autosave collision detection629 if ( $temp_id ) {630 $draft_ids[$temp_id] = $post_ID;631 update_user_option( $user_ID, 'autosave_draft_ids', $draft_ids );632 }633 634 588 // Now that we have an ID we can fix any attachment anchor hrefs 635 589 _fix_attachment_links( $post_ID ); … … 644 598 * 645 599 * @since 2.0.0 646 * 600 601 * @uses wp_write_post() 602 * @uses is_wp_error() 603 * @uses wp_die() 647 604 * @return unknown 648 605 */ … … 1323 1280 * @since 2.7.0 1324 1281 * 1325 * @uses wp_write_post()1282 * @uses get_post_status() 1326 1283 * @uses edit_post() 1327 1284 * @uses get_post() 1328 1285 * @uses current_user_can() 1286 * @uses wp_die() 1329 1287 * @uses wp_create_post_autosave() 1288 * @uses add_query_arg() 1289 * @uses wp_create_nonce() 1330 1290 * 1331 1291 * @return str URL to redirect to show the preview -
trunk/wp-includes/post.php
r18809 r18823 3729 3729 clean_post_cache($post_ID); 3730 3730 3731 if ( isset($post_parent) && $post_parent < 0 )3732 add_post_meta($post_ID, '_wp_attachment_temp_parent', $post_parent, true);3733 3734 3731 if ( ! empty( $context ) ) 3735 3732 add_post_meta( $post_ID, '_wp_attachment_context', $context, true );
Note: See TracChangeset
for help on using the changeset viewer.