Trim trailing whitespace

git-svn-id: http://svn.automattic.com/wordpress/trunk@10810 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2009-03-18 02:43:45 +00:00
parent cd5949d0c2
commit e8b6fe7347
42 changed files with 322 additions and 322 deletions

View File

@ -278,7 +278,7 @@ $page_links = paginate_links( array(
<?php } <?php }
if ( 'spam' == $comment_status ) { if ( 'spam' == $comment_status ) {
wp_nonce_field('bulk-spam-delete', '_spam_nonce'); wp_nonce_field('bulk-spam-delete', '_spam_nonce');
if ( current_user_can ('moderate_comments')) { ?> if ( current_user_can ('moderate_comments')) { ?>
<input type="submit" name="delete_all_spam" value="<?php _e('Delete All Spam'); ?>" class="button-secondary apply" /> <input type="submit" name="delete_all_spam" value="<?php _e('Delete All Spam'); ?>" class="button-secondary apply" />
<?php } <?php }

View File

@ -269,35 +269,35 @@ add_meta_box('submitdiv', __('Publish'), 'post_submit_meta_box', 'post', 'side',
* @param object $post * @param object $post
*/ */
function post_tags_meta_box($post, $box) { function post_tags_meta_box($post, $box) {
$tax_name = substr($box['id'], 8); $tax_name = substr($box['id'], 8);
$taxonomy = get_taxonomy($tax_name); $taxonomy = get_taxonomy($tax_name);
$helps = isset($taxonomy->helps) ? attribute_escape($taxonomy->helps) : __('Separate tags with commas.'); $helps = isset($taxonomy->helps) ? attribute_escape($taxonomy->helps) : __('Separate tags with commas.');
?> ?>
<div class="tagsdiv" id="<?php echo $tax_name; ?>"> <div class="tagsdiv" id="<?php echo $tax_name; ?>">
<p class="jaxtag"> <p class="jaxtag">
<label class="hidden" for="newtag"><?php _e( $box['title'] ); ?></label> <label class="hidden" for="newtag"><?php _e( $box['title'] ); ?></label>
<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 ); ?>" /> <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 ); ?>" />
<span class="ajaxtag"> <span class="ajaxtag">
<input type="text" name="newtag[<?php echo $tax_name; ?>]" class="newtag form-input-tip" size="16" autocomplete="off" value="<?php _e('Add new tag'); ?>" /> <input type="text" name="newtag[<?php echo $tax_name; ?>]" class="newtag form-input-tip" size="16" autocomplete="off" value="<?php _e('Add new tag'); ?>" />
<input type="button" class="button tagadd" value="<?php _e('Add'); ?>" tabindex="3" /> <input type="button" class="button tagadd" value="<?php _e('Add'); ?>" tabindex="3" />
</span></p> </span></p>
<p class="howto"><?php echo $helps; ?></p> <p class="howto"><?php echo $helps; ?></p>
<div class="tagchecklist"></div> <div class="tagchecklist"></div>
</div> </div>
<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> <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>
<?php <?php
} }
// all tag-style post taxonomies // all tag-style post taxonomies
foreach ( get_object_taxonomies('post') as $tax_name ) { foreach ( get_object_taxonomies('post') as $tax_name ) {
if ( !is_taxonomy_hierarchical($tax_name) ) { if ( !is_taxonomy_hierarchical($tax_name) ) {
$taxonomy = get_taxonomy($tax_name); $taxonomy = get_taxonomy($tax_name);
$label = isset($taxonomy->label) ? attribute_escape($taxonomy->label) : $tax_name; $label = isset($taxonomy->label) ? attribute_escape($taxonomy->label) : $tax_name;
add_meta_box('tagsdiv-' . $tax_name, $label, 'post_tags_meta_box', 'post', 'side', 'core'); add_meta_box('tagsdiv-' . $tax_name, $label, 'post_tags_meta_box', 'post', 'side', 'core');
} }
} }
/** /**
* Display post categories form fields. * Display post categories form fields.

View File

@ -30,7 +30,7 @@ class LJ_API_Import {
var $postmap; var $postmap;
var $commentmap; var $commentmap;
var $pointers = array(); var $pointers = array();
// This list taken from LJ, they don't appear to have an API for it // This list taken from LJ, they don't appear to have an API for it
var $moods = array( '1' => 'aggravated', var $moods = array( '1' => 'aggravated',
'10' => 'discontent', '10' => 'discontent',
@ -193,7 +193,7 @@ class LJ_API_Import {
<input type="hidden" name="login" value="true" /> <input type="hidden" name="login" value="true" />
<p><?php _e( 'Howdy! This importer allows you to connect directly to LiveJournal and download all your entries and comments' ) ?></p> <p><?php _e( 'Howdy! This importer allows you to connect directly to LiveJournal and download all your entries and comments' ) ?></p>
<p><?php _e( 'Enter your LiveJournal username and password below so we can connect to your account:' ) ?></p> <p><?php _e( 'Enter your LiveJournal username and password below so we can connect to your account:' ) ?></p>
<table class="form-table"> <table class="form-table">
<tr> <tr>
@ -205,9 +205,9 @@ class LJ_API_Import {
<th scope="row"><label for="lj_password"><?php _e( 'LiveJournal Password' ) ?></label></th> <th scope="row"><label for="lj_password"><?php _e( 'LiveJournal Password' ) ?></label></th>
<td><input type="password" name="lj_password" id="lj_password" class="regular-text" /></td> <td><input type="password" name="lj_password" id="lj_password" class="regular-text" /></td>
</tr> </tr>
</table> </table>
<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> <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>
<p><?php _e( "If you don't enter a password, ALL ENTRIES from your LiveJournal will be imported as public posts in WordPress." ) ?></p> <p><?php _e( "If you don't enter a password, ALL ENTRIES from your LiveJournal will be imported as public posts in WordPress." ) ?></p>
<p><?php _e( 'Enter the password you would like to use for all protected entries here:' ) ?></p> <p><?php _e( 'Enter the password you would like to use for all protected entries here:' ) ?></p>
@ -221,11 +221,11 @@ class LJ_API_Import {
</table> </table>
<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> <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>
<p class="submit"> <p class="submit">
<input type="submit" class="button-primary" value="<?php echo attribute_escape( __( 'Connect to LiveJournal and Import' ) ) ?>" /> <input type="submit" class="button-primary" value="<?php echo attribute_escape( __( 'Connect to LiveJournal and Import' ) ) ?>" />
</p> </p>
<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> <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>
<noscript> <noscript>
@ -236,7 +236,7 @@ class LJ_API_Import {
</div> </div>
<?php <?php
} }
function download_post_meta() { function download_post_meta() {
$total = (int) get_option( 'ljapi_total' ); $total = (int) get_option( 'ljapi_total' );
$count = (int) get_option( 'ljapi_count' ); $count = (int) get_option( 'ljapi_count' );
@ -247,17 +247,17 @@ class LJ_API_Import {
$sync_item_times = get_option( 'ljapi_sync_item_times' ); $sync_item_times = get_option( 'ljapi_sync_item_times' );
if ( !is_array( $sync_item_times ) ) if ( !is_array( $sync_item_times ) )
$sync_item_times = array(); $sync_item_times = array();
do { do {
$lastsync = date( 'Y-m-d H:i:s', strtotime( get_option( 'ljapi_lastsync' ) ) ); $lastsync = date( 'Y-m-d H:i:s', strtotime( get_option( 'ljapi_lastsync' ) ) );
$synclist = $this->lj_ixr( 'syncitems', array( 'ver' => 1, 'lastsync' => $lastsync ) ); $synclist = $this->lj_ixr( 'syncitems', array( 'ver' => 1, 'lastsync' => $lastsync ) );
if ( is_wp_error( $synclist ) ) if ( is_wp_error( $synclist ) )
return $synclist; return $synclist;
// Keep track of if we've downloaded everything // Keep track of if we've downloaded everything
$total = $synclist['total']; $total = $synclist['total'];
$count = $synclist['count']; $count = $synclist['count'];
foreach ( $synclist['syncitems'] as $event ) { foreach ( $synclist['syncitems'] as $event ) {
if ( substr( $event['item'], 0, 2 ) == 'L-' ) { if ( substr( $event['item'], 0, 2 ) == 'L-' ) {
$sync_item_times[ str_replace( 'L-', '', $event['item'] ) ] = $event['time']; $sync_item_times[ str_replace( 'L-', '', $event['item'] ) ] = $event['time'];
@ -276,7 +276,7 @@ class LJ_API_Import {
echo '<p>' . __( 'Post metadata has been downloaded, proceeding with posts...' ) . '</p>'; echo '<p>' . __( 'Post metadata has been downloaded, proceeding with posts...' ) . '</p>';
} }
function download_post_bodies() { function download_post_bodies() {
$imported_count = (int) get_option( 'ljapi_imported_count' ); $imported_count = (int) get_option( 'ljapi_imported_count' );
$sync_item_times = get_option( 'ljapi_sync_item_times' ); $sync_item_times = get_option( 'ljapi_sync_item_times' );
@ -285,10 +285,10 @@ class LJ_API_Import {
update_option( 'ljapi_lastsync_posts', date( 'Y-m-d H:i:s', 0 ) ); update_option( 'ljapi_lastsync_posts', date( 'Y-m-d H:i:s', 0 ) );
$count = 0; $count = 0;
echo '<ol>'; echo '<ol>';
do { do {
$lastsync = date( 'Y-m-d H:i:s', strtotime( get_option( 'ljapi_lastsync_posts' ) ) ); $lastsync = date( 'Y-m-d H:i:s', strtotime( get_option( 'ljapi_lastsync_posts' ) ) );
// Get the batch of items that match up with the syncitems list // Get the batch of items that match up with the syncitems list
$itemlist = $this->lj_ixr( 'getevents', array( 'ver' => 1, $itemlist = $this->lj_ixr( 'getevents', array( 'ver' => 1,
'selecttype' => 'syncitems', 'selecttype' => 'syncitems',
@ -296,7 +296,7 @@ class LJ_API_Import {
'lastsync' => $lastsync ) ); 'lastsync' => $lastsync ) );
if ( is_wp_error( $itemlist ) ) if ( is_wp_error( $itemlist ) )
return $itemlist; return $itemlist;
if ( $num = count( $itemlist['events'] ) ) { if ( $num = count( $itemlist['events'] ) ) {
for ( $e = 0; $e < count( $itemlist['events'] ); $e++ ) { for ( $e = 0; $e < count( $itemlist['events'] ); $e++ ) {
$event = $itemlist['events'][$e]; $event = $itemlist['events'][$e];
@ -314,23 +314,23 @@ class LJ_API_Import {
} }
$count++; $count++;
} while ( $num > 0 && $count < 3 ); // Doing up to 3 requests at a time to avoid memory problems } while ( $num > 0 && $count < 3 ); // Doing up to 3 requests at a time to avoid memory problems
// Used so that step1 knows when to stop posting back on itself // Used so that step1 knows when to stop posting back on itself
update_option( 'ljapi_last_sync_count', $num ); update_option( 'ljapi_last_sync_count', $num );
// Counter just used to show progress to user // Counter just used to show progress to user
update_option( 'ljapi_post_batch', ( (int) get_option( 'ljapi_post_batch' ) + 1 ) ); update_option( 'ljapi_post_batch', ( (int) get_option( 'ljapi_post_batch' ) + 1 ) );
echo '</ol>'; echo '</ol>';
} }
function import_post( $post ) { function import_post( $post ) {
global $wpdb; global $wpdb;
// Make sure we haven't already imported this one // Make sure we haven't already imported this one
if ( $this->get_wp_post_ID( $post['itemid'] ) ) if ( $this->get_wp_post_ID( $post['itemid'] ) )
return; return;
$user = wp_get_current_user(); $user = wp_get_current_user();
$post_author = $user->ID; $post_author = $user->ID;
$post['security'] = !empty( $post['security'] ) ? $post['security'] : ''; $post['security'] = !empty( $post['security'] ) ? $post['security'] : '';
@ -341,13 +341,13 @@ class LJ_API_Import {
$post_date = $post['eventtime']; $post_date = $post['eventtime'];
if ( 18 == strlen( $post_date ) ) if ( 18 == strlen( $post_date ) )
$post_date = substr( $post_date, 0, 10 ) . ' ' . substr( $post_date, 10 ); $post_date = substr( $post_date, 0, 10 ) . ' ' . substr( $post_date, 10 );
// Cleaning up and linking the title // Cleaning up and linking the title
$post_title = isset( $post['subject'] ) ? trim( $post['subject'] ) : ''; $post_title = isset( $post['subject'] ) ? trim( $post['subject'] ) : '';
$post_title = $this->translate_lj_user( $post_title ); // Translate it, but then we'll strip the link $post_title = $this->translate_lj_user( $post_title ); // Translate it, but then we'll strip the link
$post_title = strip_tags( $post_title ); // Can't have tags in the title in WP $post_title = strip_tags( $post_title ); // Can't have tags in the title in WP
$post_title = $wpdb->escape( $post_title ); $post_title = $wpdb->escape( $post_title );
// Clean up content // Clean up content
$post_content = $post['event']; $post_content = $post['event'];
$post_content = preg_replace_callback( '|<(/?[A-Z]+)|', create_function( '$match', 'return "<" . strtolower( $match[1] );' ), $post_content ); $post_content = preg_replace_callback( '|<(/?[A-Z]+)|', create_function( '$match', 'return "<" . strtolower( $match[1] );' ), $post_content );
@ -363,10 +363,10 @@ class LJ_API_Import {
$post_content = $this->translate_lj_user( $post_content ); $post_content = $this->translate_lj_user( $post_content );
$post_content = force_balance_tags( $post_content ); $post_content = force_balance_tags( $post_content );
$post_content = $wpdb->escape( $post_content ); $post_content = $wpdb->escape( $post_content );
// Handle any tags associated with the post // Handle any tags associated with the post
$tags_input = !empty( $post['props']['taglist'] ) ? $post['props']['taglist'] : ''; $tags_input = !empty( $post['props']['taglist'] ) ? $post['props']['taglist'] : '';
// Check if comments are closed on this post // Check if comments are closed on this post
$comment_status = !empty( $post['props']['opt_nocomments'] ) ? 'closed' : 'open'; $comment_status = !empty( $post['props']['opt_nocomments'] ) ? 'closed' : 'open';
@ -387,25 +387,25 @@ class LJ_API_Import {
echo '</li>'; echo '</li>';
return new WP_Error( 'insert_post_failed', __( 'Failed to create post.' ) ); return new WP_Error( 'insert_post_failed', __( 'Failed to create post.' ) );
} }
// Handle all the metadata for this post // Handle all the metadata for this post
$this->insert_postmeta( $post_id, $post ); $this->insert_postmeta( $post_id, $post );
} }
echo '</li>'; echo '</li>';
} }
// Convert lj-user tags to links to that user // Convert lj-user tags to links to that user
function translate_lj_user( $str ) { function translate_lj_user( $str ) {
return preg_replace( '|<lj\s+user\s*=\s*["\']([\w-]+)["\']>|', '<a href="http://$1.livejournal.com/" class="lj-user">$1</a>', $str ); return preg_replace( '|<lj\s+user\s*=\s*["\']([\w-]+)["\']>|', '<a href="http://$1.livejournal.com/" class="lj-user">$1</a>', $str );
} }
function insert_postmeta( $post_id, $post ) { function insert_postmeta( $post_id, $post ) {
// Need the original LJ id for comments // Need the original LJ id for comments
add_post_meta( $post_id, 'lj_itemid', $post['itemid'] ); add_post_meta( $post_id, 'lj_itemid', $post['itemid'] );
// And save the permalink on LJ in case we want to link back or something // And save the permalink on LJ in case we want to link back or something
add_post_meta( $post_id, 'lj_permalink', $post['url'] ); add_post_meta( $post_id, 'lj_permalink', $post['url'] );
// Supports the following "props" from LJ, saved as lj_<prop_name> in wp_postmeta // Supports the following "props" from LJ, saved as lj_<prop_name> in wp_postmeta
// Adult Content - adult_content // Adult Content - adult_content
// Location - current_coords + current_location // Location - current_coords + current_location
@ -424,7 +424,7 @@ class LJ_API_Import {
} }
} }
} }
// Set up a session (authenticate) with LJ // Set up a session (authenticate) with LJ
function get_session() { function get_session() {
// Get a session via XMLRPC // Get a session via XMLRPC
@ -433,18 +433,18 @@ class LJ_API_Import {
return new WP_Error( 'cookie', __( 'Could not get a cookie from LiveJournal. Please try again soon.' ) ); return new WP_Error( 'cookie', __( 'Could not get a cookie from LiveJournal. Please try again soon.' ) );
return new WP_Http_Cookie( array( 'name' => 'ljsession', 'value' => $cookie['ljsession'] ) ); return new WP_Http_Cookie( array( 'name' => 'ljsession', 'value' => $cookie['ljsession'] ) );
} }
// Loops through and gets comment meta from LJ in batches // Loops through and gets comment meta from LJ in batches
function download_comment_meta() { function download_comment_meta() {
$cookie = $this->get_session(); $cookie = $this->get_session();
if ( is_wp_error( $cookie ) ) if ( is_wp_error( $cookie ) )
return $cookie; return $cookie;
// Load previous state (if any) // Load previous state (if any)
$this->usermap = (array) get_option( 'ljapi_usermap' ); $this->usermap = (array) get_option( 'ljapi_usermap' );
$maxid = get_option( 'ljapi_maxid' ) ? get_option( 'ljapi_maxid' ) : 1; $maxid = get_option( 'ljapi_maxid' ) ? get_option( 'ljapi_maxid' ) : 1;
$highest_id = get_option( 'ljapi_highest_id' ) ? get_option( 'ljapi_highest_id' ) : 0; $highest_id = get_option( 'ljapi_highest_id' ) ? get_option( 'ljapi_highest_id' ) : 0;
// We need to loop over the metadata request until we have it all // We need to loop over the metadata request until we have it all
while ( $maxid > $highest_id ) { while ( $maxid > $highest_id ) {
// Now get the meta listing // Now get the meta listing
@ -452,9 +452,9 @@ class LJ_API_Import {
array( 'cookies' => array( $cookie ), 'timeout' => 20 ) ); array( 'cookies' => array( $cookie ), 'timeout' => 20 ) );
if ( is_wp_error( $results ) ) if ( is_wp_error( $results ) )
return new WP_Error( 'comment_meta', __( 'Failed to retrieve comment meta information from LiveJournal. Please try again soon.' ) ); return new WP_Error( 'comment_meta', __( 'Failed to retrieve comment meta information from LiveJournal. Please try again soon.' ) );
$results = wp_remote_retrieve_body( $results ); $results = wp_remote_retrieve_body( $results );
// Get the maxid so we know if we have them all yet // Get the maxid so we know if we have them all yet
preg_match( '|<maxid>(\d+)</maxid>|', $results, $matches ); preg_match( '|<maxid>(\d+)</maxid>|', $results, $matches );
if ( 0 == $matches[1] ) { if ( 0 == $matches[1] ) {
@ -465,7 +465,7 @@ class LJ_API_Import {
return false; // Bail out of comment importing entirely return false; // Bail out of comment importing entirely
} }
$maxid = !empty( $matches[1] ) ? $matches[1] : $maxid; $maxid = !empty( $matches[1] ) ? $matches[1] : $maxid;
// Parse comments and get highest id available // Parse comments and get highest id available
preg_match_all( '|<comment id=\'(\d+)\'|is', $results, $matches ); preg_match_all( '|<comment id=\'(\d+)\'|is', $results, $matches );
foreach ( $matches[1] as $id ) { foreach ( $matches[1] as $id ) {
@ -477,7 +477,7 @@ class LJ_API_Import {
preg_match_all( '|<usermap id=\'(\d+)\' user=\'([^\']+)\' />|', $results, $matches ); preg_match_all( '|<usermap id=\'(\d+)\' user=\'([^\']+)\' />|', $results, $matches );
foreach ( $matches[1] as $count => $userid ) foreach ( $matches[1] as $count => $userid )
$this->usermap[$userid] = $matches[2][$count]; // need this in memory for translating ids => names $this->usermap[$userid] = $matches[2][$count]; // need this in memory for translating ids => names
wp_cache_flush(); wp_cache_flush();
} }
// endwhile - should have seen all comment meta at this point // endwhile - should have seen all comment meta at this point
@ -485,12 +485,12 @@ class LJ_API_Import {
update_option( 'ljapi_usermap', $this->usermap ); update_option( 'ljapi_usermap', $this->usermap );
update_option( 'ljapi_maxid', $maxid ); update_option( 'ljapi_maxid', $maxid );
update_option( 'ljapi_highest_id', $highest_id ); update_option( 'ljapi_highest_id', $highest_id );
echo '<p>' . __( ' Comment metadata downloaded successfully, proceeding with comment bodies...' ) . '</p>'; echo '<p>' . __( ' Comment metadata downloaded successfully, proceeding with comment bodies...' ) . '</p>';
return true; return true;
} }
// Downloads actual comment bodies from LJ // Downloads actual comment bodies from LJ
// Inserts them all directly to the DB, with additional info stored in "spare" fields // Inserts them all directly to the DB, with additional info stored in "spare" fields
function download_comment_bodies() { function download_comment_bodies() {
@ -498,7 +498,7 @@ class LJ_API_Import {
$cookie = $this->get_session(); $cookie = $this->get_session();
if ( is_wp_error( $cookie ) ) if ( is_wp_error( $cookie ) )
return $cookie; return $cookie;
// Load previous state (if any) // Load previous state (if any)
$this->usermap = (array) get_option( 'ljapi_usermap' ); $this->usermap = (array) get_option( 'ljapi_usermap' );
$maxid = get_option( 'ljapi_maxid' ) ? (int) get_option( 'ljapi_maxid' ) : 1; $maxid = get_option( 'ljapi_maxid' ) ? (int) get_option( 'ljapi_maxid' ) : 1;
@ -506,15 +506,15 @@ class LJ_API_Import {
$loop = 0; $loop = 0;
while ( $maxid > $highest_id && $loop < 5 ) { // We do 5 loops per call to avoid memory limits while ( $maxid > $highest_id && $loop < 5 ) { // We do 5 loops per call to avoid memory limits
$loop++; $loop++;
// Get a batch of comments, using the highest_id we've already got as a starting point // Get a batch of comments, using the highest_id we've already got as a starting point
$results = wp_remote_get( $this->comments_url . '?get=comment_body&startid=' . ( $highest_id + 1 ), $results = wp_remote_get( $this->comments_url . '?get=comment_body&startid=' . ( $highest_id + 1 ),
array( 'cookies' => array( $cookie ), 'timeout' => 20 ) ); array( 'cookies' => array( $cookie ), 'timeout' => 20 ) );
if ( is_wp_error( $results ) ) if ( is_wp_error( $results ) )
return new WP_Error( 'comment_bodies', __( 'Failed to retrieve comment bodies from LiveJournal. Please try again soon.' ) ); return new WP_Error( 'comment_bodies', __( 'Failed to retrieve comment bodies from LiveJournal. Please try again soon.' ) );
$results = wp_remote_retrieve_body( $results ); $results = wp_remote_retrieve_body( $results );
// Parse out each comment and insert directly // Parse out each comment and insert directly
preg_match_all( '|<comment id=\'(\d+)\'.*</comment>|iUs', $results, $matches ); preg_match_all( '|<comment id=\'(\d+)\'.*</comment>|iUs', $results, $matches );
for ( $c = 0; $c < count( $matches[0] ); $c++ ) { for ( $c = 0; $c < count( $matches[0] ); $c++ ) {
@ -523,7 +523,7 @@ class LJ_API_Import {
$highest_id = $matches[1][$c]; $highest_id = $matches[1][$c];
update_option( 'ljapi_highest_comment_id', $highest_id ); update_option( 'ljapi_highest_comment_id', $highest_id );
} }
$comment = $matches[0][$c]; $comment = $matches[0][$c];
// Filter out any captured, deleted comments (nothing useful to import) // Filter out any captured, deleted comments (nothing useful to import)
@ -536,22 +536,22 @@ class LJ_API_Import {
// Clear cache // Clear cache
clean_comment_cache( $id ); clean_comment_cache( $id );
} }
// Clear cache to preseve memory // Clear cache to preseve memory
wp_cache_flush(); wp_cache_flush();
} }
// endwhile - all comments downloaded and ready for bulk processing // endwhile - all comments downloaded and ready for bulk processing
// Counter just used to show progress to user // Counter just used to show progress to user
update_option( 'ljapi_comment_batch', ( (int) get_option( 'ljapi_comment_batch' ) + 1 ) ); update_option( 'ljapi_comment_batch', ( (int) get_option( 'ljapi_comment_batch' ) + 1 ) );
return true; return true;
} }
// Takes a block of XML and parses out all the elements of the comment // Takes a block of XML and parses out all the elements of the comment
function parse_comment( $comment ) { function parse_comment( $comment ) {
global $wpdb; global $wpdb;
// Get the top-level attributes // Get the top-level attributes
preg_match( '|<comment([^>]+)>|i', $comment, $attribs ); preg_match( '|<comment([^>]+)>|i', $comment, $attribs );
preg_match( '| id=\'(\d+)\'|i', $attribs[1], $matches ); preg_match( '| id=\'(\d+)\'|i', $attribs[1], $matches );
@ -564,7 +564,7 @@ class LJ_API_Import {
$lj_comment_parent = isset( $matches[1] ) ? $matches[1] : 0; $lj_comment_parent = isset( $matches[1] ) ? $matches[1] : 0;
preg_match( '| state=\'([SDFA])\'|i', $attribs[1], $matches ); // optional preg_match( '| state=\'([SDFA])\'|i', $attribs[1], $matches ); // optional
$lj_comment_state = isset( $matches[1] ) ? $matches[1] : 'A'; $lj_comment_state = isset( $matches[1] ) ? $matches[1] : 'A';
// Clean up "subject" - this will become the first line of the comment in WP // Clean up "subject" - this will become the first line of the comment in WP
preg_match( '|<subject>(.*)</subject>|is', $comment, $matches ); preg_match( '|<subject>(.*)</subject>|is', $comment, $matches );
if ( isset( $matches[1] ) ) { if ( isset( $matches[1] ) ) {
@ -572,7 +572,7 @@ class LJ_API_Import {
if ( 'Re:' == $comment_subject ) if ( 'Re:' == $comment_subject )
$comment_subject = ''; $comment_subject = '';
} }
// Get the body and HTMLize it // Get the body and HTMLize it
preg_match( '|<body>(.*)</body>|is', $comment, $matches ); preg_match( '|<body>(.*)</body>|is', $comment, $matches );
$comment_content = !empty( $comment_subject ) ? $comment_subject . "\n\n" . $matches[1] : $matches[1]; $comment_content = !empty( $comment_subject ) ? $comment_subject . "\n\n" . $matches[1] : $matches[1];
@ -583,15 +583,15 @@ class LJ_API_Import {
$comment_content = str_replace( '<hr>', '<hr />', $comment_content ); $comment_content = str_replace( '<hr>', '<hr />', $comment_content );
$comment_content = preg_replace_callback( '|<(/?[A-Z]+)|', create_function( '$match', 'return "<" . strtolower( $match[1] );' ), $comment_content ); $comment_content = preg_replace_callback( '|<(/?[A-Z]+)|', create_function( '$match', 'return "<" . strtolower( $match[1] );' ), $comment_content );
$comment_content = $wpdb->escape( trim( $comment_content ) ); $comment_content = $wpdb->escape( trim( $comment_content ) );
// Get and convert the date // Get and convert the date
preg_match( '|<date>(.*)</date>|i', $comment, $matches ); preg_match( '|<date>(.*)</date>|i', $comment, $matches );
$comment_date = trim( str_replace( array( 'T', 'Z' ), ' ', $matches[1] ) ); $comment_date = trim( str_replace( array( 'T', 'Z' ), ' ', $matches[1] ) );
// Grab IP if available // Grab IP if available
preg_match( '|<property name=\'poster_ip\'>(.*)</property>|i', $comment, $matches ); // optional preg_match( '|<property name=\'poster_ip\'>(.*)</property>|i', $comment, $matches ); // optional
$comment_author_IP = isset( $matches[1] ) ? $matches[1] : ''; $comment_author_IP = isset( $matches[1] ) ? $matches[1] : '';
// Try to get something useful for the comment author, especially if it was "my" comment // Try to get something useful for the comment author, especially if it was "my" comment
$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]; $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];
if ( get_option( 'ljapi_username' ) == $author ) { if ( get_option( 'ljapi_username' ) == $author ) {
@ -601,9 +601,9 @@ class LJ_API_Import {
$url = trailingslashit( get_option( 'home' ) ); $url = trailingslashit( get_option( 'home' ) );
} else { } else {
$user_id = 0; $user_id = 0;
$url = ( __( 'Anonymous' ) == $author ) ? '' : 'http://' . $author . '.livejournal.com/'; $url = ( __( 'Anonymous' ) == $author ) ? '' : 'http://' . $author . '.livejournal.com/';
} }
// Send back the array of details // Send back the array of details
return array( 'lj_comment_ID' => $lj_comment_ID, return array( 'lj_comment_ID' => $lj_comment_ID,
'lj_comment_post_ID' => $lj_comment_post_ID, 'lj_comment_post_ID' => $lj_comment_post_ID,
@ -623,18 +623,18 @@ class LJ_API_Import {
'user_ID' => $user_id 'user_ID' => $user_id
); );
} }
// Gets the post_ID that a LJ post has been saved as within WP // Gets the post_ID that a LJ post has been saved as within WP
function get_wp_post_ID( $post ) { function get_wp_post_ID( $post ) {
global $wpdb; global $wpdb;
if ( empty( $this->postmap[$post] ) ) if ( empty( $this->postmap[$post] ) )
$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 ) ); $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 ) );
return $this->postmap[$post]; return $this->postmap[$post];
} }
// Gets the comment_ID that a LJ comment has been saved as within WP // Gets the comment_ID that a LJ comment has been saved as within WP
function get_wp_comment_ID( $comment ) { function get_wp_comment_ID( $comment ) {
global $wpdb; global $wpdb;
@ -642,7 +642,7 @@ class LJ_API_Import {
$this->commentmap[$comment] = $wpdb->get_var( $wpdb->prepare( "SELECT comment_ID FROM $wpdb->comments WHERE comment_karma = %d", $comment ) ); $this->commentmap[$comment] = $wpdb->get_var( $wpdb->prepare( "SELECT comment_ID FROM $wpdb->comments WHERE comment_karma = %d", $comment ) );
return $this->commentmap[$comment]; return $this->commentmap[$comment];
} }
function lj_ixr() { function lj_ixr() {
if ( $challenge = $this->ixr->query( 'LJ.XMLRPC.getchallenge' ) ) { if ( $challenge = $this->ixr->query( 'LJ.XMLRPC.getchallenge' ) ) {
$challenge = $this->ixr->getResponse(); $challenge = $this->ixr->getResponse();
@ -655,7 +655,7 @@ class LJ_API_Import {
} else { } else {
return new WP_Error( 'IXR', __( 'LiveJournal is not responding to authentication requests. Please wait a while and then try again.' ) ); return new WP_Error( 'IXR', __( 'LiveJournal is not responding to authentication requests. Please wait a while and then try again.' ) );
} }
$args = func_get_args(); $args = func_get_args();
$method = array_shift( $args ); $method = array_shift( $args );
if ( isset( $args[0] ) ) if ( isset( $args[0] ) )
@ -666,7 +666,7 @@ class LJ_API_Import {
return new WP_Error( 'IXR', __( 'XML-RPC Request Failed -- ' ) . $this->ixr->getErrorCode() . ': ' . $this->ixr->getErrorMessage() ); return new WP_Error( 'IXR', __( 'XML-RPC Request Failed -- ' ) . $this->ixr->getErrorCode() . ': ' . $this->ixr->getErrorMessage() );
} }
} }
function dispatch() { function dispatch() {
if ( empty( $_REQUEST['step'] ) ) if ( empty( $_REQUEST['step'] ) )
$step = 0; $step = 0;
@ -674,7 +674,7 @@ class LJ_API_Import {
$step = (int) $_REQUEST['step']; $step = (int) $_REQUEST['step'];
$this->header(); $this->header();
switch ( $step ) { switch ( $step ) {
case -1 : case -1 :
$this->cleanup(); $this->cleanup();
@ -711,7 +711,7 @@ class LJ_API_Import {
$this->username = get_option( 'ljapi_username' ); $this->username = get_option( 'ljapi_username' );
$this->password = get_option( 'ljapi_password' ); $this->password = get_option( 'ljapi_password' );
} }
// This is the password to set on protected posts // This is the password to set on protected posts
if ( !empty( $_POST['protected_password'] ) ) { if ( !empty( $_POST['protected_password'] ) ) {
$this->protected_password = $_POST['protected_password']; $this->protected_password = $_POST['protected_password'];
@ -719,7 +719,7 @@ class LJ_API_Import {
} else { } else {
$this->protected_password = get_option( 'ljapi_protected_password' ); $this->protected_password = get_option( 'ljapi_protected_password' );
} }
// Login to confirm the details are correct // Login to confirm the details are correct
if ( empty( $this->username ) || empty( $this->password ) ) { if ( empty( $this->username ) || empty( $this->password ) ) {
?> ?>
@ -745,12 +745,12 @@ class LJ_API_Import {
} else { } else {
update_option( 'ljapi_verified', 'yes' ); update_option( 'ljapi_verified', 'yes' );
} }
// Set up some options to avoid them autoloading (these ones get big) // Set up some options to avoid them autoloading (these ones get big)
add_option( 'ljapi_sync_item_times', '', '', 'no' ); add_option( 'ljapi_sync_item_times', '', '', 'no' );
add_option( 'ljapi_usermap', '', '', 'no' ); add_option( 'ljapi_usermap', '', '', 'no' );
update_option( 'ljapi_comment_batch', 0 ); update_option( 'ljapi_comment_batch', 0 );
return true; return true;
} }
@ -775,7 +775,7 @@ class LJ_API_Import {
return false; return false;
} }
} }
echo '<div id="ljapi-status">'; echo '<div id="ljapi-status">';
echo '<h3>' . __( 'Importing Posts' ) . '</h3>'; echo '<h3>' . __( 'Importing Posts' ) . '</h3>';
echo '<p>' . __( "We're downloading and importing your LiveJournal posts..." ) . '</p>'; echo '<p>' . __( "We're downloading and importing your LiveJournal posts..." ) . '</p>';
@ -785,7 +785,7 @@ class LJ_API_Import {
echo '<p><strong>' . sprintf( __( 'Imported post batch %d of <strong>approximately</strong> %d' ), ( get_option( 'ljapi_post_batch' ) + 1 ), $batch ) . '</strong></p>'; echo '<p><strong>' . sprintf( __( 'Imported post batch %d of <strong>approximately</strong> %d' ), ( get_option( 'ljapi_post_batch' ) + 1 ), $batch ) . '</strong></p>';
} }
ob_flush(); flush(); ob_flush(); flush();
if ( !get_option( 'ljapi_lastsync' ) || '1900-01-01 00:00:00' == get_option( 'ljapi_lastsync' ) ) { if ( !get_option( 'ljapi_lastsync' ) || '1900-01-01 00:00:00' == get_option( 'ljapi_lastsync' ) ) {
// We haven't downloaded meta yet, so do that first // We haven't downloaded meta yet, so do that first
$result = $this->download_post_meta(); $result = $this->download_post_meta();
@ -827,7 +827,7 @@ class LJ_API_Import {
} }
echo '</div>'; echo '</div>';
} }
// Download comments to local XML // Download comments to local XML
function step2() { function step2() {
set_time_limit( 0 ); set_time_limit( 0 );
@ -835,12 +835,12 @@ class LJ_API_Import {
$this->username = get_option( 'ljapi_username' ); $this->username = get_option( 'ljapi_username' );
$this->password = get_option( 'ljapi_password' ); $this->password = get_option( 'ljapi_password' );
$this->ixr = new IXR_Client( $this->ixr_url, false, 80, 30 ); $this->ixr = new IXR_Client( $this->ixr_url, false, 80, 30 );
echo '<div id="ljapi-status">'; echo '<div id="ljapi-status">';
echo '<h3>' . __( 'Downloading Comments' ) . '</h3>'; echo '<h3>' . __( 'Downloading Comments' ) . '</h3>';
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>'; 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>';
ob_flush(); flush(); ob_flush(); flush();
if ( !get_option( 'ljapi_usermap' ) ) { if ( !get_option( 'ljapi_usermap' ) ) {
// We haven't downloaded meta yet, so do that first // We haven't downloaded meta yet, so do that first
$result = $this->download_comment_meta(); $result = $this->download_comment_meta();
@ -877,18 +877,18 @@ class LJ_API_Import {
} }
echo '</div>'; echo '</div>';
} }
// Re-thread comments already in the DB // Re-thread comments already in the DB
function step3() { function step3() {
global $wpdb; global $wpdb;
set_time_limit( 0 ); set_time_limit( 0 );
update_option( 'ljapi_step', 3 ); update_option( 'ljapi_step', 3 );
echo '<div id="ljapi-status">'; echo '<div id="ljapi-status">';
echo '<h3>' . __( 'Threading Comments' ) . '</h3>'; echo '<h3>' . __( 'Threading Comments' ) . '</h3>';
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>'; 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>';
ob_flush(); flush(); ob_flush(); flush();
// Only bother adding indexes if they have over 5000 comments (arbitrary number) // Only bother adding indexes if they have over 5000 comments (arbitrary number)
$imported_comments = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->comments} WHERE comment_type = 'livejournal'" ); $imported_comments = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->comments} WHERE comment_type = 'livejournal'" );
$added_indices = false; $added_indices = false;
@ -899,18 +899,18 @@ class LJ_API_Import {
add_clean_index( $wpdb->comments, 'comment_karma' ); add_clean_index( $wpdb->comments, 'comment_karma' );
add_clean_index( $wpdb->comments, 'comment_agent' ); add_clean_index( $wpdb->comments, 'comment_agent' );
} }
// Get LJ comments, which haven't been threaded yet, 5000 at a time and thread them // Get LJ comments, which haven't been threaded yet, 5000 at a time and thread them
while ( $comments = $wpdb->get_results( "SELECT comment_ID, comment_agent FROM {$wpdb->comments} WHERE comment_type = 'livejournal' AND comment_agent != '0' LIMIT 5000", OBJECT ) ) { while ( $comments = $wpdb->get_results( "SELECT comment_ID, comment_agent FROM {$wpdb->comments} WHERE comment_type = 'livejournal' AND comment_agent != '0' LIMIT 5000", OBJECT ) ) {
foreach ( $comments as $comment ) { foreach ( $comments as $comment ) {
$wpdb->update( $wpdb->comments, $wpdb->update( $wpdb->comments,
array( 'comment_parent' => $this->get_wp_comment_ID( $comment->comment_agent ), 'comment_type' => 'livejournal-done' ), array( 'comment_parent' => $this->get_wp_comment_ID( $comment->comment_agent ), 'comment_type' => 'livejournal-done' ),
array( 'comment_ID' => $comment->comment_ID ) ); array( 'comment_ID' => $comment->comment_ID ) );
} }
wp_cache_flush(); wp_cache_flush();
$wpdb->flush(); $wpdb->flush();
} }
// Revert the comments table back to normal and optimize it to reclaim space // Revert the comments table back to normal and optimize it to reclaim space
if ( $added_indices ) { if ( $added_indices ) {
drop_index( $wpdb->comments, 'comment_type' ); drop_index( $wpdb->comments, 'comment_type' );
@ -918,7 +918,7 @@ class LJ_API_Import {
drop_index( $wpdb->comments, 'comment_agent' ); drop_index( $wpdb->comments, 'comment_agent' );
$wpdb->query( "OPTIMIZE TABLE {$wpdb->comments}" ); $wpdb->query( "OPTIMIZE TABLE {$wpdb->comments}" );
} }
// Clean up database and we're out // Clean up database and we're out
$this->cleanup(); $this->cleanup();
do_action( 'import_done', 'livejournal' ); do_action( 'import_done', 'livejournal' );
@ -929,13 +929,13 @@ class LJ_API_Import {
echo '</h3>'; echo '</h3>';
echo '</div>'; echo '</div>';
} }
// Output an error message with a button to try again. // Output an error message with a button to try again.
function throw_error( $error, $step ) { function throw_error( $error, $step ) {
echo '<p><strong>' . $error->get_error_message() . '</strong></p>'; echo '<p><strong>' . $error->get_error_message() . '</strong></p>';
echo $this->next_step( $step, __( 'Try Again' ) ); echo $this->next_step( $step, __( 'Try Again' ) );
} }
// Returns the HTML for a link to the next page // Returns the HTML for a link to the next page
function next_step( $next_step, $label, $id = 'ljapi-next-form' ) { function next_step( $next_step, $label, $id = 'ljapi-next-form' ) {
$str = '<form action="admin.php?import=livejournal" method="post" id="' . $id . '">'; $str = '<form action="admin.php?import=livejournal" method="post" id="' . $id . '">';
@ -944,10 +944,10 @@ class LJ_API_Import {
$str .= '<input type="hidden" name="step" id="step" value="' . $next_step . '" />'; $str .= '<input type="hidden" name="step" id="step" value="' . $next_step . '" />';
$str .= '<p><input type="submit" class="button-primary" value="' . attribute_escape( $label ) . '" /> <span id="auto-message"></span></p>'; $str .= '<p><input type="submit" class="button-primary" value="' . attribute_escape( $label ) . '" /> <span id="auto-message"></span></p>';
$str .= '</form>'; $str .= '</form>';
return $str; return $str;
} }
// Automatically submit the specified form after $seconds // Automatically submit the specified form after $seconds
// Include a friendly countdown in the element with id=$msg // Include a friendly countdown in the element with id=$msg
function auto_submit( $id = 'ljapi-next-form', $msg = 'auto-message', $seconds = 10 ) { function auto_submit( $id = 'ljapi-next-form', $msg = 'auto-message', $seconds = 10 ) {
@ -956,7 +956,7 @@ class LJ_API_Import {
jQuery(document).ready(function(){ jQuery(document).ready(function(){
ljapi_msg(); ljapi_msg();
}); });
function ljapi_msg() { function ljapi_msg() {
str = '<?php _e( "Continuing in %d" ) ?>'; str = '<?php _e( "Continuing in %d" ) ?>';
jQuery( '#<?php echo $msg ?>' ).text( str.replace( /%d/, next_counter ) ); jQuery( '#<?php echo $msg ?>' ).text( str.replace( /%d/, next_counter ) );
@ -974,7 +974,7 @@ class LJ_API_Import {
} }
</script><?php </script><?php
} }
// Automatically submit the form with #id to continue the process // Automatically submit the form with #id to continue the process
// Hide any submit buttons to avoid people clicking them // Hide any submit buttons to avoid people clicking them
// Display a countdown in the element indicated by $msg for "Continuing in x" // Display a countdown in the element indicated by $msg for "Continuing in x"
@ -984,7 +984,7 @@ class LJ_API_Import {
jQuery(document).ready(function(){ jQuery(document).ready(function(){
ljapi_msg(); ljapi_msg();
}); });
function ljapi_msg() { function ljapi_msg() {
str = '<?php _e( "Continuing in %d" ) ?>'; str = '<?php _e( "Continuing in %d" ) ?>';
jQuery( '#<?php echo $msg ?>' ).text( str.replace( /%d/, next_counter ) ); jQuery( '#<?php echo $msg ?>' ).text( str.replace( /%d/, next_counter ) );
@ -1011,7 +1011,7 @@ class LJ_API_Import {
// set wp_comments entries back to "normal" values // set wp_comments entries back to "normal" values
function cleanup() { function cleanup() {
global $wpdb; global $wpdb;
delete_option( 'ljapi_username' ); delete_option( 'ljapi_username' );
delete_option( 'ljapi_password' ); delete_option( 'ljapi_password' );
delete_option( 'ljapi_protected_password' ); delete_option( 'ljapi_protected_password' );
@ -1030,19 +1030,19 @@ class LJ_API_Import {
delete_option( 'ljapi_highest_comment_id' ); delete_option( 'ljapi_highest_comment_id' );
delete_option( 'ljapi_comment_batch' ); delete_option( 'ljapi_comment_batch' );
delete_option( 'ljapi_step' ); delete_option( 'ljapi_step' );
$wpdb->update( $wpdb->comments, $wpdb->update( $wpdb->comments,
array( 'comment_karma' => 0, 'comment_agent' => 'WP LJ Importer', 'comment_type' => '' ), array( 'comment_karma' => 0, 'comment_agent' => 'WP LJ Importer', 'comment_type' => '' ),
array( 'comment_type' => 'livejournal-done' ) ); array( 'comment_type' => 'livejournal-done' ) );
$wpdb->update( $wpdb->comments, $wpdb->update( $wpdb->comments,
array( 'comment_karma' => 0, 'comment_agent' => 'WP LJ Importer', 'comment_type' => '' ), array( 'comment_karma' => 0, 'comment_agent' => 'WP LJ Importer', 'comment_type' => '' ),
array( 'comment_type' => 'livejournal' ) ); array( 'comment_type' => 'livejournal' ) );
} }
function LJ_API_Import() { function LJ_API_Import() {
$this->__construct(); $this->__construct();
} }
function __construct() { function __construct() {
// Nothing // Nothing
} }

View File

@ -438,10 +438,10 @@ class MT_Import {
$ping->comment_author = $blog; $ping->comment_author = $blog;
} else { } else {
// Processing multi-line field, check context. // Processing multi-line field, check context.
if( !empty($line) ) if( !empty($line) )
$line .= "\n"; $line .= "\n";
if ( 'body' == $context ) { if ( 'body' == $context ) {
$post->post_content .= $line; $post->post_content .= $line;
} else if ( 'extended' == $context ) { } else if ( 'extended' == $context ) {

View File

@ -167,7 +167,7 @@ function wp_dashboard() {
<?php <?php
echo "\t<div class='postbox-container' style='$width'>\n"; echo "\t<div class='postbox-container' style='$width'>\n";
do_meta_boxes( 'dashboard', 'normal', '' ); do_meta_boxes( 'dashboard', 'normal', '' );
echo "\t</div><div class='postbox-container' style='{$hide2}$width'>\n"; echo "\t</div><div class='postbox-container' style='{$hide2}$width'>\n";
do_meta_boxes( 'dashboard', 'side', '' ); do_meta_boxes( 'dashboard', 'side', '' );

View File

@ -713,7 +713,7 @@ jQuery(function($){
jQuery("#ftp, #ftps").click(function () { jQuery("#ftp, #ftps").click(function () {
jQuery("#ssh_keys").hide(); jQuery("#ssh_keys").hide();
}); });
jQuery('form input[value=""]:first').focus(); jQuery('form input[value=""]:first').focus();
}); });
--> -->
</script> </script>

View File

@ -1549,9 +1549,9 @@ jQuery(function($){
--> -->
</script> </script>
<div id="sort-buttons" class="hide-if-no-js"> <div id="sort-buttons" class="hide-if-no-js">
<?php _e('Sort Order:'); ?> <?php _e('Sort Order:'); ?>
<a href="#" id="asc"><?php _e('Ascending'); ?></a> <a href="#" id="asc"><?php _e('Ascending'); ?></a>
<a href="#" id="desc"><?php _e('Descending'); ?></a> <a href="#" id="desc"><?php _e('Descending'); ?></a>
<a href="#" id="clear"><?php _e('Clear'); ?></a> <a href="#" id="clear"><?php _e('Clear'); ?></a>
</div> </div>
<form enctype="multipart/form-data" method="post" action="<?php echo attribute_escape($form_action_url); ?>" class="media-upload-form validate" id="gallery-form"> <form enctype="multipart/form-data" method="post" action="<?php echo attribute_escape($form_action_url); ?>" class="media-upload-form validate" id="gallery-form">

View File

@ -241,7 +241,7 @@ function show_message($message) {
function wp_doc_link_parse( $content ) { function wp_doc_link_parse( $content ) {
if ( !is_string( $content ) || empty( $content ) ) if ( !is_string( $content ) || empty( $content ) )
return array(); return array();
$tokens = token_get_all( $content ); $tokens = token_get_all( $content );
$functions = array(); $functions = array();
$ignore_functions = array(); $ignore_functions = array();
@ -256,51 +256,51 @@ function wp_doc_link_parse( $content ) {
$functions[] = $tokens[$t][1]; $functions[] = $tokens[$t][1];
} }
} }
$functions = array_unique( $functions ); $functions = array_unique( $functions );
sort( $functions ); sort( $functions );
$ignore_functions = apply_filters( 'documentation_ignore_functions', $ignore_functions ); $ignore_functions = apply_filters( 'documentation_ignore_functions', $ignore_functions );
$ignore_functions = array_unique( $ignore_functions ); $ignore_functions = array_unique( $ignore_functions );
$out = array(); $out = array();
foreach ( $functions as $function ) { foreach ( $functions as $function ) {
if ( in_array( $function, $ignore_functions ) ) if ( in_array( $function, $ignore_functions ) )
continue; continue;
$out[] = $function; $out[] = $function;
} }
return $out; return $out;
} }
/** /**
* Determines the language to use for CodePress syntax highlighting, * Determines the language to use for CodePress syntax highlighting,
* based only on a filename. * based only on a filename.
* *
* @since 2.8 * @since 2.8
* *
* @param string $filename The name of the file to be highlighting * @param string $filename The name of the file to be highlighting
**/ **/
function codepress_get_lang( $filename ) { function codepress_get_lang( $filename ) {
$codepress_supported_langs = apply_filters( 'codepress_supported_langs', $codepress_supported_langs = apply_filters( 'codepress_supported_langs',
array( '.css' => 'css', array( '.css' => 'css',
'.js' => 'javascript', '.js' => 'javascript',
'.php' => 'php', '.php' => 'php',
'.html' => 'html', '.html' => 'html',
'.htm' => 'html', '.htm' => 'html',
'.txt' => 'text' '.txt' => 'text'
) ); ) );
$extension = substr( $filename, strrpos( $filename, '.' ) ); $extension = substr( $filename, strrpos( $filename, '.' ) );
if ( $extension && array_key_exists( $extension, $codepress_supported_langs ) ) if ( $extension && array_key_exists( $extension, $codepress_supported_langs ) )
return $codepress_supported_langs[$extension]; return $codepress_supported_langs[$extension];
return 'generic'; return 'generic';
} }
/** /**
* Adds Javascript required to make CodePress work on the theme/plugin editors. * Adds Javascript required to make CodePress work on the theme/plugin editors.
* *
* This code is attached to the action admin_print_footer_scripts. * This code is attached to the action admin_print_footer_scripts.
* *
* @since 2.8 * @since 2.8
**/ **/
function codepress_footer_js() { function codepress_footer_js() {

View File

@ -411,7 +411,7 @@ function post_exists($title, $content = '', $date = '') {
global $wpdb; global $wpdb;
$post_title = stripslashes( sanitize_post_field( 'post_title', $title, 0, 'db' ) ); $post_title = stripslashes( sanitize_post_field( 'post_title', $title, 0, 'db' ) );
$post_content = stripslashes( sanitize_post_field( 'post_content', $content, 0, 'db' ) ); $post_content = stripslashes( sanitize_post_field( 'post_content', $content, 0, 'db' ) );
$post_date = stripslashes( sanitize_post_field( 'post_date', $date, 0, 'db' ) ); $post_date = stripslashes( sanitize_post_field( 'post_date', $date, 0, 'db' ) );
$query = "SELECT ID FROM $wpdb->posts WHERE 1=1"; $query = "SELECT ID FROM $wpdb->posts WHERE 1=1";
@ -431,7 +431,7 @@ function post_exists($title, $content = '', $date = '') {
$query .= 'AND post_content = %s'; $query .= 'AND post_content = %s';
$args[] = $post_content; $args[] = $post_content;
} }
if ( !empty ( $args ) ) if ( !empty ( $args ) )
return $wpdb->get_var( $wpdb->prepare($query, $args) ); return $wpdb->get_var( $wpdb->prepare($query, $args) );
@ -924,7 +924,7 @@ function get_sample_permalink($id, $title=null, $name = null) {
$post->post_name = sanitize_title($name? $name : $title, $post->ID); $post->post_name = sanitize_title($name? $name : $title, $post->ID);
} }
$post->filter = 'sample'; $post->filter = 'sample';
$permalink = get_permalink($post, true); $permalink = get_permalink($post, true);
@ -963,7 +963,7 @@ function get_sample_permalink_html( $id, $new_title = null, $new_slug = null ) {
list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug); list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
if ( 'publish' == $post->post_status ) if ( 'publish' == $post->post_status )
$view_post = 'post' == $post->post_type ? __('View Post') : __('View Page'); $view_post = 'post' == $post->post_type ? __('View Post') : __('View Page');
if ( false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%') ) { if ( false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%') ) {
$return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink">' . $permalink . "</span>\n"; $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink">' . $permalink . "</span>\n";
$return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button" target="_blank">' . __('Change Permalinks') . "</a></span>\n"; $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
@ -1144,7 +1144,7 @@ function post_preview() {
*/ */
function wp_tiny_mce( $teeny = false ) { function wp_tiny_mce( $teeny = false ) {
global $concatenate_scripts, $compress_scripts; global $concatenate_scripts, $compress_scripts;
if ( ! user_can_richedit() ) if ( ! user_can_richedit() )
return; return;

View File

@ -328,7 +328,7 @@ function populate_options() {
$option = $wpdb->escape($option); $option = $wpdb->escape($option);
$value = $wpdb->escape($value); $value = $wpdb->escape($value);
if ( !empty($insert) ) if ( !empty($insert) )
$insert .= ', '; $insert .= ', ';
$insert .= "('$option', '$value', '$autoload')"; $insert .= "('$option', '$value', '$autoload')";
} }

View File

@ -218,7 +218,7 @@ function get_terms_to_edit( $post_id, $taxonomy = 'post_tag' ) {
if ( is_wp_error($tags) ) if ( is_wp_error($tags) )
return $tags; return $tags;
foreach ( $tags as $tag ) foreach ( $tags as $tag )
$tag_names[] = $tag->name; $tag_names[] = $tag->name;
$tags_to_edit = join( ',', $tag_names ); $tags_to_edit = join( ',', $tag_names );

View File

@ -368,7 +368,7 @@ function link_cat_row( $category, $name_override = false ) {
* Outputs the html checked attribute. * Outputs the html checked attribute.
* *
* Compares the first two arguments and if identical marks as checked * Compares the first two arguments and if identical marks as checked
* *
* @since unknown * @since unknown
* *
* @param any $checked One of the values to compare * @param any $checked One of the values to compare
@ -381,7 +381,7 @@ function checked( $checked, $current = true, $echo = true) {
/** /**
* Outputs the html selected attribute. * Outputs the html selected attribute.
* *
* Compares the first two arguments and if identical marks as selected * Compares the first two arguments and if identical marks as selected
* *
* @since unknown * @since unknown
@ -396,7 +396,7 @@ function selected( $selected, $current = true, $echo = true) {
/** /**
* Private helper function for checked and selected. * Private helper function for checked and selected.
* *
* Compares the first two arguments and if identical marks as $type * Compares the first two arguments and if identical marks as $type
* *
* @since unknown * @since unknown
@ -412,10 +412,10 @@ function __checked_selected_helper( $helper, $current, $echo, $type) {
$result = " $type='$type'"; $result = " $type='$type'";
else else
$result = ''; $result = '';
if ($echo) if ($echo)
echo $result; echo $result;
return $result; return $result;
} }
@ -2751,8 +2751,8 @@ function wp_import_upload_form( $action ) {
$upload_dir = wp_upload_dir(); $upload_dir = wp_upload_dir();
if ( ! empty( $upload_dir['error'] ) ) : if ( ! empty( $upload_dir['error'] ) ) :
?><div class="error"><p><?php _e('Before you can upload your import file, you will need to fix the following error:'); ?></p> ?><div class="error"><p><?php _e('Before you can upload your import file, you will need to fix the following error:'); ?></p>
<p><strong><?php echo $upload_dir['error']; ?></strong></p></div><?php <p><strong><?php echo $upload_dir['error']; ?></strong></p></div><?php
else : else :
?> ?>
<form enctype="multipart/form-data" id="import-upload-form" method="post" action="<?php echo attribute_escape($action) ?>"> <form enctype="multipart/form-data" id="import-upload-form" method="post" action="<?php echo attribute_escape($action) ?>">
<p> <p>
@ -3473,7 +3473,7 @@ function screen_layout($screen) {
$screen_layout_columns = 0; $screen_layout_columns = 0;
return ''; return '';
} }
if ( ! $screen_layout_columns ) if ( ! $screen_layout_columns )
$screen_layout_columns = 2; $screen_layout_columns = 2;

View File

@ -18,7 +18,7 @@ $theme_field_defaults = array( 'description' => true, 'sections' => false, 'test
'rating' => true, 'downloaded' => true, 'downloadlink' => true, 'last_updated' => true, 'homepage' => true, 'rating' => true, 'downloaded' => true, 'downloadlink' => true, 'last_updated' => true, 'homepage' => true,
'tags' => true, 'num_ratings' => true 'tags' => true, 'num_ratings' => true
); );
/** /**
* Retrieve theme installer pages from WordPress Themes API. * Retrieve theme installer pages from WordPress Themes API.
@ -302,12 +302,12 @@ function display_theme($theme, $actions = null, $show_details = true) {
<div class="themedetaildiv hide-if-js"> <div class="themedetaildiv hide-if-js">
<p><strong><?php _e('Version:') ?></strong> <?php echo wp_kses($theme->version, $themes_allowedtags) ?></p> <p><strong><?php _e('Version:') ?></strong> <?php echo wp_kses($theme->version, $themes_allowedtags) ?></p>
<p><strong><?php _e('Author:') ?></strong> <?php echo wp_kses($theme->author, $themes_allowedtags) ?></p> <p><strong><?php _e('Author:') ?></strong> <?php echo wp_kses($theme->author, $themes_allowedtags) ?></p>
<?php if ( ! empty($theme->last_updated) ) : ?> <?php if ( ! empty($theme->last_updated) ) : ?>
<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> <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>
<?php endif; if ( ! empty($theme->requires) ) : ?> <?php endif; if ( ! empty($theme->requires) ) : ?>
<p><strong><?php _e('Requires WordPress Version:') ?></strong> <?php printf(__('%s or higher'), $theme->requires) ?></p> <p><strong><?php _e('Requires WordPress Version:') ?></strong> <?php printf(__('%s or higher'), $theme->requires) ?></p>
<?php endif; if ( ! empty($theme->tested) ) : ?> <?php endif; if ( ! empty($theme->tested) ) : ?>
<p><strong><?php _e('Compatible up to:') ?></strong> <?php echo $theme->tested ?></p> <p><strong><?php _e('Compatible up to:') ?></strong> <?php echo $theme->tested ?></p>
<?php endif; if ( !empty($theme->downloaded) ) : ?> <?php endif; if ( !empty($theme->downloaded) ) : ?>
<p><strong><?php _e('Downloaded:') ?></strong> <?php printf(_n('%s time', '%s times', $theme->downloaded), number_format_i18n($theme->downloaded)) ?></p> <p><strong><?php _e('Downloaded:') ?></strong> <?php printf(_n('%s time', '%s times', $theme->downloaded), number_format_i18n($theme->downloaded)) ?></p>
<?php endif; ?> <?php endif; ?>
@ -843,7 +843,7 @@ function wp_install_theme_local_package($package, $feedback = '') {
$wp_filesystem->delete($working_dir, true); $wp_filesystem->delete($working_dir, true);
return new WP_Error('install_folder_exists', __('Folder already exists.'), $filelist[0] ); return new WP_Error('install_folder_exists', __('Folder already exists.'), $filelist[0] );
} }
apply_filters('install_feedback', __('Installing the theme')); apply_filters('install_feedback', __('Installing the theme'));
// Copy new version of theme into place. // Copy new version of theme into place.
$result = copy_dir($working_dir, $themes_dir); $result = copy_dir($working_dir, $themes_dir);

View File

@ -96,7 +96,7 @@ function wp_install_defaults($user_id) {
$cat_name = __('Uncategorized'); $cat_name = __('Uncategorized');
/* translators: Default category slug */ /* translators: Default category slug */
$cat_slug = sanitize_title(_x('Uncategorized', 'Default category slug')); $cat_slug = sanitize_title(_x('Uncategorized', 'Default category slug'));
$wpdb->insert( $wpdb->terms, array('name' => $cat_name, 'slug' => $cat_slug, 'term_group' => 0) ); $wpdb->insert( $wpdb->terms, array('name' => $cat_name, 'slug' => $cat_slug, 'term_group' => 0) );
$wpdb->insert( $wpdb->term_taxonomy, array('term_id' => '1', 'taxonomy' => 'category', 'description' => '', 'parent' => 0, 'count' => 1)); $wpdb->insert( $wpdb->term_taxonomy, array('term_id' => '1', 'taxonomy' => 'category', 'description' => '', 'parent' => 0, 'count' => 1));
@ -104,7 +104,7 @@ function wp_install_defaults($user_id) {
$cat_name = __('Blogroll'); $cat_name = __('Blogroll');
/* translators: Default link category slug */ /* translators: Default link category slug */
$cat_slug = sanitize_title(_x('Blogroll', 'Default link category slug')); $cat_slug = sanitize_title(_x('Blogroll', 'Default link category slug'));
$wpdb->insert( $wpdb->terms, array('name' => $cat_name, 'slug' => $cat_slug, 'term_group' => 0) ); $wpdb->insert( $wpdb->terms, array('name' => $cat_name, 'slug' => $cat_slug, 'term_group' => 0) );
$wpdb->insert( $wpdb->term_taxonomy, array('term_id' => '2', 'taxonomy' => 'link_category', 'description' => '', 'parent' => 0, 'count' => 7)); $wpdb->insert( $wpdb->term_taxonomy, array('term_id' => '2', 'taxonomy' => 'link_category', 'description' => '', 'parent' => 0, 'count' => 7));
@ -117,7 +117,7 @@ function wp_install_defaults($user_id) {
'link_notes' => ''); 'link_notes' => '');
$default_links[] = array( 'link_url' => 'http://wordpress.org/development/', $default_links[] = array( 'link_url' => 'http://wordpress.org/development/',
'link_name' => 'Development Blog', 'link_name' => 'Development Blog',
'link_category' => 0, 'link_category' => 0,
'link_rss' => 'http://wordpress.org/development/feed/', 'link_rss' => 'http://wordpress.org/development/feed/',
'link_notes' => ''); 'link_notes' => '');
@ -161,7 +161,7 @@ function wp_install_defaults($user_id) {
$now = date('Y-m-d H:i:s'); $now = date('Y-m-d H:i:s');
$now_gmt = gmdate('Y-m-d H:i:s'); $now_gmt = gmdate('Y-m-d H:i:s');
$first_post_guid = get_option('home') . '/?p=1'; $first_post_guid = get_option('home') . '/?p=1';
$wpdb->insert( $wpdb->posts, array( $wpdb->insert( $wpdb->posts, array(
'post_author' => $user_id, 'post_author' => $user_id,
'post_date' => $now, 'post_date' => $now,
@ -176,7 +176,7 @@ function wp_install_defaults($user_id) {
'post_modified_gmt' => $now_gmt, 'post_modified_gmt' => $now_gmt,
'guid' => $first_post_guid, 'guid' => $first_post_guid,
'comment_count' => 1, 'comment_count' => 1,
'to_ping' => '', 'to_ping' => '',
'pinged' => '', 'pinged' => '',
'post_content_filtered' => '' 'post_content_filtered' => ''
)); ));
@ -208,7 +208,7 @@ function wp_install_defaults($user_id) {
'post_modified_gmt' => $now_gmt, 'post_modified_gmt' => $now_gmt,
'guid' => $first_post_guid, 'guid' => $first_post_guid,
'post_type' => 'page', 'post_type' => 'page',
'to_ping' => '', 'to_ping' => '',
'pinged' => '', 'pinged' => '',
'post_content_filtered' => '' 'post_content_filtered' => ''
)); ));
@ -518,7 +518,7 @@ function upgrade_130() {
foreach($comments as $comment) { foreach($comments as $comment) {
$comment_content = deslash($comment->comment_content); $comment_content = deslash($comment->comment_content);
$comment_author = deslash($comment->comment_author); $comment_author = deslash($comment->comment_author);
$wpdb->update($wpdb->comments, compact('comment_content', 'comment_author'), array('comment_ID' => $comment->comment_ID) ); $wpdb->update($wpdb->comments, compact('comment_content', 'comment_author'), array('comment_ID' => $comment->comment_ID) );
} }
} }
@ -529,7 +529,7 @@ function upgrade_130() {
foreach($links as $link) { foreach($links as $link) {
$link_name = deslash($link->link_name); $link_name = deslash($link->link_name);
$link_description = deslash($link->link_description); $link_description = deslash($link->link_description);
$wpdb->update( $wpdb->links, compact('link_name', 'link_description'), array('link_id' => $link->link_id) ); $wpdb->update( $wpdb->links, compact('link_name', 'link_description'), array('link_id' => $link->link_id) );
} }
} }
@ -641,7 +641,7 @@ function upgrade_160() {
$objects = $wpdb->get_results("SELECT ID, post_type FROM $wpdb->posts WHERE post_status = 'object'"); $objects = $wpdb->get_results("SELECT ID, post_type FROM $wpdb->posts WHERE post_status = 'object'");
foreach ($objects as $object) { foreach ($objects as $object) {
$wpdb->update( $wpdb->posts, array( 'post_status' => 'attachment', $wpdb->update( $wpdb->posts, array( 'post_status' => 'attachment',
'post_mime_type' => $object->post_type, 'post_mime_type' => $object->post_type,
'post_type' => ''), 'post_type' => ''),
array( 'ID' => $object->ID ) ); array( 'ID' => $object->ID ) );

View File

@ -10,7 +10,7 @@
* Creates a new user from the "Users" form using $_POST information. * Creates a new user from the "Users" form using $_POST information.
* *
* It seems that the first half is for backwards compatibility, but only * It seems that the first half is for backwards compatibility, but only
* has the ability to alter the user's role. Wordpress core seems to * has the ability to alter the user's role. Wordpress core seems to
* use this function only in the second way, running edit_user() with * use this function only in the second way, running edit_user() with
* no id so as to create a new user. * no id so as to create a new user.
* *
@ -31,7 +31,7 @@ function add_user() {
$editable_roles = get_editable_roles(); $editable_roles = get_editable_roles();
if (!$editable_roles[$_POST['role']]) if (!$editable_roles[$_POST['role']])
wp_die(__('You can&#8217;t give users that role.')); wp_die(__('You can&#8217;t give users that role.'));
$user = new WP_User( $user_id ); $user = new WP_User( $user_id );
$user->set_role( $_POST['role'] ); $user->set_role( $_POST['role'] );
} }
@ -77,7 +77,7 @@ function edit_user( $user_id = 0 ) {
// Don't let anyone with 'edit_users' (admins) edit their own role to something without it. // Don't let anyone with 'edit_users' (admins) edit their own role to something without it.
if( $user_id != $current_user->id || $wp_roles->role_objects[$_POST['role']]->has_cap( 'edit_users' )) if( $user_id != $current_user->id || $wp_roles->role_objects[$_POST['role']]->has_cap( 'edit_users' ))
$user->role = $_POST['role']; $user->role = $_POST['role'];
// If the new role isn't editable by the logged-in user die with error // If the new role isn't editable by the logged-in user die with error
$editable_roles = get_editable_roles(); $editable_roles = get_editable_roles();
@ -258,16 +258,16 @@ function get_editable_user_ids( $user_id, $exclude_zeros = true, $post_type = 'p
} }
/** /**
* Fetch a filtered list of user roles that the current user is * Fetch a filtered list of user roles that the current user is
* allowed to edit. * allowed to edit.
* *
* Simple function who's main purpose is to allow filtering of the * Simple function who's main purpose is to allow filtering of the
* list of roles in the $wp_roles object so that plugins can remove * list of roles in the $wp_roles object so that plugins can remove
* innappropriate ones depending on the situation or user making edits. * innappropriate ones depending on the situation or user making edits.
* Specifically because without filtering anyone with the edit_users * Specifically because without filtering anyone with the edit_users
* capability can edit others to be administrators, even if they are * capability can edit others to be administrators, even if they are
* only editors or authors. This filter allows admins to delegate * only editors or authors. This filter allows admins to delegate
* user management. * user management.
* *
* @since 2.8 * @since 2.8
* *
@ -277,8 +277,8 @@ function get_editable_roles() {
global $wp_roles; global $wp_roles;
$all_roles = $wp_roles->roles; $all_roles = $wp_roles->roles;
$editable_roles = apply_filters('editable_roles', $all_roles); $editable_roles = apply_filters('editable_roles', $all_roles);
return $editable_roles; return $editable_roles;
} }

View File

@ -93,8 +93,8 @@ include('./admin-header.php');
</td> </td>
</tr> </tr>
<tr> <tr>
<?php <?php
if (!wp_timezone_supported()) : // no magic timezone support here if (!wp_timezone_supported()) : // no magic timezone support here
?> ?>
<th scope="row"><label for="gmt_offset"><?php _e('Timezone') ?> </label></th> <th scope="row"><label for="gmt_offset"><?php _e('Timezone') ?> </label></th>
<td> <td>
@ -130,7 +130,7 @@ foreach ( $offset_range as $offset ) {
<br/> <br/>
<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> <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>
</td> </td>
<?php <?php
else: // looks like we can do nice timezone selection! else: // looks like we can do nice timezone selection!
$current_offset = get_option('gmt_offset'); $current_offset = get_option('gmt_offset');
$tzstring = get_option('timezone_string'); $tzstring = get_option('timezone_string');
@ -158,7 +158,7 @@ if (empty($tzstring)) { // set the Etc zone if no timezone string exists
?> ?>
<br /> <br />
<?php <?php
if (function_exists('timezone_transitions_get') && $tzstring) { if (function_exists('timezone_transitions_get') && $tzstring) {
$dateTimeZoneSelected = new DateTimeZone($tzstring); $dateTimeZoneSelected = new DateTimeZone($tzstring);
foreach (timezone_transitions_get($dateTimeZoneSelected) as $tr) { foreach (timezone_transitions_get($dateTimeZoneSelected) as $tr) {
if ($tr['ts'] > time()) { if ($tr['ts'] > time()) {
@ -166,7 +166,7 @@ if (empty($tzstring)) { // set the Etc zone if no timezone string exists
break; break;
} }
} }
if ($found) { if ($found) {
_e(' '); _e(' ');
$message = $tr['isdst'] ? $message = $tr['isdst'] ?

View File

@ -488,16 +488,16 @@ var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>';
<div id="tagsdiv-post_tag" class="stuffbox" > <div id="tagsdiv-post_tag" class="stuffbox" >
<h3><span><?php _e('Post Tags'); ?></span></h3> <h3><span><?php _e('Post Tags'); ?></span></h3>
<div class="inside"> <div class="inside">
<div class="tagsdiv" id="post_tag"> <div class="tagsdiv" id="post_tag">
<p class="jaxtag"> <p class="jaxtag">
<label class="hidden" for="newtag"><?php _e('Post Tags'); ?></label> <label class="hidden" for="newtag"><?php _e('Post Tags'); ?></label>
<input type="hidden" name="tax_input[post_tag]" class="the-tags" id="tax-input[post_tag]" value="" /> <input type="hidden" name="tax_input[post_tag]" class="the-tags" id="tax-input[post_tag]" value="" />
<span class="ajaxtag" style="display:none;"> <span class="ajaxtag" style="display:none;">
<input type="text" name="newtag[post_tag]" class="newtag form-input-tip" size="16" autocomplete="off" value="<?php _e('Add new tag'); ?>" /> <input type="text" name="newtag[post_tag]" class="newtag form-input-tip" size="16" autocomplete="off" value="<?php _e('Add new tag'); ?>" />
<input type="button" class="button tagadd" value="Add" tabindex="3" /> <input type="button" class="button tagadd" value="Add" tabindex="3" />
</span> </span>
</p> </p>
<div class="tagchecklist"></div> <div class="tagchecklist"></div>
</div> </div>
<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> <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>
</div> </div>

View File

@ -191,7 +191,7 @@ foreach ( $cols as $col => $theme_name ) {
$actions[] = '<a href="' . $activate_link . '" title="' . $activate_text . '">' . __('Activate') . '</a>'; $actions[] = '<a href="' . $activate_link . '" title="' . $activate_text . '">' . __('Activate') . '</a>';
$actions[] = '<a href="' . $preview_link . '" class="thickbox thickbox-preview" title="' . attribute_escape(sprintf(__('Preview "%s"'), $theme_name)) . '">' . __('Preview') . '</a>'; $actions[] = '<a href="' . $preview_link . '" class="thickbox thickbox-preview" title="' . attribute_escape(sprintf(__('Preview "%s"'), $theme_name)) . '">' . __('Preview') . '</a>';
if ( current_user_can('update_themes') ) if ( current_user_can('update_themes') )
$actions[] = '<a class="submitdelete deletion" href="' . wp_nonce_url("themes.php?action=delete&amp;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>'; $actions[] = '<a class="submitdelete deletion" href="' . wp_nonce_url("themes.php?action=delete&amp;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>';
$actions = apply_filters('theme_action_links', $actions, $themes[$theme_name]); $actions = apply_filters('theme_action_links', $actions, $themes[$theme_name]);
$actions = implode ( ' | ', $actions ); $actions = implode ( ' | ', $actions );

View File

@ -517,9 +517,9 @@ function wp_list_authors($args = '') {
} }
foreach ( (array) $authors as $author ) { foreach ( (array) $authors as $author ) {
$link = ''; $link = '';
$author = get_userdata( $author->ID ); $author = get_userdata( $author->ID );
$posts = (isset($author_count[$author->ID])) ? $author_count[$author->ID] : 0; $posts = (isset($author_count[$author->ID])) ? $author_count[$author->ID] : 0;
$name = $author->display_name; $name = $author->display_name;

View File

@ -355,9 +355,9 @@ class WP {
} }
} }
$headers = apply_filters('wp_headers', $headers, $this); $headers = apply_filters('wp_headers', $headers, $this);
if ( ! empty( $status ) ) if ( ! empty( $status ) )
status_header( $status ); status_header( $status );
foreach( (array) $headers as $name => $field_value ) foreach( (array) $headers as $name => $field_value )
@header("{$name}: {$field_value}"); @header("{$name}: {$field_value}");

View File

@ -1029,7 +1029,7 @@ function get_post_reply_link($args = array(), $post = null) {
$args = wp_parse_args($args, $defaults); $args = wp_parse_args($args, $defaults);
extract($args, EXTR_SKIP); extract($args, EXTR_SKIP);
$post = get_post($post); $post = get_post($post);
if ( !comments_open($post->ID) ) if ( !comments_open($post->ID) )
return false; return false;

View File

@ -1340,7 +1340,7 @@ function do_trackbacks($post_id) {
$to_ping = get_to_ping($post_id); $to_ping = get_to_ping($post_id);
$pinged = get_pung($post_id); $pinged = get_pung($post_id);
if ( empty($to_ping) ) { if ( empty($to_ping) ) {
$wpdb->update($wpdb->posts, array('to_ping' => ''), array('ID' => $post_id) ); $wpdb->update($wpdb->posts, array('to_ping' => ''), array('ID' => $post_id) );
return; return;
} }

View File

@ -1,7 +1,7 @@
<?php <?php
/** /**
* Default Widgets * Default Widgets
* *
* @package WordPress * @package WordPress
* @subpackage Widgets * @subpackage Widgets
@ -42,7 +42,7 @@ class WP_Widget_Pages extends WP_Widget {
echo $after_widget; echo $after_widget;
} }
} }
function update( $new_instance, $old_instance ) { function update( $new_instance, $old_instance ) {
$instance = $old_instance; $instance = $old_instance;
$instance['title'] = strip_tags($new_instance['title']); $instance['title'] = strip_tags($new_instance['title']);
@ -56,7 +56,7 @@ class WP_Widget_Pages extends WP_Widget {
return $instance; return $instance;
} }
function form( $instance ) { function form( $instance ) {
//Defaults //Defaults
$instance = wp_parse_args( (array) $instance, array( 'sortby' => 'post_title', 'title' => '', 'exclude' => '') ); $instance = wp_parse_args( (array) $instance, array( 'sortby' => 'post_title', 'title' => '', 'exclude' => '') );
@ -102,7 +102,7 @@ class WP_Widget_Links extends WP_Widget {
$show_name = isset($instance['name']) ? $instance['name'] : false; $show_name = isset($instance['name']) ? $instance['name'] : false;
$show_rating = isset($instance['rating']) ? $instance['rating'] : false; $show_rating = isset($instance['rating']) ? $instance['rating'] : false;
$show_images = isset($instance['images']) ? $instance['images'] : true; $show_images = isset($instance['images']) ? $instance['images'] : true;
$before_widget = preg_replace('/id="[^"]*"/','id="%id"', $before_widget); $before_widget = preg_replace('/id="[^"]*"/','id="%id"', $before_widget);
wp_list_bookmarks(apply_filters('widget_links_args', array( wp_list_bookmarks(apply_filters('widget_links_args', array(
'title_before' => $before_title, 'title_after' => $after_title, 'title_before' => $before_title, 'title_after' => $after_title,
@ -112,7 +112,7 @@ class WP_Widget_Links extends WP_Widget {
'class' => 'linkcat widget' 'class' => 'linkcat widget'
))); )));
} }
function update( $new_instance, $old_instance ) { function update( $new_instance, $old_instance ) {
$new_instance = (array) $new_instance; $new_instance = (array) $new_instance;
$instance = array( 'images' => 0, 'name' => 0, 'description' => 0, 'rating' => 0); $instance = array( 'images' => 0, 'name' => 0, 'description' => 0, 'rating' => 0);
@ -120,10 +120,10 @@ class WP_Widget_Links extends WP_Widget {
if ( isset($new_instance[$field]) ) if ( isset($new_instance[$field]) )
$instance[$field] = 1; $instance[$field] = 1;
} }
return $instance; return $instance;
} }
function form( $instance ) { function form( $instance ) {
//Defaults //Defaults
@ -162,7 +162,7 @@ class WP_Widget_Search extends WP_Widget {
// Use current theme search form if it exists // Use current theme search form if it exists
get_search_form(); get_search_form();
echo $after_widget; echo $after_widget;
} }
} }
@ -232,7 +232,7 @@ class WP_Widget_Archives extends WP_Widget {
* Meta widget class * Meta widget class
* *
* Displays log in/out, RSS feed links, etc. * Displays log in/out, RSS feed links, etc.
* *
* @since 2.8.0 * @since 2.8.0
*/ */
class WP_Widget_Meta extends WP_Widget { class WP_Widget_Meta extends WP_Widget {
@ -414,9 +414,9 @@ class WP_Widget_Categories extends WP_Widget {
<?php <?php
} }
echo $after_widget; echo $after_widget;
} }
function update( $new_instance, $old_instance ) { function update( $new_instance, $old_instance ) {
$instance = $old_instance; $instance = $old_instance;
$instance['title'] = strip_tags($new_instance['title']); $instance['title'] = strip_tags($new_instance['title']);
@ -426,7 +426,7 @@ class WP_Widget_Categories extends WP_Widget {
return $instance; return $instance;
} }
function form( $instance ) { function form( $instance ) {
//Defaults //Defaults
$instance = wp_parse_args( (array) $instance, array( 'title' => '') ); $instance = wp_parse_args( (array) $instance, array( 'title' => '') );

View File

@ -651,7 +651,7 @@ function delete_transient($transient) {
* *
* If the transient does not exist or does not have a value, then the return value * If the transient does not exist or does not have a value, then the return value
* will be false. * will be false.
* *
* @since 2.8.0 * @since 2.8.0
* @package WordPress * @package WordPress
* @subpackage Transient * @subpackage Transient
@ -710,7 +710,7 @@ function set_transient($transient, $value, $expiration = 0) {
if ( false === get_option( $safe_transient ) ) { if ( false === get_option( $safe_transient ) ) {
$autoload = 'yes'; $autoload = 'yes';
if ( 0 != $expiration ) { if ( 0 != $expiration ) {
$autoload = 'no'; $autoload = 'no';
add_option($transient_timeout, time() + $expiration, '', 'no'); add_option($transient_timeout, time() + $expiration, '', 'no');
} }
return add_option($transient, $value, '', $autoload); return add_option($transient, $value, '', $autoload);
@ -1489,7 +1489,7 @@ function wp_get_nocache_headers() {
'Cache-Control' => 'no-cache, must-revalidate, max-age=0', 'Cache-Control' => 'no-cache, must-revalidate, max-age=0',
'Pragma' => 'no-cache', 'Pragma' => 'no-cache',
); );
if ( function_exists('apply_filters') ) { if ( function_exists('apply_filters') ) {
$headers = apply_filters('nocache_headers', $headers); $headers = apply_filters('nocache_headers', $headers);
} }
@ -1507,8 +1507,8 @@ function wp_get_nocache_headers() {
*/ */
function nocache_headers() { function nocache_headers() {
$headers = wp_get_nocache_headers(); $headers = wp_get_nocache_headers();
foreach( (array) $headers as $name => $field_value ) foreach( (array) $headers as $name => $field_value )
@header("{$name}: {$field_value}"); @header("{$name}: {$field_value}");
} }
/** /**
@ -3051,7 +3051,7 @@ function update_site_option( $key, $value ) {
/** /**
* gmt_offset modification for smart timezone handling * gmt_offset modification for smart timezone handling
* *
* Overrides the gmt_offset option if we have a timezone_string available * Overrides the gmt_offset option if we have a timezone_string available
*/ */
function wp_timezone_override_offset() { function wp_timezone_override_offset() {
@ -3061,27 +3061,27 @@ function wp_timezone_override_offset() {
if (empty($tz)) return false; if (empty($tz)) return false;
@date_default_timezone_set($tz); @date_default_timezone_set($tz);
$dateTimeZoneSelected = timezone_open($tz); $dateTimeZoneSelected = timezone_open($tz);
$dateTimeServer = date_create(); $dateTimeServer = date_create();
if ($dateTimeZoneSelected === false || $dateTimeServer === false) return false; if ($dateTimeZoneSelected === false || $dateTimeServer === false) return false;
$timeOffset = timezone_offset_get($dateTimeZoneSelected, $dateTimeServer); $timeOffset = timezone_offset_get($dateTimeZoneSelected, $dateTimeServer);
$timeOffset = $timeOffset / 3600; $timeOffset = $timeOffset / 3600;
return $timeOffset; return $timeOffset;
} }
/** /**
* Check for PHP timezone support * Check for PHP timezone support
* *
*/ */
function wp_timezone_supported() { function wp_timezone_supported() {
if (function_exists('date_default_timezone_set') if (function_exists('date_default_timezone_set')
&& function_exists('timezone_identifiers_list') && function_exists('timezone_identifiers_list')
&& function_exists('timezone_open') && function_exists('timezone_open')
&& function_exists('timezone_offset_get') && function_exists('timezone_offset_get')
) )
return true; return true;
return false; return false;
@ -3108,7 +3108,7 @@ function wp_timezone_choice($selectedzone) {
$zonen[$i]['subcity'] = isset($zone[2]) ? $zone[2] : ''; $zonen[$i]['subcity'] = isset($zone[2]) ? $zone[2] : '';
$i++; $i++;
} }
asort($zonen); asort($zonen);
$structure = ''; $structure = '';
$pad = '&nbsp;&nbsp;&nbsp;'; $pad = '&nbsp;&nbsp;&nbsp;';

View File

@ -457,7 +457,7 @@ function wp_title($sep = '&raquo;', $display = true, $seplocation = '') {
$term = $term->name; $term = $term->name;
$title = "$tax$t_sep$term"; $title = "$tax$t_sep$term";
} }
//If it's a search //If it's a search
if ( is_search() ) { if ( is_search() ) {
$title = sprintf(__('Search Results %s %s'), $t_sep, strip_tags($search)); $title = sprintf(__('Search Results %s %s'), $t_sep, strip_tags($search));

View File

@ -302,7 +302,7 @@ class WP_Http {
$response = array( 'headers' => array(), 'body' => '', 'response' => array('code' => false, 'message' => false), 'cookies' => array() ); $response = array( 'headers' => array(), 'body' => '', 'response' => array('code' => false, 'message' => false), 'cookies' => array() );
foreach( (array) $transports as $transport ) { foreach( (array) $transports as $transport ) {
$response = $transport->request($url, $r); $response = $transport->request($url, $r);
if( has_action('http_api_debug') ) if( has_action('http_api_debug') )
do_action( 'http_api_debug', $response, 'response', get_class($transport) ); do_action( 'http_api_debug', $response, 'response', get_class($transport) );
@ -538,7 +538,7 @@ class WP_Http {
return false; return false;
$home = parse_url( get_bloginfo('site_url') ); $home = parse_url( get_bloginfo('site_url') );
// Don't block requests back to ourselves by default // Don't block requests back to ourselves by default
if ( $uri == 'localhost' || $uri == $home['host'] ) if ( $uri == 'localhost' || $uri == $home['host'] )
return apply_filters('block_local_requests', false); return apply_filters('block_local_requests', false);
@ -937,7 +937,7 @@ class WP_Http_Streams {
$proxy = new WP_HTTP_Proxy(); $proxy = new WP_HTTP_Proxy();
if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) ) { if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) ) {
$arrContext['http']['proxy'] = 'tcp://'.$proxy->host().':'.$proxy->port(); $arrContext['http']['proxy'] = 'tcp://'.$proxy->host().':'.$proxy->port();
// We only support Basic authentication so this will only work if that is what your proxy supports. // We only support Basic authentication so this will only work if that is what your proxy supports.
@ -1077,7 +1077,7 @@ class WP_Http_ExtHTTP {
'redirect' => $r['redirection'], 'redirect' => $r['redirection'],
'useragent' => $r['user-agent'], 'useragent' => $r['user-agent'],
'headers' => $r['headers'], 'headers' => $r['headers'],
'ssl' => array( 'ssl' => array(
'verifypeer' => apply_filters('https_ssl_verify', $r['sslverify']), 'verifypeer' => apply_filters('https_ssl_verify', $r['sslverify']),
'verifyhost' => apply_filters('https_ssl_verify', $r['sslverify']) 'verifyhost' => apply_filters('https_ssl_verify', $r['sslverify'])
) )
@ -1276,7 +1276,7 @@ class WP_Http_Curl {
if ( !empty($theResponse) ) { if ( !empty($theResponse) ) {
$parts = explode("\r\n\r\n", $theResponse); $parts = explode("\r\n\r\n", $theResponse);
$headerLength = curl_getinfo($handle, CURLINFO_HEADER_SIZE); $headerLength = curl_getinfo($handle, CURLINFO_HEADER_SIZE);
$theHeaders = trim( substr($theResponse, 0, $headerLength) ); $theHeaders = trim( substr($theResponse, 0, $headerLength) );
$theBody = substr( $theResponse, $headerLength ); $theBody = substr( $theResponse, $headerLength );
@ -1358,7 +1358,7 @@ class WP_HTTP_Proxy {
} }
function __construct() { function __construct() {
} }
/** /**
@ -1630,7 +1630,7 @@ class WP_Http_Cookie {
/** /**
* Confirms that it's OK to send this cookie to the URL checked against. * Confirms that it's OK to send this cookie to the URL checked against.
* *
* Decision is based on RFC 2109/2965, so look there for details on validity. * Decision is based on RFC 2109/2965, so look there for details on validity.
* *
* @access public * @access public
@ -1683,7 +1683,7 @@ class WP_Http_Cookie {
function getHeaderValue() { function getHeaderValue() {
if ( empty( $this->name ) || empty( $this->value ) ) if ( empty( $this->name ) || empty( $this->value ) )
return ''; return '';
return $this->name . '=' . urlencode( $this->value ); return $this->name . '=' . urlencode( $this->value );
} }

View File

@ -230,7 +230,7 @@ function _n_noop( $single, $plural ) {
/** /**
* Register plural strings with context in POT file, but don't translate them. * Register plural strings with context in POT file, but don't translate them.
* *
* @see _n_noop() * @see _n_noop()
*/ */
function _nx_noop( $single, $plural, $context ) { function _nx_noop( $single, $plural, $context ) {
@ -260,13 +260,13 @@ function load_textdomain($domain, $mofile) {
global $l10n; global $l10n;
if ( !is_readable($mofile)) return; if ( !is_readable($mofile)) return;
$mo = new MO(); $mo = new MO();
$mo->import_from_file( $mofile ); $mo->import_from_file( $mofile );
if (isset($l10n[$domain])) if (isset($l10n[$domain]))
$mo->merge_with( $l10n[$domain] ); $mo->merge_with( $l10n[$domain] );
$l10n[$domain] = &$mo; $l10n[$domain] = &$mo;
} }
@ -338,7 +338,7 @@ function load_theme_textdomain($domain, $path = false) {
/** /**
* Returns the Translations instance for a domain. If there isn't one, * Returns the Translations instance for a domain. If there isn't one,
* returns empty Translations instance. * returns empty Translations instance.
* *
* @param string $domain * @param string $domain
* @return object A Translation instance * @return object A Translation instance
*/ */
@ -352,7 +352,7 @@ function get_translations_for_domain( $domain ) {
* Translates role name. Since the role names are in the database and * Translates role name. Since the role names are in the database and
* not in the source there are dummy gettext calls to get them into the POT * not in the source there are dummy gettext calls to get them into the POT
* file and this function properly translates them back. * file and this function properly translates them back.
* *
* The before_last_bar() call is needed, because older installs keep the roles * The before_last_bar() call is needed, because older installs keep the roles
* using the old context format: 'Role name|User role' and just skipping the * using the old context format: 'Role name|User role' and just skipping the
* content after the last bar is easier than fixing them in the DB. New installs * content after the last bar is easier than fixing them in the DB. New installs

View File

@ -1528,7 +1528,7 @@ function plugins_url($path = '', $plugin = '') {
if ('.' != $folder) if ('.' != $folder)
$url .= '/' . ltrim($folder, '/'); $url .= '/' . ltrim($folder, '/');
} }
if ( !empty($path) && is_string($path) && strpos($path, '..') === false ) if ( !empty($path) && is_string($path) && strpos($path, '..') === false )
$url .= '/' . ltrim($path, '/'); $url .= '/' . ltrim($path, '/');

View File

@ -330,11 +330,11 @@ function wp_mail( $to, $subject, $message, $headers = '', $attachments = array()
/* If we don't have an email from the input headers default to wordpress@$sitename /* If we don't have an email from the input headers default to wordpress@$sitename
* Some hosts will block outgoing mail from this address if it doesn't exist but * Some hosts will block outgoing mail from this address if it doesn't exist but
* there's no easy alternative. Defaulting to admin_email might appear to be another * there's no easy alternative. Defaulting to admin_email might appear to be another
* option but some hosts may refuse to relay mail from an unknown domain. See * option but some hosts may refuse to relay mail from an unknown domain. See
* http://trac.wordpress.org/ticket/5007. * http://trac.wordpress.org/ticket/5007.
*/ */
if ( !isset( $from_email ) ) { if ( !isset( $from_email ) ) {
// Get the site domain and get rid of www. // Get the site domain and get rid of www.
$sitename = strtolower( $_SERVER['SERVER_NAME'] ); $sitename = strtolower( $_SERVER['SERVER_NAME'] );
@ -1383,7 +1383,7 @@ if ( !function_exists('wp_generate_password') ) :
* @since 2.5 * @since 2.5
* *
* @param int $length The length of password to generate * @param int $length The length of password to generate
* @param bool $special_chars Whether to include standard special characters * @param bool $special_chars Whether to include standard special characters
* @return string The random password * @return string The random password
**/ **/
function wp_generate_password($length = 12, $special_chars = true) { function wp_generate_password($length = 12, $special_chars = true) {
@ -1518,7 +1518,7 @@ function get_avatar( $id_or_email, $size = '96', $default = '', $alt = false ) {
} }
if ( is_ssl() ) if ( is_ssl() )
$host = 'https://secure.gravatar.com'; $host = 'https://secure.gravatar.com';
else else
$host = 'http://www.gravatar.com'; $host = 'http://www.gravatar.com';

View File

@ -42,7 +42,7 @@ class MO extends Translations {
$magic_little_64 = (int) 2500072158; $magic_little_64 = (int) 2500072158;
// 0xde120495 // 0xde120495
$magic_big = ((int) - 569244523) && 0xFFFFFFFF; $magic_big = ((int) - 569244523) && 0xFFFFFFFF;
if ($magic_little == $magic || $magic_little_64 == $magic) { if ($magic_little == $magic || $magic_little_64 == $magic) {
return 'little'; return 'little';
} else if ($magic_big == $magic) { } else if ($magic_big == $magic) {
@ -67,9 +67,9 @@ class MO extends Translations {
$translations_lo_addr = $reader->readint32(); $translations_lo_addr = $reader->readint32();
$reader->seekto($originals_lo_addr); $reader->seekto($originals_lo_addr);
$originals_lo = $reader->readint32array($total * 2); // each of $originals_lo = $reader->readint32array($total * 2); // each of
$reader->seekto($translations_lo_addr); $reader->seekto($translations_lo_addr);
$translations_lo = $reader->readint32array($total * 2); $translations_lo = $reader->readint32array($total * 2);
$length = create_function('$i', 'return $i * 2 + 1;'); $length = create_function('$i', 'return $i * 2 + 1;');
$offset = create_function('$i', 'return $i * 2 + 2;'); $offset = create_function('$i', 'return $i * 2 + 2;');

View File

@ -17,7 +17,7 @@ ini_set('auto_detect_line_endings', 1);
* Routines for working with PO files * Routines for working with PO files
*/ */
class PO extends Translations { class PO extends Translations {
/** /**
* Exports headers to a PO entry * Exports headers to a PO entry
@ -94,7 +94,7 @@ class PO extends Translations {
"$tab" => '\t', "$tab" => '\t',
"$quote" => "$slash$quote", "$quote" => "$slash$quote",
); );
$string = str_replace(array_keys($replaces), array_values($replaces), $string); $string = str_replace(array_keys($replaces), array_values($replaces), $string);
$po = array(); $po = array();
foreach (explode($newline, $string) as $line) { foreach (explode($newline, $string) as $line) {
@ -111,7 +111,7 @@ class PO extends Translations {
} }
/** /**
* Inserts $with in the beginning of every new line of $string and * Inserts $with in the beginning of every new line of $string and
* returns the modified string * returns the modified string
* *
* @static * @static
@ -153,7 +153,7 @@ class PO extends Translations {
*/ */
function export_entry(&$entry) { function export_entry(&$entry) {
if (is_null($entry->singular)) return false; if (is_null($entry->singular)) return false;
$po = array(); $po = array();
if (!empty($entry->translator_comments)) $po[] = PO::comment_block($entry->translator_comments); if (!empty($entry->translator_comments)) $po[] = PO::comment_block($entry->translator_comments);
if (!empty($entry->extracted_comments)) $po[] = PO::comment_block($entry->extracted_comments, '.'); if (!empty($entry->extracted_comments)) $po[] = PO::comment_block($entry->extracted_comments, '.');
if (!empty($entry->references)) $po[] = PO::comment_block(implode(' ', $entry->references), ':'); if (!empty($entry->references)) $po[] = PO::comment_block(implode(' ', $entry->references), ':');

View File

@ -130,7 +130,7 @@ class Translations {
/** /**
* Adds parantheses to the inner parts of ternary operators in * Adds parantheses to the inner parts of ternary operators in
* plural expressions, because PHP evaluates ternary oerators from left to right * plural expressions, because PHP evaluates ternary oerators from left to right
* *
* @param string $expression the expression without parentheses * @param string $expression the expression without parentheses
* @return string the expression with parentheses added * @return string the expression with parentheses added
*/ */
@ -158,7 +158,7 @@ class Translations {
} }
return rtrim($res, ';'); return rtrim($res, ';');
} }
/** /**
* Merge $other in the current object. * Merge $other in the current object.
* *

View File

@ -360,12 +360,12 @@ function body_class( $class = '' ) {
*/ */
function get_body_class( $class = '' ) { function get_body_class( $class = '' ) {
global $wp_query, $current_user; global $wp_query, $current_user;
$classes = array(); $classes = array();
if ( 'rtl' == get_bloginfo('text_direction') ) if ( 'rtl' == get_bloginfo('text_direction') )
$classes[] = 'rtl'; $classes[] = 'rtl';
if ( is_front_page() ) if ( is_front_page() )
$classes[] = 'home'; $classes[] = 'home';
if ( is_home() ) if ( is_home() )
@ -382,19 +382,19 @@ function get_body_class( $class = '' ) {
$classes[] = 'attachment'; $classes[] = 'attachment';
if ( is_404() ) if ( is_404() )
$classes[] = 'error404'; $classes[] = 'error404';
if ( is_single() ) { if ( is_single() ) {
the_post(); the_post();
$postID = $wp_query->post->ID; $postID = $wp_query->post->ID;
$classes[] = 'single postid-' . $postID; $classes[] = 'single postid-' . $postID;
if ( is_attachment() ) { if ( is_attachment() ) {
$mime_type = get_post_mime_type(); $mime_type = get_post_mime_type();
$mime_prefix = array( 'application/', 'image/', 'text/', 'audio/', 'video/', 'music/' ); $mime_prefix = array( 'application/', 'image/', 'text/', 'audio/', 'video/', 'music/' );
$classes[] = 'attachmentid-' . $postID . ' attachment-' . str_replace( $mime_prefix, "", "$mime_type" ); $classes[] = 'attachmentid-' . $postID . ' attachment-' . str_replace( $mime_prefix, "", "$mime_type" );
} }
rewind_posts(); rewind_posts();
} elseif ( is_archive() ) { } elseif ( is_archive() ) {
if ( is_author() ) { if ( is_author() ) {
@ -412,42 +412,42 @@ function get_body_class( $class = '' ) {
} }
} elseif ( is_page() ) { } elseif ( is_page() ) {
the_post(); the_post();
$pageID = $wp_query->post->ID; $pageID = $wp_query->post->ID;
$page_children = wp_list_pages("child_of=$pageID&echo=0"); $page_children = wp_list_pages("child_of=$pageID&echo=0");
if ( $page_children ) if ( $page_children )
$classes[] = 'page-parent'; $classes[] = 'page-parent';
if ( $wp_query->post->post_parent ) if ( $wp_query->post->post_parent )
$classes[] = 'page-child parent-pageid-' . $wp_query->post->post_parent; $classes[] = 'page-child parent-pageid-' . $wp_query->post->post_parent;
if ( is_page_template() ) if ( is_page_template() )
$classes[] = 'page-template page-template-' . str_replace( '.php', '-php', get_post_meta( $pageID, '_wp_page_template', true ) ); $classes[] = 'page-template page-template-' . str_replace( '.php', '-php', get_post_meta( $pageID, '_wp_page_template', true ) );
rewind_posts(); rewind_posts();
} elseif ( is_search() ) { } elseif ( is_search() ) {
the_post(); the_post();
if ( have_posts() ) if ( have_posts() )
$classes[] = 'search-results'; $classes[] = 'search-results';
else else
$classes[] = 'search-no-results'; $classes[] = 'search-no-results';
rewind_posts(); rewind_posts();
} }
if ( is_user_logged_in() ) if ( is_user_logged_in() )
$classes[] = 'logged-in'; $classes[] = 'logged-in';
$page = $wp_query->get('page'); $page = $wp_query->get('page');
if ( !$page || $page < 2) if ( !$page || $page < 2)
$page = $wp_query->get('paged'); $page = $wp_query->get('paged');
if ( $page && $page > 1 ) { if ( $page && $page > 1 ) {
$classes[] = 'paged-' . $page; $classes[] = 'paged-' . $page;
if ( is_single() ) if ( is_single() )
$classes[] = 'single-paged-' . $page; $classes[] = 'single-paged-' . $page;
elseif ( is_page() ) elseif ( is_page() )
@ -463,13 +463,13 @@ function get_body_class( $class = '' ) {
elseif ( is_search() ) elseif ( is_search() )
$classes[] = 'search-paged-' . $page; $classes[] = 'search-paged-' . $page;
} }
if ( !empty($class) ) { if ( !empty($class) ) {
if ( !is_array( $class ) ) if ( !is_array( $class ) )
$class = preg_split('#\s+#', $class); $class = preg_split('#\s+#', $class);
$classes = array_merge($classes, $class); $classes = array_merge($classes, $class);
} }
return apply_filters('body_class', $classes, $class); return apply_filters('body_class', $classes, $class);
} }
@ -854,7 +854,7 @@ function wp_page_menu( $args = array() ) {
* @see Walker_Page::walk() for parameters and return description. * @see Walker_Page::walk() for parameters and return description.
*/ */
function walk_page_tree($pages, $depth, $current_page, $r) { function walk_page_tree($pages, $depth, $current_page, $r) {
if ( empty($r['walker']) ) if ( empty($r['walker']) )
$walker = new Walker_Page; $walker = new Walker_Page;
else else
$walker = $r['walker']; $walker = $r['walker'];
@ -925,7 +925,7 @@ function wp_get_attachment_link($id = 0, $size = 'thumbnail', $permalink = false
$url = get_attachment_link($_post->ID); $url = get_attachment_link($_post->ID);
$post_title = attribute_escape($_post->post_title); $post_title = attribute_escape($_post->post_title);
if ( $text ) { if ( $text ) {
$link_text = attribute_escape($text); $link_text = attribute_escape($text);
} elseif ( ( is_int($size) && $size != 0 ) or ( is_string($size) && $size != 'none' ) or $size != false ) { } elseif ( ( is_int($size) && $size != 0 ) or ( is_string($size) && $size != 'none' ) or $size != false ) {
@ -934,7 +934,7 @@ function wp_get_attachment_link($id = 0, $size = 'thumbnail', $permalink = false
if( trim($link_text) == '' ) if( trim($link_text) == '' )
$link_text = $_post->post_title; $link_text = $_post->post_title;
return apply_filters( 'wp_get_attachment_link', "<a href='$url' title='$post_title'>$link_text</a>", $id, $size, $permalink, $icon, $text ); return apply_filters( 'wp_get_attachment_link', "<a href='$url' title='$post_title'>$link_text</a>", $id, $size, $permalink, $icon, $text );
} }

View File

@ -512,7 +512,7 @@ function get_posts($args = null) {
function add_post_meta($post_id, $meta_key, $meta_value, $unique = false) { function add_post_meta($post_id, $meta_key, $meta_value, $unique = false) {
if ( !$meta_key ) if ( !$meta_key )
return false; return false;
global $wpdb; global $wpdb;
// make sure meta is added to the post, not a revision // make sure meta is added to the post, not a revision
@ -563,7 +563,7 @@ function delete_post_meta($post_id, $meta_key, $meta_value = '') {
if ( !$meta_key ) if ( !$meta_key )
return false; return false;
if ( empty( $meta_value ) ) if ( empty( $meta_value ) )
$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 ) ); $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 ) );
else else
@ -597,7 +597,7 @@ function delete_post_meta($post_id, $meta_key, $meta_value = '') {
function get_post_meta($post_id, $key, $single = false) { function get_post_meta($post_id, $key, $single = false) {
if ( !$key ) if ( !$key )
return ''; return '';
$post_id = (int) $post_id; $post_id = (int) $post_id;
$meta_cache = wp_cache_get($post_id, 'post_meta'); $meta_cache = wp_cache_get($post_id, 'post_meta');
@ -648,7 +648,7 @@ function update_post_meta($post_id, $meta_key, $meta_value, $prev_value = '') {
if ( !$meta_key ) if ( !$meta_key )
return false; return false;
if ( ! $wpdb->get_var( $wpdb->prepare( "SELECT meta_key FROM $wpdb->postmeta WHERE meta_key = %s AND post_id = %d", $meta_key, $post_id ) ) ) { if ( ! $wpdb->get_var( $wpdb->prepare( "SELECT meta_key FROM $wpdb->postmeta WHERE meta_key = %s AND post_id = %d", $meta_key, $post_id ) ) ) {
return add_post_meta($post_id, $meta_key, $meta_value); return add_post_meta($post_id, $meta_key, $meta_value);
} }
@ -680,7 +680,7 @@ function update_post_meta($post_id, $meta_key, $meta_value, $prev_value = '') {
function delete_post_meta_by_key($post_meta_key) { function delete_post_meta_by_key($post_meta_key) {
if ( !$post_meta_key ) if ( !$post_meta_key )
return false; return false;
global $wpdb; global $wpdb;
if ( $wpdb->query($wpdb->prepare("DELETE FROM $wpdb->postmeta WHERE meta_key = %s", $post_meta_key)) ) { if ( $wpdb->query($wpdb->prepare("DELETE FROM $wpdb->postmeta WHERE meta_key = %s", $post_meta_key)) ) {
/** @todo Get post_ids and delete cache */ /** @todo Get post_ids and delete cache */
@ -756,7 +756,7 @@ function get_post_custom_keys( $post_id = 0 ) {
function get_post_custom_values( $key = '', $post_id = 0 ) { function get_post_custom_values( $key = '', $post_id = 0 ) {
if ( !$key ) if ( !$key )
return null; return null;
$custom = get_post_custom($post_id); $custom = get_post_custom($post_id);
return isset($custom[$key]) ? $custom[$key] : null; return isset($custom[$key]) ? $custom[$key] : null;
@ -1546,7 +1546,7 @@ function wp_insert_post($postarr = array(), $wp_error = false) {
// new-style support for all tag-like taxonomies // new-style support for all tag-like taxonomies
if ( !empty($tax_input) ) { if ( !empty($tax_input) ) {
foreach ( $tax_input as $taxonomy => $tags ) { foreach ( $tax_input as $taxonomy => $tags ) {
wp_set_post_terms( $post_ID, $tags, $taxonomy ); wp_set_post_terms( $post_ID, $tags, $taxonomy );
} }
} }
@ -3526,7 +3526,7 @@ function _wp_put_post_revision( $post = null, $autosave = false ) {
$post = _wp_post_revision_fields( $post, $autosave ); $post = _wp_post_revision_fields( $post, $autosave );
$post = add_magic_quotes($post); //since data is from db $post = add_magic_quotes($post); //since data is from db
$revision_id = wp_insert_post( $post ); $revision_id = wp_insert_post( $post );
if ( is_wp_error($revision_id) ) if ( is_wp_error($revision_id) )
return $revision_id; return $revision_id;
@ -3602,7 +3602,7 @@ function wp_restore_post_revision( $revision_id, $fields = null ) {
return false; return false;
$update['ID'] = $revision['post_parent']; $update['ID'] = $revision['post_parent'];
$update = add_magic_quotes( $update ); //since data is from db $update = add_magic_quotes( $update ); //since data is from db
$post_id = wp_update_post( $update ); $post_id = wp_update_post( $update );

View File

@ -6,18 +6,18 @@
* {@link http://backpress.automattic.com/ BackPress}. WordPress themes and * {@link http://backpress.automattic.com/ BackPress}. WordPress themes and
* plugins will only be concerned about the filters and actions set in this * plugins will only be concerned about the filters and actions set in this
* file. * file.
* *
* Several constants are used to manage the loading, concatenating and compression of scripts and CSS: * Several constants are used to manage the loading, concatenating and compression of scripts and CSS:
* define('SCRIPT_DEBUG', true); loads the develppment (non-minified) versions of all scripts * define('SCRIPT_DEBUG', true); loads the develppment (non-minified) versions of all scripts
* define('CONCATENATE_SCRIPTS', false); disables both compression and cancatenating, * define('CONCATENATE_SCRIPTS', false); disables both compression and cancatenating,
* define('COMPRESS_SCRIPTS', false); disables compression of scripts, * define('COMPRESS_SCRIPTS', false); disables compression of scripts,
* define('COMPRESS_CSS', false); disables compression of CSS, * define('COMPRESS_CSS', false); disables compression of CSS,
* define('ENFORCE_GZIP', true); forces gzip for compression (default is deflate). * define('ENFORCE_GZIP', true); forces gzip for compression (default is deflate).
* *
* The globals $concatenate_scripts, $compress_scripts and $compress_css can be set by plugins * The globals $concatenate_scripts, $compress_scripts and $compress_css can be set by plugins
* to temporarily override the above settings. Also a compression test is run once and the result is saved * to temporarily override the above settings. Also a compression test is run once and the result is saved
* as option 'can_compress_scripts' (0/1). The test will run again if that option is deleted. * as option 'can_compress_scripts' (0/1). The test will run again if that option is deleted.
* *
* @package WordPress * @package WordPress
*/ */
@ -389,7 +389,7 @@ function wp_default_scripts( &$scripts ) {
$scripts->add( 'media', "/wp-admin/js/media$suffix.js", array( 'jquery-ui-draggable', 'jquery-ui-resizable' ), '20090113' ); $scripts->add( 'media', "/wp-admin/js/media$suffix.js", array( 'jquery-ui-draggable', 'jquery-ui-resizable' ), '20090113' );
$scripts->add_data( 'media', 'group', 1 ); $scripts->add_data( 'media', 'group', 1 );
$scripts->add( 'codepress', '/wp-includes/js/codepress/codepress.js', false, '0.9.6' ); $scripts->add( 'codepress', '/wp-includes/js/codepress/codepress.js', false, '0.9.6' );
$scripts->add_data( 'codepress', 'group', 1 ); $scripts->add_data( 'codepress', 'group', 1 );
} }

View File

@ -156,15 +156,15 @@ function do_shortcode($content) {
* *
* The regular expression combines the shortcode tags in the regular expression * The regular expression combines the shortcode tags in the regular expression
* in a regex class. * in a regex class.
* *
* The regular expresion contains 6 different sub matches to help with parsing. * The regular expresion contains 6 different sub matches to help with parsing.
* *
* 1/6 - An extra [ or ] to allow for escaping shortcodes with double [[]] * 1/6 - An extra [ or ] to allow for escaping shortcodes with double [[]]
* 2 - The shortcode name * 2 - The shortcode name
* 3 - The shortcode argument list * 3 - The shortcode argument list
* 4 - The self closing / * 4 - The self closing /
* 5 - The content of a shortcode when it wraps some content. * 5 - The content of a shortcode when it wraps some content.
* *
* @since 2.5 * @since 2.5
* @uses $shortcode_tags * @uses $shortcode_tags
* *
@ -196,7 +196,7 @@ function do_shortcode_tag($m) {
if ($m[1] == '[' && $m[6] == ']') { if ($m[1] == '[' && $m[6] == ']') {
return substr($m[0], 1, -1); return substr($m[0], 1, -1);
} }
$tag = $m[2]; $tag = $m[2];
$attr = shortcode_parse_atts($m[3]); $attr = shortcode_parse_atts($m[3]);

View File

@ -535,7 +535,7 @@ function get_term_to_edit( $id, $taxonomy ) {
* 'exclude' is ignored. * 'exclude' is ignored.
* *
* exclude_tree - A comma- or space-delimited string of term ids to exclude * exclude_tree - A comma- or space-delimited string of term ids to exclude
* from the return array, along with all of their descendant terms according to * from the return array, along with all of their descendant terms according to
* the primary taxonomy. If 'include' is non-empty, 'exclude_tree' is ignored. * the primary taxonomy. If 'include' is non-empty, 'exclude_tree' is ignored.
* *
* include - Default is an empty string. A comma- or space-delimited string * include - Default is an empty string. A comma- or space-delimited string
@ -692,7 +692,7 @@ function &get_terms($taxonomies, $args = '') {
if ( ! empty( $exclude_tree ) ) { if ( ! empty( $exclude_tree ) ) {
$excluded_trunks = preg_split('/[\s,]+/',$exclude_tree); $excluded_trunks = preg_split('/[\s,]+/',$exclude_tree);
foreach( (array) $excluded_trunks as $extrunk ) { foreach( (array) $excluded_trunks as $extrunk ) {
$excluded_children = (array) get_terms($taxonomies[0], array('child_of' => intval($extrunk), 'fields' => 'ids')); $excluded_children = (array) get_terms($taxonomies[0], array('child_of' => intval($extrunk), 'fields' => 'ids'));
$excluded_children[] = $extrunk; $excluded_children[] = $extrunk;
foreach( (array) $excluded_children as $exterm ) { foreach( (array) $excluded_children as $exterm ) {
if ( empty($exclusions) ) if ( empty($exclusions) )
@ -736,7 +736,7 @@ function &get_terms($taxonomies, $args = '') {
if ( $hide_empty && !$hierarchical ) if ( $hide_empty && !$hierarchical )
$where .= ' AND tt.count > 0'; $where .= ' AND tt.count > 0';
// don't limit the query results when we have to descend the family tree // don't limit the query results when we have to descend the family tree
if ( ! empty($number) && ! $hierarchical && empty( $child_of ) && '' == $parent ) { if ( ! empty($number) && ! $hierarchical && empty( $child_of ) && '' == $parent ) {
if( $offset ) if( $offset )
$limit = 'LIMIT ' . $offset . ',' . $number; $limit = 'LIMIT ' . $offset . ',' . $number;

View File

@ -45,7 +45,7 @@ $wp_registered_widget_updates = array();
/** /**
* Singleton that registers and instantiates WP_Widget classes. * Singleton that registers and instantiates WP_Widget classes.
* *
* @package WordPress * @package WordPress
* @subpackage Widgets * @subpackage Widgets
* @since 2.8 * @since 2.8
@ -70,7 +70,7 @@ class WP_Widget_Factory {
/** /**
* This class must be extended for each widget and WP_Widget::widget(), WP_Widget::update() * This class must be extended for each widget and WP_Widget::widget(), WP_Widget::update()
* and WP_Widget::form() need to be over-ridden. * and WP_Widget::form() need to be over-ridden.
* *
* @package WordPress * @package WordPress
* @subpackage Widgets * @subpackage Widgets
* @since 2.8 * @since 2.8
@ -288,14 +288,14 @@ class WP_Widget {
_register_widget_update_callback( $this->id, $this->name, $this->_get_update_callback(), $this->control_options, array( 'number' => $number ) ); _register_widget_update_callback( $this->id, $this->name, $this->_get_update_callback(), $this->control_options, array( 'number' => $number ) );
_register_widget_form_callback( $this->id, $this->name, $this->_get_form_callback(), $this->control_options, array( 'number' => $number ) ); _register_widget_form_callback( $this->id, $this->name, $this->_get_form_callback(), $this->control_options, array( 'number' => $number ) );
} }
function save_settings($settings) { function save_settings($settings) {
$settings['_multiwidget'] = 1; $settings['_multiwidget'] = 1;
update_option( $this->option_name, $settings ); update_option( $this->option_name, $settings );
} }
function get_settings() { function get_settings() {
$settings = get_option($this->option_name); $settings = get_option($this->option_name);
if ( !is_array($settings) ) if ( !is_array($settings) )
$settings = array(); $settings = array();
@ -314,15 +314,15 @@ class WP_Widget {
/** /**
* Register a widget * Register a widget
* *
* Registers a WP_Widget widget * Registers a WP_Widget widget
* *
* @since 2.8.0 * @since 2.8.0
* *
* @see WP_Widget * @see WP_Widget
* @see WP_Widget_Factory * @see WP_Widget_Factory
* @uses WP_Widget_Factory * @uses WP_Widget_Factory
* *
* @param string $widget_class The name of a class that extends WP_Widget * @param string $widget_class The name of a class that extends WP_Widget
*/ */
function register_widget($widget_class) { function register_widget($widget_class) {
@ -922,7 +922,7 @@ function wp_convert_widget_settings($base_name, $option_name, $settings) {
if ( $single ) { if ( $single ) {
$settings = array( 2 => $settings ); $settings = array( 2 => $settings );
$sidebars_widgets = get_option('sidebars_widgets'); $sidebars_widgets = get_option('sidebars_widgets');
foreach ( (array) $sidebars_widgets as $index => $sidebar ) { foreach ( (array) $sidebars_widgets as $index => $sidebar ) {
if ( is_array($sidebar) ) { if ( is_array($sidebar) ) {
@ -940,14 +940,14 @@ function wp_convert_widget_settings($base_name, $option_name, $settings) {
$settings['_multiwidget'] = 1; $settings['_multiwidget'] = 1;
update_option( $option_name, $settings ); update_option( $option_name, $settings );
return $settings; return $settings;
} }
/** /**
* Deprecated API * Deprecated API
*/ */
/** /**
* Register widget for sidebar with backwards compatibility. * Register widget for sidebar with backwards compatibility.
* *

View File

@ -435,7 +435,7 @@ class wpdb {
if ( $this->dbh && $this->real_escape ) if ( $this->dbh && $this->real_escape )
return mysql_real_escape_string( $string, $this->dbh ); return mysql_real_escape_string( $string, $this->dbh );
else else
return addslashes( $string ); return addslashes( $string );
} }
function _escape($data) { function _escape($data) {

View File

@ -142,8 +142,8 @@ for ( $i = 1; $i <= $count; $i++ ) {
$post_status = 'pending'; $post_status = 'pending';
} }
$subject = trim($subject); $subject = trim($subject);
if ( $content_type == 'multipart/alternative' ) { if ( $content_type == 'multipart/alternative' ) {
$content = explode('--'.$boundary, $content); $content = explode('--'.$boundary, $content);
$content = $content[2]; $content = $content[2];
@ -159,7 +159,7 @@ for ( $i = 1; $i <= $count; $i++ ) {
//Give Post-By-Email extending plugins full access to the content //Give Post-By-Email extending plugins full access to the content
//Either the raw content or the content of the last quoted-printable section //Either the raw content or the content of the last quoted-printable section
$content = apply_filters('wp_mail_original_content', $content); $content = apply_filters('wp_mail_original_content', $content);
if ( false !== stripos($content_transfer_encoding, "quoted-printable") ) { if ( false !== stripos($content_transfer_encoding, "quoted-printable") ) {
$content = quoted_printable_decode($content); $content = quoted_printable_decode($content);
} }

View File

@ -202,7 +202,7 @@ if (defined('WP_DEBUG') and WP_DEBUG == true) {
error_reporting(E_ALL); error_reporting(E_ALL);
} else { } else {
// Unicode Extension is in PHP 6.0 only or do version check when this changes. // Unicode Extension is in PHP 6.0 only or do version check when this changes.
if ( function_exists('unicode_decode') ) if ( function_exists('unicode_decode') )
error_reporting( E_ALL ^ E_DEPRECATED ^ E_NOTICE ^ E_USER_NOTICE ^ E_STRICT ); error_reporting( E_ALL ^ E_DEPRECATED ^ E_NOTICE ^ E_USER_NOTICE ^ E_STRICT );
else if ( defined( 'E_DEPRECATED' ) ) // Introduced in PHP 5.3 else if ( defined( 'E_DEPRECATED' ) ) // Introduced in PHP 5.3
error_reporting( E_ALL ^ E_DEPRECATED ^ E_NOTICE ^ E_USER_NOTICE ); error_reporting( E_ALL ^ E_DEPRECATED ^ E_NOTICE ^ E_USER_NOTICE );
@ -377,7 +377,7 @@ if ( !defined('WPMU_PLUGIN_URL') )
* *
* @since 2.8.0 * @since 2.8.0
*/ */
if ( !defined( 'MUPLUGINDIR' ) ) if ( !defined( 'MUPLUGINDIR' ) )
define( 'MUPLUGINDIR', 'wp-content/mu-plugins' ); // Relative to ABSPATH. For back compat. define( 'MUPLUGINDIR', 'wp-content/mu-plugins' ); // Relative to ABSPATH. For back compat.
if ( is_dir( WPMU_PLUGIN_DIR ) ) { if ( is_dir( WPMU_PLUGIN_DIR ) ) {

View File

@ -2215,12 +2215,12 @@ class wp_xmlrpc_server extends IXR_Server {
return new IXR_Error(500, __('Sorry, your entry could not be posted. Something wrong happened.')); return new IXR_Error(500, __('Sorry, your entry could not be posted. Something wrong happened.'));
} }
// Only posts can be sticky // Only posts can be sticky
if ( $post_type == 'post' && isset( $content_struct['sticky'] ) ) if ( $post_type == 'post' && isset( $content_struct['sticky'] ) )
if ( $content_struct['sticky'] == true ) if ( $content_struct['sticky'] == true )
stick_post( $post_ID ); stick_post( $post_ID );
elseif ( $content_struct['sticky'] == false ) elseif ( $content_struct['sticky'] == false )
unstick_post( $post_ID ); unstick_post( $post_ID );
if ( isset($content_struct['custom_fields']) ) { if ( isset($content_struct['custom_fields']) ) {
$this->set_custom_fields($post_ID, $content_struct['custom_fields']); $this->set_custom_fields($post_ID, $content_struct['custom_fields']);
@ -2238,7 +2238,7 @@ class wp_xmlrpc_server extends IXR_Server {
function add_enclosure_if_new($post_ID, $enclosure) { function add_enclosure_if_new($post_ID, $enclosure) {
if( is_array( $enclosure ) && isset( $enclosure['url'] ) && isset( $enclosure['length'] ) && isset( $enclosure['type'] ) ) { if( is_array( $enclosure ) && isset( $enclosure['url'] ) && isset( $enclosure['length'] ) && isset( $enclosure['type'] ) ) {
$encstring = $enclosure['url'] . "\n" . $enclosure['length'] . "\n" . $enclosure['type']; $encstring = $enclosure['url'] . "\n" . $enclosure['length'] . "\n" . $enclosure['type'];
$found = false; $found = false;
foreach ( (array) get_post_custom($post_ID) as $key => $val) { foreach ( (array) get_post_custom($post_ID) as $key => $val) {
@ -2256,7 +2256,7 @@ class wp_xmlrpc_server extends IXR_Server {
} }
} }
} }
/** /**
* Attach upload to a post. * Attach upload to a post.
* *
@ -2522,12 +2522,12 @@ class wp_xmlrpc_server extends IXR_Server {
return new IXR_Error(500, __('Sorry, your entry could not be edited. Something wrong happened.')); return new IXR_Error(500, __('Sorry, your entry could not be edited. Something wrong happened.'));
} }
// Only posts can be sticky // Only posts can be sticky
if ( $post_type == 'post' && isset( $content_struct['sticky'] ) ) if ( $post_type == 'post' && isset( $content_struct['sticky'] ) )
if ( $content_struct['sticky'] == true ) if ( $content_struct['sticky'] == true )
stick_post( $post_ID ); stick_post( $post_ID );
elseif ( $content_struct['sticky'] == false ) elseif ( $content_struct['sticky'] == false )
unstick_post( $post_ID ); unstick_post( $post_ID );
if ( isset($content_struct['custom_fields']) ) { if ( isset($content_struct['custom_fields']) ) {
$this->set_custom_fields($post_ID, $content_struct['custom_fields']); $this->set_custom_fields($post_ID, $content_struct['custom_fields']);
@ -2603,9 +2603,9 @@ class wp_xmlrpc_server extends IXR_Server {
$postdata['post_status'] = 'publish'; $postdata['post_status'] = 'publish';
} }
$sticky = false; $sticky = false;
if ( is_sticky( $post_ID ) ) if ( is_sticky( $post_ID ) )
$sticky = true; $sticky = true;
$enclosure = array(); $enclosure = array();
foreach ( (array) get_post_custom($post_ID) as $key => $val) { foreach ( (array) get_post_custom($post_ID) as $key => $val) {