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 }
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')) { ?>
<input type="submit" name="delete_all_spam" value="<?php _e('Delete All Spam'); ?>" class="button-secondary apply" />
<?php }

View File

@ -269,35 +269,35 @@ add_meta_box('submitdiv', __('Publish'), 'post_submit_meta_box', 'post', 'side',
* @param object $post
*/
function post_tags_meta_box($post, $box) {
$tax_name = substr($box['id'], 8);
$tax_name = substr($box['id'], 8);
$taxonomy = get_taxonomy($tax_name);
$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">
<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">
<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" />
</span></p>
<p class="howto"><?php echo $helps; ?></p>
<div class="tagchecklist"></div>
</div>
<div class="tagchecklist"></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>
<?php
}
// all tag-style post taxonomies
foreach ( get_object_taxonomies('post') as $tax_name ) {
if ( !is_taxonomy_hierarchical($tax_name) ) {
// all tag-style post taxonomies
foreach ( get_object_taxonomies('post') as $tax_name ) {
if ( !is_taxonomy_hierarchical($tax_name) ) {
$taxonomy = get_taxonomy($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.

View File

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

View File

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

View File

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

View File

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

View File

@ -1549,9 +1549,9 @@ jQuery(function($){
-->
</script>
<div id="sort-buttons" class="hide-if-no-js">
<?php _e('Sort Order:'); ?>
<a href="#" id="asc"><?php _e('Ascending'); ?></a>
<a href="#" id="desc"><?php _e('Descending'); ?></a>
<?php _e('Sort Order:'); ?>
<a href="#" id="asc"><?php _e('Ascending'); ?></a>
<a href="#" id="desc"><?php _e('Descending'); ?></a>
<a href="#" id="clear"><?php _e('Clear'); ?></a>
</div>
<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 ) {
if ( !is_string( $content ) || empty( $content ) )
return array();
$tokens = token_get_all( $content );
$functions = array();
$ignore_functions = array();
@ -256,51 +256,51 @@ function wp_doc_link_parse( $content ) {
$functions[] = $tokens[$t][1];
}
}
$functions = array_unique( $functions );
sort( $functions );
$ignore_functions = apply_filters( 'documentation_ignore_functions', $ignore_functions );
$ignore_functions = array_unique( $ignore_functions );
$out = array();
foreach ( $functions as $function ) {
if ( in_array( $function, $ignore_functions ) )
continue;
$out[] = $function;
}
return $out;
}
/**
* Determines the language to use for CodePress syntax highlighting,
* based only on a filename.
*
*
* @since 2.8
*
*
* @param string $filename The name of the file to be highlighting
**/
function codepress_get_lang( $filename ) {
$codepress_supported_langs = apply_filters( 'codepress_supported_langs',
$codepress_supported_langs = apply_filters( 'codepress_supported_langs',
array( '.css' => 'css',
'.js' => 'javascript',
'.php' => 'php',
'.html' => 'html',
'.htm' => 'html',
'.txt' => 'text'
'.js' => 'javascript',
'.php' => 'php',
'.html' => 'html',
'.htm' => 'html',
'.txt' => 'text'
) );
$extension = substr( $filename, strrpos( $filename, '.' ) );
if ( $extension && array_key_exists( $extension, $codepress_supported_langs ) )
return $codepress_supported_langs[$extension];
return 'generic';
}
/**
* Adds Javascript required to make CodePress work on the theme/plugin editors.
*
*
* This code is attached to the action admin_print_footer_scripts.
*
*
* @since 2.8
**/
function codepress_footer_js() {

View File

@ -411,7 +411,7 @@ function post_exists($title, $content = '', $date = '') {
global $wpdb;
$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' ) );
$query = "SELECT ID FROM $wpdb->posts WHERE 1=1";
@ -431,7 +431,7 @@ function post_exists($title, $content = '', $date = '') {
$query .= 'AND post_content = %s';
$args[] = $post_content;
}
if ( !empty ( $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->filter = 'sample';
$post->filter = 'sample';
$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);
if ( 'publish' == $post->post_status )
$view_post = 'post' == $post->post_type ? __('View Post') : __('View Page');
if ( false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%') ) {
$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";
@ -1144,7 +1144,7 @@ function post_preview() {
*/
function wp_tiny_mce( $teeny = false ) {
global $concatenate_scripts, $compress_scripts;
if ( ! user_can_richedit() )
return;

View File

@ -328,7 +328,7 @@ function populate_options() {
$option = $wpdb->escape($option);
$value = $wpdb->escape($value);
if ( !empty($insert) )
$insert .= ', ';
$insert .= ', ';
$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) )
return $tags;
foreach ( $tags as $tag )
$tag_names[] = $tag->name;
$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.
*
* Compares the first two arguments and if identical marks as checked
*
*
* @since unknown
*
* @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.
*
*
* Compares the first two arguments and if identical marks as selected
*
* @since unknown
@ -396,7 +396,7 @@ function selected( $selected, $current = true, $echo = true) {
/**
* Private helper function for checked and selected.
*
*
* Compares the first two arguments and if identical marks as $type
*
* @since unknown
@ -412,10 +412,10 @@ function __checked_selected_helper( $helper, $current, $echo, $type) {
$result = " $type='$type'";
else
$result = '';
if ($echo)
echo $result;
return $result;
}
@ -2751,8 +2751,8 @@ function wp_import_upload_form( $action ) {
$upload_dir = wp_upload_dir();
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>
<p><strong><?php echo $upload_dir['error']; ?></strong></p></div><?php
else :
<p><strong><?php echo $upload_dir['error']; ?></strong></p></div><?php
else :
?>
<form enctype="multipart/form-data" id="import-upload-form" method="post" action="<?php echo attribute_escape($action) ?>">
<p>
@ -3473,7 +3473,7 @@ function screen_layout($screen) {
$screen_layout_columns = 0;
return '';
}
if ( ! $screen_layout_columns )
$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,
'tags' => true, 'num_ratings' => true
);
/**
* 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">
<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>
<?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>
<?php endif; if ( ! empty($theme->requires) ) : ?>
<p><strong><?php _e('Requires WordPress Version:') ?></strong> <?php printf(__('%s or higher'), $theme->requires) ?></p>
<?php endif; if ( ! empty($theme->tested) ) : ?>
<p><strong><?php _e('Compatible up to:') ?></strong> <?php echo $theme->tested ?></p>
<?php endif; if ( ! empty($theme->requires) ) : ?>
<p><strong><?php _e('Requires WordPress Version:') ?></strong> <?php printf(__('%s or higher'), $theme->requires) ?></p>
<?php endif; if ( ! empty($theme->tested) ) : ?>
<p><strong><?php _e('Compatible up to:') ?></strong> <?php echo $theme->tested ?></p>
<?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>
<?php endif; ?>
@ -843,7 +843,7 @@ function wp_install_theme_local_package($package, $feedback = '') {
$wp_filesystem->delete($working_dir, true);
return new WP_Error('install_folder_exists', __('Folder already exists.'), $filelist[0] );
}
apply_filters('install_feedback', __('Installing the theme'));
// Copy new version of theme into place.
$result = copy_dir($working_dir, $themes_dir);

View File

@ -96,7 +96,7 @@ function wp_install_defaults($user_id) {
$cat_name = __('Uncategorized');
/* translators: 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->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');
/* translators: 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->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' => '');
$default_links[] = array( 'link_url' => 'http://wordpress.org/development/',
'link_name' => 'Development Blog',
'link_name' => 'Development Blog',
'link_category' => 0,
'link_rss' => 'http://wordpress.org/development/feed/',
'link_notes' => '');
@ -161,7 +161,7 @@ function wp_install_defaults($user_id) {
$now = date('Y-m-d H:i:s');
$now_gmt = gmdate('Y-m-d H:i:s');
$first_post_guid = get_option('home') . '/?p=1';
$wpdb->insert( $wpdb->posts, array(
'post_author' => $user_id,
'post_date' => $now,
@ -176,7 +176,7 @@ function wp_install_defaults($user_id) {
'post_modified_gmt' => $now_gmt,
'guid' => $first_post_guid,
'comment_count' => 1,
'to_ping' => '',
'to_ping' => '',
'pinged' => '',
'post_content_filtered' => ''
));
@ -208,7 +208,7 @@ function wp_install_defaults($user_id) {
'post_modified_gmt' => $now_gmt,
'guid' => $first_post_guid,
'post_type' => 'page',
'to_ping' => '',
'to_ping' => '',
'pinged' => '',
'post_content_filtered' => ''
));
@ -518,7 +518,7 @@ function upgrade_130() {
foreach($comments as $comment) {
$comment_content = deslash($comment->comment_content);
$comment_author = deslash($comment->comment_author);
$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) {
$link_name = deslash($link->link_name);
$link_description = deslash($link->link_description);
$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'");
foreach ($objects as $object) {
$wpdb->update( $wpdb->posts, array( 'post_status' => 'attachment',
'post_mime_type' => $object->post_type,
'post_mime_type' => $object->post_type,
'post_type' => ''),
array( 'ID' => $object->ID ) );

View File

@ -10,7 +10,7 @@
* Creates a new user from the "Users" form using $_POST information.
*
* 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
* no id so as to create a new user.
*
@ -31,7 +31,7 @@ function add_user() {
$editable_roles = get_editable_roles();
if (!$editable_roles[$_POST['role']])
wp_die(__('You can&#8217;t give users that role.'));
$user = new WP_User( $user_id );
$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.
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
$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
* allowed to edit.
* Fetch a filtered list of user roles that the current user is
* 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
* innappropriate ones depending on the situation or user making edits.
* Specifically because without filtering anyone with the edit_users
* capability can edit others to be administrators, even if they are
* only editors or authors. This filter allows admins to delegate
* user management.
* user management.
*
* @since 2.8
*
@ -277,8 +277,8 @@ function get_editable_roles() {
global $wp_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;
}

View File

@ -93,8 +93,8 @@ include('./admin-header.php');
</td>
</tr>
<tr>
<?php
if (!wp_timezone_supported()) : // no magic timezone support here
<?php
if (!wp_timezone_supported()) : // no magic timezone support here
?>
<th scope="row"><label for="gmt_offset"><?php _e('Timezone') ?> </label></th>
<td>
@ -130,7 +130,7 @@ foreach ( $offset_range as $offset ) {
<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>
</td>
<?php
<?php
else: // looks like we can do nice timezone selection!
$current_offset = get_option('gmt_offset');
$tzstring = get_option('timezone_string');
@ -158,7 +158,7 @@ if (empty($tzstring)) { // set the Etc zone if no timezone string exists
?>
<br />
<?php
if (function_exists('timezone_transitions_get') && $tzstring) {
if (function_exists('timezone_transitions_get') && $tzstring) {
$dateTimeZoneSelected = new DateTimeZone($tzstring);
foreach (timezone_transitions_get($dateTimeZoneSelected) as $tr) {
if ($tr['ts'] > time()) {
@ -166,7 +166,7 @@ if (empty($tzstring)) { // set the Etc zone if no timezone string exists
break;
}
}
if ($found) {
_e(' ');
$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" >
<h3><span><?php _e('Post Tags'); ?></span></h3>
<div class="inside">
<div class="tagsdiv" id="post_tag">
<div class="tagsdiv" id="post_tag">
<p class="jaxtag">
<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;">
<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" />
</span>
</p>
<div class="tagchecklist"></div>
</p>
<div class="tagchecklist"></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>
</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="' . $preview_link . '" class="thickbox thickbox-preview" title="' . attribute_escape(sprintf(__('Preview "%s"'), $theme_name)) . '">' . __('Preview') . '</a>';
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 = implode ( ' | ', $actions );

View File

@ -517,9 +517,9 @@ function wp_list_authors($args = '') {
}
foreach ( (array) $authors as $author ) {
$link = '';
$link = '';
$author = get_userdata( $author->ID );
$posts = (isset($author_count[$author->ID])) ? $author_count[$author->ID] : 0;
$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 );
foreach( (array) $headers as $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);
extract($args, EXTR_SKIP);
$post = get_post($post);
if ( !comments_open($post->ID) )
return false;

View File

@ -1340,7 +1340,7 @@ function do_trackbacks($post_id) {
$to_ping = get_to_ping($post_id);
$pinged = get_pung($post_id);
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;
}

View File

@ -1,7 +1,7 @@
<?php
/**
* Default Widgets
/**
* Default Widgets
*
* @package WordPress
* @subpackage Widgets
@ -42,7 +42,7 @@ class WP_Widget_Pages extends WP_Widget {
echo $after_widget;
}
}
function update( $new_instance, $old_instance ) {
$instance = $old_instance;
$instance['title'] = strip_tags($new_instance['title']);
@ -56,7 +56,7 @@ class WP_Widget_Pages extends WP_Widget {
return $instance;
}
function form( $instance ) {
//Defaults
$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_rating = isset($instance['rating']) ? $instance['rating'] : false;
$show_images = isset($instance['images']) ? $instance['images'] : true;
$before_widget = preg_replace('/id="[^"]*"/','id="%id"', $before_widget);
wp_list_bookmarks(apply_filters('widget_links_args', array(
'title_before' => $before_title, 'title_after' => $after_title,
@ -112,7 +112,7 @@ class WP_Widget_Links extends WP_Widget {
'class' => 'linkcat widget'
)));
}
function update( $new_instance, $old_instance ) {
$new_instance = (array) $new_instance;
$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]) )
$instance[$field] = 1;
}
return $instance;
}
function form( $instance ) {
//Defaults
@ -162,7 +162,7 @@ class WP_Widget_Search extends WP_Widget {
// Use current theme search form if it exists
get_search_form();
echo $after_widget;
echo $after_widget;
}
}
@ -232,7 +232,7 @@ class WP_Widget_Archives extends WP_Widget {
* Meta widget class
*
* Displays log in/out, RSS feed links, etc.
*
*
* @since 2.8.0
*/
class WP_Widget_Meta extends WP_Widget {
@ -414,9 +414,9 @@ class WP_Widget_Categories extends WP_Widget {
<?php
}
echo $after_widget;
echo $after_widget;
}
function update( $new_instance, $old_instance ) {
$instance = $old_instance;
$instance['title'] = strip_tags($new_instance['title']);
@ -426,7 +426,7 @@ class WP_Widget_Categories extends WP_Widget {
return $instance;
}
function form( $instance ) {
//Defaults
$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
* will be false.
*
*
* @since 2.8.0
* @package WordPress
* @subpackage Transient
@ -710,7 +710,7 @@ function set_transient($transient, $value, $expiration = 0) {
if ( false === get_option( $safe_transient ) ) {
$autoload = 'yes';
if ( 0 != $expiration ) {
$autoload = 'no';
$autoload = 'no';
add_option($transient_timeout, time() + $expiration, '', 'no');
}
return add_option($transient, $value, '', $autoload);
@ -1489,7 +1489,7 @@ function wp_get_nocache_headers() {
'Cache-Control' => 'no-cache, must-revalidate, max-age=0',
'Pragma' => 'no-cache',
);
if ( function_exists('apply_filters') ) {
$headers = apply_filters('nocache_headers', $headers);
}
@ -1507,8 +1507,8 @@ function wp_get_nocache_headers() {
*/
function nocache_headers() {
$headers = wp_get_nocache_headers();
foreach( (array) $headers as $name => $field_value )
@header("{$name}: {$field_value}");
foreach( (array) $headers as $name => $field_value )
@header("{$name}: {$field_value}");
}
/**
@ -3051,7 +3051,7 @@ function update_site_option( $key, $value ) {
/**
* gmt_offset modification for smart timezone handling
*
*
* Overrides the gmt_offset option if we have a timezone_string available
*/
function wp_timezone_override_offset() {
@ -3061,27 +3061,27 @@ function wp_timezone_override_offset() {
if (empty($tz)) return false;
@date_default_timezone_set($tz);
$dateTimeZoneSelected = timezone_open($tz);
$dateTimeServer = date_create();
if ($dateTimeZoneSelected === false || $dateTimeServer === false) return false;
$timeOffset = timezone_offset_get($dateTimeZoneSelected, $dateTimeServer);
$timeOffset = $timeOffset / 3600;
return $timeOffset;
}
/**
* Check for PHP timezone support
*
*
*/
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_open')
&& function_exists('timezone_open')
&& function_exists('timezone_offset_get')
)
)
return true;
return false;
@ -3108,7 +3108,7 @@ function wp_timezone_choice($selectedzone) {
$zonen[$i]['subcity'] = isset($zone[2]) ? $zone[2] : '';
$i++;
}
asort($zonen);
$structure = '';
$pad = '&nbsp;&nbsp;&nbsp;';

View File

@ -457,7 +457,7 @@ function wp_title($sep = '&raquo;', $display = true, $seplocation = '') {
$term = $term->name;
$title = "$tax$t_sep$term";
}
//If it's a search
if ( is_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() );
foreach( (array) $transports as $transport ) {
$response = $transport->request($url, $r);
if( has_action('http_api_debug') )
do_action( 'http_api_debug', $response, 'response', get_class($transport) );
@ -538,7 +538,7 @@ class WP_Http {
return false;
$home = parse_url( get_bloginfo('site_url') );
// Don't block requests back to ourselves by default
if ( $uri == 'localhost' || $uri == $home['host'] )
return apply_filters('block_local_requests', false);
@ -937,7 +937,7 @@ class WP_Http_Streams {
$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();
// 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'],
'useragent' => $r['user-agent'],
'headers' => $r['headers'],
'ssl' => array(
'ssl' => array(
'verifypeer' => 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) ) {
$parts = explode("\r\n\r\n", $theResponse);
$headerLength = curl_getinfo($handle, CURLINFO_HEADER_SIZE);
$theHeaders = trim( substr($theResponse, 0, $headerLength) );
$theBody = substr( $theResponse, $headerLength );
@ -1358,7 +1358,7 @@ class WP_HTTP_Proxy {
}
function __construct() {
}
/**
@ -1630,7 +1630,7 @@ class WP_Http_Cookie {
/**
* 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.
*
* @access public
@ -1683,7 +1683,7 @@ class WP_Http_Cookie {
function getHeaderValue() {
if ( empty( $this->name ) || empty( $this->value ) )
return '';
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.
*
*
* @see _n_noop()
*/
function _nx_noop( $single, $plural, $context ) {
@ -260,13 +260,13 @@ function load_textdomain($domain, $mofile) {
global $l10n;
if ( !is_readable($mofile)) return;
$mo = new MO();
$mo->import_from_file( $mofile );
if (isset($l10n[$domain]))
$mo->merge_with( $l10n[$domain] );
$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 empty Translations instance.
*
*
* @param string $domain
* @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
* not in the source there are dummy gettext calls to get them into the POT
* file and this function properly translates them back.
*
*
* 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
* 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)
$url .= '/' . ltrim($folder, '/');
}
if ( !empty($path) && is_string($path) && strpos($path, '..') === false )
$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
* 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
* http://trac.wordpress.org/ticket/5007.
*/
if ( !isset( $from_email ) ) {
// Get the site domain and get rid of www.
$sitename = strtolower( $_SERVER['SERVER_NAME'] );
@ -1383,7 +1383,7 @@ if ( !function_exists('wp_generate_password') ) :
* @since 2.5
*
* @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
**/
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() )
$host = 'https://secure.gravatar.com';
$host = 'https://secure.gravatar.com';
else
$host = 'http://www.gravatar.com';

View File

@ -42,7 +42,7 @@ class MO extends Translations {
$magic_little_64 = (int) 2500072158;
// 0xde120495
$magic_big = ((int) - 569244523) && 0xFFFFFFFF;
if ($magic_little == $magic || $magic_little_64 == $magic) {
return 'little';
} else if ($magic_big == $magic) {
@ -67,9 +67,9 @@ class MO extends Translations {
$translations_lo_addr = $reader->readint32();
$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);
$translations_lo = $reader->readint32array($total * 2);
$translations_lo = $reader->readint32array($total * 2);
$length = create_function('$i', 'return $i * 2 + 1;');
$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
*/
class PO extends Translations {
/**
* Exports headers to a PO entry
@ -94,7 +94,7 @@ class PO extends Translations {
"$tab" => '\t',
"$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();
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
*
* @static
@ -153,7 +153,7 @@ class PO extends Translations {
*/
function export_entry(&$entry) {
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->extracted_comments)) $po[] = PO::comment_block($entry->extracted_comments, '.');
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
* plural expressions, because PHP evaluates ternary oerators from left to right
*
*
* @param string $expression the expression without parentheses
* @return string the expression with parentheses added
*/
@ -158,7 +158,7 @@ class Translations {
}
return rtrim($res, ';');
}
/**
* Merge $other in the current object.
*

View File

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

View File

@ -512,7 +512,7 @@ function get_posts($args = null) {
function add_post_meta($post_id, $meta_key, $meta_value, $unique = false) {
if ( !$meta_key )
return false;
global $wpdb;
// 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 )
return false;
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 ) );
else
@ -597,7 +597,7 @@ function delete_post_meta($post_id, $meta_key, $meta_value = '') {
function get_post_meta($post_id, $key, $single = false) {
if ( !$key )
return '';
$post_id = (int) $post_id;
$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 )
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 ) ) ) {
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) {
if ( !$post_meta_key )
return false;
global $wpdb;
if ( $wpdb->query($wpdb->prepare("DELETE FROM $wpdb->postmeta WHERE meta_key = %s", $post_meta_key)) ) {
/** @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 ) {
if ( !$key )
return null;
$custom = get_post_custom($post_id);
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
if ( !empty($tax_input) ) {
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 = add_magic_quotes($post); //since data is from db
$revision_id = wp_insert_post( $post );
if ( is_wp_error($revision_id) )
return $revision_id;
@ -3602,7 +3602,7 @@ function wp_restore_post_revision( $revision_id, $fields = null ) {
return false;
$update['ID'] = $revision['post_parent'];
$update = add_magic_quotes( $update ); //since data is from db
$post_id = wp_update_post( $update );

View File

@ -6,18 +6,18 @@
* {@link http://backpress.automattic.com/ BackPress}. WordPress themes and
* plugins will only be concerned about the filters and actions set in this
* file.
*
*
* 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('CONCATENATE_SCRIPTS', false); disables both compression and cancatenating,
* define('COMPRESS_SCRIPTS', false); disables compression of scripts,
* define('COMPRESS_CSS', false); disables compression of CSS,
* 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
* 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.
*
*
* @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_data( 'media', 'group', 1 );
$scripts->add( 'codepress', '/wp-includes/js/codepress/codepress.js', false, '0.9.6' );
$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
* in a regex class.
*
*
* The regular expresion contains 6 different sub matches to help with parsing.
*
*
* 1/6 - An extra [ or ] to allow for escaping shortcodes with double [[]]
* 2 - The shortcode name
* 3 - The shortcode argument list
* 4 - The self closing /
* 5 - The content of a shortcode when it wraps some content.
*
*
* @since 2.5
* @uses $shortcode_tags
*
@ -196,7 +196,7 @@ function do_shortcode_tag($m) {
if ($m[1] == '[' && $m[6] == ']') {
return substr($m[0], 1, -1);
}
$tag = $m[2];
$attr = shortcode_parse_atts($m[3]);

View File

@ -535,7 +535,7 @@ function get_term_to_edit( $id, $taxonomy ) {
* 'exclude' is ignored.
*
* 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.
*
* 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 ) ) {
$excluded_trunks = preg_split('/[\s,]+/',$exclude_tree);
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;
foreach( (array) $excluded_children as $exterm ) {
if ( empty($exclusions) )
@ -736,7 +736,7 @@ function &get_terms($taxonomies, $args = '') {
if ( $hide_empty && !$hierarchical )
$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( $offset )
$limit = 'LIMIT ' . $offset . ',' . $number;

View File

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

View File

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

View File

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

View File

@ -202,7 +202,7 @@ if (defined('WP_DEBUG') and WP_DEBUG == true) {
error_reporting(E_ALL);
} else {
// 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 );
else if ( defined( 'E_DEPRECATED' ) ) // Introduced in PHP 5.3
error_reporting( E_ALL ^ E_DEPRECATED ^ E_NOTICE ^ E_USER_NOTICE );
@ -377,7 +377,7 @@ if ( !defined('WPMU_PLUGIN_URL') )
*
* @since 2.8.0
*/
if ( !defined( 'MUPLUGINDIR' ) )
if ( !defined( 'MUPLUGINDIR' ) )
define( 'MUPLUGINDIR', 'wp-content/mu-plugins' ); // Relative to ABSPATH. For back compat.
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.'));
}
// Only posts can be sticky
if ( $post_type == 'post' && isset( $content_struct['sticky'] ) )
if ( $content_struct['sticky'] == true )
stick_post( $post_ID );
elseif ( $content_struct['sticky'] == false )
unstick_post( $post_ID );
// Only posts can be sticky
if ( $post_type == 'post' && isset( $content_struct['sticky'] ) )
if ( $content_struct['sticky'] == true )
stick_post( $post_ID );
elseif ( $content_struct['sticky'] == false )
unstick_post( $post_ID );
if ( isset($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) {
if( is_array( $enclosure ) && isset( $enclosure['url'] ) && isset( $enclosure['length'] ) && isset( $enclosure['type'] ) ) {
$encstring = $enclosure['url'] . "\n" . $enclosure['length'] . "\n" . $enclosure['type'];
$found = false;
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.
*
@ -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.'));
}
// Only posts can be sticky
if ( $post_type == 'post' && isset( $content_struct['sticky'] ) )
if ( $content_struct['sticky'] == true )
stick_post( $post_ID );
elseif ( $content_struct['sticky'] == false )
unstick_post( $post_ID );
// Only posts can be sticky
if ( $post_type == 'post' && isset( $content_struct['sticky'] ) )
if ( $content_struct['sticky'] == true )
stick_post( $post_ID );
elseif ( $content_struct['sticky'] == false )
unstick_post( $post_ID );
if ( isset($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';
}
$sticky = false;
if ( is_sticky( $post_ID ) )
$sticky = true;
$sticky = false;
if ( is_sticky( $post_ID ) )
$sticky = true;
$enclosure = array();
foreach ( (array) get_post_custom($post_ID) as $key => $val) {