Changeset 6726
- Timestamp:
- 02/05/2008 06:47:27 AM (17 years ago)
- Location:
- trunk
- Files:
-
- 62 edited
Legend:
- Unmodified
- Added
- Removed
-
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>"; 250 250 $out .= '<td><a href="edit-tags.php?action=edit&tag_ID=' . $tag->term_id . '" class="edit">' . 251 251 __( 'Edit' ) . "</a></td>" . 252 '<td><a href="' . wp_nonce_url( "edit-tags.php?action=delete&tag_ID=$tag->term_id", 253 'delete-tag_' . $tag->term_id ) . 252 '<td><a href="' . wp_nonce_url( "edit-tags.php?action=delete&tag_ID=$tag->term_id", 253 'delete-tag_' . $tag->term_id ) . 254 254 '" class="delete:the-list:tag-' . $tag->term_id . ' delete">' . 255 255 __( 'Delete' ) . "</a></td>"; 256 256 $out .= '</tr>'; 257 257 258 258 return $out; 259 259 } 260 260 261 261 // Outputs appropriate rows for the Nth page of the Tag Management screen, 262 // assuming M tags displayed at a time on the page 262 // assuming M tags displayed at a time on the page 263 263 // Returns the number of tags displayed 264 264 function tag_rows( $page = 0, $pagesize = 20, $searchterms = '' ) { 265 265 266 266 // Get a page worth of tags 267 267 $start = $page * $pagesize; 268 268 269 269 $args = array('offset' => $start, 'number' => $pagesize, 'hide_empty' => 0); 270 270 271 271 if ( !empty( $searchterms ) ) { 272 272 $args['name__like'] = '%' . like_escape( $searchterms ); … … 274 274 275 275 $tags = get_terms( 'post_tag', $args ); 276 276 277 277 // convert it to table rows 278 278 $out = ''; … … 292 292 $count++; 293 293 } 294 294 295 295 // filter and send to screen 296 296 $out = apply_filters('tag_rows', $out); … … 331 331 global $post; 332 332 static $class; 333 333 334 334 $post = $page; 335 335 setup_postdata($page); … … 356 356 357 357 if ( ! $children_pages ) 358 return true; 358 return true; 359 359 360 360 for ( $i = 0; $i < count($children_pages); $i++ ) { 361 361 362 362 $child = $children_pages[$i]; 363 363 364 364 if ( $child->post_parent == $id ) { 365 array_splice($children_pages, $i, 1); 365 array_splice($children_pages, $i, 1); 366 366 display_page_row($child, $children_pages, $level+1); 367 367 $i = -1; //as numeric keys in $children_pages are not preserved after splice … … 371 371 372 372 /* 373 * displays pages in hierarchical order 373 * displays pages in hierarchical order 374 374 */ 375 375 function page_rows( $pages ) { … … 386 386 387 387 foreach ( $pages as $page ) { 388 389 // catch and repair bad pages 388 389 // catch and repair bad pages 390 390 if ( $page->post_parent == $page->ID ) { 391 $page->post_parent = 0; 391 $page->post_parent = 0; 392 392 $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_parent = '0' WHERE ID = %d", $page->ID) ); 393 393 clean_page_cache( $page->ID ); 394 394 } 395 395 396 396 if ( 0 == $page->post_parent ) 397 $top_level_pages[] = $page; 397 $top_level_pages[] = $page; 398 398 else 399 $children_pages[] = $page; 399 $children_pages[] = $page; 400 400 } 401 401 402 402 foreach ( $top_level_pages as $page ) 403 403 display_page_row($page, $children_pages, 0); 404 405 /* 404 405 /* 406 406 * display the remaining children_pages which are orphans 407 407 * having orphan requires parental attention 408 408 */ 409 409 if ( count($children_pages) > 0 ) { 410 $empty_array = array(); 411 foreach ( $children_pages as $orphan_page ) { 410 $empty_array = array(); 411 foreach ( $children_pages as $orphan_page ) { 412 412 clean_page_cache( $orphan_page->ID); 413 413 display_page_row( $orphan_page, $empty_array, 0 ); 414 } 414 } 415 415 } 416 416 } … … 650 650 if ( $for_post ) 651 651 $edit = ( in_array($post->post_status, array('draft', 'pending') ) && (!$post->post_date || '0000-00-00 00:00:00' == $post->post_date ) ) ? false : true; 652 652 653 653 $tab_index_attribute = ''; 654 654 if ( (int) $tab_index > 0 ) -
trunk/wp-admin/includes/widgets.php
r6719 r6726 53 53 if ( !$sidebar || false !== strpos( $widget_control_template, '%i%' ) ) { 54 54 $already_shown[] = $widget['callback']; // it's a multi-widget. We only need to show it in the list once. 55 $action = 'add'; 55 $action = 'add'; 56 56 $add_url = wp_nonce_url( add_query_arg( array( 57 57 'sidebar' => $sidebar, … … 112 112 113 113 <?php endforeach; if ( $no_widgets_shown ) : ?> 114 114 115 115 <li><?php _e( 'No matching widgets' ); ?></li> 116 116 -
trunk/wp-admin/install.php
r6469 r6726 70 70 wp_die($wpdb->error->get_error_message()); 71 71 72 display_header(); 72 display_header(); 73 73 // Fill in the data we gathered 74 74 $weblog_title = stripslashes($_POST['weblog_title']); -
trunk/wp-admin/plugins.php
r6627 r6726 140 140 <td colspan="3"> </td> 141 141 <td colspan="2" style="width:12em;"> 142 <?php 142 <?php 143 143 $active = get_option('active_plugins'); 144 144 $inactive = get_option('deactivated_plugins'); … … 146 146 ?> 147 147 <a href="<?php echo wp_nonce_url('plugins.php?action=deactivate-all', 'deactivate-all'); ?>" class="delete"><?php _e('Deactivate All Plugins'); ?></a> 148 <?php 148 <?php 149 149 } elseif ( empty($active) && !empty($inactive) ) { 150 150 ?> -
trunk/wp-admin/setup-config.php
r6568 r6726 14 14 $configFile = file('../wp-config-sample.php'); 15 15 16 if ( !is_writable('../')) 16 if ( !is_writable('../')) 17 17 wp_die("Sorry, I can't write to the directory. You'll have to either change the permissions on your WordPress directory or create your wp-config.php manually."); 18 18 … … 195 195 fclose($handle); 196 196 chmod('../wp-config.php', 0666); 197 197 198 198 display_header(); 199 199 ?> -
trunk/wp-admin/user-edit.php
r6700 r6726 269 269 270 270 <?php 271 if ( $is_profile_page ) { 271 if ( $is_profile_page ) { 272 272 do_action('show_user_profile'); 273 273 } else { -
trunk/wp-admin/users.php
r6615 r6726 177 177 wp_enqueue_script('admin-users'); 178 178 wp_enqueue_script('admin-forms'); 179 179 180 180 include('admin-header.php'); 181 181 -
trunk/wp-admin/widgets.php
r6718 r6726 28 28 </div> 29 29 30 <div class="wrap"> 30 <div class="wrap"> 31 31 <p><?php _e( 'You are seeing this message because the theme you are currently using isn’t widget-aware, meaning that it has no sidebars that you are able to change. For information on making your theme widget-aware, please <a href="http://automattic.com/code/widgets/themes/">follow these instructions</a>.' ); /* TODO: article on codex */; ?></p> 32 32 </div> -
trunk/wp-app.php
r6645 r6726 165 165 log_app('function','get_service()'); 166 166 167 if( !current_user_can( 'edit_posts' ) ) 167 if( !current_user_can( 'edit_posts' ) ) 168 168 $this->auth_required( __( 'Sorry, you do not have the right to access this blog.' ) ); 169 169 … … 199 199 log_app('function','get_categories_xml()'); 200 200 201 if( !current_user_can( 'edit_posts' ) ) 201 if( !current_user_can( 'edit_posts' ) ) 202 202 $this->auth_required( __( 'Sorry, you do not have the right to access this blog.' ) ); 203 203 … … 296 296 297 297 if( !current_user_can( 'edit_post', $postID ) ) 298 $this->auth_required( __( 'Sorry, you do not have the right to access this post.' ) ); 298 $this->auth_required( __( 'Sorry, you do not have the right to access this post.' ) ); 299 299 300 300 $this->set_current_entry($postID); -
trunk/wp-includes/bookmark-template.php
r6481 r6726 48 48 49 49 $output = ''; // Blank string to start with. 50 50 51 51 foreach ( (array) $bookmarks as $bookmark ) { 52 52 if ( !isset($bookmark->recently_updated) ) -
trunk/wp-includes/bookmark.php
r6592 r6726 269 269 * @param int $bookmark_id Bookmark ID 270 270 * @param string $context How to filter the field value. Either 'raw', 'edit', 'attribute', 'js', 'db', or 'display' 271 * @return mixed The filtered value 271 * @return mixed The filtered value 272 272 */ 273 273 function sanitize_bookmark_field($field, $value, $bookmark_id, $context) { -
trunk/wp-includes/canonical.php
r6494 r6726 52 52 // Some PHP setups turn requests for / into /index.php in REQUEST_URI 53 53 $original['path'] = preg_replace('|/index\.php$|', '/', $original['path']); 54 54 55 55 $redirect = $original; 56 56 $redirect_url = false; -
trunk/wp-includes/classes.php
r6711 r6726 387 387 } 388 388 389 /* 390 * A class for displaying various tree-like structures. 389 /* 390 * A class for displaying various tree-like structures. 391 391 * Extend the Walker class to use it, see examples at the bottom 392 392 */ … … 406 406 */ 407 407 function display_element( $element, &$children_elements, $max_depth, $depth=0, $args, $output ) { 408 408 409 409 if ( !$element) 410 return $output; 411 410 return $output; 411 412 412 if ( $max_depth != 0 ) { 413 413 if ($depth >= $max_depth) 414 return $output; 415 } 416 414 return $output; 415 } 416 417 417 $id_field = $this->db_fields['id']; 418 418 $parent_field = $this->db_fields['parent']; 419 419 420 420 if ($depth > 0) { 421 421 //start the child delimiter 422 422 $cb_args = array_merge( array($output, $depth), $args); 423 423 $output = call_user_func_array(array(&$this, 'start_lvl'), $cb_args); 424 } 425 424 } 425 426 426 //display this element 427 427 $cb_args = array_merge( array($output, $element, $depth), $args); … … 429 429 430 430 for ( $i = 0; $i < sizeof( $children_elements ); $i++ ) { 431 431 432 432 $child = $children_elements[$i]; 433 433 if ( $child->$parent_field == $element->$id_field ) { 434 434 435 435 array_splice( $children_elements, $i, 1 ); 436 436 $output = $this->display_element( $child, $children_elements, $max_depth, $depth + 1, $args, $output ); 437 $i = -1; 437 $i = -1; 438 438 } 439 439 } 440 440 441 441 //end this element 442 442 $cb_args = array_merge( array($output, $element, $depth), $args); 443 443 $output = call_user_func_array(array(&$this, 'end_el'), $cb_args); 444 444 445 445 if ($depth > 0) { 446 446 //end the child delimiter … … 448 448 $output = call_user_func_array(array(&$this, 'end_lvl'), $cb_args); 449 449 } 450 451 return $output; 450 451 return $output; 452 452 } 453 453 … … 455 455 * displays array of elements hierarchically 456 456 * it is a generic function which does not assume any existing order of elements 457 * max_depth = -1 means flatly display every element 458 * max_depth = 0 means display all levels 459 * max_depth > 0 specifies the number of display levels. 457 * max_depth = -1 means flatly display every element 458 * max_depth = 0 means display all levels 459 * max_depth > 0 specifies the number of display levels. 460 460 */ 461 461 function walk( $elements, $max_depth) { 462 462 463 463 $args = array_slice(func_get_args(), 2); 464 464 $output = ''; 465 465 466 466 if ($max_depth < -1) //invalid parameter 467 return $output; 468 467 return $output; 468 469 469 if (empty($elements)) //nothing to walk 470 return $output; 471 470 return $output; 471 472 472 $id_field = $this->db_fields['id']; 473 473 $parent_field = $this->db_fields['parent']; 474 474 475 475 // flat display 476 476 if ( -1 == $max_depth ) { 477 $empty_array = array(); 478 foreach ( $elements as $e ) 477 $empty_array = array(); 478 foreach ( $elements as $e ) 479 479 $output = $this->display_element( $e, $empty_array, 1, 0, $args, $output ); 480 return $output; 481 } 482 483 /* 484 * need to display in hierarchical order 480 return $output; 481 } 482 483 /* 484 * need to display in hierarchical order 485 485 * splice elements into two buckets: those without parent and those with parent 486 486 */ … … 489 489 foreach ( $elements as $e) { 490 490 if ( 0 == $e->$parent_field ) 491 $top_level_elements[] = $e; 491 $top_level_elements[] = $e; 492 492 else 493 $children_elements[] = $e; 494 } 495 496 /* 493 $children_elements[] = $e; 494 } 495 496 /* 497 497 * none of the elements is top level 498 498 * the first one must be root of the sub elements 499 499 */ 500 500 if ( !$top_level_elements ) { 501 501 502 502 $root = $children_elements[0]; 503 503 for ( $i = 0; $i < sizeof( $children_elements ); $i++ ) { 504 504 505 505 $child = $children_elements[$i]; 506 506 if ($root->$parent_field == $child->$parent_field ) 507 $top_level_elements[] = $child; 507 $top_level_elements[] = $child; 508 508 array_splice( $children_elements, $i, 1 ); 509 $i--; 509 $i--; 510 510 } 511 511 } 512 512 513 513 foreach ( $top_level_elements as $e ) 514 514 $output = $this->display_element( $e, $children_elements, $max_depth, 0, $args, $output ); 515 516 /* 517 * if we are displaying all levels, and remaining children_elements is not empty, 515 516 /* 517 * if we are displaying all levels, and remaining children_elements is not empty, 518 518 * then we got orphans, which should be displayed regardless 519 519 */ 520 520 if ( ( $max_depth == 0 ) && sizeof( $children_elements ) > 0 ) { 521 $empty_array = array(); 521 $empty_array = array(); 522 522 foreach ( $children_elements as $orphan_e ) 523 523 $output = $this->display_element( $orphan_e, $empty_array, 1, 0, $args, $output ); … … 548 548 else 549 549 $indent = ''; 550 550 551 551 extract($args, EXTR_SKIP); 552 552 $css_class = 'page_item page-item-'.$page->ID; … … 750 750 $response = ''; 751 751 if ( is_wp_error($data) ) { 752 foreach ( $data->get_error_codes() as $code ) { 752 foreach ( $data->get_error_codes() as $code ) { 753 753 $response .= "<wp_error code='$code'><![CDATA[" . $data->get_error_message($code) . "]]></wp_error>"; 754 754 if ( !$error_data = $data->get_error_data($code) ) -
trunk/wp-includes/comment-template.php
r6716 r6726 131 131 * @since 1.5 132 132 * @uses $comment 133 * @uses apply_filters() 133 * @uses apply_filters() 134 134 * 135 135 * @return unknown … … 167 167 * 168 168 * @since 0.71 169 * @uses apply_filters() 169 * @uses apply_filters() 170 170 * @uses get_comment_author_url() Retrieves the comment author's URL 171 171 */ … … 569 569 570 570 $_post = get_post($post_id); 571 571 572 572 $open = ( 'open' == $_post->comment_status ); 573 573 return apply_filters( 'comments_open', $open, $post_id ); … … 578 578 * 579 579 * @since 1.5 580 * @uses $post 580 * @uses $post 581 581 * 582 582 * @param int $post_id An optional post ID to check instead of the current post. … … 758 758 } 759 759 $title = attribute_escape( get_the_title() ); 760 760 761 761 echo apply_filters( 'comments_popup_link_attributes', '' ); 762 762 -
trunk/wp-includes/comment.php
r6668 r6726 245 245 } 246 246 247 $totals = (array) $wpdb->get_results(" 248 SELECT comment_approved, COUNT( * ) AS total 249 FROM {$wpdb->comments} 250 {$where} 251 GROUP BY comment_approved 247 $totals = (array) $wpdb->get_results(" 248 SELECT comment_approved, COUNT( * ) AS total 249 FROM {$wpdb->comments} 250 {$where} 251 GROUP BY comment_approved 252 252 ", ARRAY_A); 253 253 254 $comment_count = array( 255 "approved" => 0, 254 $comment_count = array( 255 "approved" => 0, 256 256 "awaiting_moderation" => 0, 257 257 "spam" => 0, 258 258 "total_comments" => 0 259 ); 260 261 foreach ( $totals as $row ) { 262 switch ( $row['comment_approved'] ) { 263 case 'spam': 264 $comment_count['spam'] = $row['total']; 259 ); 260 261 foreach ( $totals as $row ) { 262 switch ( $row['comment_approved'] ) { 263 case 'spam': 264 $comment_count['spam'] = $row['total']; 265 265 $comment_count["total_comments"] += $row['total']; 266 break; 267 case 1: 268 $comment_count['approved'] = $row['total']; 266 break; 267 case 1: 268 $comment_count['approved'] = $row['total']; 269 269 $comment_count['total_comments'] += $row['total']; 270 break; 270 break; 271 271 case 0: 272 272 $comment_count['awaiting_moderation'] = $row['total']; … … 789 789 function wp_defer_comment_counting($defer=null) { 790 790 static $_defer = false; 791 791 792 792 if ( is_bool($defer) ) { 793 793 $_defer = $defer; … … 796 796 wp_update_comment_count( null, true ); 797 797 } 798 798 799 799 return $_defer; 800 800 } … … 820 820 function wp_update_comment_count($post_id, $do_deferred=false) { 821 821 static $_deferred = array(); 822 822 823 823 if ( $do_deferred ) { 824 824 $_deferred = array_unique($_deferred); … … 828 828 } 829 829 } 830 830 831 831 if ( wp_defer_comment_counting() ) { 832 832 $_deferred[] = $post_id; … … 836 836 return wp_update_comment_count_now($post_id); 837 837 } 838 838 839 839 } 840 840 … … 848 848 * 849 849 * @param int $post_id Post ID 850 * @return bool False on '0' $post_id or if post with ID does not exist. True on success. 850 * @return bool False on '0' $post_id or if post with ID does not exist. True on success. 851 851 */ 852 852 function wp_update_comment_count_now($post_id) { -
trunk/wp-includes/compat.php
r6672 r6726 70 70 else if (strlen($key) < 64) 71 71 $key = str_pad($key, 64, chr(0)); 72 72 73 73 $ipad = (substr($key, 0, 64) ^ str_repeat(chr(0x36), 64)); 74 74 $opad = (substr($key, 0, 64) ^ str_repeat(chr(0x5C), 64)); -
trunk/wp-includes/deprecated.php
r6551 r6726 447 447 * @param string $between Optional. The html to output between the link/image and it's description. Not used if no image or $show_images is true. 448 448 * @param bool $show_images Optional. Whether to show images (if defined). 449 * @param string $orderby Optional. The order to output the links. E.g. 'id', 'name', 'url', 'description' or 'rating'. Or maybe owner. 449 * @param string $orderby Optional. The order to output the links. E.g. 'id', 'name', 'url', 'description' or 'rating'. Or maybe owner. 450 450 * If you start the name with an underscore the order will be reversed. You can also specify 'rand' as the order which will return links in a 451 451 * random order. … … 506 506 * 507 507 * @param string $cat_name The category name to use. If no match is found uses all. 508 * @param string $orderby The order to output the links. E.g. 'id', 'name', 'url', 'description', or 'rating'. 509 * Or maybe owner. If you start the name with an underscore the order will be reversed. You can also 508 * @param string $orderby The order to output the links. E.g. 'id', 'name', 'url', 'description', or 'rating'. 509 * Or maybe owner. If you start the name with an underscore the order will be reversed. You can also 510 510 * specify 'rand' as the order which will return links in a random order. 511 511 * @param int $limit Limit to X entries. If not specified, all entries are shown. … … 559 559 * @param int $category The category to use. If no category supplied uses all 560 560 * @param string $orderby the order to output the links. E.g. 'id', 'name', 'url', 561 * 'description', or 'rating'. Or maybe owner. If you start the name with an 561 * 'description', or 'rating'. Or maybe owner. If you start the name with an 562 562 * underscore the order will be reversed. You can also specify 'rand' as the 563 563 * order which will return links in a random order. … … 590 590 * @param bool $show_images Whether to show images (if defined). 591 591 * @param string $orderby the order to output the links. E.g. 'id', 'name', 'url', 592 * 'description', or 'rating'. Or maybe owner. If you start the name with an 592 * 'description', or 'rating'. Or maybe owner. If you start the name with an 593 593 * underscore the order will be reversed. You can also specify 'rand' as the 594 594 * order which will return links in a random order. … … 617 617 * @param bool $show_images Whether to show images (if defined). 618 618 * @param string $orderby The order to output the links. E.g. 'id', 'name', 'url', 619 * 'description', or 'rating'. Or maybe owner. If you start the name with an 619 * 'description', or 'rating'. Or maybe owner. If you start the name with an 620 620 * underscore the order will be reversed. You can also specify 'rand' as the 621 621 * order which will return links in a random order. … … 670 670 * @return unknown 671 671 */ 672 function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_order = 'asc', $file = '', $list = true, $optiondates = 0, 673 $optioncount = 0, $hide_empty = 1, $use_desc_for_title = 1, $children=false, $child_of=0, $categories=0, 672 function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_order = 'asc', $file = '', $list = true, $optiondates = 0, 673 $optioncount = 0, $hide_empty = 1, $use_desc_for_title = 1, $children=false, $child_of=0, $categories=0, 674 674 $recurse=0, $feed = '', $feed_image = '', $exclude = '', $hierarchical=false) { 675 675 _deprecated_function(__FUNCTION__, '0.0', 'wp_list_categories()'); … … 867 867 * @return string 868 868 */ 869 function link_pages($before='<br />', $after='<br />', $next_or_number='number', $nextpagelink='next page', $previouspagelink='previous page', 869 function link_pages($before='<br />', $after='<br />', $next_or_number='number', $nextpagelink='next page', $previouspagelink='previous page', 870 870 $pagelink='%', $more_file='') { 871 871 _deprecated_function(__FUNCTION__, '0.0', 'wp_link_pages()'); … … 1069 1069 * 1070 1070 * @param string $order Sort link categories by 'name' or 'id' 1071 * @param string $$deprecated Not Used 1071 * @param string $$deprecated Not Used 1072 1072 */ 1073 1073 function get_links_list($order = 'name', $deprecated = '') { … … 1215 1215 1216 1216 /** 1217 * get_author_rss_link() - Print/Return link to author RSS feed 1217 * get_author_rss_link() - Print/Return link to author RSS feed 1218 1218 * 1219 1219 * @since 1.2 … … 1236 1236 1237 1237 /** 1238 * comments_rss() - Return link to the post RSS feed 1238 * comments_rss() - Return link to the post RSS feed 1239 1239 * 1240 1240 * @since 1.5 -
trunk/wp-includes/feed-atom-comments.php
r6493 r6726 26 26 <updated><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastcommentmodified('GMT')); ?></updated> 27 27 <?php the_generator( 'atom' ); ?> 28 28 29 29 <?php if ( is_singular() ) { ?> 30 30 <link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" href="<?php echo get_comments_link() ?>" /> -
trunk/wp-includes/feed.php
r6711 r6726 188 188 * @package WordPress 189 189 * @subpackage Feed 190 * @since 2.4 190 * @since 2.4 191 191 * 192 192 * @param string $data input string -
trunk/wp-includes/formatting.php
r6680 r6726 1116 1116 1117 1117 if ('' == $url) return $url; 1118 $url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@()]|i', '', $url); 1118 $url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@()]|i', '', $url); 1119 1119 $strip = array('%0d', '%0a'); 1120 1120 $url = str_replace($strip, '', $url); -
trunk/wp-includes/functions.php
r6669 r6726 554 554 else 555 555 $request_type = 'HEAD'; 556 556 557 557 $head = "$request_type $file HTTP/1.1\r\nHOST: $host\r\nUser-Agent: WordPress/" . $wp_version . "\r\n\r\n"; 558 558 … … 580 580 return wp_get_http( $headers['location'], $file_path, ++$red ); 581 581 } 582 582 583 583 // make a note of the final location, so the caller can tell if we were redirected or not 584 584 $headers['x-final-location'] = $url; … … 589 589 return $headers; 590 590 } 591 591 592 592 // GET request - fetch and write it to the supplied filename 593 593 $content_length = $headers['content-length']; … … 602 602 break; 603 603 } 604 604 605 605 fclose($out_fp); 606 606 fclose($fp); … … 948 948 global $wpdb; 949 949 950 // Check cache first. If options table goes away and we have true cached, oh well. 950 // Check cache first. If options table goes away and we have true cached, oh well. 951 951 if ( wp_cache_get('is_blog_installed') ) 952 952 return true; … … 995 995 if ( ! empty( $_REQUEST['_wp_http_referer'] ) ) 996 996 return $_REQUEST['_wp_http_referer']; 997 else if ( ! empty( $_SERVER['HTTP_REFERER'] ) ) 997 else if ( ! empty( $_SERVER['HTTP_REFERER'] ) ) 998 998 return $_SERVER['HTTP_REFERER']; 999 999 return false; … … 1069 1069 // return a filename that is sanitized and unique for the given directory 1070 1070 function wp_unique_filename( $dir, $filename, $unique_filename_callback = NULL ) { 1071 1071 1072 1072 // separate the filename into a name and extension 1073 1073 $info = pathinfo($filename); 1074 1074 $ext = $info['extension']; 1075 1075 $name = basename($filename, ".{$ext}"); 1076 1076 1077 1077 // Increment the file number until we have a unique file to save in $dir. Use $override['unique_filename_callback'] if supplied. 1078 1078 if ( $unique_filename_callback && function_exists( $unique_filename_callback ) ) { … … 1096 1096 $filename = sanitize_title_with_dashes( $filename ) . $ext; 1097 1097 } 1098 1098 1099 1099 return $filename; 1100 1100 } … … 1112 1112 if ( $upload['error'] !== false ) 1113 1113 return $upload; 1114 1114 1115 1115 $filename = wp_unique_filename( $upload['path'], $name ); 1116 1116 … … 1226 1226 $trans['delete']['bookmark'] = array( __( 'Are you sure you want to delete this link: "%s"?' ), 'use_id' ); 1227 1227 $trans['update']['bookmark'] = array( __( 'Are you sure you want to edit this link: "%s"?' ), 'use_id' ); 1228 $trans['bulk']['bookmarks'] = array( __( 'Are you sure you want to bulk modify links?' ), false ); 1228 $trans['bulk']['bookmarks'] = array( __( 'Are you sure you want to bulk modify links?' ), false ); 1229 1229 1230 1230 $trans['add']['page'] = array( __( 'Are you sure you want to add this page?' ), false ); … … 1323 1323 } 1324 1324 1325 if ( defined( 'WP_SITEURL' ) && '' != WP_SITEURL ) 1326 $admin_dir = WP_SITEURL . '/wp-admin/'; 1325 if ( defined( 'WP_SITEURL' ) && '' != WP_SITEURL ) 1326 $admin_dir = WP_SITEURL . '/wp-admin/'; 1327 1327 elseif ( function_exists( 'get_bloginfo' ) && '' != get_bloginfo( 'wpurl' ) ) 1328 $admin_dir = get_bloginfo( 'wpurl' ) . '/wp-admin/'; 1328 $admin_dir = get_bloginfo( 'wpurl' ) . '/wp-admin/'; 1329 1329 elseif ( strpos( $_SERVER['PHP_SELF'], 'wp-admin' ) !== false ) 1330 1330 $admin_dir = ''; … … 1556 1556 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 1557 1557 <title>Database Error</title> 1558 1558 1559 1559 </head> 1560 1560 <body> … … 1613 1613 * _deprecated_function() - Marks a function as deprecated and informs when it has been used. 1614 1614 * 1615 * There is a hook deprecated_function_run that will be called that can be used to get the backtrace 1615 * There is a hook deprecated_function_run that will be called that can be used to get the backtrace 1616 1616 * up to what file and function called the deprecated function. 1617 1617 * 1618 1618 * The current behavior is to trigger an user error if WP_DEBUG is defined and is true. 1619 * 1619 * 1620 1620 * This function is to be used in every function in depreceated.php 1621 1621 * … … 1648 1648 * _deprecated_file() - Marks a file as deprecated and informs when it has been used. 1649 1649 * 1650 * There is a hook deprecated_file_included that will be called that can be used to get the backtrace 1650 * There is a hook deprecated_file_included that will be called that can be used to get the backtrace 1651 1651 * up to what file and function included the deprecated file. 1652 1652 * 1653 1653 * The current behavior is to trigger an user error if WP_DEBUG is defined and is true. 1654 * 1654 * 1655 1655 * This function is to be used in every file that is depreceated 1656 1656 * -
trunk/wp-includes/general-template.php
r6694 r6726 196 196 if ( !empty($tag) ) { 197 197 $tag = get_term($tag, 'post_tag', OBJECT, 'display'); 198 if ( is_wp_error( $tag ) ) 198 if ( is_wp_error( $tag ) ) 199 199 return $tag; 200 200 if ( ! empty($tag->name) ) … … 243 243 else 244 244 $title = $prefix . $title; 245 245 246 246 $title = apply_filters('wp_title', $title, $sep); 247 247 … … 298 298 if ( !empty($tag_id) ) { 299 299 $my_tag = &get_term($tag_id, 'post_tag', OBJECT, 'display'); 300 if ( is_wp_error( $my_tag ) ) 300 if ( is_wp_error( $my_tag ) ) 301 301 return false; 302 302 $my_tag_name = apply_filters('single_tag_title', $my_tag->name); … … 934 934 add_filter('the_editor_content', 'wp_richedit_pre'); 935 935 936 // The following line moves the border so that the active button "attaches" to the toolbar. Only IE needs it. 937 ?> 936 // The following line moves the border so that the active button "attaches" to the toolbar. Only IE needs it. 937 ?> 938 938 <style type="text/css"> 939 939 #postdivrich table, #postdivrich #quicktags {border-top: none;} 940 940 #quicktags {border-bottom: none; padding-bottom: 2px; margin-bottom: -1px;} 941 941 </style> 942 942 943 943 <div id='editor-toolbar' style='display:none;'> 944 944 <div class='zerosize'><input accesskey='e' type='button' onclick='switchEditors.go("<?php echo $id; ?>")' /></div> … … 1018 1018 $attributes = array(); 1019 1019 $output = ''; 1020 1020 1021 1021 if ( $dir = get_bloginfo('text_direction') ) 1022 1022 $attributes[] = "dir=\"$dir\""; 1023 1023 1024 1024 if ( $lang = get_bloginfo('language') ) { 1025 1025 if ( get_option('html_type') == 'text/html' || $doctype == 'xhtml' ) 1026 1026 $attributes[] = "lang=\"$lang\""; 1027 1027 1028 1028 if ( get_option('html_type') != 'text/html' || $doctype == 'xhtml' ) 1029 1029 $attributes[] = "xml:lang=\"$lang\""; 1030 1030 } 1031 1031 1032 1032 $output = implode(' ', $attributes); 1033 1033 $output = apply_filters('language_attributes', $output); -
trunk/wp-includes/js/tinymce/plugins/spellchecker/classes/SpellChecker.php
r6632 r6726 21 21 * 22 22 * @param $args.. Arguments. 23 * @return {Array} Array of all input arguments. 23 * @return {Array} Array of all input arguments. 24 24 */ 25 25 function &loopback(/* args.. */) { -
trunk/wp-includes/js/tinymce/tiny_mce_config.php
r6694 r6726 25 25 $valid_elements = '*[*]'; 26 26 $valid_elements = apply_filters('mce_valid_elements', $valid_elements); 27 27 28 28 $invalid_elements = apply_filters('mce_invalid_elements', ''); 29 29 … … 41 41 $mce_buttons_3 = apply_filters('mce_buttons_3', array()); 42 42 $mce_buttons_3 = implode($mce_buttons_3, ','); 43 43 44 44 $mce_buttons_4 = apply_filters('mce_buttons_4', array()); 45 45 $mce_buttons_4 = implode($mce_buttons_4, ','); -
trunk/wp-includes/js/tinymce/tiny_mce_gzip.php
r6694 r6726 13 13 //error_reporting(E_ALL); 14 14 @require_once('../../../wp-config.php'); // For get_bloginfo(). 15 15 16 16 // Headers 17 17 $expiresOffset = 3600 * 24 * 10; // Cache for 10 days in browser cache … … 73 73 $suffix = getParam( 'suffix', '_src' ) == '_src' ? '_src' : ''; 74 74 $cachePath = realpath('.'); // Cache path, this is where the .gz files will be stored 75 75 76 76 $content = ''; 77 77 $encodings = array(); … … 79 79 $enc = ''; 80 80 $cacheKey = ''; 81 81 82 82 // WP. Language handling could be improved... Concat all translated langs files and store in /wp-content/languages as .mo? 83 83 $theme = getParam( 'theme', 'advanced' ); 84 84 $themes = array($theme); 85 85 86 86 $language = getParam( 'language', 'en' ); 87 87 $languages = array($language); 88 88 89 89 if ( $language != strtolower($language) ) 90 90 $languages[] = strtolower($language); 91 91 92 92 if ( $language != substr($language, 0, 2) ) 93 93 $languages[] = substr($language, 0, 2); 94 94 95 95 $diskCache = false; 96 96 $isJS = true; … … 159 159 foreach ( $languages as $lang ) 160 160 $lang_content .= getFileContents('langs/' . $lang . '.js'); 161 161 162 162 if ( empty($lang_content) && file_exists('langs/en.js') ) 163 163 $lang_content .= getFileContents('langs/en.js'); 164 164 165 165 $content .= $lang_content; 166 166 … … 172 172 foreach ( $languages as $lang ) 173 173 $lang_content .= getFileContents( 'themes/' . $theme . '/langs/' . $lang . '.js' ); 174 174 175 175 if ( empty($lang_content) && file_exists( 'themes/' . $theme . '/langs/en.js' ) ) 176 176 $lang_content .= getFileContents( 'themes/' . $theme . '/langs/en.js' ); 177 177 178 178 $content .= $lang_content; 179 179 } … … 186 186 foreach ( $languages as $lang ) 187 187 $lang_content .= getFileContents( 'plugins/' . $plugin . '/langs/' . $lang . '.js' ); 188 188 189 189 if ( empty($lang_content) && file_exists( 'plugins/' . $plugin . '/langs/en.js' ) ) 190 190 $lang_content .= getFileContents( 'plugins/' . $plugin . '/langs/en.js' ); 191 191 192 192 $content .= $lang_content; 193 193 } … … 236 236 suffix : '' 237 237 }, 238 238 239 239 opt : {}, 240 240 241 241 init : function(arr, cb) { 242 242 var t = this, n, s, nl = document.getElementsByTagName('script'); 243 243 244 244 t.opt = arr; 245 245 246 246 t.settings.themes = arr.theme; 247 t.settings.plugins = arr.plugins; 247 t.settings.plugins = arr.plugins; 248 248 t.settings.languages = arr.language; 249 249 s = t.settings; … … 257 257 } 258 258 tinyMCEPreInit.base = t.baseURL; 259 259 260 260 if (!t.coreLoaded) 261 261 t.loadScripts(1, s.themes, s.plugins, s.languages); … … 275 275 return x; 276 276 }; 277 277 278 278 // Build query string 279 279 q = 'load=true&js=true&diskcache=' + (s.disk_cache ? 'true' : 'false') + '&core=' + (co ? 'true' : 'false') + '&suffix=' + escape(s.suffix) + '&themes=' + escape(th) + '&plugins=' + escape(pl) + '&languages=' + escape(la); … … 281 281 if (co) 282 282 t.coreLoaded = 1; 283 283 284 284 // Easier to debug with this... 285 285 // document.write('<sc'+'ript language="javascript" type="text/javascript" src="' + t.baseURL + '/' + s.page_name + '?' + q + '"></script>'); -
trunk/wp-includes/js/tinymce/wp-mce-help.php
r6694 r6726 130 130 } 131 131 } 132 132 133 133 function init() { 134 134 document.getElementById('version').innerHTML = tinymce.majorVersion + "." + tinymce.minorVersion; … … 136 136 } 137 137 tinyMCEPopup.onInit.add(init); 138 138 139 139 // For modal dialogs in IE 140 140 if (tinymce.isIE) … … 191 191 <div id="content4" class="hidden"> 192 192 <h2><?php _e('About TinyMCE'); ?></h2> 193 193 194 194 <p><?php _e('Version:'); ?> <span id="version"></span> (<span id="date"></span>)</p> 195 195 <p><?php printf(__('TinyMCE is a platform independent web based Javascript HTML WYSIWYG editor control released as Open Source under %sLGPL</a> by Moxiecode Systems AB. It has the ability to convert HTML TEXTAREA fields or other HTML elements to editor instances.'), '<a href="'.get_bloginfo('url').'/wp-includes/js/tinymce/license.txt" target="_blank" title="'.__('GNU Library General Public Licence').'">') ?></p> -
trunk/wp-includes/l10n.php
r6585 r6726 153 153 * @since 1.2.0 154 154 * @uses $l10n Gets list of domain translated string (gettext_reader) objects 155 * @uses apply_filters() Calls 'ngettext' hook on domains text returned, 155 * @uses apply_filters() Calls 'ngettext' hook on domains text returned, 156 156 * along with $single, $plural, and $number parameters. Expected to return string. 157 157 * -
trunk/wp-includes/link-template.php
r6711 r6726 341 341 function get_category_feed_link($cat_id, $feed = '') { 342 342 $cat_id = (int) $cat_id; 343 343 344 344 $category = get_category($cat_id); 345 345 346 346 if ( empty($category) || is_wp_error($category) ) 347 347 return false; … … 360 360 else 361 361 $feed_link = "feed/$feed"; 362 362 363 363 $link = trailingslashit($link) . user_trailingslashit($feed_link, 'feed'); 364 364 } 365 365 366 366 $link = apply_filters('category_feed_link', $link, $feed); 367 367 368 368 return $link; 369 369 } … … 403 403 else 404 404 $search = attribute_escape(stripslashes($search_query)); 405 405 406 406 if ( empty($feed) ) 407 407 $feed = get_default_feed(); 408 408 409 409 $link = get_option('home') . "?s=$search&feed=$feed"; 410 410 411 411 $link = apply_filters('search_feed_link', $link); 412 412 413 413 return $link; 414 414 } … … 419 419 else 420 420 $search = attribute_escape(stripslashes($search_query)); 421 421 422 422 if ( empty($feed) ) 423 423 $feed = get_default_feed(); 424 424 425 425 $link = get_option('home') . "?s=$search&feed=comments-$feed"; 426 426 427 427 $link = apply_filters('search_feed_link', $link); 428 428 429 429 return $link; 430 430 } -
trunk/wp-includes/pluggable.php
r6711 r6726 505 505 $key = wp_hash($username . $expiration); 506 506 $hash = hash_hmac('md5', $username . $expiration, $key); 507 507 508 508 if ( $hmac != $hash ) 509 509 return false; … … 587 587 setcookie(PASS_COOKIE, ' ', time() - 31536000, COOKIEPATH, COOKIE_DOMAIN); 588 588 setcookie(USER_COOKIE, ' ', time() - 31536000, SITECOOKIEPATH, COOKIE_DOMAIN); 589 setcookie(PASS_COOKIE, ' ', time() - 31536000, SITECOOKIEPATH, COOKIE_DOMAIN); 589 setcookie(PASS_COOKIE, ' ', time() - 31536000, SITECOOKIEPATH, COOKIE_DOMAIN); 590 590 } 591 591 endif; … … 759 759 * 760 760 * @since 2.3 761 * @uses apply_filters() Calls 'allowed_redirect_hosts' on an array containing 761 * @uses apply_filters() Calls 'allowed_redirect_hosts' on an array containing 762 762 * WordPress host string and $location host string. 763 763 * … … 1088 1088 $wp_hasher = new PasswordHash(8, TRUE); 1089 1089 } 1090 1091 return $wp_hasher->HashPassword($password); 1090 1091 return $wp_hasher->HashPassword($password); 1092 1092 } 1093 1093 endif; -
trunk/wp-includes/plugin.php
r6629 r6726 165 165 166 166 } while ( next($wp_filter[$tag]) !== false ); 167 167 168 168 array_pop( $wp_current_filter ); 169 169 … … 505 505 } 506 506 507 /** 507 /** 508 508 * _wp_call_all_hook() - Calls the 'all' hook, which will process the functions hooked into it. 509 509 * … … 524 524 * @param array $args The collected parameters from the hook that was called. 525 525 * @param string $hook Optional. The hook name that was used to call the 'all' hook. 526 */ 527 function _wp_call_all_hook($args) { 528 global $wp_filter; 526 */ 527 function _wp_call_all_hook($args) { 528 global $wp_filter; 529 529 530 530 reset( $wp_filter['all'] ); -
trunk/wp-includes/post.php
r6657 r6726 1033 1033 $guid = get_post_field( 'guid', $post_ID ); 1034 1034 } 1035 1035 1036 1036 // Create a valid post name. Drafts are allowed to have an empty 1037 1037 // post name. -
trunk/wp-includes/query.php
r6704 r6726 38 38 39 39 function is_admin () { 40 if ( defined('WP_ADMIN') ) 40 if ( defined('WP_ADMIN') ) 41 41 return WP_ADMIN; 42 42 return false; … … 144 144 * @return bool True if front of site 145 145 */ 146 function is_front () { 147 // most likely case 148 if ( 'posts' == get_option('show_on_front') && is_home() ) 149 return true; 150 elseif ( 'page' == get_option('show_on_front') && get_option('page_on_front') && is_page(get_option('page_on_front')) ) 151 return true; 152 else 153 return false; 154 } 146 function is_front () { 147 // most likely case 148 if ( 'posts' == get_option('show_on_front') && is_home() ) 149 return true; 150 elseif ( 'page' == get_option('show_on_front') && get_option('page_on_front') && is_page(get_option('page_on_front')) ) 151 return true; 152 else 153 return false; 154 } 155 155 156 156 /** … … 186 186 187 187 $page = (array) $page; 188 188 189 189 if ( in_array( $page_obj->ID, $page ) ) 190 190 return true; … … 978 978 if ( !empty($q['category__not_in']) ) { 979 979 $ids = get_objects_in_term($q['category__not_in'], 'category'); 980 if ( is_wp_error( $ids ) ) 980 if ( is_wp_error( $ids ) ) 981 981 return $ids; 982 982 if ( is_array($ids) && count($ids > 0) ) { … … 1166 1166 $q['orderby'] .= (($i == 0) ? '' : ',') . $orderby; 1167 1167 } 1168 /* append ASC or DESC at the end */ 1168 /* append ASC or DESC at the end */ 1169 1169 if ( !empty($q['orderby'])){ 1170 1170 $q['orderby'] .= " {$q['order']}"; 1171 1171 } 1172 1172 1173 1173 if ( empty($q['orderby']) ) 1174 1174 $q['orderby'] = 'post_date '.$q['order']; -
trunk/wp-includes/rewrite.php
r6614 r6726 294 294 if ( !$posts ) 295 295 return array( array(), array() ); 296 296 297 297 298 298 foreach ($posts as $id => $post) { -
trunk/wp-includes/script-loader.php
r6713 r6726 105 105 'file_cancelled' => 'File cancelled.', 106 106 'upload_stopped' => 'Upload stopped.', 107 107 108 108 ) ); 109 109 … … 119 119 $this->add( 'admin-tags', '/wp-admin/js/tags.js', array('wp-lists'), '20071031' ); 120 120 $this->add( 'admin-custom-fields', '/wp-admin/js/custom-fields.js', array('wp-lists'), '20070823' ); 121 $this->add( 'password-strength-meter', '/wp-admin/js/password-strength-meter.js', array('jquery'), '20070405' ); 122 $this->localize( 'password-strength-meter', 'pwsL10n', array( 123 'short' => __('Too short'), 124 'bad' => __('Bad'), 125 'good' => __('Good'), 126 'strong' => __('Strong') 121 $this->add( 'password-strength-meter', '/wp-admin/js/password-strength-meter.js', array('jquery'), '20070405' ); 122 $this->localize( 'password-strength-meter', 'pwsL10n', array( 123 'short' => __('Too short'), 124 'bad' => __('Bad'), 125 'good' => __('Good'), 126 'strong' => __('Strong') 127 127 ) ); 128 128 $this->add( 'admin-comments', '/wp-admin/js/edit-comments.js', array('wp-lists'), '20071104' ); … … 275 275 else 276 276 continue; // We're at the top level. Move on to the next one. 277 } 277 } 278 278 279 279 $this->to_print[$handle] = true; -
trunk/wp-includes/shortcodes.php
r6659 r6726 31 31 'baz' => 'default baz', 32 32 ), $atts)); 33 33 34 34 return "foo = {$foo}"; 35 35 } -
trunk/wp-includes/streams.php
r6554 r6726 6 6 * @subpackage PHP-gettext 7 7 * 8 * @internal 8 * @internal 9 9 Copyright (c) 2003, 2005 Danilo Segan <danilo@kvota.net>. 10 10 -
trunk/wp-includes/taxonomy.php
r6660 r6726 32 32 * @subpackage Taxonomy 33 33 * @since 2.3 34 * 34 * 35 35 * @uses $wp_taxonomies 36 36 * … … 81 81 * @subpackage Taxonomy 82 82 * @since 2.3 83 * 83 * 84 84 * @uses $wp_taxonomies 85 85 * … … 140 140 * @since 2.3 141 141 * @uses $wp_taxonomies Inserts new taxonomy object into the list 142 * 142 * 143 143 * @param string $taxonomy Name of taxonomy object 144 144 * @param string $object_type Name of the object type for the taxonomy object. … … 276 276 } 277 277 } 278 278 279 279 $_term = apply_filters('get_term', $_term, $taxonomy); 280 280 $_term = apply_filters("get_$taxonomy", $_term, $taxonomy); … … 363 363 * 364 364 * Will return an empty array if $term does not exist in $taxonomy. 365 * 365 * 366 366 * @package WordPress 367 367 * @subpackage Taxonomy … … 397 397 /** 398 398 * get_term_field() - Get sanitized Term field 399 * 399 * 400 400 * Does checks for $term, based on the $taxonomy. The function is for 401 401 * contextual reasons and for simplicity of usage. See sanitize_term_field() for … … 434 434 * Return value is sanitize_term() and usage is for sanitizing the term 435 435 * for editing. Function is for contextual and simplicity. 436 * 436 * 437 437 * @package WordPress 438 438 * @subpackage Taxonomy … … 630 630 if( $offset ) 631 631 $number = 'LIMIT ' . $offset . ',' . $number; 632 else 632 else 633 633 $number = 'LIMIT ' . $number; 634 634 635 635 } else 636 636 $number = ''; … … 810 810 if ( 'slug' == $field ) 811 811 $value = apply_filters('pre_category_nicename', $value); 812 812 813 813 } else if ( 'rss' == $context ) { 814 814 $value = apply_filters("term_${field}_rss", $value, $taxonomy); … … 1033 1033 else if ( 'ids' == $fields ) 1034 1034 $select_this = 't.term_id'; 1035 else if ( 'names' == $fields ) 1035 else if ( 'names' == $fields ) 1036 1036 $select_this = 't.name'; 1037 1037 else if ( 'all_with_object_id' == $fields ) … … 1176 1176 /** 1177 1177 * wp_set_object_terms() - Create Term and Taxonomy Relationships 1178 * 1178 * 1179 1179 * Relates an object (post, link etc) to a term and taxonomy type. Creates the term and taxonomy 1180 1180 * relationship if it doesn't already exist. Creates a term if it doesn't exist (using the slug). … … 1214 1214 if ( !strlen(trim($term)) ) 1215 1215 continue; 1216 1216 1217 1217 if ( !$id = is_term($term, $taxonomy) ) 1218 1218 $id = wp_insert_term($term, $taxonomy); … … 1244 1244 /** 1245 1245 * wp_unique_term_slug() - Will make slug unique, if it isn't already 1246 * 1246 * 1247 1247 * The $slug has to be unique global to every taxonomy, meaning that one taxonomy 1248 1248 * term can't have a matching slug with another taxonomy term. Each slug has to be … … 1254 1254 * If that still doesn't return an unique slug, then it try to append a number until 1255 1255 * it finds a number that is truely unique. 1256 * 1256 * 1257 1257 * The only purpose for $term is for appending a parent, if one exists. 1258 1258 * … … 1421 1421 function wp_defer_term_counting($defer=NULL) { 1422 1422 static $_defer = false; 1423 1423 1424 1424 if ( is_bool($defer) ) { 1425 1425 $_defer = $defer; … … 1428 1428 wp_update_term_count( NULL, NULL, true ); 1429 1429 } 1430 1430 1431 1431 return $_defer; 1432 1432 } … … 1434 1434 /** 1435 1435 * wp_update_term_count() - Updates the amount of terms in taxonomy 1436 * 1436 * 1437 1437 * If there is a taxonomy callback applyed, then it will be called for updating the count. 1438 1438 * … … 1471 1471 return true; 1472 1472 } 1473 1473 1474 1474 return wp_update_term_count_now( $terms, $taxonomy ); 1475 1475 } … … 1601 1601 * 1602 1602 * It should be noted that update_object_term_cache() is very time extensive. 1603 * It is advised that the function is not called very often or at least not 1603 * It is advised that the function is not called very often or at least not 1604 1604 * for a lot of terms that exist in a lot of taxonomies. The amount of time 1605 1605 * increases for each term and it also increases for each taxonomy the term … … 1613 1613 * @param string|array $object_ids Single or list of term object ID(s) 1614 1614 * @param string $object_type The taxonomy object type 1615 * @return null|bool Null value is given with empty $object_ids. False if 1615 * @return null|bool Null value is given with empty $object_ids. False if 1616 1616 */ 1617 1617 function update_object_term_cache($object_ids, $object_type) { … … 1720 1720 /** 1721 1721 * _get_term_children() - Get array of child terms 1722 * 1722 * 1723 1723 * If $terms is an array of objects, then objects will returned from the function. 1724 1724 * If $terms is an array of IDs, then an array of ids of children will be returned. … … 1776 1776 /** 1777 1777 * _pad_term_counts() - Add count of children to parent count 1778 * 1778 * 1779 1779 * Recalculates term counts by including items from child terms. 1780 1780 * Assumes all relevant children are already in the $terms argument … … 1827 1827 } 1828 1828 1829 // Transfer the touched cells 1829 // Transfer the touched cells 1830 1830 foreach ( (array) $term_items as $id => $items ) 1831 1831 if ( isset($terms_by_id[$id]) ) … … 1839 1839 /** 1840 1840 * _update_post_term_count() - Will update term count based on posts 1841 * 1841 * 1842 1842 * Private function for the default callback for post_tag and category taxonomies. 1843 1843 * -
trunk/wp-includes/update.php
r6297 r6726 10 10 * wp_version_check() - Check WordPress version against the newest version. 11 11 * 12 * The WordPress version, PHP version, and Locale is sent. Checks against the WordPress server at 12 * The WordPress version, PHP version, and Locale is sent. Checks against the WordPress server at 13 13 * api.wordpress.org server. Will only check if PHP has fsockopen enabled and WordPress isn't installing. 14 14 * -
trunk/wp-includes/user.php
r6711 r6726 23 23 if ( empty($credentials['user_login']) && empty($credentials['user_password']) ) { 24 24 $user = wp_validate_auth_cookie(); 25 if ( $user ) 25 if ( $user ) 26 26 return new WP_User($user); 27 27 … … 158 158 } 159 159 160 foreach ($metas as $meta) 160 foreach ($metas as $meta) 161 161 $values[] = maybe_unserialize($meta->meta_value); 162 162 -
trunk/wp-includes/widgets.php
r6717 r6726 731 731 if ( !$updated && !empty($_POST['sidebar']) ) { 732 732 $sidebar = (string) $_POST['sidebar']; 733 733 734 734 $sidebars_widgets = wp_get_sidebars_widgets(); 735 735 if ( isset($sidebars_widgets[$sidebar]) ) … … 737 737 else 738 738 $this_sidebar = array(); 739 739 740 740 foreach ( $this_sidebar as $_widget_id ) { 741 741 if ( 'wp_widget_categories' == $wp_registered_widgets[$_widget_id]['callback'] && isset($wp_registered_widgets[$_widget_id]['params'][0]['number']) ) { 742 742 $widget_number = $wp_registered_widgets[$_widget_id]['params'][0]['number']; 743 743 unset($options[$widget_number]); 744 } 744 } 745 745 } 746 746 … … 772 772 <p> 773 773 <label for="categories-title-<?php echo $number; ?>"> 774 <?php _e( 'Title:' ); ?> 774 <?php _e( 'Title:' ); ?> 775 775 <input class="widefat" id="categories-title-<?php echo $number; ?>" name="widget-categories[<?php echo $number; ?>][title]" type="text" value="<?php echo $title; ?>" /> 776 776 </label> … … 1156 1156 else 1157 1157 $this_sidebar = array(); 1158 1158 1159 1159 foreach ( $this_sidebar as $_widget_id ) { 1160 1160 if ( 'wp_widget_rss' == $wp_registered_widgets[$_widget_id]['callback'] && isset($wp_registered_widgets[$_widget_id]['params'][0]['number']) ) { … … 1284 1284 $link = clean_url(strip_tags($rss->channel['link'])); 1285 1285 while ( strstr($link, 'http') != $link ) 1286 $link = substr($link, 1); 1286 $link = substr($link, 1); 1287 1287 } 1288 1288 } … … 1401 1401 $widget_args = wp_parse_args( $widget_args, array( 'number' => -1 ) ); 1402 1402 extract( $widget_args, EXTR_SKIP ); 1403 1403 1404 1404 // Data should be stored as array: array( number => data for that instance of the widget, ... ) 1405 1405 $options = get_option('widget_many'); -
trunk/wp-includes/wp-db.php
r6711 r6726 529 529 elseif ( strtolower(@$trace['function']) == 'do_action' ) 530 530 continue; 531 531 532 532 $caller = $trace['function']; 533 533 break; -
trunk/wp-login.php
r6711 r6726 65 65 if ( $errors->get_error_code() ) 66 66 return $errors; 67 67 68 68 if ( !$user_data ) { 69 69 $errors->add('invalidcombo', __('<strong>ERROR</strong>: Invalid username or e-mail.')); … … 171 171 } 172 172 173 // 173 // 174 174 // Main 175 175 // … … 243 243 <p id="nav"> 244 244 <?php if (get_option('users_can_register')) : ?> 245 <a href="<?php bloginfo('wpurl'); ?>/wp-login.php"><?php _e('Log in') ?></a> | 245 <a href="<?php bloginfo('wpurl'); ?>/wp-login.php"><?php _e('Log in') ?></a> | 246 246 <a href="<?php bloginfo('wpurl'); ?>/wp-login.php?action=register"><?php _e('Register') ?></a> 247 247 <?php else : ?> … … 312 312 313 313 <p id="nav"> 314 <a href="<?php bloginfo('wpurl'); ?>/wp-login.php"><?php _e('Log in') ?></a> | 314 <a href="<?php bloginfo('wpurl'); ?>/wp-login.php"><?php _e('Log in') ?></a> | 315 315 <a href="<?php bloginfo('wpurl'); ?>/wp-login.php?action=lostpassword" title="<?php _e('Password Lost and Found') ?>"><?php _e('Lost your password?') ?></a> 316 316 </p> … … 337 337 // If the user can't edit posts, send them to their profile. 338 338 if ( !$user->has_cap('edit_posts') && ( empty( $redirect_to ) || $redirect_to == 'wp-admin/' ) ) 339 $redirect_to = get_option('siteurl') . '/wp-admin/profile.php'; 339 $redirect_to = get_option('siteurl') . '/wp-admin/profile.php'; 340 340 wp_safe_redirect($redirect_to); 341 341 exit(); 342 342 } 343 343 344 344 $errors = $user; 345 345 // Clear errors if loggedout is set. -
trunk/wp-settings.php
r6684 r6726 175 175 if ( !defined('LANGDIR') ) { 176 176 /** 177 * Stores the location of the language directory. First looks for language folder in wp-content 177 * Stores the location of the language directory. First looks for language folder in wp-content 178 178 * and uses that folder if it exists. Or it uses the "languages" folder in WPINC. 179 179 * -
trunk/xmlrpc.php
r6714 r6726 32 32 <api name="MetaWeblog" blogID="1" preferred="false" apiLink="<?php bloginfo_rss('wpurl') ?>/xmlrpc.php" /> 33 33 <api name="Blogger" blogID="1" preferred="false" apiLink="<?php bloginfo_rss('wpurl') ?>/xmlrpc.php" /> 34 <api name="Atom" blogID="" preferred="false" apiLink="<?php echo apply_filters('atom_service_url', (get_bloginfo('url')."/wp-app.php/service"))?>" /> 34 <api name="Atom" blogID="" preferred="false" apiLink="<?php echo apply_filters('atom_service_url', (get_bloginfo('url')."/wp-app.php/service"))?>" /> 35 35 </apis> 36 36 </service> … … 175 175 } 176 176 177 function get_custom_fields($post_id) { 178 $post_id = (int) $post_id; 179 180 $custom_fields = array(); 181 182 foreach ( (array) has_meta($post_id) as $meta ) { 183 // Don't expose protected fields. 184 if ( strpos($meta['meta_key'], '_wp_') === 0 ) { 185 continue; 186 } 187 188 $custom_fields[] = array( 189 "id" => $meta['meta_id'], 190 "key" => $meta['meta_key'], 191 "value" => $meta['meta_value'] 192 ); 193 } 194 195 return $custom_fields; 196 } 197 198 function set_custom_fields($post_id, $fields) { 199 $post_id = (int) $post_id; 200 201 foreach ( (array) $fields as $meta ) { 202 if ( isset($meta['id']) ) { 203 $meta['id'] = (int) $meta['id']; 204 205 if ( isset($meta['key']) ) { 206 update_meta($meta['id'], $meta['key'], $meta['value']); 207 } 208 else { 209 delete_meta($meta['id']); 210 } 211 } 212 else { 213 $_POST['metakeyinput'] = $meta['key']; 214 $_POST['metavalue'] = $meta['value']; 215 add_meta($post_id); 216 } 217 } 218 } 177 function get_custom_fields($post_id) { 178 $post_id = (int) $post_id; 179 180 $custom_fields = array(); 181 182 foreach ( (array) has_meta($post_id) as $meta ) { 183 // Don't expose protected fields. 184 if ( strpos($meta['meta_key'], '_wp_') === 0 ) { 185 continue; 186 } 187 188 $custom_fields[] = array( 189 "id" => $meta['meta_id'], 190 "key" => $meta['meta_key'], 191 "value" => $meta['meta_value'] 192 ); 193 } 194 195 return $custom_fields; 196 } 197 198 function set_custom_fields($post_id, $fields) { 199 $post_id = (int) $post_id; 200 201 foreach ( (array) $fields as $meta ) { 202 if ( isset($meta['id']) ) { 203 $meta['id'] = (int) $meta['id']; 204 205 if ( isset($meta['key']) ) { 206 update_meta($meta['id'], $meta['key'], $meta['value']); 207 } 208 else { 209 delete_meta($meta['id']); 210 } 211 } 212 else { 213 $_POST['metakeyinput'] = $meta['key']; 214 $_POST['metavalue'] = $meta['value']; 215 add_meta($post_id); 216 } 217 } 218 } 219 219 220 220 /** … … 662 662 663 663 set_current_user(0, $username); 664 if( !current_user_can( 'edit_posts' ) ) 664 if( !current_user_can( 'edit_posts' ) ) 665 665 return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts to this blog in order to view categories.' ) ); 666 666 … … 680 680 681 681 function wp_getCommentCount( $args ) { 682 $this->escape($args); 683 684 $blog_id = (int) $args[0]; 685 $username = $args[1]; 686 $password = $args[2]; 687 $post_id = (int) $args[3]; 688 689 if( !$this->login_pass_ok( $username, $password ) ) { 690 return new IXR_Error( 403, __( 'Bad login/pass combination.' ) ); 691 } 692 693 set_current_user( 0, $username ); 694 if( !current_user_can( 'edit_posts' ) ) { 695 return new IXR_Error( 403, __( 'You are not allowed details about comments.' ) ); 696 } 682 $this->escape($args); 683 684 $blog_id = (int) $args[0]; 685 $username = $args[1]; 686 $password = $args[2]; 687 $post_id = (int) $args[3]; 688 689 if( !$this->login_pass_ok( $username, $password ) ) { 690 return new IXR_Error( 403, __( 'Bad login/pass combination.' ) ); 691 } 692 693 set_current_user( 0, $username ); 694 if( !current_user_can( 'edit_posts' ) ) { 695 return new IXR_Error( 403, __( 'You are not allowed details about comments.' ) ); 696 } 697 697 698 698 do_action('xmlrpc_call', 'wp.getCommentCount'); … … 792 792 793 793 set_current_user( 0, $user_login ); 794 if( !current_user_can( 'edit_posts' ) ) 794 if( !current_user_can( 'edit_posts' ) ) 795 795 return new IXR_Error( 401, __( 'Sorry, you do not have access to user data on this blog.' ) ); 796 796 … … 825 825 826 826 set_current_user( 0, $user_login ); 827 if( !current_user_can( 'edit_post', $post_ID ) ) 827 if( !current_user_can( 'edit_post', $post_ID ) ) 828 828 return new IXR_Error( 401, __( 'Sorry, you can not edit this post.' ) ); 829 829 … … 986 986 $content = $args[4]; 987 987 $publish = $args[5]; 988 988 989 989 if (!$this->login_pass_ok($user_login, $user_pass)) { 990 990 return $this->error; … … 997 997 if ( !current_user_can($cap) ) 998 998 return new IXR_Error(401, __('Sorry, you are not allowed to post on this blog.')); 999 999 1000 1000 $post_status = ($publish) ? 'publish' : 'draft'; 1001 1001 1002 1002 $post_author = $user->ID; 1003 1003 1004 1004 $post_title = xmlrpc_getposttitle($content); 1005 1005 $post_category = xmlrpc_getpostcategory($content); 1006 1006 $post_content = xmlrpc_removepostdata($content); 1007 1007 1008 1008 $post_date = current_time('mysql'); 1009 1009 $post_date_gmt = current_time('mysql', 1); 1010 1010 1011 1011 $post_data = compact('blog_ID', 'post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_category', 'post_status'); 1012 1012 1013 1013 $post_ID = wp_insert_post($post_data); 1014 1014 if ( is_wp_error( $post_ID ) ) … … 1029 1029 1030 1030 $this->escape($args); 1031 1031 1032 1032 $post_ID = (int) $args[1]; 1033 1033 $user_login = $args[2]; … … 1035 1035 $content = $args[4]; 1036 1036 $publish = $args[5]; 1037 1037 1038 1038 if (!$this->login_pass_ok($user_login, $user_pass)) { 1039 1039 return $this->error; … … 1043 1043 1044 1044 $actual_post = wp_get_single_post($post_ID,ARRAY_A); 1045 1045 1046 1046 if (!$actual_post) { 1047 1047 return new IXR_Error(404, __('Sorry, no such post.')); 1048 1048 } 1049 1049 1050 1050 $this->escape($actual_post); 1051 1051 1052 1052 set_current_user(0, $user_login); 1053 1053 if ( !current_user_can('edit_post', $post_ID) ) 1054 1054 return new IXR_Error(401, __('Sorry, you do not have the right to edit this post.')); 1055 1055 1056 1056 extract($actual_post, EXTR_SKIP); 1057 1057 1058 1058 if ( ('publish' == $post_status) && !current_user_can('publish_posts') ) 1059 1059 return new IXR_Error(401, __('Sorry, you do not have the right to publish this post.')); 1060 1060 1061 1061 $post_title = xmlrpc_getposttitle($content); 1062 1062 $post_category = xmlrpc_getpostcategory($content); 1063 1063 $post_content = xmlrpc_removepostdata($content); 1064 1064 1065 1065 $postdata = compact('ID', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt'); 1066 1066 1067 1067 $result = wp_update_post($postdata); 1068 1068 1069 1069 if (!$result) { 1070 1070 return new IXR_Error(500, __('For some strange yet very annoying reason, this post could not be edited.')); 1071 1071 } 1072 1072 $this->attach_uploads( $ID, $post_content ); 1073 1073 1074 1074 return true; 1075 1075 } … … 1079 1079 function blogger_deletePost($args) { 1080 1080 $this->escape($args); 1081 1081 1082 1082 $post_ID = (int) $args[1]; 1083 1083 $user_login = $args[2]; 1084 1084 $user_pass = $args[3]; 1085 1085 $publish = $args[4]; 1086 1086 1087 1087 if (!$this->login_pass_ok($user_login, $user_pass)) { 1088 1088 return $this->error; … … 1092 1092 1093 1093 $actual_post = wp_get_single_post($post_ID,ARRAY_A); 1094 1094 1095 1095 if (!$actual_post) { 1096 1096 return new IXR_Error(404, __('Sorry, no such post.')); 1097 1097 } 1098 1098 1099 1099 set_current_user(0, $user_login); 1100 1100 if ( !current_user_can('edit_post', $post_ID) ) 1101 1101 return new IXR_Error(401, __('Sorry, you do not have the right to delete this post.')); 1102 1102 1103 1103 $result = wp_delete_post($post_ID); 1104 1104 1105 1105 if (!$result) { 1106 1106 return new IXR_Error(500, __('For some strange yet very annoying reason, this post could not be deleted.')); 1107 1107 } 1108 1108 1109 1109 return true; 1110 1110 } … … 1125 1125 $content_struct = $args[3]; 1126 1126 $publish = $args[4]; 1127 1127 1128 1128 if (!$this->login_pass_ok($user_login, $user_pass)) { 1129 1129 return $this->error; … … 1225 1225 } 1226 1226 } 1227 1227 1228 1228 $post_excerpt = $content_struct['mt_excerpt']; 1229 1229 $post_more = $content_struct['mt_text_more']; … … 1299 1299 $post_content = $post_content . "\n<!--more-->\n" . $post_more; 1300 1300 } 1301 1301 1302 1302 $to_ping = $content_struct['mt_tb_ping_urls']; 1303 1303 if ( is_array($to_ping) ) … … 1321 1321 logIO('O', 'Post cats: ' . var_export($catnames,true)); 1322 1322 $post_category = array(); 1323 1323 1324 1324 if (is_array($catnames)) { 1325 1325 foreach ($catnames as $cat) { … … 1330 1330 // We've got all the data -- post it: 1331 1331 $postdata = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'comment_status', 'ping_status', 'to_ping', 'post_type', 'post_name', 'post_password', 'post_parent', 'menu_order', 'tags_input'); 1332 1332 1333 1333 $post_ID = wp_insert_post($postdata); 1334 1334 if ( is_wp_error( $post_ID ) ) 1335 1335 return new IXR_Error(500, $post_ID->get_error_message()); 1336 1336 1337 1337 if (!$post_ID) { 1338 1338 return new IXR_Error(500, __('Sorry, your entry could not be posted. Something wrong happened.')); 1339 1339 } 1340 1340 1341 if ( isset($content_struct['custom_fields']) ) { 1342 $this->set_custom_fields($post_ID, $content_struct['custom_fields']); 1343 } 1344 1341 if ( isset($content_struct['custom_fields']) ) { 1342 $this->set_custom_fields($post_ID, $content_struct['custom_fields']); 1343 } 1344 1345 1345 $this->attach_uploads( $post_ID, $post_content ); 1346 1346 1347 1347 logIO('O', "Posted ! ID: $post_ID"); 1348 1348 1349 1349 return strval($post_ID); 1350 1350 } … … 1374 1374 $content_struct = $args[3]; 1375 1375 $publish = $args[4]; 1376 1376 1377 1377 if (!$this->login_pass_ok($user_login, $user_pass)) { 1378 1378 return $this->error; … … 1524 1524 $post_content = apply_filters( 'content_save_pre', $content_struct['description'] ); 1525 1525 $catnames = $content_struct['categories']; 1526 1526 1527 1527 $post_category = array(); 1528 1528 1529 1529 if (is_array($catnames)) { 1530 1530 foreach ($catnames as $cat) { … … 1532 1532 } 1533 1533 } 1534 1534 1535 1535 $post_excerpt = $content_struct['mt_excerpt']; 1536 1536 $post_more = $content_struct['mt_text_more']; … … 1555 1555 } 1556 1556 } 1557 1557 1558 1558 $tags_input = $content_struct['mt_keywords']; 1559 1559 … … 1564 1564 return new IXR_Error(401, __('Sorry, you do not have the right to publish this post.')); 1565 1565 } 1566 1566 1567 1567 if ($post_more) { 1568 1568 $post_content = $post_content . "\n<!--more-->\n" . $post_more; … … 1589 1589 // We've got all the data -- post it: 1590 1590 $newpost = compact('ID', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'comment_status', 'ping_status', 'post_date', 'post_date_gmt', 'to_ping', 'post_name', 'post_password', 'post_parent', 'menu_order', 'post_author', 'tags_input'); 1591 1591 1592 1592 $result = wp_update_post($newpost); 1593 1593 if (!$result) { … … 1595 1595 } 1596 1596 1597 if ( isset($content_struct['custom_fields']) ) { 1598 $this->set_custom_fields($post_ID, $content_struct['custom_fields']); 1599 } 1597 if ( isset($content_struct['custom_fields']) ) { 1598 $this->set_custom_fields($post_ID, $content_struct['custom_fields']); 1599 } 1600 1600 1601 1601 $this->attach_uploads( $ID, $post_content ); 1602 1602 1603 1603 logIO('O',"(MW) Edited ! ID: $post_ID"); 1604 1604 1605 1605 return true; 1606 1606 } … … 1611 1611 1612 1612 $this->escape($args); 1613 1613 1614 1614 $post_ID = (int) $args[0]; 1615 1615 $user_login = $args[1]; 1616 1616 $user_pass = $args[2]; 1617 1617 1618 1618 if (!$this->login_pass_ok($user_login, $user_pass)) { 1619 1619 return $this->error; … … 1627 1627 1628 1628 $postdata = wp_get_single_post($post_ID, ARRAY_A); 1629 1629 1630 1630 if ($postdata['post_date'] != '') { 1631 1631 $post_date = mysql2date('Ymd\TH:i:s', $postdata['post_date']); 1632 1632 $post_date_gmt = mysql2date('Ymd\TH:i:s', $postdata['post_date_gmt']); 1633 1633 1634 1634 $categories = array(); 1635 1635 $catids = wp_get_post_categories($post_ID); 1636 1636 foreach($catids as $catid) 1637 1637 $categories[] = get_cat_name($catid); 1638 1638 1639 1639 $tagnames = array(); 1640 1640 $tags = wp_get_post_tags( $post_ID ); … … 1646 1646 $tagnames = ''; 1647 1647 } 1648 1648 1649 1649 $post = get_extended($postdata['post_content']); 1650 1650 $link = post_permalink($postdata['ID']); 1651 1651 1652 1652 // Get the author info. 1653 1653 $author = get_userdata($postdata['post_author']); 1654 1654 1655 1655 $allow_comments = ('open' == $postdata['comment_status']) ? 1 : 0; 1656 1656 $allow_pings = ('open' == $postdata['ping_status']) ? 1 : 0; … … 1660 1660 $postdata['post_status'] = 'publish'; 1661 1661 } 1662 1662 1663 1663 $resp = array( 1664 1664 'dateCreated' => new IXR_Date($post_date), … … 1685 1685 'custom_fields' => $this->get_custom_fields($post_ID) 1686 1686 ); 1687 1687 1688 1688 return $resp; 1689 1689 } else { … … 1937 1937 1938 1938 foreach ($posts_list as $entry) { 1939 if( !current_user_can( 'edit_post', $entry['ID'] ) ) 1939 if( !current_user_can( 'edit_post', $entry['ID'] ) ) 1940 1940 continue; 1941 1941
Note: See TracChangeset
for help on using the changeset viewer.