Changeset 4884 for trunk/wp-admin/admin-functions.php
- Timestamp:
- 02/15/2007 01:03:06 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/admin-functions.php
r4809 r4884 23 23 24 24 // Check for autosave collisions 25 $temp_id = false; 25 26 if ( isset($_POST['temp_ID']) ) { 26 27 $temp_id = (int) $_POST['temp_ID']; … … 34 35 $_POST['post_ID'] = $draft_ids[$temp_id]; 35 36 unset($_POST['temp_ID']); 36 relocate_children( $temp_id, $_POST['post_ID'] );37 37 update_user_option( $user_ID, 'autosave_draft_ids', $draft_ids ); 38 38 return edit_post(); … … 113 113 114 114 // Reunite any orphaned attachments with their parent 115 if ( !$draft_ids = get_user_option( 'autosave_draft_ids' ) ) 116 $draft_ids = array(); 117 if ( $draft_temp_id = array_search( $post_ID, $draft_ids ) ) 118 relocate_children( $draft_temp_id, $post_ID ); 119 if ( $temp_id && $temp_id != $draft_temp_id ) 120 relocate_children( $temp_id, $post_ID ); 121 115 122 // Update autosave collision detection 116 123 if ( $temp_id ) { 117 relocate_children( $temp_id, $post_ID );118 124 $draft_ids[$temp_id] = $post_ID; 119 125 update_user_option( $user_ID, 'autosave_draft_ids', $draft_ids ); … … 140 146 $post = & get_post( $post_ID, ARRAY_A ); 141 147 142 $search = "#<a[^>]+rel=('|\" 148 $search = "#<a[^>]+rel=('|\")[^'\"]*attachment[^>]*>#ie"; 143 149 144 150 // See if we have any rel="attachment" links … … 147 153 148 154 $i = 0; 149 $search = "#[\s]+rel=(\"|' )(.*? )wp-att-(\d+)\\1#i";155 $search = "#[\s]+rel=(\"|')(.*?)wp-att-(\d+)\\1#i"; 150 156 foreach ( $anchor_matches[0] as $anchor ) { 151 157 if ( 0 == preg_match( $search, $anchor, $id_matches ) ) … … 280 286 add_meta( $post_ID ); 281 287 282 wp_update_post( $_POST); 288 wp_update_post( $_POST ); 289 290 // Reunite any orphaned attachments with their parent 291 if ( !$draft_ids = get_user_option( 'autosave_draft_ids' ) ) 292 $draft_ids = array(); 293 if ( $draft_temp_id = array_search( $post_ID, $draft_ids ) ) 294 relocate_children( $draft_temp_id, $post_ID ); 283 295 284 296 // Now that we have an ID we can fix any attachment anchor hrefs
Note: See TracChangeset
for help on using the changeset viewer.