Changeset 10810
- Timestamp:
- 03/18/2009 02:43:45 AM (16 years ago)
- Location:
- trunk
- Files:
-
- 42 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/edit-comments.php
r10605 r10810 279 279 280 280 if ( 'spam' == $comment_status ) { 281 wp_nonce_field('bulk-spam-delete', '_spam_nonce'); 281 wp_nonce_field('bulk-spam-delete', '_spam_nonce'); 282 282 if ( current_user_can ('moderate_comments')) { ?> 283 283 <input type="submit" name="delete_all_spam" value="<?php _e('Delete All Spam'); ?>" class="button-secondary apply" /> -
trunk/wp-admin/edit-form-advanced.php
r10787 r10810 270 270 */ 271 271 function post_tags_meta_box($post, $box) { 272 $tax_name = substr($box['id'], 8); 272 $tax_name = substr($box['id'], 8); 273 273 $taxonomy = get_taxonomy($tax_name); 274 274 $helps = isset($taxonomy->helps) ? attribute_escape($taxonomy->helps) : __('Separate tags with commas.'); 275 275 ?> 276 <div class="tagsdiv" id="<?php echo $tax_name; ?>"> 276 <div class="tagsdiv" id="<?php echo $tax_name; ?>"> 277 277 <p class="jaxtag"> 278 278 <label class="hidden" for="newtag"><?php _e( $box['title'] ); ?></label> 279 <input type="hidden" name="<?php echo "tax_input[$tax_name]"; ?>" class="the-tags" id="tax-input[<?php echo $tax_name; ?>]" value="<?php echo get_terms_to_edit( $post->ID, $tax_name ); ?>" /> 280 279 <input type="hidden" name="<?php echo "tax_input[$tax_name]"; ?>" class="the-tags" id="tax-input[<?php echo $tax_name; ?>]" value="<?php echo get_terms_to_edit( $post->ID, $tax_name ); ?>" /> 280 281 281 <span class="ajaxtag"> 282 282 <input type="text" name="newtag[<?php echo $tax_name; ?>]" class="newtag form-input-tip" size="16" autocomplete="off" value="<?php _e('Add new tag'); ?>" /> … … 284 284 </span></p> 285 285 <p class="howto"><?php echo $helps; ?></p> 286 <div class="tagchecklist"></div> 287 </div> 286 <div class="tagchecklist"></div> 287 </div> 288 288 <p class="tagcloud-link hide-if-no-js"><a href="#titlediv" class="tagcloud-link" id="link-<?php echo $tax_name; ?>"><?php printf( __('Choose from the most used tags in %s'), $box['title'] ); ?></a></p> 289 289 <?php 290 290 } 291 291 292 // all tag-style post taxonomies 293 foreach ( get_object_taxonomies('post') as $tax_name ) { 294 if ( !is_taxonomy_hierarchical($tax_name) ) { 292 // all tag-style post taxonomies 293 foreach ( get_object_taxonomies('post') as $tax_name ) { 294 if ( !is_taxonomy_hierarchical($tax_name) ) { 295 295 $taxonomy = get_taxonomy($tax_name); 296 296 $label = isset($taxonomy->label) ? attribute_escape($taxonomy->label) : $tax_name; 297 297 298 add_meta_box('tagsdiv-' . $tax_name, $label, 'post_tags_meta_box', 'post', 'side', 'core'); 299 } 300 } 298 add_meta_box('tagsdiv-' . $tax_name, $label, 'post_tags_meta_box', 'post', 'side', 'core'); 299 } 300 } 301 301 302 302 /** -
trunk/wp-admin/import/livejournal.php
r10647 r10810 31 31 var $commentmap; 32 32 var $pointers = array(); 33 33 34 34 // This list taken from LJ, they don't appear to have an API for it 35 35 var $moods = array( '1' => 'aggravated', … … 194 194 <p><?php _e( 'Howdy! This importer allows you to connect directly to LiveJournal and download all your entries and comments' ) ?></p> 195 195 <p><?php _e( 'Enter your LiveJournal username and password below so we can connect to your account:' ) ?></p> 196 196 197 197 <table class="form-table"> 198 198 … … 206 206 <td><input type="password" name="lj_password" id="lj_password" class="regular-text" /></td> 207 207 </tr> 208 208 209 209 </table> 210 210 211 211 <p><?php _e( 'If you have any entries on LiveJournal which are marked as private, they will be password-protected when they are imported so that only people who know the password can see them.' ) ?></p> 212 212 <p><?php _e( "If you don't enter a password, ALL ENTRIES from your LiveJournal will be imported as public posts in WordPress." ) ?></p> … … 222 222 223 223 <p><?php _e( "<strong>WARNING:</strong> This can take a really long time if you have a lot of entries in your LiveJournal, or a lot of comments. Ideally, you should only start this process if you can leave your computer alone while it finishes the import." ) ?></p> 224 224 225 225 <p class="submit"> 226 226 <input type="submit" class="button-primary" value="<?php echo attribute_escape( __( 'Connect to LiveJournal and Import' ) ) ?>" /> 227 227 </p> 228 228 229 229 <p><?php _e( '<strong>NOTE:</strong> If the import process is interrupted for <em>any</em> reason, come back to this page and it will continue from where it stopped automatically.' ) ?></p> 230 230 … … 237 237 <?php 238 238 } 239 239 240 240 function download_post_meta() { 241 241 $total = (int) get_option( 'ljapi_total' ); … … 248 248 if ( !is_array( $sync_item_times ) ) 249 249 $sync_item_times = array(); 250 250 251 251 do { 252 252 $lastsync = date( 'Y-m-d H:i:s', strtotime( get_option( 'ljapi_lastsync' ) ) ); … … 254 254 if ( is_wp_error( $synclist ) ) 255 255 return $synclist; 256 256 257 257 // Keep track of if we've downloaded everything 258 258 $total = $synclist['total']; 259 259 $count = $synclist['count']; 260 260 261 261 foreach ( $synclist['syncitems'] as $event ) { 262 262 if ( substr( $event['item'], 0, 2 ) == 'L-' ) { … … 277 277 echo '<p>' . __( 'Post metadata has been downloaded, proceeding with posts...' ) . '</p>'; 278 278 } 279 279 280 280 function download_post_bodies() { 281 281 $imported_count = (int) get_option( 'ljapi_imported_count' ); … … 286 286 287 287 $count = 0; 288 echo '<ol>'; 288 echo '<ol>'; 289 289 do { 290 290 $lastsync = date( 'Y-m-d H:i:s', strtotime( get_option( 'ljapi_lastsync_posts' ) ) ); 291 291 292 292 // Get the batch of items that match up with the syncitems list 293 293 $itemlist = $this->lj_ixr( 'getevents', array( 'ver' => 1, … … 297 297 if ( is_wp_error( $itemlist ) ) 298 298 return $itemlist; 299 299 300 300 if ( $num = count( $itemlist['events'] ) ) { 301 301 for ( $e = 0; $e < count( $itemlist['events'] ); $e++ ) { … … 315 315 $count++; 316 316 } while ( $num > 0 && $count < 3 ); // Doing up to 3 requests at a time to avoid memory problems 317 317 318 318 // Used so that step1 knows when to stop posting back on itself 319 319 update_option( 'ljapi_last_sync_count', $num ); 320 320 321 321 // Counter just used to show progress to user 322 322 update_option( 'ljapi_post_batch', ( (int) get_option( 'ljapi_post_batch' ) + 1 ) ); … … 324 324 echo '</ol>'; 325 325 } 326 326 327 327 function import_post( $post ) { 328 328 global $wpdb; 329 329 330 330 // Make sure we haven't already imported this one 331 331 if ( $this->get_wp_post_ID( $post['itemid'] ) ) 332 332 return; 333 333 334 334 $user = wp_get_current_user(); 335 335 $post_author = $user->ID; … … 342 342 if ( 18 == strlen( $post_date ) ) 343 343 $post_date = substr( $post_date, 0, 10 ) . ' ' . substr( $post_date, 10 ); 344 344 345 345 // Cleaning up and linking the title 346 346 $post_title = isset( $post['subject'] ) ? trim( $post['subject'] ) : ''; … … 348 348 $post_title = strip_tags( $post_title ); // Can't have tags in the title in WP 349 349 $post_title = $wpdb->escape( $post_title ); 350 350 351 351 // Clean up content 352 352 $post_content = $post['event']; … … 364 364 $post_content = force_balance_tags( $post_content ); 365 365 $post_content = $wpdb->escape( $post_content ); 366 366 367 367 // Handle any tags associated with the post 368 368 $tags_input = !empty( $post['props']['taglist'] ) ? $post['props']['taglist'] : ''; 369 369 370 370 // Check if comments are closed on this post 371 371 $comment_status = !empty( $post['props']['opt_nocomments'] ) ? 'closed' : 'open'; … … 388 388 return new WP_Error( 'insert_post_failed', __( 'Failed to create post.' ) ); 389 389 } 390 390 391 391 // Handle all the metadata for this post 392 392 $this->insert_postmeta( $post_id, $post ); … … 394 394 echo '</li>'; 395 395 } 396 396 397 397 // Convert lj-user tags to links to that user 398 398 function translate_lj_user( $str ) { 399 399 return preg_replace( '|<lj\s+user\s*=\s*["\']([\w-]+)["\']>|', '<a href="http://$1.livejournal.com/" class="lj-user">$1</a>', $str ); 400 400 } 401 401 402 402 function insert_postmeta( $post_id, $post ) { 403 403 // Need the original LJ id for comments 404 404 add_post_meta( $post_id, 'lj_itemid', $post['itemid'] ); 405 405 406 406 // And save the permalink on LJ in case we want to link back or something 407 407 add_post_meta( $post_id, 'lj_permalink', $post['url'] ); 408 408 409 409 // Supports the following "props" from LJ, saved as lj_<prop_name> in wp_postmeta 410 410 // Adult Content - adult_content … … 425 425 } 426 426 } 427 427 428 428 // Set up a session (authenticate) with LJ 429 429 function get_session() { … … 434 434 return new WP_Http_Cookie( array( 'name' => 'ljsession', 'value' => $cookie['ljsession'] ) ); 435 435 } 436 436 437 437 // Loops through and gets comment meta from LJ in batches 438 438 function download_comment_meta() { … … 440 440 if ( is_wp_error( $cookie ) ) 441 441 return $cookie; 442 442 443 443 // Load previous state (if any) 444 444 $this->usermap = (array) get_option( 'ljapi_usermap' ); 445 445 $maxid = get_option( 'ljapi_maxid' ) ? get_option( 'ljapi_maxid' ) : 1; 446 446 $highest_id = get_option( 'ljapi_highest_id' ) ? get_option( 'ljapi_highest_id' ) : 0; 447 447 448 448 // We need to loop over the metadata request until we have it all 449 449 while ( $maxid > $highest_id ) { … … 453 453 if ( is_wp_error( $results ) ) 454 454 return new WP_Error( 'comment_meta', __( 'Failed to retrieve comment meta information from LiveJournal. Please try again soon.' ) ); 455 455 456 456 $results = wp_remote_retrieve_body( $results ); 457 457 458 458 // Get the maxid so we know if we have them all yet 459 459 preg_match( '|<maxid>(\d+)</maxid>|', $results, $matches ); … … 466 466 } 467 467 $maxid = !empty( $matches[1] ) ? $matches[1] : $maxid; 468 468 469 469 // Parse comments and get highest id available 470 470 preg_match_all( '|<comment id=\'(\d+)\'|is', $results, $matches ); … … 478 478 foreach ( $matches[1] as $count => $userid ) 479 479 $this->usermap[$userid] = $matches[2][$count]; // need this in memory for translating ids => names 480 480 481 481 wp_cache_flush(); 482 482 } … … 486 486 update_option( 'ljapi_maxid', $maxid ); 487 487 update_option( 'ljapi_highest_id', $highest_id ); 488 488 489 489 echo '<p>' . __( ' Comment metadata downloaded successfully, proceeding with comment bodies...' ) . '</p>'; 490 490 491 491 return true; 492 492 } 493 493 494 494 // Downloads actual comment bodies from LJ 495 495 // Inserts them all directly to the DB, with additional info stored in "spare" fields … … 499 499 if ( is_wp_error( $cookie ) ) 500 500 return $cookie; 501 501 502 502 // Load previous state (if any) 503 503 $this->usermap = (array) get_option( 'ljapi_usermap' ); … … 507 507 while ( $maxid > $highest_id && $loop < 5 ) { // We do 5 loops per call to avoid memory limits 508 508 $loop++; 509 509 510 510 // Get a batch of comments, using the highest_id we've already got as a starting point 511 511 $results = wp_remote_get( $this->comments_url . '?get=comment_body&startid=' . ( $highest_id + 1 ), … … 513 513 if ( is_wp_error( $results ) ) 514 514 return new WP_Error( 'comment_bodies', __( 'Failed to retrieve comment bodies from LiveJournal. Please try again soon.' ) ); 515 515 516 516 $results = wp_remote_retrieve_body( $results ); 517 517 518 518 // Parse out each comment and insert directly 519 519 preg_match_all( '|<comment id=\'(\d+)\'.*</comment>|iUs', $results, $matches ); … … 524 524 update_option( 'ljapi_highest_comment_id', $highest_id ); 525 525 } 526 526 527 527 $comment = $matches[0][$c]; 528 528 … … 537 537 clean_comment_cache( $id ); 538 538 } 539 539 540 540 // Clear cache to preseve memory 541 541 wp_cache_flush(); 542 542 } 543 543 // endwhile - all comments downloaded and ready for bulk processing 544 544 545 545 // Counter just used to show progress to user 546 546 update_option( 'ljapi_comment_batch', ( (int) get_option( 'ljapi_comment_batch' ) + 1 ) ); 547 547 548 548 return true; 549 549 } 550 550 551 551 // Takes a block of XML and parses out all the elements of the comment 552 552 function parse_comment( $comment ) { 553 553 global $wpdb; 554 554 555 555 // Get the top-level attributes 556 556 preg_match( '|<comment([^>]+)>|i', $comment, $attribs ); … … 565 565 preg_match( '| state=\'([SDFA])\'|i', $attribs[1], $matches ); // optional 566 566 $lj_comment_state = isset( $matches[1] ) ? $matches[1] : 'A'; 567 567 568 568 // Clean up "subject" - this will become the first line of the comment in WP 569 569 preg_match( '|<subject>(.*)</subject>|is', $comment, $matches ); … … 573 573 $comment_subject = ''; 574 574 } 575 575 576 576 // Get the body and HTMLize it 577 577 preg_match( '|<body>(.*)</body>|is', $comment, $matches ); … … 584 584 $comment_content = preg_replace_callback( '|<(/?[A-Z]+)|', create_function( '$match', 'return "<" . strtolower( $match[1] );' ), $comment_content ); 585 585 $comment_content = $wpdb->escape( trim( $comment_content ) ); 586 586 587 587 // Get and convert the date 588 588 preg_match( '|<date>(.*)</date>|i', $comment, $matches ); 589 589 $comment_date = trim( str_replace( array( 'T', 'Z' ), ' ', $matches[1] ) ); 590 590 591 591 // Grab IP if available 592 592 preg_match( '|<property name=\'poster_ip\'>(.*)</property>|i', $comment, $matches ); // optional 593 593 $comment_author_IP = isset( $matches[1] ) ? $matches[1] : ''; 594 594 595 595 // Try to get something useful for the comment author, especially if it was "my" comment 596 596 $author = ( empty( $comment_author_ID ) || empty( $this->usermap[$comment_author_ID] ) || substr( $this->usermap[$comment_author_ID], 0, 4 ) == 'ext_' ) ? __( 'Anonymous' ) : $this->usermap[$comment_author_ID]; … … 602 602 } else { 603 603 $user_id = 0; 604 $url = ( __( 'Anonymous' ) == $author ) ? '' : 'http://' . $author . '.livejournal.com/'; 605 } 606 604 $url = ( __( 'Anonymous' ) == $author ) ? '' : 'http://' . $author . '.livejournal.com/'; 605 } 606 607 607 // Send back the array of details 608 608 return array( 'lj_comment_ID' => $lj_comment_ID, … … 624 624 ); 625 625 } 626 627 626 627 628 628 // Gets the post_ID that a LJ post has been saved as within WP 629 629 function get_wp_post_ID( $post ) { 630 630 global $wpdb; 631 631 632 632 if ( empty( $this->postmap[$post] ) ) 633 633 $this->postmap[$post] = (int) $wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = 'lj_itemid' AND meta_value = %d", $post ) ); 634 634 635 635 return $this->postmap[$post]; 636 636 } 637 637 638 638 // Gets the comment_ID that a LJ comment has been saved as within WP 639 639 function get_wp_comment_ID( $comment ) { … … 643 643 return $this->commentmap[$comment]; 644 644 } 645 645 646 646 function lj_ixr() { 647 647 if ( $challenge = $this->ixr->query( 'LJ.XMLRPC.getchallenge' ) ) { … … 656 656 return new WP_Error( 'IXR', __( 'LiveJournal is not responding to authentication requests. Please wait a while and then try again.' ) ); 657 657 } 658 658 659 659 $args = func_get_args(); 660 660 $method = array_shift( $args ); … … 667 667 } 668 668 } 669 669 670 670 function dispatch() { 671 671 if ( empty( $_REQUEST['step'] ) ) … … 675 675 676 676 $this->header(); 677 677 678 678 switch ( $step ) { 679 679 case -1 : … … 712 712 $this->password = get_option( 'ljapi_password' ); 713 713 } 714 714 715 715 // This is the password to set on protected posts 716 716 if ( !empty( $_POST['protected_password'] ) ) { … … 720 720 $this->protected_password = get_option( 'ljapi_protected_password' ); 721 721 } 722 722 723 723 // Login to confirm the details are correct 724 724 if ( empty( $this->username ) || empty( $this->password ) ) { … … 746 746 update_option( 'ljapi_verified', 'yes' ); 747 747 } 748 748 749 749 // Set up some options to avoid them autoloading (these ones get big) 750 750 add_option( 'ljapi_sync_item_times', '', '', 'no' ); 751 751 add_option( 'ljapi_usermap', '', '', 'no' ); 752 752 update_option( 'ljapi_comment_batch', 0 ); 753 753 754 754 return true; 755 755 } … … 776 776 } 777 777 } 778 778 779 779 echo '<div id="ljapi-status">'; 780 780 echo '<h3>' . __( 'Importing Posts' ) . '</h3>'; … … 786 786 } 787 787 ob_flush(); flush(); 788 788 789 789 if ( !get_option( 'ljapi_lastsync' ) || '1900-01-01 00:00:00' == get_option( 'ljapi_lastsync' ) ) { 790 790 // We haven't downloaded meta yet, so do that first … … 828 828 echo '</div>'; 829 829 } 830 830 831 831 // Download comments to local XML 832 832 function step2() { … … 836 836 $this->password = get_option( 'ljapi_password' ); 837 837 $this->ixr = new IXR_Client( $this->ixr_url, false, 80, 30 ); 838 838 839 839 echo '<div id="ljapi-status">'; 840 840 echo '<h3>' . __( 'Downloading Comments' ) . '</h3>'; 841 841 echo '<p>' . __( 'Now we will download your comments so we can import them (this could take a <strong>long</strong> time if you have lots of comments)...' ) . '</p>'; 842 842 ob_flush(); flush(); 843 843 844 844 if ( !get_option( 'ljapi_usermap' ) ) { 845 845 // We haven't downloaded meta yet, so do that first … … 878 878 echo '</div>'; 879 879 } 880 880 881 881 // Re-thread comments already in the DB 882 882 function step3() { … … 884 884 set_time_limit( 0 ); 885 885 update_option( 'ljapi_step', 3 ); 886 886 887 887 echo '<div id="ljapi-status">'; 888 888 echo '<h3>' . __( 'Threading Comments' ) . '</h3>'; 889 889 echo '<p>' . __( 'We are now re-building the threading of your comments (this can also take a while if you have lots of comments)...' ) . '</p>'; 890 890 ob_flush(); flush(); 891 891 892 892 // Only bother adding indexes if they have over 5000 comments (arbitrary number) 893 893 $imported_comments = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->comments} WHERE comment_type = 'livejournal'" ); … … 900 900 add_clean_index( $wpdb->comments, 'comment_agent' ); 901 901 } 902 902 903 903 // Get LJ comments, which haven't been threaded yet, 5000 at a time and thread them 904 904 while ( $comments = $wpdb->get_results( "SELECT comment_ID, comment_agent FROM {$wpdb->comments} WHERE comment_type = 'livejournal' AND comment_agent != '0' LIMIT 5000", OBJECT ) ) { 905 905 foreach ( $comments as $comment ) { 906 $wpdb->update( $wpdb->comments, 907 array( 'comment_parent' => $this->get_wp_comment_ID( $comment->comment_agent ), 'comment_type' => 'livejournal-done' ), 906 $wpdb->update( $wpdb->comments, 907 array( 'comment_parent' => $this->get_wp_comment_ID( $comment->comment_agent ), 'comment_type' => 'livejournal-done' ), 908 908 array( 'comment_ID' => $comment->comment_ID ) ); 909 909 } … … 911 911 $wpdb->flush(); 912 912 } 913 913 914 914 // Revert the comments table back to normal and optimize it to reclaim space 915 915 if ( $added_indices ) { … … 919 919 $wpdb->query( "OPTIMIZE TABLE {$wpdb->comments}" ); 920 920 } 921 921 922 922 // Clean up database and we're out 923 923 $this->cleanup(); … … 930 930 echo '</div>'; 931 931 } 932 932 933 933 // Output an error message with a button to try again. 934 934 function throw_error( $error, $step ) { … … 936 936 echo $this->next_step( $step, __( 'Try Again' ) ); 937 937 } 938 938 939 939 // Returns the HTML for a link to the next page 940 940 function next_step( $next_step, $label, $id = 'ljapi-next-form' ) { … … 945 945 $str .= '<p><input type="submit" class="button-primary" value="' . attribute_escape( $label ) . '" /> <span id="auto-message"></span></p>'; 946 946 $str .= '</form>'; 947 947 948 948 return $str; 949 949 } 950 950 951 951 // Automatically submit the specified form after $seconds 952 952 // Include a friendly countdown in the element with id=$msg … … 957 957 ljapi_msg(); 958 958 }); 959 959 960 960 function ljapi_msg() { 961 961 str = '<?php _e( "Continuing in %d" ) ?>'; … … 975 975 </script><?php 976 976 } 977 977 978 978 // Automatically submit the form with #id to continue the process 979 979 // Hide any submit buttons to avoid people clicking them … … 985 985 ljapi_msg(); 986 986 }); 987 987 988 988 function ljapi_msg() { 989 989 str = '<?php _e( "Continuing in %d" ) ?>'; … … 1012 1012 function cleanup() { 1013 1013 global $wpdb; 1014 1014 1015 1015 delete_option( 'ljapi_username' ); 1016 1016 delete_option( 'ljapi_password' ); … … 1031 1031 delete_option( 'ljapi_comment_batch' ); 1032 1032 delete_option( 'ljapi_step' ); 1033 1034 $wpdb->update( $wpdb->comments, 1035 array( 'comment_karma' => 0, 'comment_agent' => 'WP LJ Importer', 'comment_type' => '' ), 1033 1034 $wpdb->update( $wpdb->comments, 1035 array( 'comment_karma' => 0, 'comment_agent' => 'WP LJ Importer', 'comment_type' => '' ), 1036 1036 array( 'comment_type' => 'livejournal-done' ) ); 1037 $wpdb->update( $wpdb->comments, 1038 array( 'comment_karma' => 0, 'comment_agent' => 'WP LJ Importer', 'comment_type' => '' ), 1037 $wpdb->update( $wpdb->comments, 1038 array( 'comment_karma' => 0, 'comment_agent' => 'WP LJ Importer', 'comment_type' => '' ), 1039 1039 array( 'comment_type' => 'livejournal' ) ); 1040 1040 } 1041 1041 1042 1042 function LJ_API_Import() { 1043 1043 $this->__construct(); 1044 1044 } 1045 1045 1046 1046 function __construct() { 1047 1047 // Nothing -
trunk/wp-admin/import/mt.php
r10609 r10810 439 439 } else { 440 440 // Processing multi-line field, check context. 441 441 442 442 if( !empty($line) ) 443 443 $line .= "\n"; 444 444 445 445 if ( 'body' == $context ) { 446 446 $post->post_content .= $line; -
trunk/wp-admin/includes/dashboard.php
r10743 r10810 168 168 echo "\t<div class='postbox-container' style='$width'>\n"; 169 169 do_meta_boxes( 'dashboard', 'normal', '' ); 170 170 171 171 echo "\t</div><div class='postbox-container' style='{$hide2}$width'>\n"; 172 172 do_meta_boxes( 'dashboard', 'side', '' ); -
trunk/wp-admin/includes/file.php
r10628 r10810 714 714 jQuery("#ssh_keys").hide(); 715 715 }); 716 jQuery('form input[value=""]:first').focus(); 716 jQuery('form input[value=""]:first').focus(); 717 717 }); 718 718 --> -
trunk/wp-admin/includes/media.php
r10793 r10810 1550 1550 </script> 1551 1551 <div id="sort-buttons" class="hide-if-no-js"> 1552 <?php _e('Sort Order:'); ?> 1553 <a href="#" id="asc"><?php _e('Ascending'); ?></a> 1554 <a href="#" id="desc"><?php _e('Descending'); ?></a> 1552 <?php _e('Sort Order:'); ?> 1553 <a href="#" id="asc"><?php _e('Ascending'); ?></a> 1554 <a href="#" id="desc"><?php _e('Descending'); ?></a> 1555 1555 <a href="#" id="clear"><?php _e('Clear'); ?></a> 1556 1556 </div> -
trunk/wp-admin/includes/misc.php
r10643 r10810 242 242 if ( !is_string( $content ) || empty( $content ) ) 243 243 return array(); 244 244 245 245 $tokens = token_get_all( $content ); 246 246 $functions = array(); … … 257 257 } 258 258 } 259 259 260 260 $functions = array_unique( $functions ); 261 261 sort( $functions ); 262 262 $ignore_functions = apply_filters( 'documentation_ignore_functions', $ignore_functions ); 263 263 $ignore_functions = array_unique( $ignore_functions ); 264 264 265 265 $out = array(); 266 266 foreach ( $functions as $function ) { … … 269 269 $out[] = $function; 270 270 } 271 271 272 272 return $out; 273 273 } … … 276 276 * Determines the language to use for CodePress syntax highlighting, 277 277 * based only on a filename. 278 * 278 * 279 279 * @since 2.8 280 * 280 * 281 281 * @param string $filename The name of the file to be highlighting 282 282 **/ 283 283 function codepress_get_lang( $filename ) { 284 $codepress_supported_langs = apply_filters( 'codepress_supported_langs', 284 $codepress_supported_langs = apply_filters( 'codepress_supported_langs', 285 285 array( '.css' => 'css', 286 '.js' => 'javascript', 287 '.php' => 'php', 288 '.html' => 'html', 289 '.htm' => 'html', 290 '.txt' => 'text' 286 '.js' => 'javascript', 287 '.php' => 'php', 288 '.html' => 'html', 289 '.htm' => 'html', 290 '.txt' => 'text' 291 291 ) ); 292 292 $extension = substr( $filename, strrpos( $filename, '.' ) ); 293 293 if ( $extension && array_key_exists( $extension, $codepress_supported_langs ) ) 294 294 return $codepress_supported_langs[$extension]; 295 295 296 296 return 'generic'; 297 297 } … … 299 299 /** 300 300 * Adds Javascript required to make CodePress work on the theme/plugin editors. 301 * 301 * 302 302 * This code is attached to the action admin_print_footer_scripts. 303 * 303 * 304 304 * @since 2.8 305 305 **/ -
trunk/wp-admin/includes/post.php
r10791 r10810 412 412 413 413 $post_title = stripslashes( sanitize_post_field( 'post_title', $title, 0, 'db' ) ); 414 $post_content = stripslashes( sanitize_post_field( 'post_content', $content, 0, 'db' ) ); 414 $post_content = stripslashes( sanitize_post_field( 'post_content', $content, 0, 'db' ) ); 415 415 $post_date = stripslashes( sanitize_post_field( 'post_date', $date, 0, 'db' ) ); 416 416 … … 432 432 $args[] = $post_content; 433 433 } 434 434 435 435 if ( !empty ( $args ) ) 436 436 return $wpdb->get_var( $wpdb->prepare($query, $args) ); … … 925 925 } 926 926 927 $post->filter = 'sample'; 927 $post->filter = 'sample'; 928 928 929 929 $permalink = get_permalink($post, true); … … 964 964 if ( 'publish' == $post->post_status ) 965 965 $view_post = 'post' == $post->post_type ? __('View Post') : __('View Page'); 966 966 967 967 if ( false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%') ) { 968 968 $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink">' . $permalink . "</span>\n"; … … 1145 1145 function wp_tiny_mce( $teeny = false ) { 1146 1146 global $concatenate_scripts, $compress_scripts; 1147 1147 1148 1148 if ( ! user_can_richedit() ) 1149 1149 return; -
trunk/wp-admin/includes/schema.php
r10774 r10810 329 329 $value = $wpdb->escape($value); 330 330 if ( !empty($insert) ) 331 $insert .= ', '; 331 $insert .= ', '; 332 332 $insert .= "('$option', '$value', '$autoload')"; 333 333 } -
trunk/wp-admin/includes/taxonomy.php
r10222 r10810 219 219 if ( is_wp_error($tags) ) 220 220 return $tags; 221 221 222 222 foreach ( $tags as $tag ) 223 223 $tag_names[] = $tag->name; -
trunk/wp-admin/includes/template.php
r10788 r10810 369 369 * 370 370 * Compares the first two arguments and if identical marks as checked 371 * 371 * 372 372 * @since unknown 373 373 * … … 382 382 /** 383 383 * Outputs the html selected attribute. 384 * 384 * 385 385 * Compares the first two arguments and if identical marks as selected 386 386 * … … 397 397 /** 398 398 * Private helper function for checked and selected. 399 * 399 * 400 400 * Compares the first two arguments and if identical marks as $type 401 401 * … … 413 413 else 414 414 $result = ''; 415 415 416 416 if ($echo) 417 417 echo $result; 418 418 419 419 return $result; 420 420 } … … 2752 2752 if ( ! empty( $upload_dir['error'] ) ) : 2753 2753 ?><div class="error"><p><?php _e('Before you can upload your import file, you will need to fix the following error:'); ?></p> 2754 <p><strong><?php echo $upload_dir['error']; ?></strong></p></div><?php 2755 else : 2754 <p><strong><?php echo $upload_dir['error']; ?></strong></p></div><?php 2755 else : 2756 2756 ?> 2757 2757 <form enctype="multipart/form-data" id="import-upload-form" method="post" action="<?php echo attribute_escape($action) ?>"> … … 3474 3474 return ''; 3475 3475 } 3476 3476 3477 3477 if ( ! $screen_layout_columns ) 3478 3478 $screen_layout_columns = 2; -
trunk/wp-admin/includes/theme-install.php
r10788 r10810 19 19 'tags' => true, 'num_ratings' => true 20 20 ); 21 21 22 22 23 23 /** … … 303 303 <p><strong><?php _e('Version:') ?></strong> <?php echo wp_kses($theme->version, $themes_allowedtags) ?></p> 304 304 <p><strong><?php _e('Author:') ?></strong> <?php echo wp_kses($theme->author, $themes_allowedtags) ?></p> 305 <?php if ( ! empty($theme->last_updated) ) : ?> 305 <?php if ( ! empty($theme->last_updated) ) : ?> 306 306 <p><strong><?php _e('Last Updated:') ?></strong> <span title="<?php echo $theme->last_updated ?>"><?php printf( __('%s ago'), human_time_diff(strtotime($theme->last_updated)) ) ?></span></p> 307 <?php endif; if ( ! empty($theme->requires) ) : ?> 308 <p><strong><?php _e('Requires WordPress Version:') ?></strong> <?php printf(__('%s or higher'), $theme->requires) ?></p> 309 <?php endif; if ( ! empty($theme->tested) ) : ?> 310 <p><strong><?php _e('Compatible up to:') ?></strong> <?php echo $theme->tested ?></p> 307 <?php endif; if ( ! empty($theme->requires) ) : ?> 308 <p><strong><?php _e('Requires WordPress Version:') ?></strong> <?php printf(__('%s or higher'), $theme->requires) ?></p> 309 <?php endif; if ( ! empty($theme->tested) ) : ?> 310 <p><strong><?php _e('Compatible up to:') ?></strong> <?php echo $theme->tested ?></p> 311 311 <?php endif; if ( !empty($theme->downloaded) ) : ?> 312 312 <p><strong><?php _e('Downloaded:') ?></strong> <?php printf(_n('%s time', '%s times', $theme->downloaded), number_format_i18n($theme->downloaded)) ?></p> … … 844 844 return new WP_Error('install_folder_exists', __('Folder already exists.'), $filelist[0] ); 845 845 } 846 846 847 847 apply_filters('install_feedback', __('Installing the theme')); 848 848 // Copy new version of theme into place. -
trunk/wp-admin/includes/upgrade.php
r10767 r10810 97 97 /* translators: Default category slug */ 98 98 $cat_slug = sanitize_title(_x('Uncategorized', 'Default category slug')); 99 99 100 100 $wpdb->insert( $wpdb->terms, array('name' => $cat_name, 'slug' => $cat_slug, 'term_group' => 0) ); 101 101 $wpdb->insert( $wpdb->term_taxonomy, array('term_id' => '1', 'taxonomy' => 'category', 'description' => '', 'parent' => 0, 'count' => 1)); … … 105 105 /* translators: Default link category slug */ 106 106 $cat_slug = sanitize_title(_x('Blogroll', 'Default link category slug')); 107 107 108 108 $wpdb->insert( $wpdb->terms, array('name' => $cat_name, 'slug' => $cat_slug, 'term_group' => 0) ); 109 109 $wpdb->insert( $wpdb->term_taxonomy, array('term_id' => '2', 'taxonomy' => 'link_category', 'description' => '', 'parent' => 0, 'count' => 7)); … … 118 118 119 119 $default_links[] = array( 'link_url' => 'http://wordpress.org/development/', 120 'link_name' => 'Development Blog', 120 'link_name' => 'Development Blog', 121 121 'link_category' => 0, 122 122 'link_rss' => 'http://wordpress.org/development/feed/', … … 162 162 $now_gmt = gmdate('Y-m-d H:i:s'); 163 163 $first_post_guid = get_option('home') . '/?p=1'; 164 164 165 165 $wpdb->insert( $wpdb->posts, array( 166 166 'post_author' => $user_id, … … 177 177 'guid' => $first_post_guid, 178 178 'comment_count' => 1, 179 'to_ping' => '', 179 'to_ping' => '', 180 180 'pinged' => '', 181 181 'post_content_filtered' => '' … … 209 209 'guid' => $first_post_guid, 210 210 'post_type' => 'page', 211 'to_ping' => '', 211 'to_ping' => '', 212 212 'pinged' => '', 213 213 'post_content_filtered' => '' … … 519 519 $comment_content = deslash($comment->comment_content); 520 520 $comment_author = deslash($comment->comment_author); 521 521 522 522 $wpdb->update($wpdb->comments, compact('comment_content', 'comment_author'), array('comment_ID' => $comment->comment_ID) ); 523 523 } … … 530 530 $link_name = deslash($link->link_name); 531 531 $link_description = deslash($link->link_description); 532 532 533 533 $wpdb->update( $wpdb->links, compact('link_name', 'link_description'), array('link_id' => $link->link_id) ); 534 534 } … … 642 642 foreach ($objects as $object) { 643 643 $wpdb->update( $wpdb->posts, array( 'post_status' => 'attachment', 644 'post_mime_type' => $object->post_type, 644 'post_mime_type' => $object->post_type, 645 645 'post_type' => ''), 646 646 array( 'ID' => $object->ID ) ); -
trunk/wp-admin/includes/user.php
r10760 r10810 11 11 * 12 12 * It seems that the first half is for backwards compatibility, but only 13 * has the ability to alter the user's role. Wordpress core seems to 13 * has the ability to alter the user's role. Wordpress core seems to 14 14 * use this function only in the second way, running edit_user() with 15 15 * no id so as to create a new user. … … 32 32 if (!$editable_roles[$_POST['role']]) 33 33 wp_die(__('You can’t give users that role.')); 34 34 35 35 $user = new WP_User( $user_id ); 36 36 $user->set_role( $_POST['role'] ); … … 78 78 // Don't let anyone with 'edit_users' (admins) edit their own role to something without it. 79 79 if( $user_id != $current_user->id || $wp_roles->role_objects[$_POST['role']]->has_cap( 'edit_users' )) 80 $user->role = $_POST['role']; 80 $user->role = $_POST['role']; 81 81 82 82 // If the new role isn't editable by the logged-in user die with error … … 259 259 260 260 /** 261 * Fetch a filtered list of user roles that the current user is 262 * allowed to edit. 263 * 264 * Simple function who's main purpose is to allow filtering of the 261 * Fetch a filtered list of user roles that the current user is 262 * allowed to edit. 263 * 264 * Simple function who's main purpose is to allow filtering of the 265 265 * list of roles in the $wp_roles object so that plugins can remove 266 266 * innappropriate ones depending on the situation or user making edits. … … 268 268 * capability can edit others to be administrators, even if they are 269 269 * only editors or authors. This filter allows admins to delegate 270 * user management. 270 * user management. 271 271 * 272 272 * @since 2.8 … … 278 278 279 279 $all_roles = $wp_roles->roles; 280 $editable_roles = apply_filters('editable_roles', $all_roles); 281 280 $editable_roles = apply_filters('editable_roles', $all_roles); 281 282 282 return $editable_roles; 283 283 } -
trunk/wp-admin/options-general.php
r10770 r10810 94 94 </tr> 95 95 <tr> 96 <?php 97 if (!wp_timezone_supported()) : // no magic timezone support here 96 <?php 97 if (!wp_timezone_supported()) : // no magic timezone support here 98 98 ?> 99 99 <th scope="row"><label for="gmt_offset"><?php _e('Timezone') ?> </label></th> … … 131 131 <span class="setting-description"><?php _e('Unfortunately, you have to manually update this for Daylight Savings Time. Lame, we know, but will be fixed in the future.'); ?></span> 132 132 </td> 133 <?php 133 <?php 134 134 else: // looks like we can do nice timezone selection! 135 135 $current_offset = get_option('gmt_offset'); … … 159 159 <br /> 160 160 <?php 161 if (function_exists('timezone_transitions_get') && $tzstring) { 161 if (function_exists('timezone_transitions_get') && $tzstring) { 162 162 $dateTimeZoneSelected = new DateTimeZone($tzstring); 163 163 foreach (timezone_transitions_get($dateTimeZoneSelected) as $tr) { … … 167 167 } 168 168 } 169 169 170 170 if ($found) { 171 171 _e(' '); -
trunk/wp-admin/press-this.php
r10375 r10810 489 489 <h3><span><?php _e('Post Tags'); ?></span></h3> 490 490 <div class="inside"> 491 <div class="tagsdiv" id="post_tag"> 491 <div class="tagsdiv" id="post_tag"> 492 492 <p class="jaxtag"> 493 493 <label class="hidden" for="newtag"><?php _e('Post Tags'); ?></label> 494 <input type="hidden" name="tax_input[post_tag]" class="the-tags" id="tax-input[post_tag]" value="" /> 494 <input type="hidden" name="tax_input[post_tag]" class="the-tags" id="tax-input[post_tag]" value="" /> 495 495 <span class="ajaxtag" style="display:none;"> 496 496 <input type="text" name="newtag[post_tag]" class="newtag form-input-tip" size="16" autocomplete="off" value="<?php _e('Add new tag'); ?>" /> 497 497 <input type="button" class="button tagadd" value="Add" tabindex="3" /> 498 498 </span> 499 </p> 500 <div class="tagchecklist"></div> 499 </p> 500 <div class="tagchecklist"></div> 501 501 </div> 502 502 <p class="tagcloud-link"><a href="#titlediv" class="tagcloud-link" id="link-post_tag"><?php _e('Choose from the most used tags in Post Tags'); ?></a></p> -
trunk/wp-admin/themes.php
r10715 r10810 192 192 $actions[] = '<a href="' . $preview_link . '" class="thickbox thickbox-preview" title="' . attribute_escape(sprintf(__('Preview "%s"'), $theme_name)) . '">' . __('Preview') . '</a>'; 193 193 if ( current_user_can('update_themes') ) 194 $actions[] = '<a class="submitdelete deletion" href="' . wp_nonce_url("themes.php?action=delete&template=$template", 'delete-theme_' . $template) . '" onclick="' . "if ( confirm('" . js_escape(sprintf( __("You are about to delete this theme '%s'\n 'Cancel' to stop, 'OK' to delete."), $theme_name )) . "') ) {return true;}return false;" . '">' . __('Delete') . '</a>'; 194 $actions[] = '<a class="submitdelete deletion" href="' . wp_nonce_url("themes.php?action=delete&template=$template", 'delete-theme_' . $template) . '" onclick="' . "if ( confirm('" . js_escape(sprintf( __("You are about to delete this theme '%s'\n 'Cancel' to stop, 'OK' to delete."), $theme_name )) . "') ) {return true;}return false;" . '">' . __('Delete') . '</a>'; 195 195 $actions = apply_filters('theme_action_links', $actions, $themes[$theme_name]); 196 196 -
trunk/wp-includes/author-template.php
r10661 r10810 518 518 519 519 foreach ( (array) $authors as $author ) { 520 521 $link = ''; 522 520 521 $link = ''; 522 523 523 $author = get_userdata( $author->ID ); 524 524 $posts = (isset($author_count[$author->ID])) ? $author_count[$author->ID] : 0; -
trunk/wp-includes/classes.php
r10782 r10810 356 356 } 357 357 358 $headers = apply_filters('wp_headers', $headers, $this); 359 360 if ( ! empty( $status ) ) 358 $headers = apply_filters('wp_headers', $headers, $this); 359 360 if ( ! empty( $status ) ) 361 361 status_header( $status ); 362 362 foreach( (array) $headers as $name => $field_value ) -
trunk/wp-includes/comment-template.php
r10778 r10810 1030 1030 extract($args, EXTR_SKIP); 1031 1031 $post = get_post($post); 1032 1032 1033 1033 if ( !comments_open($post->ID) ) 1034 1034 return false; -
trunk/wp-includes/comment.php
r10767 r10810 1341 1341 $pinged = get_pung($post_id); 1342 1342 if ( empty($to_ping) ) { 1343 $wpdb->update($wpdb->posts, array('to_ping' => ''), array('ID' => $post_id) ); 1343 $wpdb->update($wpdb->posts, array('to_ping' => ''), array('ID' => $post_id) ); 1344 1344 return; 1345 1345 } -
trunk/wp-includes/default-widgets.php
r10809 r10810 1 1 <?php 2 2 3 /** 4 * Default Widgets 3 /** 4 * Default Widgets 5 5 * 6 6 * @package WordPress … … 43 43 } 44 44 } 45 45 46 46 function update( $new_instance, $old_instance ) { 47 47 $instance = $old_instance; … … 57 57 return $instance; 58 58 } 59 59 60 60 function form( $instance ) { 61 61 //Defaults … … 103 103 $show_rating = isset($instance['rating']) ? $instance['rating'] : false; 104 104 $show_images = isset($instance['images']) ? $instance['images'] : true; 105 105 106 106 $before_widget = preg_replace('/id="[^"]*"/','id="%id"', $before_widget); 107 107 wp_list_bookmarks(apply_filters('widget_links_args', array( … … 113 113 ))); 114 114 } 115 115 116 116 function update( $new_instance, $old_instance ) { 117 117 $new_instance = (array) $new_instance; … … 121 121 $instance[$field] = 1; 122 122 } 123 123 124 124 return $instance; 125 125 } 126 126 127 127 function form( $instance ) { 128 128 … … 163 163 get_search_form(); 164 164 165 echo $after_widget; 165 echo $after_widget; 166 166 } 167 167 } … … 233 233 * 234 234 * Displays log in/out, RSS feed links, etc. 235 * 235 * 236 236 * @since 2.8.0 237 237 */ … … 415 415 } 416 416 417 echo $after_widget; 418 } 419 417 echo $after_widget; 418 } 419 420 420 function update( $new_instance, $old_instance ) { 421 421 $instance = $old_instance; … … 427 427 return $instance; 428 428 } 429 429 430 430 function form( $instance ) { 431 431 //Defaults -
trunk/wp-includes/functions.php
r10795 r10810 652 652 * If the transient does not exist or does not have a value, then the return value 653 653 * will be false. 654 * 654 * 655 655 * @since 2.8.0 656 656 * @package WordPress … … 711 711 $autoload = 'yes'; 712 712 if ( 0 != $expiration ) { 713 $autoload = 'no'; 713 $autoload = 'no'; 714 714 add_option($transient_timeout, time() + $expiration, '', 'no'); 715 715 } … … 1490 1490 'Pragma' => 'no-cache', 1491 1491 ); 1492 1492 1493 1493 if ( function_exists('apply_filters') ) { 1494 1494 $headers = apply_filters('nocache_headers', $headers); … … 1508 1508 function nocache_headers() { 1509 1509 $headers = wp_get_nocache_headers(); 1510 foreach( (array) $headers as $name => $field_value ) 1511 @header("{$name}: {$field_value}"); 1510 foreach( (array) $headers as $name => $field_value ) 1511 @header("{$name}: {$field_value}"); 1512 1512 } 1513 1513 … … 3052 3052 /** 3053 3053 * gmt_offset modification for smart timezone handling 3054 * 3054 * 3055 3055 * Overrides the gmt_offset option if we have a timezone_string available 3056 3056 */ … … 3062 3062 3063 3063 @date_default_timezone_set($tz); 3064 3064 3065 3065 $dateTimeZoneSelected = timezone_open($tz); 3066 3066 $dateTimeServer = date_create(); 3067 3067 if ($dateTimeZoneSelected === false || $dateTimeServer === false) return false; 3068 3068 3069 3069 $timeOffset = timezone_offset_get($dateTimeZoneSelected, $dateTimeServer); 3070 3070 $timeOffset = $timeOffset / 3600; 3071 3071 3072 3072 return $timeOffset; 3073 3073 } … … 3075 3075 /** 3076 3076 * Check for PHP timezone support 3077 * 3077 * 3078 3078 */ 3079 3079 function wp_timezone_supported() { 3080 if (function_exists('date_default_timezone_set') 3080 if (function_exists('date_default_timezone_set') 3081 3081 && function_exists('timezone_identifiers_list') 3082 && function_exists('timezone_open') 3082 && function_exists('timezone_open') 3083 3083 && function_exists('timezone_offset_get') 3084 ) 3084 ) 3085 3085 return true; 3086 3086 … … 3109 3109 $i++; 3110 3110 } 3111 3111 3112 3112 asort($zonen); 3113 3113 $structure = ''; -
trunk/wp-includes/general-template.php
r10774 r10810 458 458 $title = "$tax$t_sep$term"; 459 459 } 460 460 461 461 //If it's a search 462 462 if ( is_search() ) { -
trunk/wp-includes/http.php
r10692 r10810 303 303 foreach( (array) $transports as $transport ) { 304 304 $response = $transport->request($url, $r); 305 305 306 306 if( has_action('http_api_debug') ) 307 307 do_action( 'http_api_debug', $response, 'response', get_class($transport) ); … … 539 539 540 540 $home = parse_url( get_bloginfo('site_url') ); 541 541 542 542 // Don't block requests back to ourselves by default 543 543 if ( $uri == 'localhost' || $uri == $home['host'] ) … … 938 938 $proxy = new WP_HTTP_Proxy(); 939 939 940 if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) ) { 940 if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) ) { 941 941 $arrContext['http']['proxy'] = 'tcp://'.$proxy->host().':'.$proxy->port(); 942 942 … … 1078 1078 'useragent' => $r['user-agent'], 1079 1079 'headers' => $r['headers'], 1080 'ssl' => array( 1080 'ssl' => array( 1081 1081 'verifypeer' => apply_filters('https_ssl_verify', $r['sslverify']), 1082 1082 'verifyhost' => apply_filters('https_ssl_verify', $r['sslverify']) … … 1277 1277 if ( !empty($theResponse) ) { 1278 1278 $parts = explode("\r\n\r\n", $theResponse); 1279 1279 1280 1280 $headerLength = curl_getinfo($handle, CURLINFO_HEADER_SIZE); 1281 1281 $theHeaders = trim( substr($theResponse, 0, $headerLength) ); … … 1359 1359 1360 1360 function __construct() { 1361 1361 1362 1362 } 1363 1363 … … 1631 1631 /** 1632 1632 * Confirms that it's OK to send this cookie to the URL checked against. 1633 * 1633 * 1634 1634 * Decision is based on RFC 2109/2965, so look there for details on validity. 1635 1635 * … … 1684 1684 if ( empty( $this->name ) || empty( $this->value ) ) 1685 1685 return ''; 1686 1686 1687 1687 return $this->name . '=' . urlencode( $this->value ); 1688 1688 } -
trunk/wp-includes/l10n.php
r10774 r10810 231 231 /** 232 232 * Register plural strings with context in POT file, but don't translate them. 233 * 233 * 234 234 * @see _n_noop() 235 235 */ … … 261 261 262 262 if ( !is_readable($mofile)) return; 263 263 264 264 $mo = new MO(); 265 265 $mo->import_from_file( $mofile ); … … 267 267 if (isset($l10n[$domain])) 268 268 $mo->merge_with( $l10n[$domain] ); 269 269 270 270 $l10n[$domain] = &$mo; 271 271 } … … 339 339 * Returns the Translations instance for a domain. If there isn't one, 340 340 * returns empty Translations instance. 341 * 341 * 342 342 * @param string $domain 343 343 * @return object A Translation instance … … 353 353 * not in the source there are dummy gettext calls to get them into the POT 354 354 * file and this function properly translates them back. 355 * 355 * 356 356 * The before_last_bar() call is needed, because older installs keep the roles 357 357 * using the old context format: 'Role name|User role' and just skipping the -
trunk/wp-includes/link-template.php
r10578 r10810 1529 1529 $url .= '/' . ltrim($folder, '/'); 1530 1530 } 1531 1531 1532 1532 if ( !empty($path) && is_string($path) && strpos($path, '..') === false ) 1533 1533 $url .= '/' . ltrim($path, '/'); -
trunk/wp-includes/pluggable.php
r10730 r10810 331 331 /* If we don't have an email from the input headers default to wordpress@$sitename 332 332 * Some hosts will block outgoing mail from this address if it doesn't exist but 333 * there's no easy alternative. Defaulting to admin_email might appear to be another 333 * there's no easy alternative. Defaulting to admin_email might appear to be another 334 334 * option but some hosts may refuse to relay mail from an unknown domain. See 335 335 * http://trac.wordpress.org/ticket/5007. 336 336 */ 337 337 338 338 if ( !isset( $from_email ) ) { 339 339 // Get the site domain and get rid of www. … … 1384 1384 * 1385 1385 * @param int $length The length of password to generate 1386 * @param bool $special_chars Whether to include standard special characters 1386 * @param bool $special_chars Whether to include standard special characters 1387 1387 * @return string The random password 1388 1388 **/ … … 1519 1519 1520 1520 if ( is_ssl() ) 1521 $host = 'https://secure.gravatar.com'; 1521 $host = 'https://secure.gravatar.com'; 1522 1522 else 1523 1523 $host = 'http://www.gravatar.com'; -
trunk/wp-includes/pomo/mo.php
r10584 r10810 43 43 // 0xde120495 44 44 $magic_big = ((int) - 569244523) && 0xFFFFFFFF; 45 45 46 46 if ($magic_little == $magic || $magic_little_64 == $magic) { 47 47 return 'little'; … … 68 68 69 69 $reader->seekto($originals_lo_addr); 70 $originals_lo = $reader->readint32array($total * 2); // each of 70 $originals_lo = $reader->readint32array($total * 2); // each of 71 71 $reader->seekto($translations_lo_addr); 72 $translations_lo = $reader->readint32array($total * 2); 72 $translations_lo = $reader->readint32array($total * 2); 73 73 74 74 $length = create_function('$i', 'return $i * 2 + 1;'); -
trunk/wp-includes/pomo/po.php
r10584 r10810 18 18 */ 19 19 class PO extends Translations { 20 20 21 21 22 22 /** … … 95 95 "$quote" => "$slash$quote", 96 96 ); 97 $string = str_replace(array_keys($replaces), array_values($replaces), $string); 97 $string = str_replace(array_keys($replaces), array_values($replaces), $string); 98 98 99 99 $po = array(); … … 112 112 113 113 /** 114 * Inserts $with in the beginning of every new line of $string and 114 * Inserts $with in the beginning of every new line of $string and 115 115 * returns the modified string 116 116 * … … 154 154 function export_entry(&$entry) { 155 155 if (is_null($entry->singular)) return false; 156 $po = array(); 156 $po = array(); 157 157 if (!empty($entry->translator_comments)) $po[] = PO::comment_block($entry->translator_comments); 158 158 if (!empty($entry->extracted_comments)) $po[] = PO::comment_block($entry->extracted_comments, '.'); -
trunk/wp-includes/pomo/translations.php
r10584 r10810 131 131 * Adds parantheses to the inner parts of ternary operators in 132 132 * plural expressions, because PHP evaluates ternary oerators from left to right 133 * 133 * 134 134 * @param string $expression the expression without parentheses 135 135 * @return string the expression with parentheses added … … 159 159 return rtrim($res, ';'); 160 160 } 161 161 162 162 /** 163 163 * Merge $other in the current object. -
trunk/wp-includes/post-template.php
r10774 r10810 361 361 function get_body_class( $class = '' ) { 362 362 global $wp_query, $current_user; 363 363 364 364 $classes = array(); 365 365 366 366 if ( 'rtl' == get_bloginfo('text_direction') ) 367 367 $classes[] = 'rtl'; 368 368 369 369 if ( is_front_page() ) 370 370 $classes[] = 'home'; … … 383 383 if ( is_404() ) 384 384 $classes[] = 'error404'; 385 385 386 386 if ( is_single() ) { 387 387 the_post(); 388 388 389 389 $postID = $wp_query->post->ID; 390 390 $classes[] = 'single postid-' . $postID; 391 391 392 392 if ( is_attachment() ) { 393 393 $mime_type = get_post_mime_type(); … … 395 395 $classes[] = 'attachmentid-' . $postID . ' attachment-' . str_replace( $mime_prefix, "", "$mime_type" ); 396 396 } 397 397 398 398 rewind_posts(); 399 399 } elseif ( is_archive() ) { … … 413 413 } elseif ( is_page() ) { 414 414 the_post(); 415 415 416 416 $pageID = $wp_query->post->ID; 417 417 $page_children = wp_list_pages("child_of=$pageID&echo=0"); 418 418 419 419 if ( $page_children ) 420 420 $classes[] = 'page-parent'; 421 421 422 422 if ( $wp_query->post->post_parent ) 423 423 $classes[] = 'page-child parent-pageid-' . $wp_query->post->post_parent; 424 424 425 425 if ( is_page_template() ) 426 426 $classes[] = 'page-template page-template-' . str_replace( '.php', '-php', get_post_meta( $pageID, '_wp_page_template', true ) ); 427 427 428 428 rewind_posts(); 429 429 } elseif ( is_search() ) { 430 430 the_post(); 431 431 432 432 if ( have_posts() ) 433 433 $classes[] = 'search-results'; 434 434 else 435 435 $classes[] = 'search-no-results'; 436 436 437 437 rewind_posts(); 438 438 } 439 439 440 440 if ( is_user_logged_in() ) 441 441 $classes[] = 'logged-in'; 442 442 443 443 $page = $wp_query->get('page'); 444 444 445 445 if ( !$page || $page < 2) 446 446 $page = $wp_query->get('paged'); 447 447 448 448 if ( $page && $page > 1 ) { 449 449 $classes[] = 'paged-' . $page; 450 450 451 451 if ( is_single() ) 452 452 $classes[] = 'single-paged-' . $page; … … 464 464 $classes[] = 'search-paged-' . $page; 465 465 } 466 466 467 467 if ( !empty($class) ) { 468 468 if ( !is_array( $class ) ) … … 470 470 $classes = array_merge($classes, $class); 471 471 } 472 472 473 473 return apply_filters('body_class', $classes, $class); 474 474 } … … 855 855 */ 856 856 function walk_page_tree($pages, $depth, $current_page, $r) { 857 if ( empty($r['walker']) ) 857 if ( empty($r['walker']) ) 858 858 $walker = new Walker_Page; 859 859 else … … 926 926 927 927 $post_title = attribute_escape($_post->post_title); 928 928 929 929 if ( $text ) { 930 930 $link_text = attribute_escape($text); … … 935 935 if( trim($link_text) == '' ) 936 936 $link_text = $_post->post_title; 937 937 938 938 return apply_filters( 'wp_get_attachment_link', "<a href='$url' title='$post_title'>$link_text</a>", $id, $size, $permalink, $icon, $text ); 939 939 } -
trunk/wp-includes/post.php
r10730 r10810 513 513 if ( !$meta_key ) 514 514 return false; 515 515 516 516 global $wpdb; 517 517 … … 564 564 if ( !$meta_key ) 565 565 return false; 566 566 567 567 if ( empty( $meta_value ) ) 568 568 $meta_id = $wpdb->get_var( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = %s", $post_id, $meta_key ) ); … … 598 598 if ( !$key ) 599 599 return ''; 600 600 601 601 $post_id = (int) $post_id; 602 602 … … 649 649 if ( !$meta_key ) 650 650 return false; 651 651 652 652 if ( ! $wpdb->get_var( $wpdb->prepare( "SELECT meta_key FROM $wpdb->postmeta WHERE meta_key = %s AND post_id = %d", $meta_key, $post_id ) ) ) { 653 653 return add_post_meta($post_id, $meta_key, $meta_value); … … 681 681 if ( !$post_meta_key ) 682 682 return false; 683 683 684 684 global $wpdb; 685 685 if ( $wpdb->query($wpdb->prepare("DELETE FROM $wpdb->postmeta WHERE meta_key = %s", $post_meta_key)) ) { … … 757 757 if ( !$key ) 758 758 return null; 759 759 760 760 $custom = get_post_custom($post_id); 761 761 … … 1547 1547 if ( !empty($tax_input) ) { 1548 1548 foreach ( $tax_input as $taxonomy => $tags ) { 1549 wp_set_post_terms( $post_ID, $tags, $taxonomy ); 1549 wp_set_post_terms( $post_ID, $tags, $taxonomy ); 1550 1550 } 1551 1551 } … … 3527 3527 $post = _wp_post_revision_fields( $post, $autosave ); 3528 3528 $post = add_magic_quotes($post); //since data is from db 3529 3529 3530 3530 $revision_id = wp_insert_post( $post ); 3531 3531 if ( is_wp_error($revision_id) ) … … 3603 3603 3604 3604 $update['ID'] = $revision['post_parent']; 3605 3605 3606 3606 $update = add_magic_quotes( $update ); //since data is from db 3607 3607 -
trunk/wp-includes/script-loader.php
r10793 r10810 7 7 * plugins will only be concerned about the filters and actions set in this 8 8 * file. 9 * 9 * 10 10 * Several constants are used to manage the loading, concatenating and compression of scripts and CSS: 11 11 * define('SCRIPT_DEBUG', true); loads the develppment (non-minified) versions of all scripts … … 14 14 * define('COMPRESS_CSS', false); disables compression of CSS, 15 15 * define('ENFORCE_GZIP', true); forces gzip for compression (default is deflate). 16 * 16 * 17 17 * The globals $concatenate_scripts, $compress_scripts and $compress_css can be set by plugins 18 18 * to temporarily override the above settings. Also a compression test is run once and the result is saved 19 19 * as option 'can_compress_scripts' (0/1). The test will run again if that option is deleted. 20 * 20 * 21 21 * @package WordPress 22 22 */ … … 390 390 $scripts->add( 'media', "/wp-admin/js/media$suffix.js", array( 'jquery-ui-draggable', 'jquery-ui-resizable' ), '20090113' ); 391 391 $scripts->add_data( 'media', 'group', 1 ); 392 392 393 393 $scripts->add( 'codepress', '/wp-includes/js/codepress/codepress.js', false, '0.9.6' ); 394 394 $scripts->add_data( 'codepress', 'group', 1 ); -
trunk/wp-includes/shortcodes.php
r10658 r10810 157 157 * The regular expression combines the shortcode tags in the regular expression 158 158 * in a regex class. 159 * 159 * 160 160 * The regular expresion contains 6 different sub matches to help with parsing. 161 * 161 * 162 162 * 1/6 - An extra [ or ] to allow for escaping shortcodes with double [[]] 163 163 * 2 - The shortcode name … … 165 165 * 4 - The self closing / 166 166 * 5 - The content of a shortcode when it wraps some content. 167 * 167 * 168 168 * @since 2.5 169 169 * @uses $shortcode_tags … … 197 197 return substr($m[0], 1, -1); 198 198 } 199 199 200 200 $tag = $m[2]; 201 201 $attr = shortcode_parse_atts($m[3]); -
trunk/wp-includes/taxonomy.php
r10803 r10810 536 536 * 537 537 * exclude_tree - A comma- or space-delimited string of term ids to exclude 538 * from the return array, along with all of their descendant terms according to 538 * from the return array, along with all of their descendant terms according to 539 539 * the primary taxonomy. If 'include' is non-empty, 'exclude_tree' is ignored. 540 540 * … … 693 693 $excluded_trunks = preg_split('/[\s,]+/',$exclude_tree); 694 694 foreach( (array) $excluded_trunks as $extrunk ) { 695 $excluded_children = (array) get_terms($taxonomies[0], array('child_of' => intval($extrunk), 'fields' => 'ids')); 695 $excluded_children = (array) get_terms($taxonomies[0], array('child_of' => intval($extrunk), 'fields' => 'ids')); 696 696 $excluded_children[] = $extrunk; 697 697 foreach( (array) $excluded_children as $exterm ) { … … 737 737 $where .= ' AND tt.count > 0'; 738 738 739 // don't limit the query results when we have to descend the family tree 739 // don't limit the query results when we have to descend the family tree 740 740 if ( ! empty($number) && ! $hierarchical && empty( $child_of ) && '' == $parent ) { 741 741 if( $offset ) -
trunk/wp-includes/widgets.php
r10808 r10810 46 46 /** 47 47 * Singleton that registers and instantiates WP_Widget classes. 48 * 48 * 49 49 * @package WordPress 50 50 * @subpackage Widgets … … 71 71 * This class must be extended for each widget and WP_Widget::widget(), WP_Widget::update() 72 72 * and WP_Widget::form() need to be over-ridden. 73 * 73 * 74 74 * @package WordPress 75 75 * @subpackage Widgets … … 289 289 _register_widget_form_callback( $this->id, $this->name, $this->_get_form_callback(), $this->control_options, array( 'number' => $number ) ); 290 290 } 291 291 292 292 function save_settings($settings) { 293 293 $settings['_multiwidget'] = 1; … … 296 296 297 297 function get_settings() { 298 $settings = get_option($this->option_name); 298 $settings = get_option($this->option_name); 299 299 300 300 if ( !is_array($settings) ) … … 315 315 /** 316 316 * Register a widget 317 * 317 * 318 318 * Registers a WP_Widget widget 319 * 319 * 320 320 * @since 2.8.0 321 * 321 * 322 322 * @see WP_Widget 323 323 * @see WP_Widget_Factory 324 324 * @uses WP_Widget_Factory 325 * 325 * 326 326 * @param string $widget_class The name of a class that extends WP_Widget 327 327 */ … … 923 923 if ( $single ) { 924 924 $settings = array( 2 => $settings ); 925 925 926 926 $sidebars_widgets = get_option('sidebars_widgets'); 927 927 foreach ( (array) $sidebars_widgets as $index => $sidebar ) { … … 941 941 $settings['_multiwidget'] = 1; 942 942 update_option( $option_name, $settings ); 943 943 944 944 return $settings; 945 945 } … … 948 948 * Deprecated API 949 949 */ 950 950 951 951 /** 952 952 * Register widget for sidebar with backwards compatibility. -
trunk/wp-includes/wp-db.php
r10735 r10810 436 436 return mysql_real_escape_string( $string, $this->dbh ); 437 437 else 438 return addslashes( $string ); 438 return addslashes( $string ); 439 439 } 440 440 -
trunk/wp-mail.php
r10412 r10810 143 143 } 144 144 145 $subject = trim($subject); 146 145 $subject = trim($subject); 146 147 147 if ( $content_type == 'multipart/alternative' ) { 148 148 $content = explode('--'.$boundary, $content); … … 160 160 //Either the raw content or the content of the last quoted-printable section 161 161 $content = apply_filters('wp_mail_original_content', $content); 162 162 163 163 if ( false !== stripos($content_transfer_encoding, "quoted-printable") ) { 164 164 $content = quoted_printable_decode($content); -
trunk/wp-settings.php
r10808 r10810 203 203 } else { 204 204 // Unicode Extension is in PHP 6.0 only or do version check when this changes. 205 if ( function_exists('unicode_decode') ) 205 if ( function_exists('unicode_decode') ) 206 206 error_reporting( E_ALL ^ E_DEPRECATED ^ E_NOTICE ^ E_USER_NOTICE ^ E_STRICT ); 207 207 else if ( defined( 'E_DEPRECATED' ) ) // Introduced in PHP 5.3 … … 378 378 * @since 2.8.0 379 379 */ 380 if ( !defined( 'MUPLUGINDIR' ) ) 380 if ( !defined( 'MUPLUGINDIR' ) ) 381 381 define( 'MUPLUGINDIR', 'wp-content/mu-plugins' ); // Relative to ABSPATH. For back compat. 382 382 -
trunk/xmlrpc.php
r10730 r10810 2216 2216 } 2217 2217 2218 // Only posts can be sticky 2219 if ( $post_type == 'post' && isset( $content_struct['sticky'] ) ) 2220 if ( $content_struct['sticky'] == true ) 2221 stick_post( $post_ID ); 2222 elseif ( $content_struct['sticky'] == false ) 2223 unstick_post( $post_ID ); 2218 // Only posts can be sticky 2219 if ( $post_type == 'post' && isset( $content_struct['sticky'] ) ) 2220 if ( $content_struct['sticky'] == true ) 2221 stick_post( $post_ID ); 2222 elseif ( $content_struct['sticky'] == false ) 2223 unstick_post( $post_ID ); 2224 2224 2225 2225 if ( isset($content_struct['custom_fields']) ) { … … 2239 2239 function add_enclosure_if_new($post_ID, $enclosure) { 2240 2240 if( is_array( $enclosure ) && isset( $enclosure['url'] ) && isset( $enclosure['length'] ) && isset( $enclosure['type'] ) ) { 2241 2241 2242 2242 $encstring = $enclosure['url'] . "\n" . $enclosure['length'] . "\n" . $enclosure['type']; 2243 2243 $found = false; … … 2257 2257 } 2258 2258 } 2259 2259 2260 2260 /** 2261 2261 * Attach upload to a post. … … 2523 2523 } 2524 2524 2525 // Only posts can be sticky 2526 if ( $post_type == 'post' && isset( $content_struct['sticky'] ) ) 2527 if ( $content_struct['sticky'] == true ) 2528 stick_post( $post_ID ); 2529 elseif ( $content_struct['sticky'] == false ) 2530 unstick_post( $post_ID ); 2525 // Only posts can be sticky 2526 if ( $post_type == 'post' && isset( $content_struct['sticky'] ) ) 2527 if ( $content_struct['sticky'] == true ) 2528 stick_post( $post_ID ); 2529 elseif ( $content_struct['sticky'] == false ) 2530 unstick_post( $post_ID ); 2531 2531 2532 2532 if ( isset($content_struct['custom_fields']) ) { … … 2604 2604 } 2605 2605 2606 $sticky = false; 2607 if ( is_sticky( $post_ID ) ) 2608 $sticky = true; 2606 $sticky = false; 2607 if ( is_sticky( $post_ID ) ) 2608 $sticky = true; 2609 2609 2610 2610 $enclosure = array();
Note: See TracChangeset
for help on using the changeset viewer.