Trailing whitespace cleanup

git-svn-id: http://svn.automattic.com/wordpress/trunk@6726 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2008-02-05 06:47:27 +00:00
parent 252c30c9c1
commit d88983793b
62 changed files with 514 additions and 514 deletions

View File

@ -303,7 +303,7 @@ case 'add-link-cat' : // From Blogroll -> Categories
if ( !$link_cat = link_cat_row( $term_id ) )
die('0');
$x = new WP_Ajax_Response( array(
'what' => 'link-cat',
'id' => $term_id,

View File

@ -48,7 +48,7 @@ addLoadEvent(focusit);
<div id="titlediv">
<h3><?php _e('Title') ?></h3>
<div class="inside">
<div class="inside">
<input type="text" name="post_title" size="30" tabindex="1" value="<?php echo attribute_escape( $post->post_title ); ?>" id="title" />
</div>
</div>

View File

@ -87,7 +87,7 @@ if ($posts) {
</tr>
</thead>
<tbody id="the-list" class="list:page">
<?php page_rows($posts); ?>
<?php page_rows($posts); ?>
</tbody>
</table>

View File

@ -42,8 +42,8 @@ case 'edit':
require_once ('admin-header.php');
$tag_ID = (int) $_GET['tag_ID'];
$tag = get_term($tag_ID, 'post_tag', OBJECT, 'edit');
$tag = get_term($tag_ID, 'post_tag', OBJECT, 'edit');
include('edit-tag-form.php');
break;

View File

@ -4,7 +4,7 @@ require_once('includes/export.php');
$title = __('Export');
$parent_file = 'edit.php';
if ( isset( $_GET['download'] ) ) {
if ( isset( $_GET['download'] ) ) {
export_wp( $_GET['author'] );
die();
}

View File

@ -381,7 +381,7 @@ class Blogger_Import {
$AtomParser = new AtomParser();
$AtomParser->parse( $entry );
$result = $this->import_post($AtomParser->entry);
if ( is_wp_error( $result ) )
if ( is_wp_error( $result ) )
return $result;
unset($AtomParser);
}
@ -520,7 +520,7 @@ class Blogger_Import {
$post = compact('post_date', 'post_content', 'post_title', 'post_status');
$post_id = wp_insert_post($post);
if ( is_wp_error( $post_id ) )
if ( is_wp_error( $post_id ) )
return $post_id;
wp_create_categories( array_map( 'addslashes', $entry->categories ), $post_id );

View File

@ -61,7 +61,7 @@ class BunnyTags_Import {
echo '<div class="narrow">';
echo '<p><h3>'.__('Reading Bunny&#8217;s Technorati Tags&#8230;').'</h3></p>';
// import Bunny's Keywords tags
// import Bunny's Keywords tags
$metakeys = $wpdb->get_results("SELECT post_id, meta_id, meta_key, meta_value FROM $wpdb->postmeta WHERE $wpdb->postmeta.meta_key = 'tags'");
if ( !is_array($metakeys)) {
echo '<p>' . __('No Tags Found!') . '</p>';

View File

@ -77,7 +77,7 @@ class JeromesKeyword_Import {
echo '<div class="narrow">';
echo '<p><h3>'.__('Reading Jerome&#8217;s Keywords Tags&#8230;').'</h3></p>';
// import Jerome's Keywords tags
// import Jerome's Keywords tags
$metakeys = $wpdb->get_results("SELECT post_id, meta_id, meta_key, meta_value FROM $wpdb->postmeta WHERE $wpdb->postmeta.meta_key = 'keywords'");
if ( !is_array($metakeys)) {
echo '<p>' . __('No Tags Found!') . '</p>';
@ -117,7 +117,7 @@ class JeromesKeyword_Import {
echo '<div class="narrow">';
echo '<p><h3>'.__('Reading Jerome&#8217;s Keywords Tags&#8230;').'</h3></p>';
// import Jerome's Keywords tags
// import Jerome's Keywords tags
$tablename = $wpdb->prefix . substr(get_option('jkeywords_keywords_table'), 1, -1);
$metakeys = $wpdb->get_results("SELECT post_id, tag_name FROM $tablename");
if ( !is_array($metakeys) ) {

View File

@ -215,7 +215,7 @@ class MT_Import {
$post->post_author = $this->checkauthor($post->post_author); //just so that if a post already exists, new users are not created by checkauthor
$post_id = wp_insert_post($post);
if ( is_wp_error( $post_id ) )
if ( is_wp_error( $post_id ) )
return $post_id;
// Add categories.
@ -294,7 +294,7 @@ class MT_Import {
// Finishing a post.
$context = '';
$result = $this->save_post($post, $comments, $pings);
if ( is_wp_error( $result ) )
if ( is_wp_error( $result ) )
return $result;
$post = new StdClass;
$comment = new StdClass();
@ -420,7 +420,7 @@ class MT_Import {
$this->file = get_attached_file($this->id);
$this->get_authors_from_post();
$result = $this->process_posts();
if ( is_wp_error( $result ) )
if ( is_wp_error( $result ) )
return $result;
}

View File

@ -70,7 +70,7 @@ class STP_Import {
if ( get_option('stpimp_posts') ) {
delete_option('stpimp_posts');
}
add_option('stpimp_posts', $posts);
$count = count($posts);
echo '<p>' . sprintf( __ngettext('Done! <strong>%s</strong> tag to post relationships were read.', 'Done! <strong>%s</strong> tags to post relationships were read.', $count), $count ) . '<br /></p>';
@ -87,10 +87,10 @@ class STP_Import {
function import_t2p ( ) {
echo '<div class="narrow">';
echo '<p><h3>'.__('Adding Tags to Posts&#8230;').'</h3></p>';
// run that funky magic!
$tags_added = $this->tag2post();
echo '<p>' . sprintf( __ngettext('Done! <strong>%s</strong> tags where added!', 'Done! <strong>%s</strong> tags where added!', $tags_added), $tags_added ) . '<br /></p>';
echo '<form action="admin.php?import=stp&amp;step=3" method="post">';
wp_nonce_field('import-stp');

View File

@ -646,7 +646,7 @@ class Textpattern_Import {
break;
case 3 :
$result = $this->import_posts();
if ( is_wp_error( $result ) )
if ( is_wp_error( $result ) )
echo $result->get_error_message();
break;
case 4 :

View File

@ -9,10 +9,10 @@ class WP_Import {
var $mtnames = array ();
var $newauthornames = array ();
var $allauthornames = array ();
var $author_ids = array ();
var $tags = array ();
var $j = -1;
var $fetch_attachments = false;
var $url_remap = array ();
@ -51,25 +51,25 @@ class WP_Import {
function has_gzip() {
return is_callable('gzopen');
}
function fopen($filename, $mode='r') {
if ( $this->has_gzip() )
return gzopen($filename, $mode);
return fopen($filename, $mode);
}
function feof($fp) {
if ( $this->has_gzip() )
return gzeof($fp);
return feof($fp);
}
function fgets($fp, $len=8192) {
if ( $this->has_gzip() )
return gzgets($fp, $len);
return fgets($fp, $len);
}
function fclose($fp) {
if ( $this->has_gzip() )
return gzclose($fp);
@ -86,7 +86,7 @@ class WP_Import {
if ($fp) {
while ( !$this->feof($fp) ) {
$importline = rtrim($this->fgets($fp));
// this doesn't check that the file is perfectly valid but will at least confirm that it's not the wrong format altogether
if ( !$is_wxr_file && preg_match('|xmlns:wp="http://wordpress[.]org/export/\d+[.]\d+/"|', $importline) )
$is_wxr_file = true;
@ -123,7 +123,7 @@ class WP_Import {
return $is_wxr_file;
}
function get_wp_authors() {
// We need to find unique values of author names, while preserving the order, so this function emulates the unique_value(); php function, without the sorting.
$temp = $this->allauthornames;
@ -140,11 +140,11 @@ class WP_Import {
function get_authors_from_post() {
global $current_user;
// this will populate $this->author_ids with a list of author_names => user_ids
foreach ( $_POST['author_in'] as $i => $in_author_name ) {
if ( !empty($_POST['user_select'][$i]) ) {
// an existing user was selected in the dropdown list
$user = get_userdata( intval($_POST['user_select'][$i]) );
@ -153,26 +153,26 @@ class WP_Import {
}
elseif ( $this->allow_create_users() ) {
// nothing was selected in the dropdown list, so we'll use the name in the text field
$new_author_name = trim($_POST['user_create'][$i]);
// if the user didn't enter a name, assume they want to use the same name as in the import file
if ( empty($new_author_name) )
$new_author_name = $in_author_name;
$user_id = username_exists($new_author_name);
if ( !$user_id ) {
if ( !$user_id ) {
$user_id = wp_create_user($new_author_name, 'changeme');
}
$this->author_ids[$in_author_name] = $user_id;
}
// failsafe: if the user_id was invalid, default to the current user
if ( empty($this->author_ids[$in_author_name]) ) {
$this->author_ids[$in_author_name] = intval($current_user->ID);
}
}
}
function wp_authors_form() {
@ -196,10 +196,10 @@ class WP_Import {
$this->users_form($j, $author);
echo '</li>';
}
if ( $this->allow_fetch_attachments() ) {
?>
</ol>
?>
</ol>
<h2><?php _e('Import Attachments'); ?></h2>
<p>
<input type="checkbox" value="1" name="attachments" id="import-attachments" />
@ -208,14 +208,14 @@ class WP_Import {
<?php
}
echo '<input type="submit" value="Submit">'.'<br />';
echo '</form>';
}
function users_form($n, $author) {
if ( $this->allow_create_users() ) {
printf(__('Create user %1$s or map to existing'), ' <input type="text" value="'.$author.'" name="'.'user_create['.intval($n).']'.'" maxlength="30"> <br />');
}
@ -225,7 +225,7 @@ class WP_Import {
// keep track of $n => $author name
echo '<input type="hidden" name="author_in['.intval($n).']" value="'.htmlspecialchars($author).'" />';
$users = get_users_of_blog();
?><select name="user_select[<?php echo $n; ?>]">
<option value="0">- Select -</option>
@ -252,10 +252,10 @@ class WP_Import {
// fetch the user ID for a given author name, respecting the mapping preferences
function checkauthor($author) {
global $current_user;
if ( !empty($this->author_ids[$author]) )
return $this->author_ids[$author];
// failsafe: map to the current user
return $current_user->ID;
}
@ -334,7 +334,7 @@ class WP_Import {
function process_post($post) {
global $wpdb;
$post_ID = (int) $this->get_tag( $post, 'wp:post_id' );
if ( $post_ID && !empty($this->post_ids_processed[$post_ID]) ) // Processed already
return 0;
@ -357,7 +357,7 @@ class WP_Import {
$post_content = preg_replace('|<(/?[A-Z]+)|e', "'<' . strtolower('$1')", $post_content);
$post_content = str_replace('<br>', '<br />', $post_content);
$post_content = str_replace('<hr>', '<hr />', $post_content);
preg_match_all('|<category domain="tag">(.*?)</category>|is', $post, $tags);
$tags = $tags[1];
@ -377,7 +377,7 @@ class WP_Import {
}
$post_exists = post_exists($post_title, '', $post_date);
if ( $post_exists ) {
echo '<li>';
printf(__('Post <i>%s</i> already exists.'), stripslashes($post_title));
@ -405,7 +405,7 @@ class WP_Import {
$remote_url = $this->get_tag( $post, 'wp:attachment_url' );
if ( !$remote_url )
$remote_url = $guid;
$comment_post_ID = $post_id = $this->process_attachment($postdata, $remote_url);
if ( !$post_id or is_wp_error($post_id) )
return $post_id;
@ -414,7 +414,7 @@ class WP_Import {
printf(__('Importing post <i>%s</i>...'), stripslashes($post_title));
$comment_post_ID = $post_id = wp_insert_post($postdata);
}
if ( is_wp_error( $post_id ) )
return $post_id;
@ -422,7 +422,7 @@ class WP_Import {
if ( $post_id && $post_ID ) {
$this->post_ids_processed[intval($post_ID)] = intval($post_id);
}
// Add categories.
if (count($categories) > 0) {
$post_cats = array();
@ -495,15 +495,15 @@ class WP_Import {
$key = $this->get_tag( $p, 'wp:meta_key' );
$value = $this->get_tag( $p, 'wp:meta_value' );
$value = stripslashes($value); // add_post_meta() will escape.
$this->process_post_meta($post_id, $key, $value);
} }
do_action('import_post_added', $post_id);
print "</li>\n";
}
function process_post_meta($post_id, $key, $value) {
// the filter can return false to skip a particular metadata key
$_key = apply_filters('import_post_meta_key', $key);
@ -512,7 +512,7 @@ class WP_Import {
do_action('import_post_meta', $post_id, $_key, $value);
}
}
function process_attachment($postdata, $remote_url) {
if ($this->fetch_attachments and $remote_url) {
printf( __('Importing attachment <i>%s</i>... '), htmlspecialchars($remote_url) );
@ -524,7 +524,7 @@ class WP_Import {
else {
print '('.size_format(filesize($upload['file'])).')';
}
if ( $info = wp_check_filetype($upload['file']) ) {
$postdata['post_mime_type'] = $info['type'];
}
@ -532,13 +532,13 @@ class WP_Import {
print __('Invalid file type');
return;
}
$postdata['guid'] = $upload['url'];
// as per wp-admin/includes/upload.php
$post_id = wp_insert_attachment($postdata, $upload['file']);
wp_update_attachment_metadata( $post_id, wp_generate_attachment_metadata( $post_id, $upload['file'] ) );
// remap the thumbnail url. this isn't perfect because we're just guessing the original url.
if ( preg_match('@^image/@', $info['type']) && $thumb_url = wp_get_attachment_thumb_url($post_id) ) {
$parts = pathinfo($remote_url);
@ -546,17 +546,17 @@ class WP_Import {
$name = basename($parts['basename'], ".{$ext}");
$this->url_remap[$parts['dirname'] . '/' . $name . '.thumbnail.' . $ext] = $thumb_url;
}
return $post_id;
}
else {
printf( __('Skipping attachment <i>%s</i>'), htmlspecialchars($remote_url) );
}
}
function fetch_remote_file($post, $url) {
$upload = wp_upload_dir($post['post_date']);
// extract the file name and extension from the url
$file_name = basename($url);
@ -566,10 +566,10 @@ class WP_Import {
echo $upload['error'];
return new WP_Error( 'upload_dir_error', $upload['error'] );
}
// fetch the remote url and write it to the placeholder file
$headers = wp_get_http($url, $upload['file']);
// make sure the fetch was successful
if ( $headers['response'] != '200' ) {
@unlink($upload['file']);
@ -579,34 +579,34 @@ class WP_Import {
@unlink($upload['file']);
return new WP_Error( 'import_file_error', __('Remote file is incorrect size') );
}
$max_size = $this->max_attachment_size();
if ( !empty($max_size) and filesize($upload['file']) > $max_size ) {
@unlink($upload['file']);
return new WP_Error( 'import_file_error', sprintf(__('Remote file is too large, limit is %s', size_format($max_size))) );
}
// keep track of the old and new urls so we can substitute them later
$this->url_remap[$url] = $upload['url'];
// if the remote url is redirected somewhere else, keep track of the destination too
if ( $headers['x-final-location'] != $url )
$this->url_remap[$headers['x-final-location']] = $upload['url'];
return $upload;
}
// sort by strlen, longest string first
function cmpr_strlen($a, $b) {
return strlen($b) - strlen($a);
}
// update url references in post bodies to point to the new local files
function backfill_attachment_urls() {
// make sure we do the longest urls first, in case one is a substring of another
uksort($this->url_remap, array(&$this, 'cmpr_strlen'));
global $wpdb;
foreach ($this->url_remap as $from_url => $to_url) {
// remap urls in post_content
@ -615,11 +615,11 @@ class WP_Import {
$result = $wpdb->query( $wpdb->prepare("UPDATE {$wpdb->postmeta} SET meta_value = REPLACE(meta_value, '%s', '%s') WHERE meta_key='enclosure'", $from_url, $to_url) );
}
}
// update the post_parent of orphans now that we know the local id's of all parents
function backfill_parents() {
global $wpdb;
foreach ($this->orphans as $child_id => $parent_id) {
$local_child_id = $this->post_ids_processed[$child_id];
$local_parent_id = $this->post_ids_processed[$parent_id];
@ -628,7 +628,7 @@ class WP_Import {
}
}
}
function is_valid_meta_key($key) {
// skip _wp_attached_file metadata since we'll regenerate it from scratch
if ( $key == '_wp_attached_file' )
@ -640,7 +640,7 @@ class WP_Import {
function allow_create_users() {
return apply_filters('import_allow_create_users', true);
}
// give the user the option of downloading and importing attached files
function allow_fetch_attachments() {
return apply_filters('import_allow_fetch_attachments', true);
@ -650,20 +650,20 @@ class WP_Import {
// can be overridden with a filter - 0 means no limit
return apply_filters('import_attachment_size_limit', 0);
}
function import_start() {
wp_defer_term_counting(true);
wp_defer_comment_counting(true);
do_action('import_start');
}
function import_end() {
do_action('import_end');
// clear the caches after backfilling
foreach ($this->post_ids_processed as $post_id)
clean_post_cache($post_id);
wp_defer_term_counting(false);
wp_defer_comment_counting(false);
}
@ -676,10 +676,10 @@ class WP_Import {
$file = get_attached_file($this->id);
$this->import_file($file);
}
function import_file($file) {
$this->file = $file;
$this->import_start();
$this->get_authors_from_post();
$this->get_entries();
@ -689,11 +689,11 @@ class WP_Import {
$this->backfill_parents();
$this->backfill_attachment_urls();
$this->import_end();
if ( is_wp_error( $result ) )
return $result;
}
function handle_upload() {
$file = wp_import_handle_upload();
if ( isset($file['error']) ) {

View File

@ -1,4 +1,4 @@
<?php
<?php
class WP_Categories_to_Tags {
var $categories_to_convert = array();
@ -19,7 +19,7 @@ class WP_Categories_to_Tags {
$categories = get_categories('get=all');
foreach ( $categories as $category ) {
if ( !tag_exists($wpdb->escape($category->name)) )
$this->all_categories[] = $category;
$this->all_categories[] = $category;
}
}
@ -53,14 +53,14 @@ function check_all_rows() {
field[i].checked = true;
}
checkflag = 'true';
return '<?php _e('Uncheck All') ?>';
return '<?php _e('Uncheck All') ?>';
} else {
for ( i = 0; i < field.length; i++ ) {
if ( 'cats_to_convert[]' == field[i].name )
field[i].checked = false;
}
checkflag = 'false';
return '<?php _e('Check All') ?>';
return '<?php _e('Check All') ?>';
}
}
@ -76,7 +76,7 @@ function check_all_rows() {
foreach ($this->all_categories as $category) {
$category = sanitize_term( $category, 'category', 'display' );
if ((int) $category->parent == 0) {
echo '<li><label><input type="checkbox" name="cats_to_convert[]" value="' . intval($category->term_id) . '" /> ' . $category->name . ' (' . $category->count . ')</label>';
@ -164,7 +164,7 @@ function check_all_rows() {
$id = $id['term_taxonomy_id'];
$posts = get_objects_in_term($category->term_id, 'category');
foreach ( $posts as $post ) {
if ( !$wpdb->get_var("SELECT object_id FROM $wpdb->term_relationships WHERE object_id = '$post' AND term_taxonomy_id = '$id'") )
if ( !$wpdb->get_var("SELECT object_id FROM $wpdb->term_relationships WHERE object_id = '$post' AND term_taxonomy_id = '$id'") )
$wpdb->query("INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id) VALUES ('$post', '$id')");
clean_post_cache($post);
}

View File

@ -58,7 +58,7 @@ function wp_dashboard_setup() {
wp_register_widget_control( 'dashboard_plugins', __( 'Plugins' ), 'wp_dashboard_empty', array(),
array( 'widget_id' => 'dashboard_plugins' )
);
// Primary feed (Dev Blog) Widget
if ( !isset( $widget_options['dashboard_primary'] ) ) {
@ -91,7 +91,7 @@ function wp_dashboard_setup() {
'items' => 15
);
}
wp_register_sidebar_widget( 'dashboard_secondary', $widget_options['dashboard_secondary']['title'], 'wp_dashboard_empty',
wp_register_sidebar_widget( 'dashboard_secondary', $widget_options['dashboard_secondary']['title'], 'wp_dashboard_empty',
array( 'all_link' => $widget_options['dashboard_secondary']['link'], 'feed_link' => $widget_options['dashboard_secondary']['url'], 'width' => 'full' )
);
wp_register_widget_control( 'dashboard_secondary', __( 'Secondary Feed' ), 'wp_dashboard_rss_control', array(),

View File

@ -74,7 +74,7 @@ function wxr_cdata($str) {
function wxr_site_url() {
global $current_site;
// mu: the base url
if ( isset($current_site->domain) ) {
return 'http://'.$current_site->domain.$current_site->path;

View File

@ -21,7 +21,7 @@ function wp_create_thumbnail( $file, $max_side, $deprecated = '' ) {
$file = get_attached_file( $file );
$image = wp_load_image( $file );
if ( !is_resource( $image ) )
return $image;
@ -39,10 +39,10 @@ function wp_create_thumbnail( $file, $max_side, $deprecated = '' ) {
imagealphablending( $thumbnail, false);
imagesavealpha( $thumbnail, true);
}
@ imagecopyresampled( $thumbnail, $image, 0, 0, 0, 0, $image_new_width, $image_new_height, $sourceImageWidth, $sourceImageHeight );
imagedestroy( $image ); // Free up memory
imagedestroy( $image ); // Free up memory
// If no filters change the filename, we'll do a default transformation.
if ( basename( $file ) == $thumb = apply_filters( 'thumbnail_filename', basename( $file ) ) )
@ -67,12 +67,12 @@ function wp_create_thumbnail( $file, $max_side, $deprecated = '' ) {
break;
}
imagedestroy( $thumbnail ); // Free up memory
// Set correct file permissions
$stat = stat( dirname( $thumbpath ));
imagedestroy( $thumbnail ); // Free up memory
// Set correct file permissions
$stat = stat( dirname( $thumbpath ));
$perms = $stat['mode'] & 0000666; //same permissions as parent folder, strip off the executable bits
@ chmod( $thumbpath, $perms );
@ chmod( $thumbpath, $perms );
return apply_filters( 'wp_create_thumbnail', $thumbpath );
}
@ -114,8 +114,8 @@ function wp_crop_image( $src_file, $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_
imageantialias( $dst, true );
imagecopyresampled( $dst, $src, 0, 0, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h );
imagedestroy( $src ); // Free up memory
imagedestroy( $src ); // Free up memory
if ( ! $dst_file )
$dst_file = str_replace( basename( $src_file ), 'cropped-' . basename( $src_file ), $src_file );
@ -159,7 +159,7 @@ function wp_generate_attachment_metadata( $attachment_id, $file ) {
if ( @file_exists($thumb) )
$metadata['thumb'] = basename($thumb);
}
// fetch additional metadata from exif/iptc
$image_meta = wp_read_image_metadata( $file );
if ($image_meta)

View File

@ -15,7 +15,7 @@ function image_upload_form( $action_url, $values = array(), $error = null ) {
$image_title = attribute_escape( @$values['image-title'] );
$image_align = @$values['image-url'];
$post_id = $_GET['post_id'];
?>
<div id="media-upload-header">
<h3>Add Image</h3>
@ -33,7 +33,7 @@ function image_upload_form( $action_url, $values = array(), $error = null ) {
<script type="text/javascript">
<!--
jQuery(document).ready(function(){
jQuery(document).ready(function(){
var swfu = new SWFUpload({
upload_url : "<?php echo get_option('siteurl').'/wp-admin/async-upload.php'; ?>",
flash_url : "<?php echo get_option('siteurl').'/wp-includes/js/swfupload/swfupload_f9.swf'; ?>",
@ -59,9 +59,9 @@ jQuery(document).ready(function(){
progressTarget : "flash-upload-ui",
cancelButtonId : "btnCancel2"
},
debug: false,
});
document.getElementById("flash-browse-button").onclick = function () { swfu.selectFile(); };
@ -107,7 +107,7 @@ jQuery(document).ready(function(){
}
function image_upload_handler() {
if ( !current_user_can('upload_files') ) {
return new wp_error( 'upload_not_allowed', __('You are not allowed to upload files.') );
}
@ -119,7 +119,7 @@ function image_upload_handler() {
else {
// Add Image button was clicked
check_admin_referer('inlineuploading');
// if the async flash uploader was used, the attachment has already been inserted and its ID is passed in post.
// otherwise this is a regular form post and we still have to handle the upload and create the attachment.
if ( !empty($_POST['attachment_id']) ) {
@ -134,7 +134,7 @@ function image_upload_handler() {
else {
$id = image_upload_post();
}
// if the input was invalid, redisplay the form with its current values
if ( is_wp_error($id) )
wp_iframe( 'image_upload_form', get_option('siteurl') . '/wp-admin/media-upload.php?type=image', $_POST, $id );
@ -150,7 +150,7 @@ function async_image_callback($id) {
$thumb_url = wp_get_attachment_thumb_url($id);
if ( empty($thumb_url) )
$thumb_url = wp_mime_type_icon($id);
if ($thumb_url) {
$out = '<p><input type="hidden" name="attachment_id" id="attachment_id" value="'.intval($id).'" />'
. '<img src="'.wp_get_attachment_thumb_url($id).'" class="pinkynail" /> '
@ -160,11 +160,11 @@ function async_image_callback($id) {
$out = '<p><input type="hidden" name="attachment_id" id="attachment_id" value="'.intval($id).'" />'
. basename(wp_get_attachment_url($id)).'</p>';
}
$post = get_post($id);
$title = addslashes($post->post_title);
$alt = addslashes($post->post_content);
// populate the input fields with post data (which in turn comes from exif/iptc)
$out .= <<<EOF
<script type="text/javascript">
@ -174,7 +174,7 @@ jQuery('#image-title').val('{$title}').attr('disabled', false);
jQuery('#image-url').attr('disabled', false);
jQuery('#image-add').attr('disabled', false);
-->
</script>
</script>
EOF;
return $out;
@ -184,10 +184,10 @@ add_filter('async_upload_image', 'async_image_callback');
function image_send_to_editor($id, $alt, $title, $align, $url='') {
$img_src = wp_get_attachment_url($id);
$meta = wp_get_attachment_metadata($id);
$hwstring = '';
if ( isset($meta['width'], $meta['height']) )
$hwstring = ' width="'.intval($meta['width']).'" height="'.intval($meta['height']).'"';
@ -207,7 +207,7 @@ function media_send_to_editor($html) {
top.send_to_editor('<?php echo addslashes($html); ?>');
top.tb_remove();
-->
</script>
</script>
<?php
}
@ -217,21 +217,21 @@ function image_upload_post() {
return new wp_error( 'image_file_required', __('Please choose an image file to upload') );
if ( empty($_POST['image-alt']) )
return new wp_error( 'image_alt_required', __('Please enter an &lt;alt&gt; description') );
$overrides = array('test_form'=>false);
$file = wp_handle_upload($_FILES['image-file'], $overrides);
if ( isset($file['error']) )
return new wp_error( 'upload_error', $file['error'] );
$url = $file['url'];
$type = $file['type'];
$file = $file['file'];
$post_title = trim($_POST['image-title']);
$post_content = trim($_POST['image-alt']);
$post_parent = intval($_POST['parent_post_id']);
// Construct the attachment array
$attachment = array(
'post_title' => $post_title,
@ -247,7 +247,7 @@ function image_upload_post() {
if ( !is_wp_error($id) )
wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) );
return $id;
return $id;
}
// this handles the file upload POST itself, creating the attachment post

View File

@ -542,7 +542,7 @@ function get_sample_permalink($id, $name = null) {
$post->post_name = sanitize_title($post->post_name? $post->post_name : $post->post_title, $post->ID);
}
if (!is_null($name)) {
$post->post_name = sanitize_title($name, $post->ID);
$post->post_name = sanitize_title($name, $post->ID);
}
$permalink = get_permalink($post, true);
$permalink = array($permalink, $post->post_name);
@ -565,6 +565,6 @@ function get_sample_permalink_html($id, $new_slug=null) {
$post_name_html = '<span id="editable-post-name" title="'.$title.'">'.$post_name.'</span>';
$display_link = str_replace('%postname%', $post_name_html, $permalink);
return $display_link;
}
}
?>

View File

@ -239,41 +239,41 @@ function dropdown_link_categories( $default = 0 ) {
function _tag_row( $tag, $class = '' ) {
$count = number_format_i18n( $tag->count );
$count = ( $count > 0 ) ? "<a href='edit.php?tag=$tag->slug'>$count</a>" : $count;
$out = '';
$out .= '<tr id="tag-' . $tag->term_id . '"' . $class . '>';
$out .= '<th scope="row">' . $tag->term_id . '</th>';
$out .= '<td>' . apply_filters( 'term_name', $tag->name ) . '</td>';
$out .= "<td>$count</td>";
$out .= "<td>$count</td>";
$out .= '<td><a href="edit-tags.php?action=edit&amp;tag_ID=' . $tag->term_id . '" class="edit">' .
__( 'Edit' ) . "</a></td>" .
'<td><a href="' . wp_nonce_url( "edit-tags.php?action=delete&amp;tag_ID=$tag->term_id",
'delete-tag_' . $tag->term_id ) .
'<td><a href="' . wp_nonce_url( "edit-tags.php?action=delete&amp;tag_ID=$tag->term_id",
'delete-tag_' . $tag->term_id ) .
'" class="delete:the-list:tag-' . $tag->term_id . ' delete">' .
__( 'Delete' ) . "</a></td>";
$out .= '</tr>';
return $out;
}
// Outputs appropriate rows for the Nth page of the Tag Management screen,
// assuming M tags displayed at a time on the page
// assuming M tags displayed at a time on the page
// Returns the number of tags displayed
function tag_rows( $page = 0, $pagesize = 20, $searchterms = '' ) {
// Get a page worth of tags
$start = $page * $pagesize;
$args = array('offset' => $start, 'number' => $pagesize, 'hide_empty' => 0);
if ( !empty( $searchterms ) ) {
$args['name__like'] = '%' . like_escape( $searchterms );
}
$tags = get_terms( 'post_tag', $args );
// convert it to table rows
$out = '';
$class = '';
@ -291,7 +291,7 @@ function tag_rows( $page = 0, $pagesize = 20, $searchterms = '' ) {
$out .= _tag_row( $tag, $class );
$count++;
}
// filter and send to screen
$out = apply_filters('tag_rows', $out);
echo $out;
@ -330,7 +330,7 @@ function wp_manage_posts_columns() {
function display_page_row( $page, &$children_pages, $level = 0 ) {
global $post;
static $class;
$post = $page;
setup_postdata($page);
@ -355,14 +355,14 @@ function display_page_row( $page, &$children_pages, $level = 0 ) {
<?php
if ( ! $children_pages )
return true;
return true;
for ( $i = 0; $i < count($children_pages); $i++ ) {
$child = $children_pages[$i];
if ( $child->post_parent == $id ) {
array_splice($children_pages, $i, 1);
array_splice($children_pages, $i, 1);
display_page_row($child, $children_pages, $level+1);
$i = -1; //as numeric keys in $children_pages are not preserved after splice
}
@ -370,7 +370,7 @@ function display_page_row( $page, &$children_pages, $level = 0 ) {
}
/*
* displays pages in hierarchical order
* displays pages in hierarchical order
*/
function page_rows( $pages ) {
if ( ! $pages )
@ -385,33 +385,33 @@ function page_rows( $pages ) {
$children_pages = array();
foreach ( $pages as $page ) {
// catch and repair bad pages
// catch and repair bad pages
if ( $page->post_parent == $page->ID ) {
$page->post_parent = 0;
$page->post_parent = 0;
$wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_parent = '0' WHERE ID = %d", $page->ID) );
clean_page_cache( $page->ID );
}
if ( 0 == $page->post_parent )
$top_level_pages[] = $page;
$top_level_pages[] = $page;
else
$children_pages[] = $page;
$children_pages[] = $page;
}
foreach ( $top_level_pages as $page )
display_page_row($page, $children_pages, 0);
/*
/*
* display the remaining children_pages which are orphans
* having orphan requires parental attention
*/
if ( count($children_pages) > 0 ) {
$empty_array = array();
foreach ( $children_pages as $orphan_page ) {
$empty_array = array();
foreach ( $children_pages as $orphan_page ) {
clean_page_cache( $orphan_page->ID);
display_page_row( $orphan_page, $empty_array, 0 );
}
}
}
}
@ -649,7 +649,7 @@ function touch_time( $edit = 1, $for_post = 1, $tab_index = 0 ) {
if ( $for_post )
$edit = ( in_array($post->post_status, array('draft', 'pending') ) && (!$post->post_date || '0000-00-00 00:00:00' == $post->post_date ) ) ? false : true;
$tab_index_attribute = '';
if ( (int) $tab_index > 0 )
$tab_index_attribute = " tabindex=\"$tab_index\"";

View File

@ -52,7 +52,7 @@ function wp_list_widgets( $show = 'all', $_search = false ) {
if ( !$sidebar || false !== strpos( $widget_control_template, '%i%' ) ) {
$already_shown[] = $widget['callback']; // it's a multi-widget. We only need to show it in the list once.
$action = 'add';
$action = 'add';
$add_url = wp_nonce_url( add_query_arg( array(
'sidebar' => $sidebar,
'add' => $widget['id'],
@ -111,7 +111,7 @@ function wp_list_widgets( $show = 'all', $_search = false ) {
</li>
<?php endforeach; if ( $no_widgets_shown ) : ?>
<li><?php _e( 'No matching widgets' ); ?></li>
<?php endif; ?>

View File

@ -69,7 +69,7 @@ switch($step) {
if ( !empty($wpdb->error) )
wp_die($wpdb->error->get_error_message());
display_header();
display_header();
// Fill in the data we gathered
$weblog_title = stripslashes($_POST['weblog_title']);
$admin_email = stripslashes($_POST['admin_email']);

View File

@ -139,13 +139,13 @@ if (empty($plugins)) {
<tr>
<td colspan="3">&nbsp;</td>
<td colspan="2" style="width:12em;">
<?php
<?php
$active = get_option('active_plugins');
$inactive = get_option('deactivated_plugins');
if ( !empty($active) ) {
?>
<a href="<?php echo wp_nonce_url('plugins.php?action=deactivate-all', 'deactivate-all'); ?>" class="delete"><?php _e('Deactivate All Plugins'); ?></a>
<?php
<?php
} elseif ( empty($active) && !empty($inactive) ) {
?>
<a href="<?php echo wp_nonce_url('plugins.php?action=reactivate-all', 'reactivate-all'); ?>" class="delete"><?php _e('Reactivate All Plugins'); ?></a>

View File

@ -13,7 +13,7 @@ if (!file_exists('../wp-config-sample.php'))
$configFile = file('../wp-config-sample.php');
if ( !is_writable('../'))
if ( !is_writable('../'))
wp_die("Sorry, I can't write to the directory. You'll have to either change the permissions on your WordPress directory or create your wp-config.php manually.");
// Check if wp-config.php has been created
@ -194,7 +194,7 @@ switch($step) {
}
fclose($handle);
chmod('../wp-config.php', 0666);
display_header();
?>
<p>All right sparky! You've made it through this part of the installation. WordPress can now communicate with your database. If you are ready, time now to <a href="install.php">run the install!</a></p>

View File

@ -268,7 +268,7 @@ if ( $show_password_fields ) :
<?php endif; ?>
<?php
if ( $is_profile_page ) {
if ( $is_profile_page ) {
do_action('show_user_profile');
} else {
do_action('edit_user_profile');

View File

@ -176,7 +176,7 @@ case 'adduser':
default:
wp_enqueue_script('admin-users');
wp_enqueue_script('admin-forms');
include('admin-header.php');
// Query the users

View File

@ -27,7 +27,7 @@ if ( isset($_GET['sidebar']) && isset($wp_registered_sidebars[$_GET['sidebar']])
<p><?php _e( 'No Sidebars Defined' ); ?></p>
</div>
<div class="wrap">
<div class="wrap">
<p><?php _e( 'You are seeing this message because the theme you are currently using isn&#8217;t widget-aware, meaning that it has no sidebars that you are able to change. For information on making your theme widget-aware, please <a href="http://automattic.com/code/widgets/themes/">follow these instructions</a>.' ); /* TODO: article on codex */; ?></p>
</div>

View File

@ -164,7 +164,7 @@ class AtomServer {
function get_service() {
log_app('function','get_service()');
if( !current_user_can( 'edit_posts' ) )
if( !current_user_can( 'edit_posts' ) )
$this->auth_required( __( 'Sorry, you do not have the right to access this blog.' ) );
$entries_url = attribute_escape($this->get_entries_url());
@ -198,7 +198,7 @@ EOD;
function get_categories_xml() {
log_app('function','get_categories_xml()');
if( !current_user_can( 'edit_posts' ) )
if( !current_user_can( 'edit_posts' ) )
$this->auth_required( __( 'Sorry, you do not have the right to access this blog.' ) );
$home = attribute_escape(get_bloginfo_rss('home'));
@ -295,7 +295,7 @@ EOD;
global $entry;
if( !current_user_can( 'edit_post', $postID ) )
$this->auth_required( __( 'Sorry, you do not have the right to access this post.' ) );
$this->auth_required( __( 'Sorry, you do not have the right to access this post.' ) );
$this->set_current_entry($postID);
$output = $this->get_entry($postID);

View File

@ -47,7 +47,7 @@ function _walk_bookmarks($bookmarks, $args = '' ) {
extract( $r, EXTR_SKIP );
$output = ''; // Blank string to start with.
foreach ( (array) $bookmarks as $bookmark ) {
if ( !isset($bookmark->recently_updated) )
$bookmark->recently_updated = false;

View File

@ -268,7 +268,7 @@ function sanitize_bookmark($bookmark, $context = 'display') {
* @param mixed $value The bookmark field value
* @param int $bookmark_id Bookmark ID
* @param string $context How to filter the field value. Either 'raw', 'edit', 'attribute', 'js', 'db', or 'display'
* @return mixed The filtered value
* @return mixed The filtered value
*/
function sanitize_bookmark_field($field, $value, $bookmark_id, $context) {
$int_fields = array('link_id', 'link_rating');

View File

@ -51,7 +51,7 @@ function redirect_canonical($requested_url=null, $do_redirect=true) {
// Some PHP setups turn requests for / into /index.php in REQUEST_URI
$original['path'] = preg_replace('|/index\.php$|', '/', $original['path']);
$redirect = $original;
$redirect_url = false;

View File

@ -386,8 +386,8 @@ function is_wp_error($thing) {
return false;
}
/*
* A class for displaying various tree-like structures.
/*
* A class for displaying various tree-like structures.
* Extend the Walker class to use it, see examples at the bottom
*/
class Walker {
@ -405,120 +405,120 @@ class Walker {
* otherwise, display the element and its children
*/
function display_element( $element, &$children_elements, $max_depth, $depth=0, $args, $output ) {
if ( !$element)
return $output;
return $output;
if ( $max_depth != 0 ) {
if ($depth >= $max_depth)
return $output;
return $output;
}
$id_field = $this->db_fields['id'];
$parent_field = $this->db_fields['parent'];
if ($depth > 0) {
//start the child delimiter
$cb_args = array_merge( array($output, $depth), $args);
$output = call_user_func_array(array(&$this, 'start_lvl'), $cb_args);
}
}
//display this element
$cb_args = array_merge( array($output, $element, $depth), $args);
$output = call_user_func_array(array(&$this, 'start_el'), $cb_args);
for ( $i = 0; $i < sizeof( $children_elements ); $i++ ) {
$child = $children_elements[$i];
if ( $child->$parent_field == $element->$id_field ) {
array_splice( $children_elements, $i, 1 );
$output = $this->display_element( $child, $children_elements, $max_depth, $depth + 1, $args, $output );
$i = -1;
$i = -1;
}
}
//end this element
$cb_args = array_merge( array($output, $element, $depth), $args);
$output = call_user_func_array(array(&$this, 'end_el'), $cb_args);
if ($depth > 0) {
//end the child delimiter
$cb_args = array_merge( array($output, $depth), $args);
$output = call_user_func_array(array(&$this, 'end_lvl'), $cb_args);
}
return $output;
return $output;
}
/*
* displays array of elements hierarchically
* it is a generic function which does not assume any existing order of elements
* max_depth = -1 means flatly display every element
* max_depth = 0 means display all levels
* max_depth > 0 specifies the number of display levels.
* max_depth = -1 means flatly display every element
* max_depth = 0 means display all levels
* max_depth > 0 specifies the number of display levels.
*/
function walk( $elements, $max_depth) {
$args = array_slice(func_get_args(), 2);
$output = '';
if ($max_depth < -1) //invalid parameter
return $output;
return $output;
if (empty($elements)) //nothing to walk
return $output;
return $output;
$id_field = $this->db_fields['id'];
$parent_field = $this->db_fields['parent'];
// flat display
if ( -1 == $max_depth ) {
$empty_array = array();
foreach ( $elements as $e )
$empty_array = array();
foreach ( $elements as $e )
$output = $this->display_element( $e, $empty_array, 1, 0, $args, $output );
return $output;
return $output;
}
/*
* need to display in hierarchical order
/*
* need to display in hierarchical order
* splice elements into two buckets: those without parent and those with parent
*/
$top_level_elements = array();
$children_elements = array();
foreach ( $elements as $e) {
if ( 0 == $e->$parent_field )
$top_level_elements[] = $e;
$top_level_elements[] = $e;
else
$children_elements[] = $e;
$children_elements[] = $e;
}
/*
/*
* none of the elements is top level
* the first one must be root of the sub elements
*/
if ( !$top_level_elements ) {
$root = $children_elements[0];
for ( $i = 0; $i < sizeof( $children_elements ); $i++ ) {
$child = $children_elements[$i];
if ($root->$parent_field == $child->$parent_field )
$top_level_elements[] = $child;
$top_level_elements[] = $child;
array_splice( $children_elements, $i, 1 );
$i--;
$i--;
}
}
foreach ( $top_level_elements as $e )
$output = $this->display_element( $e, $children_elements, $max_depth, 0, $args, $output );
/*
* if we are displaying all levels, and remaining children_elements is not empty,
/*
* if we are displaying all levels, and remaining children_elements is not empty,
* then we got orphans, which should be displayed regardless
*/
if ( ( $max_depth == 0 ) && sizeof( $children_elements ) > 0 ) {
$empty_array = array();
$empty_array = array();
foreach ( $children_elements as $orphan_e )
$output = $this->display_element( $orphan_e, $empty_array, 1, 0, $args, $output );
}
@ -547,7 +547,7 @@ class Walker_Page extends Walker {
$indent = str_repeat("\t", $depth);
else
$indent = '';
extract($args, EXTR_SKIP);
$css_class = 'page_item page-item-'.$page->ID;
$_current_page = get_page( $current_page );
@ -749,7 +749,7 @@ class WP_Ajax_Response {
$response = '';
if ( is_wp_error($data) ) {
foreach ( $data->get_error_codes() as $code ) {
foreach ( $data->get_error_codes() as $code ) {
$response .= "<wp_error code='$code'><![CDATA[" . $data->get_error_message($code) . "]]></wp_error>";
if ( !$error_data = $data->get_error_data($code) )
continue;

View File

@ -130,7 +130,7 @@ function comment_author_link() {
*
* @since 1.5
* @uses $comment
* @uses apply_filters()
* @uses apply_filters()
*
* @return unknown
*/
@ -166,7 +166,7 @@ function get_comment_author_url() {
* comment_author_url() - Display the url of the author of the current comment
*
* @since 0.71
* @uses apply_filters()
* @uses apply_filters()
* @uses get_comment_author_url() Retrieves the comment author's URL
*/
function comment_author_url() {
@ -568,7 +568,7 @@ function trackback_rdf($deprecated = '') {
function comments_open( $post_id=NULL ) {
$_post = get_post($post_id);
$open = ( 'open' == $_post->comment_status );
return apply_filters( 'comments_open', $open, $post_id );
}
@ -577,7 +577,7 @@ function comments_open( $post_id=NULL ) {
* pings_open() - Whether the current post is open for pings
*
* @since 1.5
* @uses $post
* @uses $post
*
* @param int $post_id An optional post ID to check instead of the current post.
* @return bool True if pings are accepted
@ -757,7 +757,7 @@ function comments_popup_link( $zero = 'No Comments', $one = '1 Comment', $more =
echo ' class="'.$css_class.'" ';
}
$title = attribute_escape( get_the_title() );
echo apply_filters( 'comments_popup_link_attributes', '' );
echo ' title="' . sprintf( __('Comment on %s'), $title ) . '">';

View File

@ -244,30 +244,30 @@ function get_comment_count( $post_id = 0 ) {
$where = "WHERE comment_post_ID = {$post_id}";
}
$totals = (array) $wpdb->get_results("
SELECT comment_approved, COUNT( * ) AS total
FROM {$wpdb->comments}
{$where}
GROUP BY comment_approved
$totals = (array) $wpdb->get_results("
SELECT comment_approved, COUNT( * ) AS total
FROM {$wpdb->comments}
{$where}
GROUP BY comment_approved
", ARRAY_A);
$comment_count = array(
"approved" => 0,
$comment_count = array(
"approved" => 0,
"awaiting_moderation" => 0,
"spam" => 0,
"total_comments" => 0
);
);
foreach ( $totals as $row ) {
switch ( $row['comment_approved'] ) {
case 'spam':
$comment_count['spam'] = $row['total'];
foreach ( $totals as $row ) {
switch ( $row['comment_approved'] ) {
case 'spam':
$comment_count['spam'] = $row['total'];
$comment_count["total_comments"] += $row['total'];
break;
case 1:
$comment_count['approved'] = $row['total'];
break;
case 1:
$comment_count['approved'] = $row['total'];
$comment_count['total_comments'] += $row['total'];
break;
break;
case 0:
$comment_count['awaiting_moderation'] = $row['total'];
$comment_count['total_comments'] += $row['total'];
@ -788,14 +788,14 @@ function wp_update_comment($commentarr) {
*/
function wp_defer_comment_counting($defer=null) {
static $_defer = false;
if ( is_bool($defer) ) {
$_defer = $defer;
// flush any deferred counts
if ( !$defer )
wp_update_comment_count( null, true );
}
return $_defer;
}
@ -819,7 +819,7 @@ function wp_defer_comment_counting($defer=null) {
*/
function wp_update_comment_count($post_id, $do_deferred=false) {
static $_deferred = array();
if ( $do_deferred ) {
$_deferred = array_unique($_deferred);
foreach ( $_deferred as $i => $_post_id ) {
@ -827,7 +827,7 @@ function wp_update_comment_count($post_id, $do_deferred=false) {
unset( $_deferred[$i] ); /** @todo Move this outside of the foreach and reset $_deferred to an array instead */
}
}
if ( wp_defer_comment_counting() ) {
$_deferred[] = $post_id;
return true;
@ -835,7 +835,7 @@ function wp_update_comment_count($post_id, $do_deferred=false) {
elseif ( $post_id ) {
return wp_update_comment_count_now($post_id);
}
}
/**
@ -847,7 +847,7 @@ function wp_update_comment_count($post_id, $do_deferred=false) {
* @uses do_action() Calls 'edit_posts' hook on $post_id and $post
*
* @param int $post_id Post ID
* @return bool False on '0' $post_id or if post with ID does not exist. True on success.
* @return bool False on '0' $post_id or if post with ID does not exist. True on success.
*/
function wp_update_comment_count_now($post_id) {
global $wpdb;

View File

@ -69,7 +69,7 @@ function hash_hmac($algo, $data, $key, $raw_output = false) {
$key = pack($pack, $algo($key));
else if (strlen($key) < 64)
$key = str_pad($key, 64, chr(0));
$ipad = (substr($key, 0, 64) ^ str_repeat(chr(0x36), 64));
$opad = (substr($key, 0, 64) ^ str_repeat(chr(0x5C), 64));

View File

@ -446,7 +446,7 @@ function user_can_edit_user($user_id, $other_user) {
* @param string $after Optional. The html to output after the link.
* @param string $between Optional. The html to output between the link/image and it's description. Not used if no image or $show_images is true.
* @param bool $show_images Optional. Whether to show images (if defined).
* @param string $orderby Optional. The order to output the links. E.g. 'id', 'name', 'url', 'description' or 'rating'. Or maybe owner.
* @param string $orderby Optional. The order to output the links. E.g. 'id', 'name', 'url', 'description' or 'rating'. Or maybe owner.
* If you start the name with an underscore the order will be reversed. You can also specify 'rand' as the order which will return links in a
* random order.
* @param bool $show_description Optional. Whether to show the description if show_images=false/not defined.
@ -505,8 +505,8 @@ function wp_get_linksbyname($category, $args = '') {
* @see get_linkobjects()
*
* @param string $cat_name The category name to use. If no match is found uses all.
* @param string $orderby The order to output the links. E.g. 'id', 'name', 'url', 'description', or 'rating'.
* Or maybe owner. If you start the name with an underscore the order will be reversed. You can also
* @param string $orderby The order to output the links. E.g. 'id', 'name', 'url', 'description', or 'rating'.
* Or maybe owner. If you start the name with an underscore the order will be reversed. You can also
* specify 'rand' as the order which will return links in a random order.
* @param int $limit Limit to X entries. If not specified, all entries are shown.
* @return unknown
@ -558,7 +558,7 @@ function get_linkobjectsbyname($cat_name = "noname" , $orderby = 'name', $limit
*
* @param int $category The category to use. If no category supplied uses all
* @param string $orderby the order to output the links. E.g. 'id', 'name', 'url',
* 'description', or 'rating'. Or maybe owner. If you start the name with an
* 'description', or 'rating'. Or maybe owner. If you start the name with an
* underscore the order will be reversed. You can also specify 'rand' as the
* order which will return links in a random order.
* @param int $limit Limit to X entries. If not specified, all entries are shown.
@ -589,7 +589,7 @@ function get_linkobjects($category = 0, $orderby = 'name', $limit = 0) {
* @param string $between The html to output between the link/image and it's description. Not used if no image or show_images is true
* @param bool $show_images Whether to show images (if defined).
* @param string $orderby the order to output the links. E.g. 'id', 'name', 'url',
* 'description', or 'rating'. Or maybe owner. If you start the name with an
* 'description', or 'rating'. Or maybe owner. If you start the name with an
* underscore the order will be reversed. You can also specify 'rand' as the
* order which will return links in a random order.
* @param bool $show_description Whether to show the description if show_images=false/not defined
@ -616,7 +616,7 @@ function get_linksbyname_withrating($cat_name = "noname", $before = '', $after =
* @param string $between The html to output between the link/image and it's description. Not used if no image or show_images == true
* @param bool $show_images Whether to show images (if defined).
* @param string $orderby The order to output the links. E.g. 'id', 'name', 'url',
* 'description', or 'rating'. Or maybe owner. If you start the name with an
* 'description', or 'rating'. Or maybe owner. If you start the name with an
* underscore the order will be reversed. You can also specify 'rand' as the
* order which will return links in a random order.
* @param bool $show_description Whether to show the description if show_images=false/not defined.
@ -669,8 +669,8 @@ function get_autotoggle($id = 0) {
* @param bool $hierarchical
* @return unknown
*/
function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_order = 'asc', $file = '', $list = true, $optiondates = 0,
$optioncount = 0, $hide_empty = 1, $use_desc_for_title = 1, $children=false, $child_of=0, $categories=0,
function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_order = 'asc', $file = '', $list = true, $optiondates = 0,
$optioncount = 0, $hide_empty = 1, $use_desc_for_title = 1, $children=false, $child_of=0, $categories=0,
$recurse=0, $feed = '', $feed_image = '', $exclude = '', $hierarchical=false) {
_deprecated_function(__FUNCTION__, '0.0', 'wp_list_categories()');
@ -866,7 +866,7 @@ function get_author_link($echo = false, $author_id, $author_nicename = '') {
* @param string $more_file
* @return string
*/
function link_pages($before='<br />', $after='<br />', $next_or_number='number', $nextpagelink='next page', $previouspagelink='previous page',
function link_pages($before='<br />', $after='<br />', $next_or_number='number', $nextpagelink='next page', $previouspagelink='previous page',
$pagelink='%', $more_file='') {
_deprecated_function(__FUNCTION__, '0.0', 'wp_link_pages()');
@ -1068,7 +1068,7 @@ function get_links($category = -1, $before = '', $after = '<br />', $between = '
* @see get_categories()
*
* @param string $order Sort link categories by 'name' or 'id'
* @param string $$deprecated Not Used
* @param string $$deprecated Not Used
*/
function get_links_list($order = 'name', $deprecated = '') {
_deprecated_function(__FUNCTION__, '0.0', 'get_categories()');
@ -1214,7 +1214,7 @@ function get_category_rss_link($echo = false, $cat_ID = 1, $deprecated = '') {
}
/**
* get_author_rss_link() - Print/Return link to author RSS feed
* get_author_rss_link() - Print/Return link to author RSS feed
*
* @since 1.2
* @deprecated Use get_author_feed_link()
@ -1235,7 +1235,7 @@ function get_author_rss_link($echo = false, $author_id = 1, $deprecated = '') {
}
/**
* comments_rss() - Return link to the post RSS feed
* comments_rss() - Return link to the post RSS feed
*
* @since 1.5
* @deprecated Use get_post_comments_feed_link()

View File

@ -25,7 +25,7 @@ echo '<?xml version="1.0" encoding="' . get_option('blog_charset') . '" ?' . '>'
<updated><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastcommentmodified('GMT')); ?></updated>
<?php the_generator( 'atom' ); ?>
<?php if ( is_singular() ) { ?>
<link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" href="<?php echo get_comments_link() ?>" />
<link rel="self" type="application/atom+xml" href="<?php echo get_post_comments_feed_link('', 'atom'); ?>" />

View File

@ -187,7 +187,7 @@ function atom_enclosure() {
*
* @package WordPress
* @subpackage Feed
* @since 2.4
* @since 2.4
*
* @param string $data input string
* @return array $result array(type, value)

View File

@ -1115,7 +1115,7 @@ function clean_url( $url, $protocols = null, $context = 'display' ) {
$original_url = $url;
if ('' == $url) return $url;
$url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@()]|i', '', $url);
$url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@()]|i', '', $url);
$strip = array('%0d', '%0a');
$url = str_replace($strip, '', $url);
$url = str_replace(';//', '://', $url);

View File

@ -553,7 +553,7 @@ function wp_get_http( $url, $file_path = false, $red = 1 ) {
$request_type = 'GET';
else
$request_type = 'HEAD';
$head = "$request_type $file HTTP/1.1\r\nHOST: $host\r\nUser-Agent: WordPress/" . $wp_version . "\r\n\r\n";
$fp = @fsockopen( $host, $parts['port'], $err_num, $err_msg, 3 );
@ -579,7 +579,7 @@ function wp_get_http( $url, $file_path = false, $red = 1 ) {
fclose($fp);
return wp_get_http( $headers['location'], $file_path, ++$red );
}
// make a note of the final location, so the caller can tell if we were redirected or not
$headers['x-final-location'] = $url;
@ -588,7 +588,7 @@ function wp_get_http( $url, $file_path = false, $red = 1 ) {
fclose($fp);
return $headers;
}
// GET request - fetch and write it to the supplied filename
$content_length = $headers['content-length'];
$got_bytes = 0;
@ -601,7 +601,7 @@ function wp_get_http( $url, $file_path = false, $red = 1 ) {
if ($content_length and $got_bytes >= $content_length)
break;
}
fclose($out_fp);
fclose($fp);
return $headers;
@ -947,7 +947,7 @@ function do_robots() {
function is_blog_installed() {
global $wpdb;
// Check cache first. If options table goes away and we have true cached, oh well.
// Check cache first. If options table goes away and we have true cached, oh well.
if ( wp_cache_get('is_blog_installed') )
return true;
@ -994,7 +994,7 @@ function wp_original_referer_field() {
function wp_get_referer() {
if ( ! empty( $_REQUEST['_wp_http_referer'] ) )
return $_REQUEST['_wp_http_referer'];
else if ( ! empty( $_SERVER['HTTP_REFERER'] ) )
else if ( ! empty( $_SERVER['HTTP_REFERER'] ) )
return $_SERVER['HTTP_REFERER'];
return false;
}
@ -1068,12 +1068,12 @@ function wp_upload_dir( $time = NULL ) {
// return a filename that is sanitized and unique for the given directory
function wp_unique_filename( $dir, $filename, $unique_filename_callback = NULL ) {
// separate the filename into a name and extension
$info = pathinfo($filename);
$ext = $info['extension'];
$name = basename($filename, ".{$ext}");
// Increment the file number until we have a unique file to save in $dir. Use $override['unique_filename_callback'] if supplied.
if ( $unique_filename_callback && function_exists( $unique_filename_callback ) ) {
$filename = $unique_filename_callback( $dir, $name );
@ -1095,7 +1095,7 @@ function wp_unique_filename( $dir, $filename, $unique_filename_callback = NULL )
$filename = str_replace( $ext, '', $filename );
$filename = sanitize_title_with_dashes( $filename ) . $ext;
}
return $filename;
}
@ -1111,7 +1111,7 @@ function wp_upload_bits( $name, $deprecated, $bits, $time = NULL ) {
if ( $upload['error'] !== false )
return $upload;
$filename = wp_unique_filename( $upload['path'], $name );
$new_file = $upload['path'] . "/$filename";
@ -1225,7 +1225,7 @@ function wp_explain_nonce( $action ) {
$trans['add']['bookmark'] = array( __( 'Are you sure you want to add this link?' ), false );
$trans['delete']['bookmark'] = array( __( 'Are you sure you want to delete this link: &quot;%s&quot;?' ), 'use_id' );
$trans['update']['bookmark'] = array( __( 'Are you sure you want to edit this link: &quot;%s&quot;?' ), 'use_id' );
$trans['bulk']['bookmarks'] = array( __( 'Are you sure you want to bulk modify links?' ), false );
$trans['bulk']['bookmarks'] = array( __( 'Are you sure you want to bulk modify links?' ), false );
$trans['add']['page'] = array( __( 'Are you sure you want to add this page?' ), false );
$trans['delete']['page'] = array( __( 'Are you sure you want to delete this page: &quot;%s&quot;?' ), 'get_the_title' );
@ -1322,10 +1322,10 @@ function wp_die( $message, $title = '' ) {
$message = "<p>$message</p>";
}
if ( defined( 'WP_SITEURL' ) && '' != WP_SITEURL )
$admin_dir = WP_SITEURL . '/wp-admin/';
if ( defined( 'WP_SITEURL' ) && '' != WP_SITEURL )
$admin_dir = WP_SITEURL . '/wp-admin/';
elseif ( function_exists( 'get_bloginfo' ) && '' != get_bloginfo( 'wpurl' ) )
$admin_dir = get_bloginfo( 'wpurl' ) . '/wp-admin/';
$admin_dir = get_bloginfo( 'wpurl' ) . '/wp-admin/';
elseif ( strpos( $_SERVER['PHP_SELF'], 'wp-admin' ) !== false )
$admin_dir = '';
else
@ -1555,7 +1555,7 @@ function dead_db() {
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Database Error</title>
</head>
<body>
<h1>Error establishing a database connection</h1>
@ -1612,11 +1612,11 @@ function atom_service_url_filter($url)
/**
* _deprecated_function() - Marks a function as deprecated and informs when it has been used.
*
* There is a hook deprecated_function_run that will be called that can be used to get the backtrace
* There is a hook deprecated_function_run that will be called that can be used to get the backtrace
* up to what file and function called the deprecated function.
*
* The current behavior is to trigger an user error if WP_DEBUG is defined and is true.
*
*
* This function is to be used in every function in depreceated.php
*
* @package WordPress
@ -1647,11 +1647,11 @@ function _deprecated_function($function, $version, $replacement=null) {
/**
* _deprecated_file() - Marks a file as deprecated and informs when it has been used.
*
* There is a hook deprecated_file_included that will be called that can be used to get the backtrace
* There is a hook deprecated_file_included that will be called that can be used to get the backtrace
* up to what file and function included the deprecated file.
*
* The current behavior is to trigger an user error if WP_DEBUG is defined and is true.
*
*
* This function is to be used in every file that is depreceated
*
* @package WordPress

View File

@ -195,7 +195,7 @@ function wp_title($sep = '&raquo;', $display = true, $seplocation = '') {
if ( !empty($tag) ) {
$tag = get_term($tag, 'post_tag', OBJECT, 'display');
if ( is_wp_error( $tag ) )
if ( is_wp_error( $tag ) )
return $tag;
if ( ! empty($tag->name) )
$title = apply_filters('single_tag_title', $tag->name);
@ -242,7 +242,7 @@ function wp_title($sep = '&raquo;', $display = true, $seplocation = '') {
$title = $title . $prefix;
else
$title = $prefix . $title;
$title = apply_filters('wp_title', $title, $sep);
// Send it out
@ -297,7 +297,7 @@ function single_tag_title($prefix = '', $display = true ) {
if ( !empty($tag_id) ) {
$my_tag = &get_term($tag_id, 'post_tag', OBJECT, 'display');
if ( is_wp_error( $my_tag ) )
if ( is_wp_error( $my_tag ) )
return false;
$my_tag_name = apply_filters('single_tag_title', $my_tag->name);
if ( !empty($my_tag_name) ) {
@ -933,13 +933,13 @@ function the_editor($content, $id = 'content', $prev_id = 'title') {
if ( 'tinymce' == $wp_default_editor )
add_filter('the_editor_content', 'wp_richedit_pre');
// The following line moves the border so that the active button "attaches" to the toolbar. Only IE needs it.
?>
// The following line moves the border so that the active button "attaches" to the toolbar. Only IE needs it.
?>
<style type="text/css">
#postdivrich table, #postdivrich #quicktags {border-top: none;}
#quicktags {border-bottom: none; padding-bottom: 2px; margin-bottom: -1px;}
</style>
<div id='editor-toolbar' style='display:none;'>
<div class='zerosize'><input accesskey='e' type='button' onclick='switchEditors.go("<?php echo $id; ?>")' /></div>
<a id='edButtonHTML'<?php echo 'html' == $wp_default_editor ? $active : $inactive; ?>><?php _e('HTML'); ?></a>
@ -1017,18 +1017,18 @@ function the_search_query() {
function language_attributes($doctype = 'html') {
$attributes = array();
$output = '';
if ( $dir = get_bloginfo('text_direction') )
$attributes[] = "dir=\"$dir\"";
if ( $lang = get_bloginfo('language') ) {
if ( get_option('html_type') == 'text/html' || $doctype == 'xhtml' )
$attributes[] = "lang=\"$lang\"";
if ( get_option('html_type') != 'text/html' || $doctype == 'xhtml' )
$attributes[] = "xml:lang=\"$lang\"";
}
$output = implode(' ', $attributes);
$output = apply_filters('language_attributes', $output);
echo $output;

View File

@ -20,7 +20,7 @@ class SpellChecker {
* Simple loopback function everything that gets in will be send back.
*
* @param $args.. Arguments.
* @return {Array} Array of all input arguments.
* @return {Array} Array of all input arguments.
*/
function &loopback(/* args.. */) {
return func_get_args();

View File

@ -24,7 +24,7 @@
// Set up init variables
$valid_elements = '*[*]';
$valid_elements = apply_filters('mce_valid_elements', $valid_elements);
$invalid_elements = apply_filters('mce_invalid_elements', '');
$plugins = array( 'safari', 'inlinepopups', 'autosave', 'spellchecker', 'paste', 'wordpress', 'media', 'fullscreen' );
@ -40,7 +40,7 @@
$mce_buttons_3 = apply_filters('mce_buttons_3', array());
$mce_buttons_3 = implode($mce_buttons_3, ',');
$mce_buttons_4 = apply_filters('mce_buttons_4', array());
$mce_buttons_4 = implode($mce_buttons_4, ',');

View File

@ -12,7 +12,7 @@
//error_reporting(E_ALL);
@require_once('../../../wp-config.php'); // For get_bloginfo().
// Headers
$expiresOffset = 3600 * 24 * 10; // Cache for 10 days in browser cache
header("Content-type: text/javascript");
@ -72,26 +72,26 @@ if ( isset($_GET['load']) ) {
$core = getParam( 'core', 'true' ) == 'true';
$suffix = getParam( 'suffix', '_src' ) == '_src' ? '_src' : '';
$cachePath = realpath('.'); // Cache path, this is where the .gz files will be stored
$content = '';
$encodings = array();
$supportsGzip = false;
$enc = '';
$cacheKey = '';
// WP. Language handling could be improved... Concat all translated langs files and store in /wp-content/languages as .mo?
$theme = getParam( 'theme', 'advanced' );
$themes = array($theme);
$language = getParam( 'language', 'en' );
$languages = array($language);
if ( $language != strtolower($language) )
$languages[] = strtolower($language);
if ( $language != substr($language, 0, 2) )
$languages[] = substr($language, 0, 2);
$diskCache = false;
$isJS = true;
$suffix = '';
@ -158,10 +158,10 @@ if ( isset($_GET['load']) ) {
$lang_content = '';
foreach ( $languages as $lang )
$lang_content .= getFileContents('langs/' . $lang . '.js');
if ( empty($lang_content) && file_exists('langs/en.js') )
$lang_content .= getFileContents('langs/en.js');
$content .= $lang_content;
// Add themes
@ -171,10 +171,10 @@ if ( isset($_GET['load']) ) {
$lang_content = '';
foreach ( $languages as $lang )
$lang_content .= getFileContents( 'themes/' . $theme . '/langs/' . $lang . '.js' );
if ( empty($lang_content) && file_exists( 'themes/' . $theme . '/langs/en.js' ) )
$lang_content .= getFileContents( 'themes/' . $theme . '/langs/en.js' );
$content .= $lang_content;
}
@ -185,10 +185,10 @@ if ( isset($_GET['load']) ) {
$lang_content = '';
foreach ( $languages as $lang )
$lang_content .= getFileContents( 'plugins/' . $plugin . '/langs/' . $lang . '.js' );
if ( empty($lang_content) && file_exists( 'plugins/' . $plugin . '/langs/en.js' ) )
$lang_content .= getFileContents( 'plugins/' . $plugin . '/langs/en.js' );
$content .= $lang_content;
}
@ -235,16 +235,16 @@ var tinyMCE_GZ = {
debug : false,
suffix : ''
},
opt : {},
init : function(arr, cb) {
var t = this, n, s, nl = document.getElementsByTagName('script');
t.opt = arr;
t.settings.themes = arr.theme;
t.settings.plugins = arr.plugins;
t.settings.plugins = arr.plugins;
t.settings.languages = arr.language;
s = t.settings;
t.cb = cb || '';
@ -256,7 +256,7 @@ var tinyMCE_GZ = {
t.baseURL = n.src.substring(0, n.src.lastIndexOf('/'));
}
tinyMCEPreInit.base = t.baseURL;
if (!t.coreLoaded)
t.loadScripts(1, s.themes, s.plugins, s.languages);
},
@ -274,13 +274,13 @@ var tinyMCE_GZ = {
return x;
};
// Build query string
q = 'load=true&js=true&diskcache=' + (s.disk_cache ? 'true' : 'false') + '&core=' + (co ? 'true' : 'false') + '&suffix=' + escape(s.suffix) + '&themes=' + escape(th) + '&plugins=' + escape(pl) + '&languages=' + escape(la);
if (co)
t.coreLoaded = 1;
// Easier to debug with this...
// document.write('<sc'+'ript language="javascript" type="text/javascript" src="' + t.baseURL + '/' + s.page_name + '?' + q + '"></script>');

View File

@ -129,13 +129,13 @@ header('Content-Type: text/html; charset=' . get_bloginfo('charset'));
}
}
}
function init() {
document.getElementById('version').innerHTML = tinymce.majorVersion + "." + tinymce.minorVersion;
document.getElementById('date').innerHTML = tinymce.releaseDate;
}
tinyMCEPopup.onInit.add(init);
// For modal dialogs in IE
if (tinymce.isIE)
document.write('<base target="_self" />');
@ -190,7 +190,7 @@ header('Content-Type: text/html; charset=' . get_bloginfo('charset'));
<div id="content4" class="hidden">
<h2><?php _e('About TinyMCE'); ?></h2>
<p><?php _e('Version:'); ?> <span id="version"></span> (<span id="date"></span>)</p>
<p><?php printf(__('TinyMCE is a platform independent web based Javascript HTML WYSIWYG editor control released as Open Source under %sLGPL</a> by Moxiecode Systems AB. It has the ability to convert HTML TEXTAREA fields or other HTML elements to editor instances.'), '<a href="'.get_bloginfo('url').'/wp-includes/js/tinymce/license.txt" target="_blank" title="'.__('GNU Library General Public Licence').'">') ?></p>
<p><?php _e('Copyright &copy; 2003-2007, <a href="http://www.moxiecode.com" target="_blank">Moxiecode Systems AB</a>, All rights reserved.') ?></p>

View File

@ -152,7 +152,7 @@ function _c($text, $domain = 'default') {
*
* @since 1.2.0
* @uses $l10n Gets list of domain translated string (gettext_reader) objects
* @uses apply_filters() Calls 'ngettext' hook on domains text returned,
* @uses apply_filters() Calls 'ngettext' hook on domains text returned,
* along with $single, $plural, and $number parameters. Expected to return string.
*
* @param string $single The text that will be used if $number is 1

View File

@ -340,9 +340,9 @@ function get_author_feed_link( $author_id, $feed = '' ) {
*/
function get_category_feed_link($cat_id, $feed = '') {
$cat_id = (int) $cat_id;
$category = get_category($cat_id);
if ( empty($category) || is_wp_error($category) )
return false;
@ -359,12 +359,12 @@ function get_category_feed_link($cat_id, $feed = '') {
$feed_link = 'feed';
else
$feed_link = "feed/$feed";
$link = trailingslashit($link) . user_trailingslashit($feed_link, 'feed');
}
$link = apply_filters('category_feed_link', $link, $feed);
return $link;
}
@ -402,14 +402,14 @@ function get_search_feed_link($search_query = '', $feed = '') {
$search = attribute_escape(get_search_query());
else
$search = attribute_escape(stripslashes($search_query));
if ( empty($feed) )
$feed = get_default_feed();
$link = get_option('home') . "?s=$search&amp;feed=$feed";
$link = apply_filters('search_feed_link', $link);
return $link;
}
@ -418,14 +418,14 @@ function get_search_comments_feed_link($search_query = '', $feed = '') {
$search = attribute_escape(get_search_query());
else
$search = attribute_escape(stripslashes($search_query));
if ( empty($feed) )
$feed = get_default_feed();
$link = get_option('home') . "?s=$search&amp;feed=comments-$feed";
$link = apply_filters('search_feed_link', $link);
return $link;
}

View File

@ -504,7 +504,7 @@ function wp_validate_auth_cookie($cookie = '') {
$key = wp_hash($username . $expiration);
$hash = hash_hmac('md5', $username . $expiration, $key);
if ( $hmac != $hash )
return false;
@ -586,7 +586,7 @@ function wp_clear_auth_cookie() {
setcookie(USER_COOKIE, ' ', time() - 31536000, COOKIEPATH, COOKIE_DOMAIN);
setcookie(PASS_COOKIE, ' ', time() - 31536000, COOKIEPATH, COOKIE_DOMAIN);
setcookie(USER_COOKIE, ' ', time() - 31536000, SITECOOKIEPATH, COOKIE_DOMAIN);
setcookie(PASS_COOKIE, ' ', time() - 31536000, SITECOOKIEPATH, COOKIE_DOMAIN);
setcookie(PASS_COOKIE, ' ', time() - 31536000, SITECOOKIEPATH, COOKIE_DOMAIN);
}
endif;
@ -758,7 +758,7 @@ if ( !function_exists('wp_safe_redirect') ) :
* only used in a few places.
*
* @since 2.3
* @uses apply_filters() Calls 'allowed_redirect_hosts' on an array containing
* @uses apply_filters() Calls 'allowed_redirect_hosts' on an array containing
* WordPress host string and $location host string.
*
* @return void Does not return anything
@ -1087,8 +1087,8 @@ function wp_hash_password($password) {
// By default, use the portable hash from phpass
$wp_hasher = new PasswordHash(8, TRUE);
}
return $wp_hasher->HashPassword($password);
return $wp_hasher->HashPassword($password);
}
endif;

View File

@ -164,7 +164,7 @@ function apply_filters($tag, $value) {
}
} while ( next($wp_filter[$tag]) !== false );
array_pop( $wp_current_filter );
return $value;
@ -504,7 +504,7 @@ function register_deactivation_hook($file, $function) {
add_action('deactivate_' . $file, $function);
}
/**
/**
* _wp_call_all_hook() - Calls the 'all' hook, which will process the functions hooked into it.
*
* The 'all' hook passes all of the arguments or parameters that were used for the
@ -523,9 +523,9 @@ function register_deactivation_hook($file, $function) {
*
* @param array $args The collected parameters from the hook that was called.
* @param string $hook Optional. The hook name that was used to call the 'all' hook.
*/
function _wp_call_all_hook($args) {
global $wp_filter;
*/
function _wp_call_all_hook($args) {
global $wp_filter;
reset( $wp_filter['all'] );
do {

View File

@ -1032,7 +1032,7 @@ function wp_insert_post($postarr = array()) {
$post_ID = (int) $ID;
$guid = get_post_field( 'guid', $post_ID );
}
// Create a valid post name. Drafts are allowed to have an empty
// post name.
if ( empty($post_name) ) {

View File

@ -37,7 +37,7 @@ function wp_reset_query() {
*/
function is_admin () {
if ( defined('WP_ADMIN') )
if ( defined('WP_ADMIN') )
return WP_ADMIN;
return false;
}
@ -143,15 +143,15 @@ function is_feed () {
*
* @return bool True if front of site
*/
function is_front () {
// most likely case
if ( 'posts' == get_option('show_on_front') && is_home() )
return true;
elseif ( 'page' == get_option('show_on_front') && get_option('page_on_front') && is_page(get_option('page_on_front')) )
return true;
else
return false;
}
function is_front () {
// most likely case
if ( 'posts' == get_option('show_on_front') && is_home() )
return true;
elseif ( 'page' == get_option('show_on_front') && get_option('page_on_front') && is_page(get_option('page_on_front')) )
return true;
else
return false;
}
/**
* is_home() - Is it the blog view homepage?
@ -185,7 +185,7 @@ function is_page ($page = '') {
$page_obj = $wp_query->get_queried_object();
$page = (array) $page;
if ( in_array( $page_obj->ID, $page ) )
return true;
elseif ( in_array( $page_obj->post_title, $page ) )
@ -977,7 +977,7 @@ class WP_Query {
if ( !empty($q['category__not_in']) ) {
$ids = get_objects_in_term($q['category__not_in'], 'category');
if ( is_wp_error( $ids ) )
if ( is_wp_error( $ids ) )
return $ids;
if ( is_array($ids) && count($ids > 0) ) {
$out_posts = "'" . implode("', '", $ids) . "'";
@ -1165,11 +1165,11 @@ class WP_Query {
if ( in_array($orderby_array[$i], $allowed_keys) )
$q['orderby'] .= (($i == 0) ? '' : ',') . $orderby;
}
/* append ASC or DESC at the end */
/* append ASC or DESC at the end */
if ( !empty($q['orderby'])){
$q['orderby'] .= " {$q['order']}";
}
if ( empty($q['orderby']) )
$q['orderby'] = 'post_date '.$q['order'];
}

View File

@ -293,7 +293,7 @@ class WP_Rewrite {
if ( !$posts )
return array( array(), array() );
foreach ($posts as $id => $post) {
// URL => page name

View File

@ -104,7 +104,7 @@ class WP_Scripts {
'security_error' => 'Security error.',
'file_cancelled' => 'File cancelled.',
'upload_stopped' => 'Upload stopped.',
) );
$this->add( 'jquery-ui-tabs', '/wp-includes/js/jquery/ui.tabs.js', array('jquery'), '3' );
@ -118,12 +118,12 @@ class WP_Scripts {
$this->add( 'admin-categories', '/wp-admin/js/categories.js', array('wp-lists'), '20071031' );
$this->add( 'admin-tags', '/wp-admin/js/tags.js', array('wp-lists'), '20071031' );
$this->add( 'admin-custom-fields', '/wp-admin/js/custom-fields.js', array('wp-lists'), '20070823' );
$this->add( 'password-strength-meter', '/wp-admin/js/password-strength-meter.js', array('jquery'), '20070405' );
$this->localize( 'password-strength-meter', 'pwsL10n', array(
'short' => __('Too short'),
'bad' => __('Bad'),
'good' => __('Good'),
'strong' => __('Strong')
$this->add( 'password-strength-meter', '/wp-admin/js/password-strength-meter.js', array('jquery'), '20070405' );
$this->localize( 'password-strength-meter', 'pwsL10n', array(
'short' => __('Too short'),
'bad' => __('Bad'),
'good' => __('Good'),
'strong' => __('Strong')
) );
$this->add( 'admin-comments', '/wp-admin/js/edit-comments.js', array('wp-lists'), '20071104' );
$this->add( 'admin-posts', '/wp-admin/js/edit-posts.js', array('wp-lists'), '20071023' );
@ -274,7 +274,7 @@ class WP_Scripts {
return false; // Abort this branch.
else
continue; // We're at the top level. Move on to the next one.
}
}
$this->to_print[$handle] = true;
}

View File

@ -30,7 +30,7 @@ function bartag_func($atts) {
'foo' => 'no foo',
'baz' => 'default baz',
), $atts));
return "foo = {$foo}";
}
add_shortcode('bartag', 'bartag_func');

View File

@ -5,7 +5,7 @@
* @package External
* @subpackage PHP-gettext
*
* @internal
* @internal
Copyright (c) 2003, 2005 Danilo Segan <danilo@kvota.net>.
This file is part of PHP-gettext.

View File

@ -31,7 +31,7 @@ $wp_taxonomies['link_category'] = (object) array('name' => 'link_category', 'obj
* @package WordPress
* @subpackage Taxonomy
* @since 2.3
*
*
* @uses $wp_taxonomies
*
* @param string $object_type Name of the type of taxonomy object
@ -80,7 +80,7 @@ function get_taxonomy( $taxonomy ) {
* @package WordPress
* @subpackage Taxonomy
* @since 2.3
*
*
* @uses $wp_taxonomies
*
* @param string $taxonomy Name of taxonomy object
@ -139,7 +139,7 @@ function is_taxonomy_hierarchical($taxonomy) {
* @subpackage Taxonomy
* @since 2.3
* @uses $wp_taxonomies Inserts new taxonomy object into the list
*
*
* @param string $taxonomy Name of taxonomy object
* @param string $object_type Name of the object type for the taxonomy object.
* @param array|string $args See above description for the two keys values.
@ -275,7 +275,7 @@ function &get_term($term, $taxonomy, $output = OBJECT, $filter = 'raw') {
wp_cache_add($term, $_term, $taxonomy);
}
}
$_term = apply_filters('get_term', $_term, $taxonomy);
$_term = apply_filters("get_$taxonomy", $_term, $taxonomy);
$_term = sanitize_term($_term, $taxonomy, $filter);
@ -362,7 +362,7 @@ function get_term_by($field, $value, $taxonomy, $output = OBJECT, $filter = 'raw
* the same array. Only useful for taxonomies which are hierarchical.
*
* Will return an empty array if $term does not exist in $taxonomy.
*
*
* @package WordPress
* @subpackage Taxonomy
* @since 2.3
@ -396,7 +396,7 @@ function get_term_children( $term, $taxonomy ) {
/**
* get_term_field() - Get sanitized Term field
*
*
* Does checks for $term, based on the $taxonomy. The function is for
* contextual reasons and for simplicity of usage. See sanitize_term_field() for
* more information.
@ -433,7 +433,7 @@ function get_term_field( $field, $term, $taxonomy, $context = 'display' ) {
*
* Return value is sanitize_term() and usage is for sanitizing the term
* for editing. Function is for contextual and simplicity.
*
*
* @package WordPress
* @subpackage Taxonomy
* @since 2.3
@ -629,9 +629,9 @@ function &get_terms($taxonomies, $args = '') {
if ( !empty($number) ) {
if( $offset )
$number = 'LIMIT ' . $offset . ',' . $number;
else
else
$number = 'LIMIT ' . $number;
} else
$number = '';
@ -809,7 +809,7 @@ function sanitize_term_field($field, $value, $term_id, $taxonomy, $context) {
// Back compat filters
if ( 'slug' == $field )
$value = apply_filters('pre_category_nicename', $value);
} else if ( 'rss' == $context ) {
$value = apply_filters("term_${field}_rss", $value, $taxonomy);
$value = apply_filters("${taxonomy}_${field}_rss", $value);
@ -1032,7 +1032,7 @@ function wp_get_object_terms($object_ids, $taxonomies, $args = array()) {
$select_this = 't.*, tt.*';
else if ( 'ids' == $fields )
$select_this = 't.term_id';
else if ( 'names' == $fields )
else if ( 'names' == $fields )
$select_this = 't.name';
else if ( 'all_with_object_id' == $fields )
$select_this = 't.*, tt.*, tr.object_id';
@ -1175,7 +1175,7 @@ function wp_insert_term( $term, $taxonomy, $args = array() ) {
/**
* wp_set_object_terms() - Create Term and Taxonomy Relationships
*
*
* Relates an object (post, link etc) to a term and taxonomy type. Creates the term and taxonomy
* relationship if it doesn't already exist. Creates a term if it doesn't exist (using the slug).
*
@ -1213,7 +1213,7 @@ function wp_set_object_terms($object_id, $terms, $taxonomy, $append = false) {
foreach ($terms as $term) {
if ( !strlen(trim($term)) )
continue;
if ( !$id = is_term($term, $taxonomy) )
$id = wp_insert_term($term, $taxonomy);
if ( is_wp_error($id) )
@ -1243,7 +1243,7 @@ function wp_set_object_terms($object_id, $terms, $taxonomy, $append = false) {
/**
* wp_unique_term_slug() - Will make slug unique, if it isn't already
*
*
* The $slug has to be unique global to every taxonomy, meaning that one taxonomy
* term can't have a matching slug with another taxonomy term. Each slug has to be
* globally unique for every taxonomy.
@ -1253,7 +1253,7 @@ function wp_set_object_terms($object_id, $terms, $taxonomy, $append = false) {
*
* If that still doesn't return an unique slug, then it try to append a number until
* it finds a number that is truely unique.
*
*
* The only purpose for $term is for appending a parent, if one exists.
*
* @package WordPress
@ -1420,20 +1420,20 @@ function wp_update_term( $term, $taxonomy, $args = array() ) {
// if no value is supplied, the current value of the defer setting is returned
function wp_defer_term_counting($defer=NULL) {
static $_defer = false;
if ( is_bool($defer) ) {
$_defer = $defer;
// flush any deferred counts
if ( !$defer )
wp_update_term_count( NULL, NULL, true );
}
return $_defer;
}
/**
* wp_update_term_count() - Updates the amount of terms in taxonomy
*
*
* If there is a taxonomy callback applyed, then it will be called for updating the count.
*
* The default action is to count what the amount of terms have the relationship of term ID.
@ -1470,7 +1470,7 @@ function wp_update_term_count( $terms, $taxonomy, $do_deferred=false ) {
$_deferred[$taxonomy] = array_unique( array_merge($_deferred[$taxonomy], $terms) );
return true;
}
return wp_update_term_count_now( $terms, $taxonomy );
}
@ -1600,7 +1600,7 @@ function &get_object_term_cache($id, $taxonomy) {
* a string.
*
* It should be noted that update_object_term_cache() is very time extensive.
* It is advised that the function is not called very often or at least not
* It is advised that the function is not called very often or at least not
* for a lot of terms that exist in a lot of taxonomies. The amount of time
* increases for each term and it also increases for each taxonomy the term
* belongs to.
@ -1612,7 +1612,7 @@ function &get_object_term_cache($id, $taxonomy) {
*
* @param string|array $object_ids Single or list of term object ID(s)
* @param string $object_type The taxonomy object type
* @return null|bool Null value is given with empty $object_ids. False if
* @return null|bool Null value is given with empty $object_ids. False if
*/
function update_object_term_cache($object_ids, $object_type) {
if ( empty($object_ids) )
@ -1719,7 +1719,7 @@ function _get_term_hierarchy($taxonomy) {
/**
* _get_term_children() - Get array of child terms
*
*
* If $terms is an array of objects, then objects will returned from the function.
* If $terms is an array of IDs, then an array of ids of children will be returned.
*
@ -1775,7 +1775,7 @@ function &_get_term_children($term_id, $terms, $taxonomy) {
/**
* _pad_term_counts() - Add count of children to parent count
*
*
* Recalculates term counts by including items from child terms.
* Assumes all relevant children are already in the $terms argument
*
@ -1826,7 +1826,7 @@ function _pad_term_counts(&$terms, $taxonomy) {
}
}
// Transfer the touched cells
// Transfer the touched cells
foreach ( (array) $term_items as $id => $items )
if ( isset($terms_by_id[$id]) )
$terms_by_id[$id]->count = count($items);
@ -1838,7 +1838,7 @@ function _pad_term_counts(&$terms, $taxonomy) {
/**
* _update_post_term_count() - Will update term count based on posts
*
*
* Private function for the default callback for post_tag and category taxonomies.
*
* @package WordPress

View File

@ -9,7 +9,7 @@
/**
* wp_version_check() - Check WordPress version against the newest version.
*
* The WordPress version, PHP version, and Locale is sent. Checks against the WordPress server at
* The WordPress version, PHP version, and Locale is sent. Checks against the WordPress server at
* api.wordpress.org server. Will only check if PHP has fsockopen enabled and WordPress isn't installing.
*
* @package WordPress

View File

@ -22,7 +22,7 @@ function wp_signon( $credentials = '' ) {
// If no credential info provided, check cookie.
if ( empty($credentials['user_login']) && empty($credentials['user_password']) ) {
$user = wp_validate_auth_cookie();
if ( $user )
if ( $user )
return new WP_User($user);
if ( !empty($_COOKIE[AUTH_COOKIE]) )
@ -157,7 +157,7 @@ function get_usermeta( $user_id, $meta_key = '') {
return '';
}
foreach ($metas as $meta)
foreach ($metas as $meta)
$values[] = maybe_unserialize($meta->meta_value);
if ( count($values) == 1 )

View File

@ -730,18 +730,18 @@ function wp_widget_categories_control( $widget_args ) {
if ( !$updated && !empty($_POST['sidebar']) ) {
$sidebar = (string) $_POST['sidebar'];
$sidebars_widgets = wp_get_sidebars_widgets();
if ( isset($sidebars_widgets[$sidebar]) )
$this_sidebar =& $sidebars_widgets[$sidebar];
else
$this_sidebar = array();
foreach ( $this_sidebar as $_widget_id ) {
if ( 'wp_widget_categories' == $wp_registered_widgets[$_widget_id]['callback'] && isset($wp_registered_widgets[$_widget_id]['params'][0]['number']) ) {
$widget_number = $wp_registered_widgets[$_widget_id]['params'][0]['number'];
unset($options[$widget_number]);
}
}
}
foreach ( (array) $_POST['widget-categories'] as $widget_number => $widget_cat ) {
@ -771,7 +771,7 @@ function wp_widget_categories_control( $widget_args ) {
?>
<p>
<label for="categories-title-<?php echo $number; ?>">
<?php _e( 'Title:' ); ?>
<?php _e( 'Title:' ); ?>
<input class="widefat" id="categories-title-<?php echo $number; ?>" name="widget-categories[<?php echo $number; ?>][title]" type="text" value="<?php echo $title; ?>" />
</label>
</p>
@ -1155,7 +1155,7 @@ function wp_widget_rss_control($widget_args) {
$this_sidebar =& $sidebars_widgets[$sidebar];
else
$this_sidebar = array();
foreach ( $this_sidebar as $_widget_id ) {
if ( 'wp_widget_rss' == $wp_registered_widgets[$_widget_id]['callback'] && isset($wp_registered_widgets[$_widget_id]['params'][0]['number']) ) {
$widget_number = $wp_registered_widgets[$_widget_id]['params'][0]['number'];
@ -1283,7 +1283,7 @@ function wp_widget_rss_process( $widget_rss, $check_feed = true ) {
} else {
$link = clean_url(strip_tags($rss->channel['link']));
while ( strstr($link, 'http') != $link )
$link = substr($link, 1);
$link = substr($link, 1);
}
}
@ -1400,7 +1400,7 @@ function widget_many( $args, $widget_args = 1 ) {
$widget_args = array( 'number' => $widget_args );
$widget_args = wp_parse_args( $widget_args, array( 'number' => -1 ) );
extract( $widget_args, EXTR_SKIP );
// Data should be stored as array: array( number => data for that instance of the widget, ... )
$options = get_option('widget_many');
if ( !isset($options[$number]) )

View File

@ -528,7 +528,7 @@ class wpdb {
continue;
elseif ( strtolower(@$trace['function']) == 'do_action' )
continue;
$caller = $trace['function'];
break;
}

View File

@ -64,7 +64,7 @@ function retrieve_password() {
if ( $errors->get_error_code() )
return $errors;
if ( !$user_data ) {
$errors->add('invalidcombo', __('<strong>ERROR</strong>: Invalid username or e-mail.'));
return $errors;
@ -170,7 +170,7 @@ function register_new_user($user_login, $user_email) {
return $user_id;
}
//
//
// Main
//
@ -242,7 +242,7 @@ case 'retrievepassword' :
<p id="nav">
<?php if (get_option('users_can_register')) : ?>
<a href="<?php bloginfo('wpurl'); ?>/wp-login.php"><?php _e('Log in') ?></a> |
<a href="<?php bloginfo('wpurl'); ?>/wp-login.php"><?php _e('Log in') ?></a> |
<a href="<?php bloginfo('wpurl'); ?>/wp-login.php?action=register"><?php _e('Register') ?></a>
<?php else : ?>
<a href="<?php bloginfo('wpurl'); ?>/wp-login.php"><?php _e('Log in') ?></a>
@ -311,7 +311,7 @@ case 'register' :
</form>
<p id="nav">
<a href="<?php bloginfo('wpurl'); ?>/wp-login.php"><?php _e('Log in') ?></a> |
<a href="<?php bloginfo('wpurl'); ?>/wp-login.php"><?php _e('Log in') ?></a> |
<a href="<?php bloginfo('wpurl'); ?>/wp-login.php?action=lostpassword" title="<?php _e('Password Lost and Found') ?>"><?php _e('Lost your password?') ?></a>
</p>
@ -336,11 +336,11 @@ default:
if ( !is_wp_error($user) ) {
// If the user can't edit posts, send them to their profile.
if ( !$user->has_cap('edit_posts') && ( empty( $redirect_to ) || $redirect_to == 'wp-admin/' ) )
$redirect_to = get_option('siteurl') . '/wp-admin/profile.php';
$redirect_to = get_option('siteurl') . '/wp-admin/profile.php';
wp_safe_redirect($redirect_to);
exit();
}
$errors = $user;
// Clear errors if loggedout is set.
if ( !empty($_GET['loggedout']) )

View File

@ -174,7 +174,7 @@ define('WPINC', 'wp-includes');
if ( !defined('LANGDIR') ) {
/**
* Stores the location of the language directory. First looks for language folder in wp-content
* Stores the location of the language directory. First looks for language folder in wp-content
* and uses that folder if it exists. Or it uses the "languages" folder in WPINC.
*
* @since 2.1.0

View File

@ -31,7 +31,7 @@ header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
<api name="Movable Type" blogID="1" preferred="false" apiLink="<?php bloginfo_rss('wpurl') ?>/xmlrpc.php" />
<api name="MetaWeblog" blogID="1" preferred="false" apiLink="<?php bloginfo_rss('wpurl') ?>/xmlrpc.php" />
<api name="Blogger" blogID="1" preferred="false" apiLink="<?php bloginfo_rss('wpurl') ?>/xmlrpc.php" />
<api name="Atom" blogID="" preferred="false" apiLink="<?php echo apply_filters('atom_service_url', (get_bloginfo('url')."/wp-app.php/service"))?>" />
<api name="Atom" blogID="" preferred="false" apiLink="<?php echo apply_filters('atom_service_url', (get_bloginfo('url')."/wp-app.php/service"))?>" />
</apis>
</service>
</rsd>
@ -174,48 +174,48 @@ class wp_xmlrpc_server extends IXR_Server {
}
}
function get_custom_fields($post_id) {
$post_id = (int) $post_id;
function get_custom_fields($post_id) {
$post_id = (int) $post_id;
$custom_fields = array();
$custom_fields = array();
foreach ( (array) has_meta($post_id) as $meta ) {
// Don't expose protected fields.
if ( strpos($meta['meta_key'], '_wp_') === 0 ) {
continue;
}
foreach ( (array) has_meta($post_id) as $meta ) {
// Don't expose protected fields.
if ( strpos($meta['meta_key'], '_wp_') === 0 ) {
continue;
}
$custom_fields[] = array(
"id" => $meta['meta_id'],
"key" => $meta['meta_key'],
"value" => $meta['meta_value']
);
}
$custom_fields[] = array(
"id" => $meta['meta_id'],
"key" => $meta['meta_key'],
"value" => $meta['meta_value']
);
}
return $custom_fields;
}
return $custom_fields;
}
function set_custom_fields($post_id, $fields) {
$post_id = (int) $post_id;
function set_custom_fields($post_id, $fields) {
$post_id = (int) $post_id;
foreach ( (array) $fields as $meta ) {
if ( isset($meta['id']) ) {
$meta['id'] = (int) $meta['id'];
foreach ( (array) $fields as $meta ) {
if ( isset($meta['id']) ) {
$meta['id'] = (int) $meta['id'];
if ( isset($meta['key']) ) {
update_meta($meta['id'], $meta['key'], $meta['value']);
}
else {
delete_meta($meta['id']);
}
}
else {
$_POST['metakeyinput'] = $meta['key'];
$_POST['metavalue'] = $meta['value'];
add_meta($post_id);
}
}
}
if ( isset($meta['key']) ) {
update_meta($meta['id'], $meta['key'], $meta['value']);
}
else {
delete_meta($meta['id']);
}
}
else {
$_POST['metakeyinput'] = $meta['key'];
$_POST['metavalue'] = $meta['value'];
add_meta($post_id);
}
}
}
/**
* WordPress XML-RPC API
@ -661,7 +661,7 @@ class wp_xmlrpc_server extends IXR_Server {
}
set_current_user(0, $username);
if( !current_user_can( 'edit_posts' ) )
if( !current_user_can( 'edit_posts' ) )
return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts to this blog in order to view categories.' ) );
do_action('xmlrpc_call', 'wp.suggestCategories');
@ -679,21 +679,21 @@ class wp_xmlrpc_server extends IXR_Server {
}
function wp_getCommentCount( $args ) {
$this->escape($args);
$this->escape($args);
$blog_id = (int) $args[0];
$username = $args[1];
$password = $args[2];
$post_id = (int) $args[3];
$blog_id = (int) $args[0];
$username = $args[1];
$password = $args[2];
$post_id = (int) $args[3];
if( !$this->login_pass_ok( $username, $password ) ) {
return new IXR_Error( 403, __( 'Bad login/pass combination.' ) );
}
if( !$this->login_pass_ok( $username, $password ) ) {
return new IXR_Error( 403, __( 'Bad login/pass combination.' ) );
}
set_current_user( 0, $username );
if( !current_user_can( 'edit_posts' ) ) {
return new IXR_Error( 403, __( 'You are not allowed details about comments.' ) );
}
set_current_user( 0, $username );
if( !current_user_can( 'edit_posts' ) ) {
return new IXR_Error( 403, __( 'You are not allowed details about comments.' ) );
}
do_action('xmlrpc_call', 'wp.getCommentCount');
@ -791,7 +791,7 @@ class wp_xmlrpc_server extends IXR_Server {
}
set_current_user( 0, $user_login );
if( !current_user_can( 'edit_posts' ) )
if( !current_user_can( 'edit_posts' ) )
return new IXR_Error( 401, __( 'Sorry, you do not have access to user data on this blog.' ) );
do_action('xmlrpc_call', 'blogger.getUserInfo');
@ -824,7 +824,7 @@ class wp_xmlrpc_server extends IXR_Server {
}
set_current_user( 0, $user_login );
if( !current_user_can( 'edit_post', $post_ID ) )
if( !current_user_can( 'edit_post', $post_ID ) )
return new IXR_Error( 401, __( 'Sorry, you can not edit this post.' ) );
do_action('xmlrpc_call', 'blogger.getPost');
@ -985,7 +985,7 @@ class wp_xmlrpc_server extends IXR_Server {
$user_pass = $args[3];
$content = $args[4];
$publish = $args[5];
if (!$this->login_pass_ok($user_login, $user_pass)) {
return $this->error;
}
@ -996,20 +996,20 @@ class wp_xmlrpc_server extends IXR_Server {
$user = set_current_user(0, $user_login);
if ( !current_user_can($cap) )
return new IXR_Error(401, __('Sorry, you are not allowed to post on this blog.'));
$post_status = ($publish) ? 'publish' : 'draft';
$post_author = $user->ID;
$post_title = xmlrpc_getposttitle($content);
$post_category = xmlrpc_getpostcategory($content);
$post_content = xmlrpc_removepostdata($content);
$post_date = current_time('mysql');
$post_date_gmt = current_time('mysql', 1);
$post_data = compact('blog_ID', 'post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_category', 'post_status');
$post_ID = wp_insert_post($post_data);
if ( is_wp_error( $post_ID ) )
return new IXR_Error(500, $post_ID->get_error_message());
@ -1028,13 +1028,13 @@ class wp_xmlrpc_server extends IXR_Server {
function blogger_editPost($args) {
$this->escape($args);
$post_ID = (int) $args[1];
$user_login = $args[2];
$user_pass = $args[3];
$content = $args[4];
$publish = $args[5];
if (!$this->login_pass_ok($user_login, $user_pass)) {
return $this->error;
}
@ -1042,35 +1042,35 @@ class wp_xmlrpc_server extends IXR_Server {
do_action('xmlrpc_call', 'blogger.editPost');
$actual_post = wp_get_single_post($post_ID,ARRAY_A);
if (!$actual_post) {
return new IXR_Error(404, __('Sorry, no such post.'));
}
$this->escape($actual_post);
set_current_user(0, $user_login);
if ( !current_user_can('edit_post', $post_ID) )
return new IXR_Error(401, __('Sorry, you do not have the right to edit this post.'));
extract($actual_post, EXTR_SKIP);
if ( ('publish' == $post_status) && !current_user_can('publish_posts') )
return new IXR_Error(401, __('Sorry, you do not have the right to publish this post.'));
$post_title = xmlrpc_getposttitle($content);
$post_category = xmlrpc_getpostcategory($content);
$post_content = xmlrpc_removepostdata($content);
$postdata = compact('ID', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt');
$result = wp_update_post($postdata);
if (!$result) {
return new IXR_Error(500, __('For some strange yet very annoying reason, this post could not be edited.'));
}
$this->attach_uploads( $ID, $post_content );
return true;
}
@ -1078,12 +1078,12 @@ class wp_xmlrpc_server extends IXR_Server {
/* blogger.deletePost ...deletes a post */
function blogger_deletePost($args) {
$this->escape($args);
$post_ID = (int) $args[1];
$user_login = $args[2];
$user_pass = $args[3];
$publish = $args[4];
if (!$this->login_pass_ok($user_login, $user_pass)) {
return $this->error;
}
@ -1091,21 +1091,21 @@ class wp_xmlrpc_server extends IXR_Server {
do_action('xmlrpc_call', 'blogger.deletePost');
$actual_post = wp_get_single_post($post_ID,ARRAY_A);
if (!$actual_post) {
return new IXR_Error(404, __('Sorry, no such post.'));
}
set_current_user(0, $user_login);
if ( !current_user_can('edit_post', $post_ID) )
return new IXR_Error(401, __('Sorry, you do not have the right to delete this post.'));
$result = wp_delete_post($post_ID);
if (!$result) {
return new IXR_Error(500, __('For some strange yet very annoying reason, this post could not be deleted.'));
}
return true;
}
@ -1124,7 +1124,7 @@ class wp_xmlrpc_server extends IXR_Server {
$user_pass = $args[2];
$content_struct = $args[3];
$publish = $args[4];
if (!$this->login_pass_ok($user_login, $user_pass)) {
return $this->error;
}
@ -1224,7 +1224,7 @@ class wp_xmlrpc_server extends IXR_Server {
break;
}
}
$post_excerpt = $content_struct['mt_excerpt'];
$post_more = $content_struct['mt_text_more'];
@ -1298,7 +1298,7 @@ class wp_xmlrpc_server extends IXR_Server {
if ($post_more) {
$post_content = $post_content . "\n<!--more-->\n" . $post_more;
}
$to_ping = $content_struct['mt_tb_ping_urls'];
if ( is_array($to_ping) )
$to_ping = implode(' ', $to_ping);
@ -1320,7 +1320,7 @@ class wp_xmlrpc_server extends IXR_Server {
$catnames = $content_struct['categories'];
logIO('O', 'Post cats: ' . var_export($catnames,true));
$post_category = array();
if (is_array($catnames)) {
foreach ($catnames as $cat) {
$post_category[] = get_cat_ID($cat);
@ -1329,23 +1329,23 @@ class wp_xmlrpc_server extends IXR_Server {
// We've got all the data -- post it:
$postdata = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'comment_status', 'ping_status', 'to_ping', 'post_type', 'post_name', 'post_password', 'post_parent', 'menu_order', 'tags_input');
$post_ID = wp_insert_post($postdata);
if ( is_wp_error( $post_ID ) )
return new IXR_Error(500, $post_ID->get_error_message());
if (!$post_ID) {
return new IXR_Error(500, __('Sorry, your entry could not be posted. Something wrong happened.'));
}
if ( isset($content_struct['custom_fields']) ) {
$this->set_custom_fields($post_ID, $content_struct['custom_fields']);
}
if ( isset($content_struct['custom_fields']) ) {
$this->set_custom_fields($post_ID, $content_struct['custom_fields']);
}
$this->attach_uploads( $post_ID, $post_content );
logIO('O', "Posted ! ID: $post_ID");
return strval($post_ID);
}
@ -1373,7 +1373,7 @@ class wp_xmlrpc_server extends IXR_Server {
$user_pass = $args[2];
$content_struct = $args[3];
$publish = $args[4];
if (!$this->login_pass_ok($user_login, $user_pass)) {
return $this->error;
}
@ -1523,15 +1523,15 @@ class wp_xmlrpc_server extends IXR_Server {
$post_title = $content_struct['title'];
$post_content = apply_filters( 'content_save_pre', $content_struct['description'] );
$catnames = $content_struct['categories'];
$post_category = array();
if (is_array($catnames)) {
foreach ($catnames as $cat) {
$post_category[] = get_cat_ID($cat);
}
}
$post_excerpt = $content_struct['mt_excerpt'];
$post_more = $content_struct['mt_text_more'];
@ -1554,7 +1554,7 @@ class wp_xmlrpc_server extends IXR_Server {
break;
}
}
$tags_input = $content_struct['mt_keywords'];
if ( ('publish' == $post_status) ) {
@ -1563,7 +1563,7 @@ class wp_xmlrpc_server extends IXR_Server {
else if ( !current_user_can('publish_posts') )
return new IXR_Error(401, __('Sorry, you do not have the right to publish this post.'));
}
if ($post_more) {
$post_content = $post_content . "\n<!--more-->\n" . $post_more;
}
@ -1588,20 +1588,20 @@ class wp_xmlrpc_server extends IXR_Server {
// We've got all the data -- post it:
$newpost = compact('ID', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'comment_status', 'ping_status', 'post_date', 'post_date_gmt', 'to_ping', 'post_name', 'post_password', 'post_parent', 'menu_order', 'post_author', 'tags_input');
$result = wp_update_post($newpost);
if (!$result) {
return new IXR_Error(500, __('Sorry, your entry could not be edited. Something wrong happened.'));
}
if ( isset($content_struct['custom_fields']) ) {
$this->set_custom_fields($post_ID, $content_struct['custom_fields']);
}
if ( isset($content_struct['custom_fields']) ) {
$this->set_custom_fields($post_ID, $content_struct['custom_fields']);
}
$this->attach_uploads( $ID, $post_content );
logIO('O',"(MW) Edited ! ID: $post_ID");
return true;
}
@ -1610,11 +1610,11 @@ class wp_xmlrpc_server extends IXR_Server {
function mw_getPost($args) {
$this->escape($args);
$post_ID = (int) $args[0];
$user_login = $args[1];
$user_pass = $args[2];
if (!$this->login_pass_ok($user_login, $user_pass)) {
return $this->error;
}
@ -1626,16 +1626,16 @@ class wp_xmlrpc_server extends IXR_Server {
do_action('xmlrpc_call', 'metaWeblog.getPost');
$postdata = wp_get_single_post($post_ID, ARRAY_A);
if ($postdata['post_date'] != '') {
$post_date = mysql2date('Ymd\TH:i:s', $postdata['post_date']);
$post_date_gmt = mysql2date('Ymd\TH:i:s', $postdata['post_date_gmt']);
$categories = array();
$catids = wp_get_post_categories($post_ID);
foreach($catids as $catid)
$categories[] = get_cat_name($catid);
$tagnames = array();
$tags = wp_get_post_tags( $post_ID );
if ( !empty( $tags ) ) {
@ -1645,13 +1645,13 @@ class wp_xmlrpc_server extends IXR_Server {
} else {
$tagnames = '';
}
$post = get_extended($postdata['post_content']);
$link = post_permalink($postdata['ID']);
// Get the author info.
$author = get_userdata($postdata['post_author']);
$allow_comments = ('open' == $postdata['comment_status']) ? 1 : 0;
$allow_pings = ('open' == $postdata['ping_status']) ? 1 : 0;
@ -1659,7 +1659,7 @@ class wp_xmlrpc_server extends IXR_Server {
if( $postdata['post_status'] === 'future' ) {
$postdata['post_status'] = 'publish';
}
$resp = array(
'dateCreated' => new IXR_Date($post_date),
'userid' => $postdata['post_author'],
@ -1684,7 +1684,7 @@ class wp_xmlrpc_server extends IXR_Server {
'post_status' => $postdata['post_status'],
'custom_fields' => $this->get_custom_fields($post_ID)
);
return $resp;
} else {
return new IXR_Error(404, __('Sorry, no such post.'));
@ -1936,7 +1936,7 @@ class wp_xmlrpc_server extends IXR_Server {
set_current_user( 0, $user_login );
foreach ($posts_list as $entry) {
if( !current_user_can( 'edit_post', $entry['ID'] ) )
if( !current_user_can( 'edit_post', $entry['ID'] ) )
continue;
$post_date = mysql2date('Ymd\TH:i:s', $entry['post_date']);