Changeset 6726
- Timestamp:
- 02/05/08 06:47:27 (5 months ago)
- Files:
-
- trunk/wp-admin/admin-ajax.php (modified) (1 diff)
- trunk/wp-admin/edit-page-form.php (modified) (1 diff)
- trunk/wp-admin/edit-pages.php (modified) (1 diff)
- trunk/wp-admin/edit-tags.php (modified) (1 diff)
- trunk/wp-admin/export.php (modified) (1 diff)
- trunk/wp-admin/import/blogger.php (modified) (2 diffs)
- trunk/wp-admin/import/btt.php (modified) (1 diff)
- trunk/wp-admin/import/jkw.php (modified) (2 diffs)
- trunk/wp-admin/import/mt.php (modified) (3 diffs)
- trunk/wp-admin/import/stp.php (modified) (2 diffs)
- trunk/wp-admin/import/textpattern.php (modified) (1 diff)
- trunk/wp-admin/import/wordpress.php (modified) (39 diffs)
- trunk/wp-admin/import/wp-cat2tag.php (modified) (6 diffs)
- trunk/wp-admin/includes/dashboard.php (modified) (2 diffs)
- trunk/wp-admin/includes/export.php (modified) (1 diff)
- trunk/wp-admin/includes/image.php (modified) (5 diffs)
- trunk/wp-admin/includes/media.php (modified) (14 diffs)
- trunk/wp-admin/includes/post.php (modified) (2 diffs)
- trunk/wp-admin/includes/template.php (modified) (9 diffs)
- trunk/wp-admin/includes/widgets.php (modified) (2 diffs)
- trunk/wp-admin/install.php (modified) (1 diff)
- trunk/wp-admin/plugins.php (modified) (2 diffs)
- trunk/wp-admin/setup-config.php (modified) (2 diffs)
- trunk/wp-admin/user-edit.php (modified) (1 diff)
- trunk/wp-admin/users.php (modified) (1 diff)
- trunk/wp-admin/widgets.php (modified) (1 diff)
- trunk/wp-app.php (modified) (3 diffs)
- trunk/wp-includes/bookmark-template.php (modified) (1 diff)
- trunk/wp-includes/bookmark.php (modified) (1 diff)
- trunk/wp-includes/canonical.php (modified) (1 diff)
- trunk/wp-includes/classes.php (modified) (8 diffs)
- trunk/wp-includes/comment-template.php (modified) (5 diffs)
- trunk/wp-includes/comment.php (modified) (7 diffs)
- trunk/wp-includes/compat.php (modified) (1 diff)
- trunk/wp-includes/deprecated.php (modified) (10 diffs)
- trunk/wp-includes/feed-atom-comments.php (modified) (1 diff)
- trunk/wp-includes/feed.php (modified) (1 diff)
- trunk/wp-includes/formatting.php (modified) (1 diff)
- trunk/wp-includes/functions.php (modified) (14 diffs)
- trunk/wp-includes/general-template.php (modified) (5 diffs)
- trunk/wp-includes/js/tinymce/plugins/spellchecker/classes/SpellChecker.php (modified) (1 diff)
- trunk/wp-includes/js/tinymce/tiny_mce_config.php (modified) (2 diffs)
- trunk/wp-includes/js/tinymce/tiny_mce_gzip.php (modified) (10 diffs)
- trunk/wp-includes/js/tinymce/wp-mce-help.php (modified) (3 diffs)
- trunk/wp-includes/l10n.php (modified) (1 diff)
- trunk/wp-includes/link-template.php (modified) (4 diffs)
- trunk/wp-includes/pluggable.php (modified) (4 diffs)
- trunk/wp-includes/plugin.php (modified) (3 diffs)
- trunk/wp-includes/post.php (modified) (1 diff)
- trunk/wp-includes/query.php (modified) (5 diffs)
- trunk/wp-includes/rewrite.php (modified) (1 diff)
- trunk/wp-includes/script-loader.php (modified) (3 diffs)
- trunk/wp-includes/shortcodes.php (modified) (1 diff)
- trunk/wp-includes/streams.php (modified) (1 diff)
- trunk/wp-includes/taxonomy.php (modified) (24 diffs)
- trunk/wp-includes/update.php (modified) (1 diff)
- trunk/wp-includes/user.php (modified) (2 diffs)
- trunk/wp-includes/widgets.php (modified) (6 diffs)
- trunk/wp-includes/wp-db.php (modified) (1 diff)
- trunk/wp-login.php (modified) (5 diffs)
- trunk/wp-settings.php (modified) (1 diff)
- trunk/xmlrpc.php (modified) (31 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/wp-admin/admin-ajax.php
r6660 r6726 304 304 if ( !$link_cat = link_cat_row( $term_id ) ) 305 305 die('0'); 306 306 307 307 $x = new WP_Ajax_Response( array( 308 308 'what' => 'link-cat', trunk/wp-admin/edit-page-form.php
r6712 r6726 49 49 <div id="titlediv"> 50 50 <h3><?php _e('Title') ?></h3> 51 <div class="inside"> 51 <div class="inside"> 52 52 <input type="text" name="post_title" size="30" tabindex="1" value="<?php echo attribute_escape( $post->post_title ); ?>" id="title" /> 53 53 </div> trunk/wp-admin/edit-pages.php
r6380 r6726 88 88 </thead> 89 89 <tbody id="the-list" class="list:page"> 90 <?php page_rows($posts); ?> 90 <?php page_rows($posts); ?> 91 91 </tbody> 92 92 </table> trunk/wp-admin/edit-tags.php
r6723 r6726 43 43 require_once ('admin-header.php'); 44 44 $tag_ID = (int) $_GET['tag_ID']; 45 46 $tag = get_term($tag_ID, 'post_tag', OBJECT, 'edit'); 45 46 $tag = get_term($tag_ID, 'post_tag', OBJECT, 'edit'); 47 47 include('edit-tag-form.php'); 48 48 trunk/wp-admin/export.php
r6335 r6726 5 5 $parent_file = 'edit.php'; 6 6 7 if ( isset( $_GET['download'] ) ) { 7 if ( isset( $_GET['download'] ) ) { 8 8 export_wp( $_GET['author'] ); 9 9 die(); trunk/wp-admin/import/blogger.php
r6607 r6726 382 382 $AtomParser->parse( $entry ); 383 383 $result = $this->import_post($AtomParser->entry); 384 if ( is_wp_error( $result ) ) 384 if ( is_wp_error( $result ) ) 385 385 return $result; 386 386 unset($AtomParser); … … 521 521 522 522 $post_id = wp_insert_post($post); 523 if ( is_wp_error( $post_id ) ) 523 if ( is_wp_error( $post_id ) ) 524 524 return $post_id; 525 525 trunk/wp-admin/import/btt.php
r6682 r6726 62 62 echo '<p><h3>'.__('Reading Bunny’s Technorati Tags…').'</h3></p>'; 63 63 64 // import Bunny's Keywords tags 64 // import Bunny's Keywords tags 65 65 $metakeys = $wpdb->get_results("SELECT post_id, meta_id, meta_key, meta_value FROM $wpdb->postmeta WHERE $wpdb->postmeta.meta_key = 'tags'"); 66 66 if ( !is_array($metakeys)) { trunk/wp-admin/import/jkw.php
r6682 r6726 78 78 echo '<p><h3>'.__('Reading Jerome’s Keywords Tags…').'</h3></p>'; 79 79 80 // import Jerome's Keywords tags 80 // import Jerome's Keywords tags 81 81 $metakeys = $wpdb->get_results("SELECT post_id, meta_id, meta_key, meta_value FROM $wpdb->postmeta WHERE $wpdb->postmeta.meta_key = 'keywords'"); 82 82 if ( !is_array($metakeys)) { … … 118 118 echo '<p><h3>'.__('Reading Jerome’s Keywords Tags…').'</h3></p>'; 119 119 120 // import Jerome's Keywords tags 120 // import Jerome's Keywords tags 121 121 $tablename = $wpdb->prefix . substr(get_option('jkeywords_keywords_table'), 1, -1); 122 122 $metakeys = $wpdb->get_results("SELECT post_id, tag_name FROM $tablename"); trunk/wp-admin/import/mt.php
r6430 r6726 216 216 $post->post_author = $this->checkauthor($post->post_author); //just so that if a post already exists, new users are not created by checkauthor 217 217 $post_id = wp_insert_post($post); 218 if ( is_wp_error( $post_id ) ) 218 if ( is_wp_error( $post_id ) ) 219 219 return $post_id; 220 220 … … 295 295 $context = ''; 296 296 $result = $this->save_post($post, $comments, $pings); 297 if ( is_wp_error( $result ) ) 297 if ( is_wp_error( $result ) ) 298 298 return $result; 299 299 $post = new StdClass; … … 421 421 $this->get_authors_from_post(); 422 422 $result = $this->process_posts(); 423 if ( is_wp_error( $result ) ) 423 if ( is_wp_error( $result ) ) 424 424 return $result; 425 425 } trunk/wp-admin/import/stp.php
r6430 r6726 71 71 delete_option('stpimp_posts'); 72 72 } 73 73 74 74 add_option('stpimp_posts', $posts); 75 75 $count = count($posts); … … 88 88 echo '<div class="narrow">'; 89 89 echo '<p><h3>'.__('Adding Tags to Posts…').'</h3></p>'; 90 90 91 91 // run that funky magic! 92 92 $tags_added = $this->tag2post(); 93 93 94 94 echo '<p>' . sprintf( __ngettext('Done! <strong>%s</strong> tags where added!', 'Done! <strong>%s</strong> tags where added!', $tags_added), $tags_added ) . '<br /></p>'; 95 95 echo '<form action="admin.php?import=stp&step=3" method="post">'; trunk/wp-admin/import/textpattern.php
r6472 r6726 647 647 case 3 : 648 648 $result = $this->import_posts(); 649 if ( is_wp_error( $result ) ) 649 if ( is_wp_error( $result ) ) 650 650 echo $result->get_error_message(); 651 651 break; trunk/wp-admin/import/wordpress.php
r6565 r6726 10 10 var $newauthornames = array (); 11 11 var $allauthornames = array (); 12 12 13 13 var $author_ids = array (); 14 14 var $tags = array (); 15 15 16 16 var $j = -1; 17 17 var $fetch_attachments = false; … … 52 52 return is_callable('gzopen'); 53 53 } 54 54 55 55 function fopen($filename, $mode='r') { 56 56 if ( $this->has_gzip() ) … … 58 58 return fopen($filename, $mode); 59 59 } 60 60 61 61 function feof($fp) { 62 62 if ( $this->has_gzip() ) … … 64 64 return feof($fp); 65 65 } 66 66 67 67 function fgets($fp, $len=8192) { 68 68 if ( $this->has_gzip() ) … … 70 70 return fgets($fp, $len); 71 71 } 72 72 73 73 function fclose($fp) { 74 74 if ( $this->has_gzip() ) … … 87 87 while ( !$this->feof($fp) ) { 88 88 $importline = rtrim($this->fgets($fp)); 89 89 90 90 // this doesn't check that the file is perfectly valid but will at least confirm that it's not the wrong format altogether 91 91 if ( !$is_wxr_file && preg_match('|xmlns:wp="http://wordpress[.]org/export/\d+[.]\d+/"|', $importline) ) … … 124 124 125 125 } 126 126 127 127 function get_wp_authors() { 128 128 // We need to find unique values of author names, while preserving the order, so this function emulates the unique_value(); php function, without the sorting. … … 141 141 function get_authors_from_post() { 142 142 global $current_user; 143 143 144 144 // this will populate $this->author_ids with a list of author_names => user_ids 145 145 146 146 foreach ( $_POST['author_in'] as $i => $in_author_name ) { 147 147 148 148 if ( !empty($_POST['user_select'][$i]) ) { 149 149 // an existing user was selected in the dropdown list … … 154 154 elseif ( $this->allow_create_users() ) { 155 155 // nothing was selected in the dropdown list, so we'll use the name in the text field 156 156 157 157 $new_author_name = trim($_POST['user_create'][$i]); 158 158 // if the user didn't enter a name, assume they want to use the same name as in the import file 159 159 if ( empty($new_author_name) ) 160 160 $new_author_name = $in_author_name; 161 161 162 162 $user_id = username_exists($new_author_name); 163 if ( !$user_id ) { 163 if ( !$user_id ) { 164 164 $user_id = wp_create_user($new_author_name, 'changeme'); 165 165 } 166 166 167 167 $this->author_ids[$in_author_name] = $user_id; 168 168 } 169 169 170 170 // failsafe: if the user_id was invalid, default to the current user 171 171 if ( empty($this->author_ids[$in_author_name]) ) { … … 173 173 } 174 174 } 175 175 176 176 } 177 177 … … 197 197 echo '</li>'; 198 198 } 199 199 200 200 if ( $this->allow_fetch_attachments() ) { 201 ?> 202 </ol> 201 ?> 202 </ol> 203 203 <h2><?php _e('Import Attachments'); ?></h2> 204 204 <p> … … 209 209 <?php 210 210 } 211 211 212 212 echo '<input type="submit" value="Submit">'.'<br />'; 213 213 echo '</form>'; 214 214 215 215 } 216 216 217 217 function users_form($n, $author) { 218 218 219 219 if ( $this->allow_create_users() ) { 220 220 printf(__('Create user %1$s or map to existing'), ' <input type="text" value="'.$author.'" name="'.'user_create['.intval($n).']'.'" maxlength="30"> <br />'); … … 226 226 // keep track of $n => $author name 227 227 echo '<input type="hidden" name="author_in['.intval($n).']" value="'.htmlspecialchars($author).'" />'; 228 228 229 229 $users = get_users_of_blog(); 230 230 ?><select name="user_select[<?php echo $n; ?>]"> … … 253 253 function checkauthor($author) { 254 254 global $current_user; 255 255 256 256 if ( !empty($this->author_ids[$author]) ) 257 257 return $this->author_ids[$author]; 258 258 259 259 // failsafe: map to the current user 260 260 return $current_user->ID; … … 335 335 function process_post($post) { 336 336 global $wpdb; 337 337 338 338 $post_ID = (int) $this->get_tag( $post, 'wp:post_id' ); 339 339 if ( $post_ID && !empty($this->post_ids_processed[$post_ID]) ) // Processed already … … 358 358 $post_content = str_replace('<br>', '<br />', $post_content); 359 359 $post_content = str_replace('<hr>', '<hr />', $post_content); 360 360 361 361 preg_match_all('|<category domain="tag">(.*?)</category>|is', $post, $tags); 362 362 $tags = $tags[1]; … … 378 378 379 379 $post_exists = post_exists($post_title, '', $post_date); 380 380 381 381 if ( $post_exists ) { 382 382 echo '<li>'; … … 406 406 if ( !$remote_url ) 407 407 $remote_url = $guid; 408 408 409 409 $comment_post_ID = $post_id = $this->process_attachment($postdata, $remote_url); 410 410 if ( !$post_id or is_wp_error($post_id) ) … … 415 415 $comment_post_ID = $post_id = wp_insert_post($postdata); 416 416 } 417 417 418 418 if ( is_wp_error( $post_id ) ) 419 419 return $post_id; … … 423 423 $this->post_ids_processed[intval($post_ID)] = intval($post_id); 424 424 } 425 425 426 426 // Add categories. 427 427 if (count($categories) > 0) { … … 496 496 $value = $this->get_tag( $p, 'wp:meta_value' ); 497 497 $value = stripslashes($value); // add_post_meta() will escape. 498 498 499 499 $this->process_post_meta($post_id, $key, $value); 500 500 501 501 } } 502 502 503 503 do_action('import_post_added', $post_id); 504 504 print "</li>\n"; 505 505 } 506 506 507 507 function process_post_meta($post_id, $key, $value) { 508 508 // the filter can return false to skip a particular metadata key … … 513 513 } 514 514 } 515 515 516 516 function process_attachment($postdata, $remote_url) { 517 517 if ($this->fetch_attachments and $remote_url) { … … 525 525 print '('.size_format(filesize($upload['file'])).')'; 526 526 } 527 527 528 528 if ( $info = wp_check_filetype($upload['file']) ) { 529 529 $postdata['post_mime_type'] = $info['type']; … … 533 533 return; 534 534 } 535 535 536 536 $postdata['guid'] = $upload['url']; 537 537 … … 539 539 $post_id = wp_insert_attachment($postdata, $upload['file']); 540 540 wp_update_attachment_metadata( $post_id, wp_generate_attachment_metadata( $post_id, $upload['file'] ) ); 541 541 542 542 // remap the thumbnail url. this isn't perfect because we're just guessing the original url. 543 543 if ( preg_match('@^image/@', $info['type']) && $thumb_url = wp_get_attachment_thumb_url($post_id) ) { … … 547 547 $this->url_remap[$parts['dirname'] . '/' . $name . '.thumbnail.' . $ext] = $thumb_url; 548 548 } 549 549 550 550 return $post_id; 551 551 } … … 554 554 } 555 555 } 556 556 557 557 function fetch_remote_file($post, $url) { 558 558 $upload = wp_upload_dir($post['post_date']); 559 559 560 560 // extract the file name and extension from the url 561 561 $file_name = basename($url); … … 567 567 return new WP_Error( 'upload_dir_error', $upload['error'] ); 568 568 } 569 569 570 570 // fetch the remote url and write it to the placeholder file 571 571 $headers = wp_get_http($url, $upload['file']); 572 572 573 573 // make sure the fetch was successful 574 574 if ( $headers['response'] != '200' ) { … … 580 580 return new WP_Error( 'import_file_error', __('Remote file is incorrect size') ); 581 581 } 582 582 583 583 $max_size = $this->max_attachment_size(); 584 584 if ( !empty($max_size) and filesize($upload['file']) > $max_size ) { … … 586 586 return new WP_Error( 'import_file_error', sprintf(__('Remote file is too large, limit is %s', size_format($max_size))) ); 587 587 } 588 588 589 589 // keep track of the old and new urls so we can substitute them later 590 590 $this->url_remap[$url] = $upload['url']; … … 592 592 if ( $headers['x-final-location'] != $url ) 593 593 $this->url_remap[$headers['x-final-location']] = $upload['url']; 594 594 595 595 return $upload; 596 596 597 597 } 598 598 … … 601 601 return strlen($b) - strlen($a); 602 602 } 603 603 604 604 // update url references in post bodies to point to the new local files 605 605 function backfill_attachment_urls() { 606 606 607 607 // make sure we do the longest urls first, in case one is a substring of another 608 608 uksort($this->url_remap, array(&$this, 'cmpr_strlen')); 609 609 610 610 global $wpdb; 611 611 foreach ($this->url_remap as $from_url => $to_url) { … … 616 616 } 617 617 } 618 618 619 619 // update the post_parent of orphans now that we know the local id's of all parents 620 620 function backfill_parents() { 621 621 global $wpdb; 622 622 623 623 foreach ($this->orphans as $child_id => $parent_id) { 624 624 $local_child_id = $this->post_ids_processed[$child_id]; … … 629 629 } 630 630 } 631 631 632 632 function is_valid_meta_key($key) { 633 633 // skip _wp_attached_file metadata since we'll regenerate it from scratch … … 641 641 return apply_filters('import_allow_create_users', true); 642 642 } 643 643 644 644 // give the user the option of downloading and importing attached files 645 645 function allow_fetch_attachments() { … … 651 651 return apply_filters('import_attachment_size_limit', 0); 652 652 } 653 653 654 654 function import_start() { 655 655 wp_defer_term_counting(true); … … 657 657 do_action('import_start'); 658 658 } 659 659 660 660 function import_end() { 661 661 do_action('import_end'); 662 662 663 663 // clear the caches after backfilling 664 664 foreach ($this->post_ids_processed as $post_id) 665 665 clean_post_cache($post_id); 666 666 667 667 wp_defer_term_counting(false); 668 668 wp_defer_comment_counting(false); … … 677 677 $this->import_file($file); 678 678 } 679 679 680 680 function import_file($file) { 681 681 $this->file = $file; 682 682 683 683 $this->import_start(); 684 684 $this->get_authors_from_post(); … … 690 690 $this->backfill_attachment_urls(); 691 691 $this->import_end(); 692 692 693 693 if ( is_wp_error( $result ) ) 694 694 return $result; 695 695 } 696 696 697 697 function handle_upload() { 698 698 $file = wp_import_handle_upload(); trunk/wp-admin/import/wp-cat2tag.php
r6551 r6726 1 <?php 1 <?php 2 2 3 3 class WP_Categories_to_Tags { … … 20 20 foreach ( $categories as $category ) { 21 21 if ( !tag_exists($wpdb->escape($category->name)) ) 22 $this->all_categories[] = $category; 22 $this->all_categories[] = $category; 23 23 } 24 24 } … … 54 54 } 55 55 checkflag = 'true'; 56 return '<?php _e('Uncheck All') ?>'; 56 return '<?php _e('Uncheck All') ?>'; 57 57 } else { 58 58 for ( i = 0; i < field.length; i++ ) { … … 61 61 } 62 62 checkflag = 'false'; 63 return '<?php _e('Check All') ?>'; 63 return '<?php _e('Check All') ?>'; 64 64 } 65 65 } … … 77 77 foreach ($this->all_categories as $category) { 78 78 $category = sanitize_term( $category, 'category', 'display' ); 79 79 80 80 if ((int) $category->parent == 0) { 81 81 echo '<li><label><input type="checkbox" name="cats_to_convert[]" value="' . intval($category->term_id) . '" /> ' . $category->name . ' (' . $category->count . ')</label>'; … … 165 165 $posts = get_objects_in_term($category->term_id, 'category'); 166 166 foreach ( $posts as $post ) { 167 if ( !$wpdb->get_var("SELECT object_id FROM $wpdb->term_relationships WHERE object_id = '$post' AND term_taxonomy_id = '$id'") ) 167 if ( !$wpdb->get_var("SELECT object_id FROM $wpdb->term_relationships WHERE object_id = '$post' AND term_taxonomy_id = '$id'") ) 168 168 $wpdb->query("INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id) VALUES ('$post', '$id')"); 169 169 clean_post_cache($post); trunk/wp-admin/includes/dashboard.php
r6717 r6726 59 59 array( 'widget_id' => 'dashboard_plugins' ) 60 60 ); 61 61 62 62 63 63 // Primary feed (Dev Blog) Widget … … 92 92 ); 93 93 } 94 wp_register_sidebar_widget( 'dashboard_secondary', $widget_options['dashboard_secondary']['title'], 'wp_dashboard_empty', 94 wp_register_sidebar_widget( 'dashboard_secondary', $widget_options['dashboard_secondary']['title'], 'wp_dashboard_empty', 95 95 array( 'all_link' => $widget_options['dashboard_secondary']['link'], 'feed_link' => $widget_options['dashboard_secondary']['url'], 'width' => 'full' ) 96 96 ); trunk/wp-admin/includes/export.php
r6383 r6726 75 75 function wxr_site_url() { 76 76 global $current_site; 77 77 78 78 // mu: the base url 79 79 if ( isset($current_site->domain) ) { trunk/wp-admin/includes/image.php
r6579 r6726 22 22 23 23 $image = wp_load_image( $file ); 24 24 25 25 if ( !is_resource( $image ) ) 26 26 return $image; … … 40 40 imagesavealpha( $thumbnail, true); 41 41 } 42 42 43 43 @ imagecopyresampled( $thumbnail, $image, 0, 0, 0, 0, $image_new_width, $image_new_height, $sourceImageWidth, $sourceImageHeight ); 44 44 45 imagedestroy( $image ); // Free up memory 45 imagedestroy( $image ); // Free up memory 46 46 47 47 // If no filters change the filename, we'll do a default transformation. … … 68 68 } 69 69 70 imagedestroy( $thumbnail ); // Free up memory 71 72 // Set correct file permissions 73 $stat = stat( dirname( $thumbpath )); 70 imagedestroy( $thumbnail ); // Free up memory 71 72 // Set correct file permissions 73 $stat = stat( dirname( $thumbpath )); 74 74 $perms = $stat['mode'] & 0000666; //same permissions as parent folder, strip off the executable bits 75 @ chmod( $thumbpath, $perms ); 75 @ chmod( $thumbpath, $perms ); 76 76 77 77 return apply_filters( 'wp_create_thumbnail', $thumbpath ); … … 115 115 116 116 imagecopyresampled( $dst, $src, 0, 0, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h ); 117 118 imagedestroy( $src ); // Free up memory 117 118 imagedestroy( $src ); // Free up memory 119 119 120 120 if ( ! $dst_file ) … … 160 160 $metadata['thumb'] = basename($thumb); 161 161 } 162 162 163 163 // fetch additional metadata from exif/iptc 164 164 $image_meta = wp_read_image_metadata( $file ); trunk/wp-admin/includes/media.php
r6659 r6726 16 16 $image_align = @$values['image-url']; 17 17 $post_id = $_GET['post_id']; 18 18 19 19 ?> 20 20 <div id="media-upload-header"> … … 34 34 <!-- 35 35 36 jQuery(document).ready(function(){ 36 jQuery(document).ready(function(){ 37 37 var swfu = new SWFUpload({ 38 38 upload_url : "<?php echo get_option('siteurl').'/wp-admin/async-upload.php'; ?>", … … 60 60 cancelButtonId : "btnCancel2" 61 61 }, 62 62 63 63 debug: false, 64 64 65 65 }); 66 66 … … 108 108 109 109 function image_upload_handler() { 110 110 111 111 if ( !current_user_can('upload_files') ) { 112 112 return new wp_error( 'upload_not_allowed', __('You are not allowed to upload files.') ); … … 120 120 // Add Image button was clicked 121 121 check_admin_referer('inlineuploading'); 122 122 123 123 // if the async flash uploader was used, the attachment has already been inserted and its ID is passed in post. 124 124 // otherwise this is a regular form post and we still have to handle the upload and create the attachment. … … 135 135 $id = image_upload_post(); 136 136 } 137 137 138 138 // if the input was invalid, redisplay the form with its current values 139 139 if ( is_wp_error($id) ) … … 151 151 if ( empty($thumb_url) ) 152 152 $thumb_url = wp_mime_type_icon($id); 153 153 154 154 if ($thumb_url) { 155 155 $out = '<p><input type="hidden" name="attachment_id" id="attachment_id" value="'.intval($id).'" />' … … 161 161 . basename(wp_get_attachment_url($id)).'</p>'; 162 162 } 163 163 164 164 $post = get_post($id); 165 165 $title = addslashes($post->post_title); 166 166 $alt = addslashes($post->post_content); 167 167 168 168 // populate the input fields with post data (which in turn comes from exif/iptc) 169 169 $out .= <<<EOF … … 175 175 jQuery('#image-add').attr('disabled', false); 176 176 --> 177 </script> 177 </script> 178 178 EOF; 179 179 … … 185 185 186 186 function image_send_to_editor($id, $alt, $title, $align, $url='') { 187 187 188 188 $img_src = wp_get_attachment_url($id); 189 189 $meta = wp_get_attachment_metadata($id); 190 190 191 191 $hwstring = ''; 192 192 if ( isset($meta['width'], $meta['height']) ) … … 208 208 top.tb_remove(); 209 209 --> 210 </script> 210 </script> 211 211 <?php 212 212 } … … 218 218 if ( empty($_POST['image-alt']) ) 219 219 return new wp_error( 'image_alt_required', __('Please enter an <alt> description') ); 220 220 221 221 $overrides = array('test_form'=>false); 222 222 $file = wp_handle_upload($_FILES['image-file'], $overrides); … … 224 224 if ( isset($file['error']) ) 225 225 return new wp_error( 'upload_error', $file['error'] ); 226 226 227 227 $url = $file['url']; 228 228 $type = $file['type']; 229 229 $file = $file['file']; 230 230 231 231 $post_title = trim($_POST['image-title']); 232 232 $post_content = trim($_POST['image-alt']); 233 233 $post_parent = intval($_POST['parent_post_id']); 234 234 235 235 // Construct the attachment array 236 236 $attachment = array( … … 248 248 wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) ); 249 249 250 return $id; 250 return $id; 251 251 } 252 252 trunk/wp-admin/includes/post.php
r6712 r6726 543 543 } 544 544 if (!is_null($name)) { 545 $post->post_name = sanitize_title($name, $post->ID); 545 $post->post_name = sanitize_title($name, $post->ID); 546 546 } 547 547 $permalink = get_permalink($post, true); … … 566 566 $display_link = str_replace('%postname%', $post_name_html, $permalink); 567 567 return $display_link; 568 } 568 } 569 569 570 570 ?> trunk/wp-admin/includes/template.php
r6713 r6726 240 240 $count = number_format_i18n( $tag->count ); 241 241 $count = ( $count > 0 ) ? "<a href='edit.php?tag=$tag->slug'>$count</a>" : $count; 242 242 243 243 $out = ''; 244 244 $out .= '<tr id="tag-' . $tag->term_id . '"' . $class . '>'; … … 247 247 $out .= '<td>' . apply_filters( 'term_name', $tag->name ) . '</td>'; 248 248 249 $out .= "<td>$count</td>"; 249 $out .= "<td>$count</td>";
