Changeset 823
- Timestamp:
- 12/11/06 11:45:03 (2 years ago)
- Files:
-
- trunk/wp-admin/admin-db.php (modified) (5 diffs)
- trunk/wp-admin/admin-functions.php (modified) (2 diffs)
- trunk/wp-admin/upload-functions.php (modified) (1 diff)
- trunk/wp-commentsrss2.php (modified) (1 diff)
- trunk/wp-includes/category.php (modified) (3 diffs)
- trunk/wp-includes/comment.php (modified) (2 diffs)
- trunk/wp-includes/functions.php (modified) (4 diffs)
- trunk/wp-includes/general-template.php (modified) (2 diffs)
- trunk/wp-includes/js/crop (added)
- trunk/wp-includes/js/crop/cropper.css (added)
- trunk/wp-includes/js/crop/cropper.js (added)
- trunk/wp-includes/js/crop/marqueeHoriz.gif (added)
- trunk/wp-includes/js/crop/marqueeVert.gif (added)
- trunk/wp-includes/post.php (modified) (6 diffs)
- trunk/wp-includes/query.php (modified) (1 diff)
- trunk/wp-includes/script-loader.php (modified) (1 diff)
- trunk/xmlrpc.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/wp-admin/admin-db.php
r811 r823 139 139 } 140 140 141 wp_cache_delete($cat_ID, 'category'); 142 wp_cache_delete('get_categories', 'category'); 141 // Keep in mind when using this filter and altering the cat_ID that the two queries above 142 // have already taken place with the OLD cat_ID 143 // Also note that you may have post2cat entries with the old cat_ID if this is an update 144 $cat_ID = apply_filters('cat_id_filter', $cat_ID, $update); 145 146 clean_category_cache($cat_ID); 143 147 144 148 if ($update) { 145 149 do_action('edit_category', $cat_ID); 146 150 } else { 147 wp_cache_delete('all_category_ids', 'category');148 151 do_action('create_category', $cat_ID); 149 152 do_action('add_category', $cat_ID); 150 153 } 151 $cat_ID = apply_filters( "cat_id_filter", $cat_ID );152 154 153 155 return $cat_ID; … … 178 180 179 181 $cat_ID = (int) $cat_ID; 180 181 // Don't delete the default cat. 182 if ( $cat_ID == get_option('default_category') ) 182 $default_cat = get_option('default_category'); 183 $default_link_cat = get_option('default_link_category'); 184 185 // Don't delete either of the default cats 186 if ( $cat_ID == $default_cat || $cat_ID == $default_link_cat ) 183 187 return 0; 184 188 185 if ( $cat_ID == get_option('default_link_category') )186 return 0;187 188 189 $category = get_category($cat_ID); 189 190 190 191 $parent = $category->category_parent; 191 192 192 // Delete the category .193 // Delete the category 193 194 if ( !$wpdb->query("DELETE FROM $wpdb->categories WHERE cat_ID = '$cat_ID'") ) 194 195 return 0; 195 196 196 // Update children to point to new parent .197 // Update children to point to new parent 197 198 $wpdb->query("UPDATE $wpdb->categories SET category_parent = '$parent' WHERE category_parent = '$cat_ID'"); 198 199 199 // Only set posts and links to the default category if they're not in another category already. 200 $default_cat = get_option('default_category'); 200 // Only set posts and links to the default category if they're not in another category already 201 201 $posts = $wpdb->get_col("SELECT post_id FROM $wpdb->post2cat WHERE category_id='$cat_ID'"); 202 if ( is_array($posts) ) foreach ($posts as $post_id) {202 foreach ( (array) $posts as $post_id ) { 203 203 $cats = wp_get_post_categories($post_id); 204 204 if ( 1 == count($cats) ) … … 209 209 } 210 210 211 $default_link_cat = get_option('default_link_category');212 211 $links = $wpdb->get_col("SELECT link_id FROM $wpdb->link2cat WHERE category_id='$cat_ID'"); 213 if ( is_array($links) ) foreach ($links as $link_id) {212 foreach ( (array) $links as $link_id ) { 214 213 $cats = wp_get_link_cats($link_id); 215 214 if ( 1 == count($cats) ) … … 220 219 } 221 220 222 wp_cache_delete($cat_ID, 'category'); 223 wp_cache_delete('all_category_ids', 'category'); 224 wp_cache_delete('get_categories', 'category'); 225 221 clean_category_cache($cat_ID); 226 222 do_action('delete_category', $cat_ID); 227 228 223 return 1; 229 224 } … … 493 488 } 494 489 495 do_action('edit_link', $link_ID);496 490 } // wp_set_link_cats() 497 491 trunk/wp-admin/admin-functions.php
r819 r823 864 864 } else { 865 865 return false; 866 }867 }868 869 function wp_create_thumbnail( $file, $max_side, $effect = '' ) {870 871 // 1 = GIF, 2 = JPEG, 3 = PNG872 873 if ( file_exists( $file ) ) {874 $type = getimagesize( $file );875 876 // if the associated function doesn't exist - then it's not877 // handle. duh. i hope.878 879 if (!function_exists( 'imagegif' ) && $type[2] == 1 ) {880 $error = __( 'Filetype not supported. Thumbnail not created.' );881 }882 elseif (!function_exists( 'imagejpeg' ) && $type[2] == 2 ) {883 $error = __( 'Filetype not supported. Thumbnail not created.' );884 }885 elseif (!function_exists( 'imagepng' ) && $type[2] == 3 ) {886 $error = __( 'Filetype not supported. Thumbnail not created.' );887 } else {888 889 // create the initial copy from the original file890 if ( $type[2] == 1 ) {891 $image = imagecreatefromgif( $file );892 }893 elseif ( $type[2] == 2 ) {894 $image = imagecreatefromjpeg( $file );895 }896 elseif ( $type[2] == 3 ) {897 $image = imagecreatefrompng( $file );898 }899 900 if ( function_exists( 'imageantialias' ))901 imageantialias( $image, TRUE );902 903 $image_attr = getimagesize( $file );904 905 // figure out the longest side906 907 if ( $image_attr[0] > $image_attr[1] ) {908 $image_width = $image_attr[0];909 $image_height = $image_attr[1];910 $image_new_width = $max_side;911 912 $image_ratio = $image_width / $image_new_width;913 $image_new_height = $image_height / $image_ratio;914 //width is > height915 } else {916 $image_width = $image_attr[0];917 $image_height = $image_attr[1];918 $image_new_height = $max_side;919 920 $image_ratio = $image_height / $image_new_height;921 $image_new_width = $image_width / $image_ratio;922 //height > width923 }924 925 $thumbnail = imagecreatetruecolor( $image_new_width, $image_new_height);926 @ imagecopyresampled( $thumbnail, $image, 0, 0, 0, 0, $image_new_width, $image_new_height, $image_attr[0], $image_attr[1] );927 928 // If no filters change the filename, we'll do a default transformation.929 if ( basename( $file ) == $thumb = apply_filters( 'thumbnail_filename', basename( $file ) ) )930 $thumb = preg_replace( '!(\.[^.]+)?$!', __( '.thumbnail' ).'$1', basename( $file ), 1 );931 932 $thumbpath = str_replace( basename( $file ), $thumb, $file );933 934 // move the thumbnail to it's final destination935 if ( $type[2] == 1 ) {936 if (!imagegif( $thumbnail, $thumbpath ) ) {937 $error = __( "Thumbnail path invalid" );938 }939 }940 elseif ( $type[2] == 2 ) {941 if (!imagejpeg( $thumbnail, $thumbpath ) ) {942 $error = __( "Thumbnail path invalid" );943 }944 }945 elseif ( $type[2] == 3 ) {946 if (!imagepng( $thumbnail, $thumbpath ) ) {947 $error = __( "Thumbnail path invalid" );948 }949 }950 951 }952 } else {953 $error = __( 'File not found' );954 }955 956 if (!empty ( $error ) ) {957 return $error;958 } else {959 apply_filters( 'wp_create_thumbnail', $thumbpath );960 return $thumbpath;961 866 } 962 867 } … … 2093 1998 2094 1999 2095 function wp_check_for_changed_slugs($post_id) {2096 if ( !strlen($_POST['wp-old-slug']) )2097 return $post_id;2098 2099 $post = &get_post($post_id);2100 2101 // we're only concerned with published posts2102 if ( $post->post_status != 'publish' || $post->post_type != 'post' )2103 return $post_id;2104 2105 // only bother if the slug has changed2106 if ( $post->post_name == $_POST['wp-old-slug'] )2107 return $post_id;2108 2109 $old_slugs = (array) get_post_meta($post_id, '_wp_old_slug');2110 2111 // if we haven't added this old slug before, add it now2112 if ( !count($old_slugs) || !in_array($_POST['wp-old-slug'], $old_slugs) )2113 add_post_meta($post_id, '_wp_old_slug', $_POST['wp-old-slug']);2114 2115 // if the new slug was used previously, delete it from the list2116 if ( in_array($post->post_name, $old_slugs) )2117 delete_post_meta($post_id, '_wp_old_slug', $post->post_name);2118 2119 return $post_id;2120 }2121 2122 2123 2000 function wp_remember_old_slug() { 2124 2001 global $post; trunk/wp-admin/upload-functions.php
r819 r823 221 221 $id = wp_insert_attachment($attachment, $file, $post_id); 222 222 223 if ( preg_match('!^image/!', $attachment['post_mime_type']) ) { 224 // Generate the attachment's postmeta. 225 $imagesize = getimagesize($file); 226 $imagedata['width'] = $imagesize['0']; 227 $imagedata['height'] = $imagesize['1']; 228 list($uwidth, $uheight) = get_udims($imagedata['width'], $imagedata['height']); 229 $imagedata['hwstring_small'] = "height='$uheight' width='$uwidth'"; 230 $imagedata['file'] = $file; 231 232 wp_update_attachment_metadata( $id, $imagedata ); 233 234 if ( $imagedata['width'] * $imagedata['height'] < 3 * 1024 * 1024 ) { 235 if ( $imagedata['width'] > 128 && $imagedata['width'] >= $imagedata['height'] * 4 / 3 ) 236 $thumb = wp_create_thumbnail($file, 128); 237 elseif ( $imagedata['height'] > 96 ) 238 $thumb = wp_create_thumbnail($file, 96); 239 240 if ( @file_exists($thumb) ) { 241 $newdata = $imagedata; 242 $newdata['thumb'] = basename($thumb); 243 wp_update_attachment_metadata( $id, $newdata ); 244 } else { 245 $error = $thumb; 246 } 247 } 248 } else { 249 wp_update_attachment_metadata( $id, array() ); 250 } 223 wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) ); 251 224 252 225 wp_redirect( get_option('siteurl') . "/wp-admin/upload.php?style=$style&tab=browse&action=view&ID=$id&post_id=$post_id"); trunk/wp-commentsrss2.php
r816 r823 77 77 <?php 78 78 } // close check for password 79 do_action('commentrss2_item', $comment->comment_ID, $comment->comment_post_ID); 79 80 ?> 80 81 </item> trunk/wp-includes/category.php
r811 r823 112 112 if ( $hierarchical ) { 113 113 foreach ( $categories as $k => $category ) { 114 $progeny = $category->category_count;114 $progeny = 'link' == $type ? $category->link_count : $category->category_count; 115 115 if ( $children = _get_cat_children($category->cat_ID, $categories) ) { 116 116 foreach ( $children as $child ) 117 $progeny += $child->category_count;117 $progeny += 'link' == $type ? $child->link_count : $child->category_count; 118 118 } 119 119 if ( !$progeny && $hide_empty ) 120 120 unset($categories[$k]); 121 121 else 122 $categories[$k]-> category_count= $progeny;122 $categories[$k]->{'link' == $type ? 'link_count' : 'category_count'} = $progeny; 123 123 } 124 124 } … … 130 130 return apply_filters('get_categories', $categories, $r); 131 131 } 132 133 function delete_get_categories_cache() {134 wp_cache_delete('get_categories', 'category');135 }136 add_action( 'wp_insert_post', 'delete_get_categories_cache' );137 add_action( 'edit_category', 'delete_get_categories_cache' );138 add_action( 'add_category', 'delete_get_categories_cache' );139 add_action( 'delete_category', 'delete_get_categories_cache' );140 132 141 133 // Retrieves category data given a category ID or category object. … … 178 170 $leaf_path = sanitize_title(basename($category_paths)); 179 171 $category_paths = explode('/', $category_paths); 180 foreach($category_paths as $pathdir) 181 $full_path .= ($pathdir!=''?'/':'') . sanitize_title($pathdir); 172 $full_path = ''; 173 foreach ( (array) $category_paths as $pathdir ) 174 $full_path .= ( $pathdir != '' ? '/' : '' ) . sanitize_title($pathdir); 182 175 183 176 $categories = $wpdb->get_results("SELECT cat_ID, category_nicename, category_parent FROM $wpdb->categories WHERE category_nicename = '$leaf_path'"); trunk/wp-includes/comment.php
r821 r823 433 433 } 434 434 435 if ( $wpdb->query($query) ) { 436 do_action('wp_set_comment_status', $comment_id, $comment_status); 437 438 $comment = get_comment($comment_id); 439 $comment_post_ID = $comment->comment_post_ID; 440 $c = $wpdb->get_row("SELECT count(*) as c FROM {$wpdb->comments} WHERE comment_post_ID = '$comment_post_ID' AND comment_approved = '1'"); 441 if ( is_object($c) ) 442 $wpdb->query("UPDATE $wpdb->posts SET comment_count = '$c->c' WHERE ID = '$comment_post_ID'"); 443 return true; 444 } else { 435 if ( !$wpdb->query($query) ) 445 436 return false; 446 } 437 438 do_action('wp_set_comment_status', $comment_id, $comment_status); 439 $comment = get_comment($comment_id); 440 wp_update_comment_count($comment->comment_post_ID); 441 return true; 447 442 } 448 443 … … 493 488 $wpdb->query("UPDATE $wpdb->posts SET comment_count = $count WHERE ID = '$post_id'"); 494 489 $comment_count_cache[$post_id] = $count; 490 491 $post = get_post($post_id); 492 if ( 'page' == $post->post_type ) 493 clean_page_cache( $post_id ); 494 else 495 clean_post_cache( $post_id ); 496 497 do_action('edit_post', $post_id); 498 495 499 return true; 496 500 } trunk/wp-includes/functions.php
r810 r823 537 537 538 538 function clean_post_cache($id) { 539 global $post_cache, $ blog_id;539 global $post_cache, $post_meta_cache, $category_cache, $blog_id; 540 540 541 541 if ( isset( $post_cache[$blog_id][$id] ) ) 542 542 unset( $post_cache[$blog_id][$id] ); 543 544 if ( isset ($post_meta_cache[$blog_id][$id] ) ) 545 unset( $post_meta_cache[$blog_id][$id] ); 546 547 if ( isset( $category_cache[$blog_id][$id]) ) 548 unset ( $category_cache[$blog_id][$id] ); 543 549 } 544 550 … … 555 561 } 556 562 557 558 563 function clean_page_cache($id) { 559 global $page_cache, $ wpdb, $blog_id;564 global $page_cache, $blog_id; 560 565 561 566 if ( isset( $page_cache[$blog_id][$id] ) ) 562 567 unset( $page_cache[$blog_id][$id] ); 563 568 564 $page_ids = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE post_type='page'");565 wp_cache_delete( 'all_page_ids','pages');566 569 wp_cache_delete($id, 'pages'); 570 wp_cache_delete( 'all_page_ids', 'pages' ); 571 wp_cache_delete( 'get_pages', 'page' ); 567 572 } 568 573 … … 669 674 function update_category_cache() { 670 675 return true; 676 } 677 678 function clean_category_cache($id) { 679 wp_cache_delete($id, 'category'); 680 wp_cache_delete('all_category_ids', 'category'); 681 wp_cache_delete('get_categories', 'category'); 671 682 } 672 683 … … 1118 1129 } 1119 1130 1131 function wp_generate_attachment_metadata( $attachment_id, $file ) { 1132 $attachment = get_post( $attachment_id ); 1133 1134 $metadata = array(); 1135 if ( preg_match('!^image/!', get_post_mime_type( $attachment )) ) { 1136 $imagesize = getimagesize($file); 1137 $metadata['width'] = $imagesize['0']; 1138 $metadata['height'] = $imagesize['1']; 1139 list($uwidth, $uheight) = get_udims($metadata['width'], $metadata['height']); 1140 $metadata['hwstring_small'] = "height='$uheight' width='$uwidth'"; 1141 $metadata['file'] = $file; 1142 1143 if ( $metadata['width'] * $metadata['height'] < 3 * 1024 * 1024 ) { 1144 if ( $metadata['width'] > 128 && $metadata['width'] >= $metadata['height'] * 4 / 3 ) 1145 $thumb = wp_create_thumbnail($file, 128); 1146 elseif ( $metadata['height'] > 96 ) 1147 $thumb = wp_create_thumbnail($file, 96); 1148 1149 if ( @file_exists($thumb) ) 1150 $metadata['thumb'] = basename($thumb); 1151 } 1152 } 1153 return apply_filters( 'wp_generate_attachment_metadata', $metadata ); 1154 } 1155 1156 function wp_create_thumbnail( $file, $max_side, $effect = '' ) { 1157 1158 // 1 = GIF, 2 = JPEG, 3 = PNG 1159 1160 if ( file_exists( $file ) ) { 1161 $type = getimagesize( $file ); 1162 1163 // if the associated function doesn't exist - then it's not 1164 // handle. duh. i hope. 1165 1166 if (!function_exists( 'imagegif' ) && $type[2] == 1 ) { 1167 $error = __( 'Filetype not supported. Thumbnail not created.' ); 1168 } 1169 elseif (!function_exists( 'imagejpeg' ) && $type[2] == 2 ) { 1170 $error = __( 'Filetype not supported. Thumbnail not created.' ); 1171 } 1172 elseif (!function_exists( 'imagepng' ) && $type[2] == 3 ) { 1173 $error = __( 'Filetype not supported. Thumbnail not created.' ); 1174 } else { 1175 1176 // create the initial copy from the original file 1177 if ( $type[2] == 1 ) { 1178 $image = imagecreatefromgif( $file ); 1179 } 1180 elseif ( $type[2] == 2 ) { 1181 $image = imagecreatefromjpeg( $file ); 1182 } 1183 elseif ( $type[2] == 3 ) { 1184 $image = imagecreatefrompng( $file ); 1185 } 1186 1187 if ( function_exists( 'imageantialias' )) 1188 imageantialias( $image, TRUE ); 1189 1190 $image_attr = getimagesize( $file ); 1191 1192 // figure out the longest side 1193 1194 if ( $image_attr[0] > $image_attr[1] ) { 1195 $image_width = $image_attr[0]; 1196 $image_height = $image_attr[1]; 1197 $image_new_width = $max_side; 1198 1199 $image_ratio = $image_width / $image_new_width; 1200 $image_new_height = $image_height / $image_ratio; 1201 //width is > height 1202 } else { 1203 $image_width = $image_attr[0]; 1204 $image_height = $image_attr[1]; 1205 $image_new_height = $max_side; 1206 1207 $image_ratio = $image_height / $image_new_height; 1208 $image_new_width = $image_width / $image_ratio; 1209 //height > width 1210 } 1211 1212 $thumbnail = imagecreatetruecolor( $image_new_width, $image_new_height); 1213 @ imagecopyresampled( $thumbnail, $image, 0, 0, 0, 0, $image_new_width, $image_new_height, $image_attr[0], $image_attr[1] ); 1214 1215 // If no filters change the filename, we'll do a default transformation. 1216 if ( basename( $file ) == $thumb = apply_filters( 'thumbnail_filename', basename( $file ) ) ) 1217 $thumb = preg_replace( '!(\.[^.]+)?$!', __( '.thumbnail' ).'$1', basename( $file ), 1 ); 1218 1219 $thumbpath = str_replace( basename( $file ), $thumb, $file ); 1220 1221 // move the thumbnail to it's final destination 1222 if ( $type[2] == 1 ) { 1223 if (!imagegif( $thumbnail, $thumbpath ) ) { 1224 $error = __( "Thumbnail path invalid" ); 1225 } 1226 } 1227 elseif ( $type[2] == 2 ) { 1228 if (!imagejpeg( $thumbnail, $thumbpath ) ) { 1229 $error = __( "Thumbnail path invalid" ); 1230 } 1231 } 1232 elseif ( $type[2] == 3 ) { 1233 if (!imagepng( $thumbnail, $thumbpath ) ) { 1234 $error = __( "Thumbnail path invalid" ); 1235 } 1236 } 1237 1238 } 1239 } else { 1240 $error = __( 'File not found' ); 1241 } 1242 1243 if (!empty ( $error ) ) { 1244 return $error; 1245 } else { 1246 apply_filters( 'wp_create_thumbnail', $thumbpath ); 1247 return $thumbpath; 1248 } 1249 } 1250 1120 1251 function wp_explain_nonce($action) { 1121 1252 if ( $action !== -1 && preg_match('/([a-z]+)-([a-z]+)(_(.+))?/', $action, $matches) ) { trunk/wp-includes/general-template.php
r821 r823 369 369 foreach ( $arcresults as $arcresult ) { 370 370 $url = get_day_link($arcresult->year, $arcresult->month, $arcresult->dayofmonth); 371 $date = sprintf( __('%1$d-%2$02d-%3$02d 00:00:00'), $arcresult->year, $arcresult->month, $arcresult->dayofmonth);371 $date = sprintf('%1$d-%2$02d-%3$02d 00:00:00', $arcresult->year, $arcresult->month, $arcresult->dayofmonth); 372 372 $text = mysql2date($archive_day_date_format, $date); 373 373 if ($show_post_count) … … 389 389 $arc_week_start = date_i18n($archive_week_start_date_format, $arc_week['start']); 390 390 $arc_week_end = date_i18n($archive_week_end_date_format, $arc_week['end']); 391 $url = sprintf( __('%1$s/%2$s%3$sm%4$s%5$s%6$sw%7$s%8$d'), get_option('home'), '', '?', '=', $arc_year, '&', '=', $arcresult->week);391 $url = sprintf('%1$s/%2$s%3$sm%4$s%5$s%6$sw%7$s%8$d', get_option('home'), '', '?', '=', $arc_year, '&', '=', $arcresult->week); 392 392 $text = $arc_week_start . $archive_week_separator . $arc_week_end; 393 393 if ($show_post_count) trunk/wp-includes/post.php
r821 r823 439 439 440 440 if ( 'page' == $post->post_type ) { 441 wp_cache_delete( 'all_page_ids', 'pages' ); 442 wp_cache_delete( 'get_pages', 'page' ); 441 clean_page_cache($postid); 443 442 $wp_rewrite->flush_rules(); 444 443 } … … 653 652 if ( 'page' == $post_type ) { 654 653 clean_page_cache($post_ID); 655 wp_cache_delete($post_ID, 'pages');654 $wp_rewrite->flush_rules(); 656 655 } else { 657 656 clean_post_cache($post_ID); … … 692 691 } 693 692 } else if ($post_type == 'page') { 694 wp_cache_delete( 'all_page_ids', 'pages' );695 wp_cache_delete( 'get_pages', 'page' );696 $wp_rewrite->flush_rules();697 698 693 if ( !empty($page_template) ) 699 694 if ( ! update_post_meta($post_ID, '_wp_page_template', $page_template)) … … 819 814 $count = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->post2cat, $wpdb->posts WHERE $wpdb->posts.ID=$wpdb->post2cat.post_id AND post_status = 'publish' AND post_type = 'post' AND category_id = '$cat_id'"); 820 815 $wpdb->query("UPDATE $wpdb->categories SET category_count = '$count' WHERE cat_ID = '$cat_id'"); 821 wp_cache_delete($cat_id, 'category');816 clean_category_cache($cat_id); 822 817 do_action('edit_category', $cat_id); 823 818 } 824 825 wp_cache_delete('get_categories', 'category');826 827 do_action('edit_post', $post_ID);828 819 } // wp_set_post_categories() 829 820 … … 1164 1155 return $pages; 1165 1156 } 1166 1167 function delete_get_pages_cache() {1168 wp_cache_delete( 'get_pages', 'page' );1169 }1170 add_action( 'save_post', 'delete_get_pages_cache' );1171 1157 1172 1158 function generate_page_uri_index() { … … 1440 1426 } 1441 1427 1428 function wp_check_for_changed_slugs($post_id) { 1429 if ( !strlen($_POST['wp-old-slug']) ) 1430 return $post_id; 1431 1432 $post = &get_post($post_id); 1433 1434 // we're only concerned with published posts 1435 if ( $post->post_status != 'publish' || $post->post_type != 'post' ) 1436 return $post_id; 1437 1438 // only bother if the slug has changed 1439 if ( $post->post_name == $_POST['wp-old-slug'] ) 1440 return $post_id; 1441 1442 $old_slugs = (array) get_post_meta($post_id, '_wp_old_slug'); 1443 1444 // if we haven't added this old slug before, add it now 1445 if ( !count($old_slugs) || !in_array($_POST['wp-old-slug'], $old_slugs) ) 1446 add_post_meta($post_id, '_wp_old_slug', $_POST['wp-old-slug']); 1447 1448 // if the new slug was used previously, delete it from the list 1449 if ( in_array($post->post_name, $old_slugs) ) 1450 delete_post_meta($post_id, '_wp_old_slug', $post->post_name); 1451 1452 return $post_id; 1453 } 1454 1442 1455 ?> trunk/wp-includes/query.php
r821 r823 820 820 $q['category_name'] = sanitize_title(basename($cat_paths)); 821 821 $cat_paths = explode('/', $cat_paths); 822 foreach($cat_paths as $pathdir) 823 $cat_path .= ($pathdir!=''?'/':'') . sanitize_title($pathdir); 822 $cat_path = ''; 823 foreach ( (array) $cat_paths as $pathdir ) 824 $cat_path .= ( $pathdir != '' ? '/' : '' ) . sanitize_title($pathdir); 824 825 825 826 //if we don't match the entire hierarchy fallback on just matching the nicename trunk/wp-includes/script-loader.php
r819 r823 23 23 $this->add( 'wp-ajax', '/wp-includes/js/wp-ajax-js.php', array('prototype'), '4459'); 24 24 $this->add( 'listman', '/wp-includes/js/list-manipulation-js.php', array('wp-ajax', 'fat'), '4583'); 25 $this->add( 'scriptaculous', '/wp-includes/js/scriptaculous/scriptaculous.js', array('prototype'), '1.6.1'); 26 $this->add( 'scriptaculous-dragdrop', '/wp-includes/js/scriptaculous/scriptaculous.js?load=builder,dragdrop', array('prototype'), '1.6.1'); 27 $this->add( 'scriptaculous-slider', '/wp-includes/js/scriptaculous/scriptaculous.js?load=slider,effects', array('prototype'), '1.6.1'); 28 $this->add( 'scriptaculous-controls', '/wp-includes/js/scriptaculous/scriptaculous.js?load=controls', array('prototype'), '1.6.1'); 29 $this->add( 'cropper', '/wp-includes/js/crop/cropper.js', array('scriptaculous-dragdrop'), '1'); 25 30 if ( is_admin() ) { 26 31 $this->add( 'dbx-admin-key', '/wp-admin/dbx-admin-key-js.php', array('dbx'), '3651' ); trunk/xmlrpc.php
r819 r823 883 883 // Save the data 884 884 $id = wp_insert_attachment( $attachment, $upload[ 'file' ], $post_id ); 885 wp_update_attachment_metadata( $id, array() );885 wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $upload['file'] ) ); 886 886 887 887 return apply_filters( 'wp_handle_upload', array( 'file' => $upload[ 'file' ], 'url' => $upload[ 'url' ], 'type' => $type ) );
