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 ) ) if ( !$link_cat = link_cat_row( $term_id ) )
die('0'); die('0');
$x = new WP_Ajax_Response( array( $x = new WP_Ajax_Response( array(
'what' => 'link-cat', 'what' => 'link-cat',
'id' => $term_id, 'id' => $term_id,

View File

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

View File

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

View File

@ -42,8 +42,8 @@ case 'edit':
require_once ('admin-header.php'); require_once ('admin-header.php');
$tag_ID = (int) $_GET['tag_ID']; $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'); include('edit-tag-form.php');
break; break;

View File

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

View File

@ -381,7 +381,7 @@ class Blogger_Import {
$AtomParser = new AtomParser(); $AtomParser = new AtomParser();
$AtomParser->parse( $entry ); $AtomParser->parse( $entry );
$result = $this->import_post($AtomParser->entry); $result = $this->import_post($AtomParser->entry);
if ( is_wp_error( $result ) ) if ( is_wp_error( $result ) )
return $result; return $result;
unset($AtomParser); unset($AtomParser);
} }
@ -520,7 +520,7 @@ class Blogger_Import {
$post = compact('post_date', 'post_content', 'post_title', 'post_status'); $post = compact('post_date', 'post_content', 'post_title', 'post_status');
$post_id = wp_insert_post($post); $post_id = wp_insert_post($post);
if ( is_wp_error( $post_id ) ) if ( is_wp_error( $post_id ) )
return $post_id; return $post_id;
wp_create_categories( array_map( 'addslashes', $entry->categories ), $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 '<div class="narrow">';
echo '<p><h3>'.__('Reading Bunny&#8217;s Technorati Tags&#8230;').'</h3></p>'; 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'"); $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)) { if ( !is_array($metakeys)) {
echo '<p>' . __('No Tags Found!') . '</p>'; echo '<p>' . __('No Tags Found!') . '</p>';

View File

@ -77,7 +77,7 @@ class JeromesKeyword_Import {
echo '<div class="narrow">'; echo '<div class="narrow">';
echo '<p><h3>'.__('Reading Jerome&#8217;s Keywords Tags&#8230;').'</h3></p>'; 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'"); $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)) { if ( !is_array($metakeys)) {
echo '<p>' . __('No Tags Found!') . '</p>'; echo '<p>' . __('No Tags Found!') . '</p>';
@ -117,7 +117,7 @@ class JeromesKeyword_Import {
echo '<div class="narrow">'; echo '<div class="narrow">';
echo '<p><h3>'.__('Reading Jerome&#8217;s Keywords Tags&#8230;').'</h3></p>'; 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); $tablename = $wpdb->prefix . substr(get_option('jkeywords_keywords_table'), 1, -1);
$metakeys = $wpdb->get_results("SELECT post_id, tag_name FROM $tablename"); $metakeys = $wpdb->get_results("SELECT post_id, tag_name FROM $tablename");
if ( !is_array($metakeys) ) { 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->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); $post_id = wp_insert_post($post);
if ( is_wp_error( $post_id ) ) if ( is_wp_error( $post_id ) )
return $post_id; return $post_id;
// Add categories. // Add categories.
@ -294,7 +294,7 @@ class MT_Import {
// Finishing a post. // Finishing a post.
$context = ''; $context = '';
$result = $this->save_post($post, $comments, $pings); $result = $this->save_post($post, $comments, $pings);
if ( is_wp_error( $result ) ) if ( is_wp_error( $result ) )
return $result; return $result;
$post = new StdClass; $post = new StdClass;
$comment = new StdClass(); $comment = new StdClass();
@ -420,7 +420,7 @@ class MT_Import {
$this->file = get_attached_file($this->id); $this->file = get_attached_file($this->id);
$this->get_authors_from_post(); $this->get_authors_from_post();
$result = $this->process_posts(); $result = $this->process_posts();
if ( is_wp_error( $result ) ) if ( is_wp_error( $result ) )
return $result; return $result;
} }

View File

@ -70,7 +70,7 @@ class STP_Import {
if ( get_option('stpimp_posts') ) { if ( get_option('stpimp_posts') ) {
delete_option('stpimp_posts'); delete_option('stpimp_posts');
} }
add_option('stpimp_posts', $posts); add_option('stpimp_posts', $posts);
$count = count($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>'; 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 ( ) { function import_t2p ( ) {
echo '<div class="narrow">'; echo '<div class="narrow">';
echo '<p><h3>'.__('Adding Tags to Posts&#8230;').'</h3></p>'; echo '<p><h3>'.__('Adding Tags to Posts&#8230;').'</h3></p>';
// run that funky magic! // run that funky magic!
$tags_added = $this->tag2post(); $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 '<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">'; echo '<form action="admin.php?import=stp&amp;step=3" method="post">';
wp_nonce_field('import-stp'); wp_nonce_field('import-stp');

View File

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

View File

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

View File

@ -1,4 +1,4 @@
<?php <?php
class WP_Categories_to_Tags { class WP_Categories_to_Tags {
var $categories_to_convert = array(); var $categories_to_convert = array();
@ -19,7 +19,7 @@ class WP_Categories_to_Tags {
$categories = get_categories('get=all'); $categories = get_categories('get=all');
foreach ( $categories as $category ) { foreach ( $categories as $category ) {
if ( !tag_exists($wpdb->escape($category->name)) ) 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; field[i].checked = true;
} }
checkflag = 'true'; checkflag = 'true';
return '<?php _e('Uncheck All') ?>'; return '<?php _e('Uncheck All') ?>';
} else { } else {
for ( i = 0; i < field.length; i++ ) { for ( i = 0; i < field.length; i++ ) {
if ( 'cats_to_convert[]' == field[i].name ) if ( 'cats_to_convert[]' == field[i].name )
field[i].checked = false; field[i].checked = false;
} }
checkflag = '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) { foreach ($this->all_categories as $category) {
$category = sanitize_term( $category, 'category', 'display' ); $category = sanitize_term( $category, 'category', 'display' );
if ((int) $category->parent == 0) { 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>'; 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']; $id = $id['term_taxonomy_id'];
$posts = get_objects_in_term($category->term_id, 'category'); $posts = get_objects_in_term($category->term_id, 'category');
foreach ( $posts as $post ) { 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')"); $wpdb->query("INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id) VALUES ('$post', '$id')");
clean_post_cache($post); 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(), wp_register_widget_control( 'dashboard_plugins', __( 'Plugins' ), 'wp_dashboard_empty', array(),
array( 'widget_id' => 'dashboard_plugins' ) array( 'widget_id' => 'dashboard_plugins' )
); );
// Primary feed (Dev Blog) Widget // Primary feed (Dev Blog) Widget
if ( !isset( $widget_options['dashboard_primary'] ) ) { if ( !isset( $widget_options['dashboard_primary'] ) ) {
@ -91,7 +91,7 @@ function wp_dashboard_setup() {
'items' => 15 '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' ) 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(), 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() { function wxr_site_url() {
global $current_site; global $current_site;
// mu: the base url // mu: the base url
if ( isset($current_site->domain) ) { if ( isset($current_site->domain) ) {
return 'http://'.$current_site->domain.$current_site->path; 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 ); $file = get_attached_file( $file );
$image = wp_load_image( $file ); $image = wp_load_image( $file );
if ( !is_resource( $image ) ) if ( !is_resource( $image ) )
return $image; return $image;
@ -39,10 +39,10 @@ function wp_create_thumbnail( $file, $max_side, $deprecated = '' ) {
imagealphablending( $thumbnail, false); imagealphablending( $thumbnail, false);
imagesavealpha( $thumbnail, true); imagesavealpha( $thumbnail, true);
} }
@ imagecopyresampled( $thumbnail, $image, 0, 0, 0, 0, $image_new_width, $image_new_height, $sourceImageWidth, $sourceImageHeight ); @ 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 no filters change the filename, we'll do a default transformation.
if ( basename( $file ) == $thumb = apply_filters( 'thumbnail_filename', basename( $file ) ) ) if ( basename( $file ) == $thumb = apply_filters( 'thumbnail_filename', basename( $file ) ) )
@ -67,12 +67,12 @@ function wp_create_thumbnail( $file, $max_side, $deprecated = '' ) {
break; break;
} }
imagedestroy( $thumbnail ); // Free up memory imagedestroy( $thumbnail ); // Free up memory
// Set correct file permissions // Set correct file permissions
$stat = stat( dirname( $thumbpath )); $stat = stat( dirname( $thumbpath ));
$perms = $stat['mode'] & 0000666; //same permissions as parent folder, strip off the executable bits $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 ); 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 ); imageantialias( $dst, true );
imagecopyresampled( $dst, $src, 0, 0, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h ); 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 ) if ( ! $dst_file )
$dst_file = str_replace( basename( $src_file ), 'cropped-' . basename( $src_file ), $src_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) ) if ( @file_exists($thumb) )
$metadata['thumb'] = basename($thumb); $metadata['thumb'] = basename($thumb);
} }
// fetch additional metadata from exif/iptc // fetch additional metadata from exif/iptc
$image_meta = wp_read_image_metadata( $file ); $image_meta = wp_read_image_metadata( $file );
if ($image_meta) 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_title = attribute_escape( @$values['image-title'] );
$image_align = @$values['image-url']; $image_align = @$values['image-url'];
$post_id = $_GET['post_id']; $post_id = $_GET['post_id'];
?> ?>
<div id="media-upload-header"> <div id="media-upload-header">
<h3>Add Image</h3> <h3>Add Image</h3>
@ -33,7 +33,7 @@ function image_upload_form( $action_url, $values = array(), $error = null ) {
<script type="text/javascript"> <script type="text/javascript">
<!-- <!--
jQuery(document).ready(function(){ jQuery(document).ready(function(){
var swfu = new SWFUpload({ var swfu = new SWFUpload({
upload_url : "<?php echo get_option('siteurl').'/wp-admin/async-upload.php'; ?>", 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'; ?>", 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", progressTarget : "flash-upload-ui",
cancelButtonId : "btnCancel2" cancelButtonId : "btnCancel2"
}, },
debug: false, debug: false,
}); });
document.getElementById("flash-browse-button").onclick = function () { swfu.selectFile(); }; document.getElementById("flash-browse-button").onclick = function () { swfu.selectFile(); };
@ -107,7 +107,7 @@ jQuery(document).ready(function(){
} }
function image_upload_handler() { function image_upload_handler() {
if ( !current_user_can('upload_files') ) { if ( !current_user_can('upload_files') ) {
return new wp_error( 'upload_not_allowed', __('You are not allowed to 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 { else {
// Add Image button was clicked // Add Image button was clicked
check_admin_referer('inlineuploading'); check_admin_referer('inlineuploading');
// if the async flash uploader was used, the attachment has already been inserted and its ID is passed in post. // 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. // otherwise this is a regular form post and we still have to handle the upload and create the attachment.
if ( !empty($_POST['attachment_id']) ) { if ( !empty($_POST['attachment_id']) ) {
@ -134,7 +134,7 @@ function image_upload_handler() {
else { else {
$id = image_upload_post(); $id = image_upload_post();
} }
// if the input was invalid, redisplay the form with its current values // if the input was invalid, redisplay the form with its current values
if ( is_wp_error($id) ) if ( is_wp_error($id) )
wp_iframe( 'image_upload_form', get_option('siteurl') . '/wp-admin/media-upload.php?type=image', $_POST, $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); $thumb_url = wp_get_attachment_thumb_url($id);
if ( empty($thumb_url) ) if ( empty($thumb_url) )
$thumb_url = wp_mime_type_icon($id); $thumb_url = wp_mime_type_icon($id);
if ($thumb_url) { if ($thumb_url) {
$out = '<p><input type="hidden" name="attachment_id" id="attachment_id" value="'.intval($id).'" />' $out = '<p><input type="hidden" name="attachment_id" id="attachment_id" value="'.intval($id).'" />'
. '<img src="'.wp_get_attachment_thumb_url($id).'" class="pinkynail" /> ' . '<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).'" />' $out = '<p><input type="hidden" name="attachment_id" id="attachment_id" value="'.intval($id).'" />'
. basename(wp_get_attachment_url($id)).'</p>'; . basename(wp_get_attachment_url($id)).'</p>';
} }
$post = get_post($id); $post = get_post($id);
$title = addslashes($post->post_title); $title = addslashes($post->post_title);
$alt = addslashes($post->post_content); $alt = addslashes($post->post_content);
// populate the input fields with post data (which in turn comes from exif/iptc) // populate the input fields with post data (which in turn comes from exif/iptc)
$out .= <<<EOF $out .= <<<EOF
<script type="text/javascript"> <script type="text/javascript">
@ -174,7 +174,7 @@ jQuery('#image-title').val('{$title}').attr('disabled', false);
jQuery('#image-url').attr('disabled', false); jQuery('#image-url').attr('disabled', false);
jQuery('#image-add').attr('disabled', false); jQuery('#image-add').attr('disabled', false);
--> -->
</script> </script>
EOF; EOF;
return $out; return $out;
@ -184,10 +184,10 @@ add_filter('async_upload_image', 'async_image_callback');
function image_send_to_editor($id, $alt, $title, $align, $url='') { function image_send_to_editor($id, $alt, $title, $align, $url='') {
$img_src = wp_get_attachment_url($id); $img_src = wp_get_attachment_url($id);
$meta = wp_get_attachment_metadata($id); $meta = wp_get_attachment_metadata($id);
$hwstring = ''; $hwstring = '';
if ( isset($meta['width'], $meta['height']) ) if ( isset($meta['width'], $meta['height']) )
$hwstring = ' width="'.intval($meta['width']).'" height="'.intval($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.send_to_editor('<?php echo addslashes($html); ?>');
top.tb_remove(); top.tb_remove();
--> -->
</script> </script>
<?php <?php
} }
@ -217,21 +217,21 @@ function image_upload_post() {
return new wp_error( 'image_file_required', __('Please choose an image file to upload') ); return new wp_error( 'image_file_required', __('Please choose an image file to upload') );
if ( empty($_POST['image-alt']) ) if ( empty($_POST['image-alt']) )
return new wp_error( 'image_alt_required', __('Please enter an &lt;alt&gt; description') ); return new wp_error( 'image_alt_required', __('Please enter an &lt;alt&gt; description') );
$overrides = array('test_form'=>false); $overrides = array('test_form'=>false);
$file = wp_handle_upload($_FILES['image-file'], $overrides); $file = wp_handle_upload($_FILES['image-file'], $overrides);
if ( isset($file['error']) ) if ( isset($file['error']) )
return new wp_error( 'upload_error', $file['error'] ); return new wp_error( 'upload_error', $file['error'] );
$url = $file['url']; $url = $file['url'];
$type = $file['type']; $type = $file['type'];
$file = $file['file']; $file = $file['file'];
$post_title = trim($_POST['image-title']); $post_title = trim($_POST['image-title']);
$post_content = trim($_POST['image-alt']); $post_content = trim($_POST['image-alt']);
$post_parent = intval($_POST['parent_post_id']); $post_parent = intval($_POST['parent_post_id']);
// Construct the attachment array // Construct the attachment array
$attachment = array( $attachment = array(
'post_title' => $post_title, 'post_title' => $post_title,
@ -247,7 +247,7 @@ function image_upload_post() {
if ( !is_wp_error($id) ) if ( !is_wp_error($id) )
wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) ); 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 // 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); $post->post_name = sanitize_title($post->post_name? $post->post_name : $post->post_title, $post->ID);
} }
if (!is_null($name)) { 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 = get_permalink($post, true);
$permalink = array($permalink, $post->post_name); $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>'; $post_name_html = '<span id="editable-post-name" title="'.$title.'">'.$post_name.'</span>';
$display_link = str_replace('%postname%', $post_name_html, $permalink); $display_link = str_replace('%postname%', $post_name_html, $permalink);
return $display_link; return $display_link;
} }
?> ?>

View File

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

View File

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

View File

@ -139,13 +139,13 @@ if (empty($plugins)) {
<tr> <tr>
<td colspan="3">&nbsp;</td> <td colspan="3">&nbsp;</td>
<td colspan="2" style="width:12em;"> <td colspan="2" style="width:12em;">
<?php <?php
$active = get_option('active_plugins'); $active = get_option('active_plugins');
$inactive = get_option('deactivated_plugins'); $inactive = get_option('deactivated_plugins');
if ( !empty($active) ) { 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> <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) ) { } 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> <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'); $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."); 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 // Check if wp-config.php has been created
@ -194,7 +194,7 @@ switch($step) {
} }
fclose($handle); fclose($handle);
chmod('../wp-config.php', 0666); chmod('../wp-config.php', 0666);
display_header(); 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> <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 endif; ?>
<?php <?php
if ( $is_profile_page ) { if ( $is_profile_page ) {
do_action('show_user_profile'); do_action('show_user_profile');
} else { } else {
do_action('edit_user_profile'); do_action('edit_user_profile');

View File

@ -176,7 +176,7 @@ case 'adduser':
default: default:
wp_enqueue_script('admin-users'); wp_enqueue_script('admin-users');
wp_enqueue_script('admin-forms'); wp_enqueue_script('admin-forms');
include('admin-header.php'); include('admin-header.php');
// Query the users // 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> <p><?php _e( 'No Sidebars Defined' ); ?></p>
</div> </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> <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> </div>

View File

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

View File

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

View File

@ -268,7 +268,7 @@ function sanitize_bookmark($bookmark, $context = 'display') {
* @param mixed $value The bookmark field value * @param mixed $value The bookmark field value
* @param int $bookmark_id Bookmark ID * @param int $bookmark_id Bookmark ID
* @param string $context How to filter the field value. Either 'raw', 'edit', 'attribute', 'js', 'db', or 'display' * @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) { function sanitize_bookmark_field($field, $value, $bookmark_id, $context) {
$int_fields = array('link_id', 'link_rating'); $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 // Some PHP setups turn requests for / into /index.php in REQUEST_URI
$original['path'] = preg_replace('|/index\.php$|', '/', $original['path']); $original['path'] = preg_replace('|/index\.php$|', '/', $original['path']);
$redirect = $original; $redirect = $original;
$redirect_url = false; $redirect_url = false;

View File

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

View File

@ -130,7 +130,7 @@ function comment_author_link() {
* *
* @since 1.5 * @since 1.5
* @uses $comment * @uses $comment
* @uses apply_filters() * @uses apply_filters()
* *
* @return unknown * @return unknown
*/ */
@ -166,7 +166,7 @@ function get_comment_author_url() {
* comment_author_url() - Display the url of the author of the current comment * comment_author_url() - Display the url of the author of the current comment
* *
* @since 0.71 * @since 0.71
* @uses apply_filters() * @uses apply_filters()
* @uses get_comment_author_url() Retrieves the comment author's URL * @uses get_comment_author_url() Retrieves the comment author's URL
*/ */
function comment_author_url() { function comment_author_url() {
@ -568,7 +568,7 @@ function trackback_rdf($deprecated = '') {
function comments_open( $post_id=NULL ) { function comments_open( $post_id=NULL ) {
$_post = get_post($post_id); $_post = get_post($post_id);
$open = ( 'open' == $_post->comment_status ); $open = ( 'open' == $_post->comment_status );
return apply_filters( 'comments_open', $open, $post_id ); 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 * pings_open() - Whether the current post is open for pings
* *
* @since 1.5 * @since 1.5
* @uses $post * @uses $post
* *
* @param int $post_id An optional post ID to check instead of the current post. * @param int $post_id An optional post ID to check instead of the current post.
* @return bool True if pings are accepted * @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.'" '; echo ' class="'.$css_class.'" ';
} }
$title = attribute_escape( get_the_title() ); $title = attribute_escape( get_the_title() );
echo apply_filters( 'comments_popup_link_attributes', '' ); echo apply_filters( 'comments_popup_link_attributes', '' );
echo ' title="' . sprintf( __('Comment on %s'), $title ) . '">'; 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}"; $where = "WHERE comment_post_ID = {$post_id}";
} }
$totals = (array) $wpdb->get_results(" $totals = (array) $wpdb->get_results("
SELECT comment_approved, COUNT( * ) AS total SELECT comment_approved, COUNT( * ) AS total
FROM {$wpdb->comments} FROM {$wpdb->comments}
{$where} {$where}
GROUP BY comment_approved GROUP BY comment_approved
", ARRAY_A); ", ARRAY_A);
$comment_count = array( $comment_count = array(
"approved" => 0, "approved" => 0,
"awaiting_moderation" => 0, "awaiting_moderation" => 0,
"spam" => 0, "spam" => 0,
"total_comments" => 0 "total_comments" => 0
); );
foreach ( $totals as $row ) { foreach ( $totals as $row ) {
switch ( $row['comment_approved'] ) { switch ( $row['comment_approved'] ) {
case 'spam': case 'spam':
$comment_count['spam'] = $row['total']; $comment_count['spam'] = $row['total'];
$comment_count["total_comments"] += $row['total']; $comment_count["total_comments"] += $row['total'];
break; break;
case 1: case 1:
$comment_count['approved'] = $row['total']; $comment_count['approved'] = $row['total'];
$comment_count['total_comments'] += $row['total']; $comment_count['total_comments'] += $row['total'];
break; break;
case 0: case 0:
$comment_count['awaiting_moderation'] = $row['total']; $comment_count['awaiting_moderation'] = $row['total'];
$comment_count['total_comments'] += $row['total']; $comment_count['total_comments'] += $row['total'];
@ -788,14 +788,14 @@ function wp_update_comment($commentarr) {
*/ */
function wp_defer_comment_counting($defer=null) { function wp_defer_comment_counting($defer=null) {
static $_defer = false; static $_defer = false;
if ( is_bool($defer) ) { if ( is_bool($defer) ) {
$_defer = $defer; $_defer = $defer;
// flush any deferred counts // flush any deferred counts
if ( !$defer ) if ( !$defer )
wp_update_comment_count( null, true ); wp_update_comment_count( null, true );
} }
return $_defer; return $_defer;
} }
@ -819,7 +819,7 @@ function wp_defer_comment_counting($defer=null) {
*/ */
function wp_update_comment_count($post_id, $do_deferred=false) { function wp_update_comment_count($post_id, $do_deferred=false) {
static $_deferred = array(); static $_deferred = array();
if ( $do_deferred ) { if ( $do_deferred ) {
$_deferred = array_unique($_deferred); $_deferred = array_unique($_deferred);
foreach ( $_deferred as $i => $_post_id ) { 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 */ unset( $_deferred[$i] ); /** @todo Move this outside of the foreach and reset $_deferred to an array instead */
} }
} }
if ( wp_defer_comment_counting() ) { if ( wp_defer_comment_counting() ) {
$_deferred[] = $post_id; $_deferred[] = $post_id;
return true; return true;
@ -835,7 +835,7 @@ function wp_update_comment_count($post_id, $do_deferred=false) {
elseif ( $post_id ) { elseif ( $post_id ) {
return wp_update_comment_count_now($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 * @uses do_action() Calls 'edit_posts' hook on $post_id and $post
* *
* @param int $post_id Post ID * @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) { function wp_update_comment_count_now($post_id) {
global $wpdb; global $wpdb;

View File

@ -69,7 +69,7 @@ function hash_hmac($algo, $data, $key, $raw_output = false) {
$key = pack($pack, $algo($key)); $key = pack($pack, $algo($key));
else if (strlen($key) < 64) else if (strlen($key) < 64)
$key = str_pad($key, 64, chr(0)); $key = str_pad($key, 64, chr(0));
$ipad = (substr($key, 0, 64) ^ str_repeat(chr(0x36), 64)); $ipad = (substr($key, 0, 64) ^ str_repeat(chr(0x36), 64));
$opad = (substr($key, 0, 64) ^ str_repeat(chr(0x5C), 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 $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 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 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 * 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. * random order.
* @param bool $show_description Optional. Whether to show the description if show_images=false/not defined. * @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() * @see get_linkobjects()
* *
* @param string $cat_name The category name to use. If no match is found uses all. * @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'. * @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 * 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. * 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. * @param int $limit Limit to X entries. If not specified, all entries are shown.
* @return unknown * @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 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', * @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 * underscore the order will be reversed. You can also specify 'rand' as the
* order which will return links in a random order. * order which will return links in a random order.
* @param int $limit Limit to X entries. If not specified, all entries are shown. * @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 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 bool $show_images Whether to show images (if defined).
* @param string $orderby the order to output the links. E.g. 'id', 'name', 'url', * @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 * underscore the order will be reversed. You can also specify 'rand' as the
* order which will return links in a random order. * order which will return links in a random order.
* @param bool $show_description Whether to show the description if show_images=false/not defined * @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 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 bool $show_images Whether to show images (if defined).
* @param string $orderby The order to output the links. E.g. 'id', 'name', 'url', * @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 * underscore the order will be reversed. You can also specify 'rand' as the
* order which will return links in a random order. * order which will return links in a random order.
* @param bool $show_description Whether to show the description if show_images=false/not defined. * @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 * @param bool $hierarchical
* @return unknown * @return unknown
*/ */
function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_order = 'asc', $file = '', $list = true, $optiondates = 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, $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) { $recurse=0, $feed = '', $feed_image = '', $exclude = '', $hierarchical=false) {
_deprecated_function(__FUNCTION__, '0.0', 'wp_list_categories()'); _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 * @param string $more_file
* @return string * @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='') { $pagelink='%', $more_file='') {
_deprecated_function(__FUNCTION__, '0.0', 'wp_link_pages()'); _deprecated_function(__FUNCTION__, '0.0', 'wp_link_pages()');
@ -1068,7 +1068,7 @@ function get_links($category = -1, $before = '', $after = '<br />', $between = '
* @see get_categories() * @see get_categories()
* *
* @param string $order Sort link categories by 'name' or 'id' * @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 = '') { function get_links_list($order = 'name', $deprecated = '') {
_deprecated_function(__FUNCTION__, '0.0', 'get_categories()'); _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 * @since 1.2
* @deprecated Use get_author_feed_link() * @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 * @since 1.5
* @deprecated Use get_post_comments_feed_link() * @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> <updated><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastcommentmodified('GMT')); ?></updated>
<?php the_generator( 'atom' ); ?> <?php the_generator( 'atom' ); ?>
<?php if ( is_singular() ) { ?> <?php if ( is_singular() ) { ?>
<link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" href="<?php echo get_comments_link() ?>" /> <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'); ?>" /> <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 * @package WordPress
* @subpackage Feed * @subpackage Feed
* @since 2.4 * @since 2.4
* *
* @param string $data input string * @param string $data input string
* @return array $result array(type, value) * @return array $result array(type, value)

View File

@ -1115,7 +1115,7 @@ function clean_url( $url, $protocols = null, $context = 'display' ) {
$original_url = $url; $original_url = $url;
if ('' == $url) return $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'); $strip = array('%0d', '%0a');
$url = str_replace($strip, '', $url); $url = str_replace($strip, '', $url);
$url = str_replace(';//', '://', $url); $url = str_replace(';//', '://', $url);

View File

@ -553,7 +553,7 @@ function wp_get_http( $url, $file_path = false, $red = 1 ) {
$request_type = 'GET'; $request_type = 'GET';
else else
$request_type = 'HEAD'; $request_type = 'HEAD';
$head = "$request_type $file HTTP/1.1\r\nHOST: $host\r\nUser-Agent: WordPress/" . $wp_version . "\r\n\r\n"; $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 ); $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); fclose($fp);
return wp_get_http( $headers['location'], $file_path, ++$red ); 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 // make a note of the final location, so the caller can tell if we were redirected or not
$headers['x-final-location'] = $url; $headers['x-final-location'] = $url;
@ -588,7 +588,7 @@ function wp_get_http( $url, $file_path = false, $red = 1 ) {
fclose($fp); fclose($fp);
return $headers; return $headers;
} }
// GET request - fetch and write it to the supplied filename // GET request - fetch and write it to the supplied filename
$content_length = $headers['content-length']; $content_length = $headers['content-length'];
$got_bytes = 0; $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) if ($content_length and $got_bytes >= $content_length)
break; break;
} }
fclose($out_fp); fclose($out_fp);
fclose($fp); fclose($fp);
return $headers; return $headers;
@ -947,7 +947,7 @@ function do_robots() {
function is_blog_installed() { function is_blog_installed() {
global $wpdb; 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') ) if ( wp_cache_get('is_blog_installed') )
return true; return true;
@ -994,7 +994,7 @@ function wp_original_referer_field() {
function wp_get_referer() { function wp_get_referer() {
if ( ! empty( $_REQUEST['_wp_http_referer'] ) ) if ( ! empty( $_REQUEST['_wp_http_referer'] ) )
return $_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 $_SERVER['HTTP_REFERER'];
return false; return false;
} }
@ -1068,12 +1068,12 @@ function wp_upload_dir( $time = NULL ) {
// return a filename that is sanitized and unique for the given directory // return a filename that is sanitized and unique for the given directory
function wp_unique_filename( $dir, $filename, $unique_filename_callback = NULL ) { function wp_unique_filename( $dir, $filename, $unique_filename_callback = NULL ) {
// separate the filename into a name and extension // separate the filename into a name and extension
$info = pathinfo($filename); $info = pathinfo($filename);
$ext = $info['extension']; $ext = $info['extension'];
$name = basename($filename, ".{$ext}"); $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. // 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 ) ) { if ( $unique_filename_callback && function_exists( $unique_filename_callback ) ) {
$filename = $unique_filename_callback( $dir, $name ); $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 = str_replace( $ext, '', $filename );
$filename = sanitize_title_with_dashes( $filename ) . $ext; $filename = sanitize_title_with_dashes( $filename ) . $ext;
} }
return $filename; return $filename;
} }
@ -1111,7 +1111,7 @@ function wp_upload_bits( $name, $deprecated, $bits, $time = NULL ) {
if ( $upload['error'] !== false ) if ( $upload['error'] !== false )
return $upload; return $upload;
$filename = wp_unique_filename( $upload['path'], $name ); $filename = wp_unique_filename( $upload['path'], $name );
$new_file = $upload['path'] . "/$filename"; $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['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['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['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['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' ); $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>"; $message = "<p>$message</p>";
} }
if ( defined( 'WP_SITEURL' ) && '' != WP_SITEURL ) if ( defined( 'WP_SITEURL' ) && '' != WP_SITEURL )
$admin_dir = WP_SITEURL . '/wp-admin/'; $admin_dir = WP_SITEURL . '/wp-admin/';
elseif ( function_exists( 'get_bloginfo' ) && '' != get_bloginfo( 'wpurl' ) ) 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 ) elseif ( strpos( $_SERVER['PHP_SELF'], 'wp-admin' ) !== false )
$admin_dir = ''; $admin_dir = '';
else else
@ -1555,7 +1555,7 @@ function dead_db() {
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Database Error</title> <title>Database Error</title>
</head> </head>
<body> <body>
<h1>Error establishing a database connection</h1> <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. * _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. * 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. * 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 * This function is to be used in every function in depreceated.php
* *
* @package WordPress * @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. * _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. * 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. * 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 * This function is to be used in every file that is depreceated
* *
* @package WordPress * @package WordPress

View File

@ -195,7 +195,7 @@ function wp_title($sep = '&raquo;', $display = true, $seplocation = '') {
if ( !empty($tag) ) { if ( !empty($tag) ) {
$tag = get_term($tag, 'post_tag', OBJECT, 'display'); $tag = get_term($tag, 'post_tag', OBJECT, 'display');
if ( is_wp_error( $tag ) ) if ( is_wp_error( $tag ) )
return $tag; return $tag;
if ( ! empty($tag->name) ) if ( ! empty($tag->name) )
$title = apply_filters('single_tag_title', $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; $title = $title . $prefix;
else else
$title = $prefix . $title; $title = $prefix . $title;
$title = apply_filters('wp_title', $title, $sep); $title = apply_filters('wp_title', $title, $sep);
// Send it out // Send it out
@ -297,7 +297,7 @@ function single_tag_title($prefix = '', $display = true ) {
if ( !empty($tag_id) ) { if ( !empty($tag_id) ) {
$my_tag = &get_term($tag_id, 'post_tag', OBJECT, 'display'); $my_tag = &get_term($tag_id, 'post_tag', OBJECT, 'display');
if ( is_wp_error( $my_tag ) ) if ( is_wp_error( $my_tag ) )
return false; return false;
$my_tag_name = apply_filters('single_tag_title', $my_tag->name); $my_tag_name = apply_filters('single_tag_title', $my_tag->name);
if ( !empty($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 ) if ( 'tinymce' == $wp_default_editor )
add_filter('the_editor_content', 'wp_richedit_pre'); 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"> <style type="text/css">
#postdivrich table, #postdivrich #quicktags {border-top: none;} #postdivrich table, #postdivrich #quicktags {border-top: none;}
#quicktags {border-bottom: none; padding-bottom: 2px; margin-bottom: -1px;} #quicktags {border-bottom: none; padding-bottom: 2px; margin-bottom: -1px;}
</style> </style>
<div id='editor-toolbar' style='display:none;'> <div id='editor-toolbar' style='display:none;'>
<div class='zerosize'><input accesskey='e' type='button' onclick='switchEditors.go("<?php echo $id; ?>")' /></div> <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> <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') { function language_attributes($doctype = 'html') {
$attributes = array(); $attributes = array();
$output = ''; $output = '';
if ( $dir = get_bloginfo('text_direction') ) if ( $dir = get_bloginfo('text_direction') )
$attributes[] = "dir=\"$dir\""; $attributes[] = "dir=\"$dir\"";
if ( $lang = get_bloginfo('language') ) { if ( $lang = get_bloginfo('language') ) {
if ( get_option('html_type') == 'text/html' || $doctype == 'xhtml' ) if ( get_option('html_type') == 'text/html' || $doctype == 'xhtml' )
$attributes[] = "lang=\"$lang\""; $attributes[] = "lang=\"$lang\"";
if ( get_option('html_type') != 'text/html' || $doctype == 'xhtml' ) if ( get_option('html_type') != 'text/html' || $doctype == 'xhtml' )
$attributes[] = "xml:lang=\"$lang\""; $attributes[] = "xml:lang=\"$lang\"";
} }
$output = implode(' ', $attributes); $output = implode(' ', $attributes);
$output = apply_filters('language_attributes', $output); $output = apply_filters('language_attributes', $output);
echo $output; echo $output;

View File

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

View File

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

View File

@ -12,7 +12,7 @@
//error_reporting(E_ALL); //error_reporting(E_ALL);
@require_once('../../../wp-config.php'); // For get_bloginfo(). @require_once('../../../wp-config.php'); // For get_bloginfo().
// Headers // Headers
$expiresOffset = 3600 * 24 * 10; // Cache for 10 days in browser cache $expiresOffset = 3600 * 24 * 10; // Cache for 10 days in browser cache
header("Content-type: text/javascript"); header("Content-type: text/javascript");
@ -72,26 +72,26 @@ if ( isset($_GET['load']) ) {
$core = getParam( 'core', 'true' ) == 'true'; $core = getParam( 'core', 'true' ) == 'true';
$suffix = getParam( 'suffix', '_src' ) == '_src' ? '_src' : ''; $suffix = getParam( 'suffix', '_src' ) == '_src' ? '_src' : '';
$cachePath = realpath('.'); // Cache path, this is where the .gz files will be stored $cachePath = realpath('.'); // Cache path, this is where the .gz files will be stored
$content = ''; $content = '';
$encodings = array(); $encodings = array();
$supportsGzip = false; $supportsGzip = false;
$enc = ''; $enc = '';
$cacheKey = ''; $cacheKey = '';
// WP. Language handling could be improved... Concat all translated langs files and store in /wp-content/languages as .mo? // WP. Language handling could be improved... Concat all translated langs files and store in /wp-content/languages as .mo?
$theme = getParam( 'theme', 'advanced' ); $theme = getParam( 'theme', 'advanced' );
$themes = array($theme); $themes = array($theme);
$language = getParam( 'language', 'en' ); $language = getParam( 'language', 'en' );
$languages = array($language); $languages = array($language);
if ( $language != strtolower($language) ) if ( $language != strtolower($language) )
$languages[] = strtolower($language); $languages[] = strtolower($language);
if ( $language != substr($language, 0, 2) ) if ( $language != substr($language, 0, 2) )
$languages[] = substr($language, 0, 2); $languages[] = substr($language, 0, 2);
$diskCache = false; $diskCache = false;
$isJS = true; $isJS = true;
$suffix = ''; $suffix = '';
@ -158,10 +158,10 @@ if ( isset($_GET['load']) ) {
$lang_content = ''; $lang_content = '';
foreach ( $languages as $lang ) foreach ( $languages as $lang )
$lang_content .= getFileContents('langs/' . $lang . '.js'); $lang_content .= getFileContents('langs/' . $lang . '.js');
if ( empty($lang_content) && file_exists('langs/en.js') ) if ( empty($lang_content) && file_exists('langs/en.js') )
$lang_content .= getFileContents('langs/en.js'); $lang_content .= getFileContents('langs/en.js');
$content .= $lang_content; $content .= $lang_content;
// Add themes // Add themes
@ -171,10 +171,10 @@ if ( isset($_GET['load']) ) {
$lang_content = ''; $lang_content = '';
foreach ( $languages as $lang ) foreach ( $languages as $lang )
$lang_content .= getFileContents( 'themes/' . $theme . '/langs/' . $lang . '.js' ); $lang_content .= getFileContents( 'themes/' . $theme . '/langs/' . $lang . '.js' );
if ( empty($lang_content) && file_exists( 'themes/' . $theme . '/langs/en.js' ) ) if ( empty($lang_content) && file_exists( 'themes/' . $theme . '/langs/en.js' ) )
$lang_content .= getFileContents( 'themes/' . $theme . '/langs/en.js' ); $lang_content .= getFileContents( 'themes/' . $theme . '/langs/en.js' );
$content .= $lang_content; $content .= $lang_content;
} }
@ -185,10 +185,10 @@ if ( isset($_GET['load']) ) {
$lang_content = ''; $lang_content = '';
foreach ( $languages as $lang ) foreach ( $languages as $lang )
$lang_content .= getFileContents( 'plugins/' . $plugin . '/langs/' . $lang . '.js' ); $lang_content .= getFileContents( 'plugins/' . $plugin . '/langs/' . $lang . '.js' );
if ( empty($lang_content) && file_exists( 'plugins/' . $plugin . '/langs/en.js' ) ) if ( empty($lang_content) && file_exists( 'plugins/' . $plugin . '/langs/en.js' ) )
$lang_content .= getFileContents( 'plugins/' . $plugin . '/langs/en.js' ); $lang_content .= getFileContents( 'plugins/' . $plugin . '/langs/en.js' );
$content .= $lang_content; $content .= $lang_content;
} }
@ -235,16 +235,16 @@ var tinyMCE_GZ = {
debug : false, debug : false,
suffix : '' suffix : ''
}, },
opt : {}, opt : {},
init : function(arr, cb) { init : function(arr, cb) {
var t = this, n, s, nl = document.getElementsByTagName('script'); var t = this, n, s, nl = document.getElementsByTagName('script');
t.opt = arr; t.opt = arr;
t.settings.themes = arr.theme; t.settings.themes = arr.theme;
t.settings.plugins = arr.plugins; t.settings.plugins = arr.plugins;
t.settings.languages = arr.language; t.settings.languages = arr.language;
s = t.settings; s = t.settings;
t.cb = cb || ''; t.cb = cb || '';
@ -256,7 +256,7 @@ var tinyMCE_GZ = {
t.baseURL = n.src.substring(0, n.src.lastIndexOf('/')); t.baseURL = n.src.substring(0, n.src.lastIndexOf('/'));
} }
tinyMCEPreInit.base = t.baseURL; tinyMCEPreInit.base = t.baseURL;
if (!t.coreLoaded) if (!t.coreLoaded)
t.loadScripts(1, s.themes, s.plugins, s.languages); t.loadScripts(1, s.themes, s.plugins, s.languages);
}, },
@ -274,13 +274,13 @@ var tinyMCE_GZ = {
return x; return x;
}; };
// Build query string // 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); 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) if (co)
t.coreLoaded = 1; t.coreLoaded = 1;
// Easier to debug with this... // Easier to debug with this...
// document.write('<sc'+'ript language="javascript" type="text/javascript" src="' + t.baseURL + '/' + s.page_name + '?' + q + '"></script>'); // 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() { function init() {
document.getElementById('version').innerHTML = tinymce.majorVersion + "." + tinymce.minorVersion; document.getElementById('version').innerHTML = tinymce.majorVersion + "." + tinymce.minorVersion;
document.getElementById('date').innerHTML = tinymce.releaseDate; document.getElementById('date').innerHTML = tinymce.releaseDate;
} }
tinyMCEPopup.onInit.add(init); tinyMCEPopup.onInit.add(init);
// For modal dialogs in IE // For modal dialogs in IE
if (tinymce.isIE) if (tinymce.isIE)
document.write('<base target="_self" />'); document.write('<base target="_self" />');
@ -190,7 +190,7 @@ header('Content-Type: text/html; charset=' . get_bloginfo('charset'));
<div id="content4" class="hidden"> <div id="content4" class="hidden">
<h2><?php _e('About TinyMCE'); ?></h2> <h2><?php _e('About TinyMCE'); ?></h2>
<p><?php _e('Version:'); ?> <span id="version"></span> (<span id="date"></span>)</p> <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 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> <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 * @since 1.2.0
* @uses $l10n Gets list of domain translated string (gettext_reader) objects * @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. * along with $single, $plural, and $number parameters. Expected to return string.
* *
* @param string $single The text that will be used if $number is 1 * @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 = '') { function get_category_feed_link($cat_id, $feed = '') {
$cat_id = (int) $cat_id; $cat_id = (int) $cat_id;
$category = get_category($cat_id); $category = get_category($cat_id);
if ( empty($category) || is_wp_error($category) ) if ( empty($category) || is_wp_error($category) )
return false; return false;
@ -359,12 +359,12 @@ function get_category_feed_link($cat_id, $feed = '') {
$feed_link = 'feed'; $feed_link = 'feed';
else else
$feed_link = "feed/$feed"; $feed_link = "feed/$feed";
$link = trailingslashit($link) . user_trailingslashit($feed_link, 'feed'); $link = trailingslashit($link) . user_trailingslashit($feed_link, 'feed');
} }
$link = apply_filters('category_feed_link', $link, $feed); $link = apply_filters('category_feed_link', $link, $feed);
return $link; return $link;
} }
@ -402,14 +402,14 @@ function get_search_feed_link($search_query = '', $feed = '') {
$search = attribute_escape(get_search_query()); $search = attribute_escape(get_search_query());
else else
$search = attribute_escape(stripslashes($search_query)); $search = attribute_escape(stripslashes($search_query));
if ( empty($feed) ) if ( empty($feed) )
$feed = get_default_feed(); $feed = get_default_feed();
$link = get_option('home') . "?s=$search&amp;feed=$feed"; $link = get_option('home') . "?s=$search&amp;feed=$feed";
$link = apply_filters('search_feed_link', $link); $link = apply_filters('search_feed_link', $link);
return $link; return $link;
} }
@ -418,14 +418,14 @@ function get_search_comments_feed_link($search_query = '', $feed = '') {
$search = attribute_escape(get_search_query()); $search = attribute_escape(get_search_query());
else else
$search = attribute_escape(stripslashes($search_query)); $search = attribute_escape(stripslashes($search_query));
if ( empty($feed) ) if ( empty($feed) )
$feed = get_default_feed(); $feed = get_default_feed();
$link = get_option('home') . "?s=$search&amp;feed=comments-$feed"; $link = get_option('home') . "?s=$search&amp;feed=comments-$feed";
$link = apply_filters('search_feed_link', $link); $link = apply_filters('search_feed_link', $link);
return $link; return $link;
} }

View File

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

View File

@ -164,7 +164,7 @@ function apply_filters($tag, $value) {
} }
} while ( next($wp_filter[$tag]) !== false ); } while ( next($wp_filter[$tag]) !== false );
array_pop( $wp_current_filter ); array_pop( $wp_current_filter );
return $value; return $value;
@ -504,7 +504,7 @@ function register_deactivation_hook($file, $function) {
add_action('deactivate_' . $file, $function); add_action('deactivate_' . $file, $function);
} }
/** /**
* _wp_call_all_hook() - Calls the 'all' hook, which will process the functions hooked into it. * _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 * 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 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. * @param string $hook Optional. The hook name that was used to call the 'all' hook.
*/ */
function _wp_call_all_hook($args) { function _wp_call_all_hook($args) {
global $wp_filter; global $wp_filter;
reset( $wp_filter['all'] ); reset( $wp_filter['all'] );
do { do {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -5,7 +5,7 @@
* @package External * @package External
* @subpackage PHP-gettext * @subpackage PHP-gettext
* *
* @internal * @internal
Copyright (c) 2003, 2005 Danilo Segan <danilo@kvota.net>. Copyright (c) 2003, 2005 Danilo Segan <danilo@kvota.net>.
This file is part of PHP-gettext. 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 * @package WordPress
* @subpackage Taxonomy * @subpackage Taxonomy
* @since 2.3 * @since 2.3
* *
* @uses $wp_taxonomies * @uses $wp_taxonomies
* *
* @param string $object_type Name of the type of taxonomy object * @param string $object_type Name of the type of taxonomy object
@ -80,7 +80,7 @@ function get_taxonomy( $taxonomy ) {
* @package WordPress * @package WordPress
* @subpackage Taxonomy * @subpackage Taxonomy
* @since 2.3 * @since 2.3
* *
* @uses $wp_taxonomies * @uses $wp_taxonomies
* *
* @param string $taxonomy Name of taxonomy object * @param string $taxonomy Name of taxonomy object
@ -139,7 +139,7 @@ function is_taxonomy_hierarchical($taxonomy) {
* @subpackage Taxonomy * @subpackage Taxonomy
* @since 2.3 * @since 2.3
* @uses $wp_taxonomies Inserts new taxonomy object into the list * @uses $wp_taxonomies Inserts new taxonomy object into the list
* *
* @param string $taxonomy Name of taxonomy object * @param string $taxonomy Name of taxonomy object
* @param string $object_type Name of the object type for the 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. * @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); wp_cache_add($term, $_term, $taxonomy);
} }
} }
$_term = apply_filters('get_term', $_term, $taxonomy); $_term = apply_filters('get_term', $_term, $taxonomy);
$_term = apply_filters("get_$taxonomy", $_term, $taxonomy); $_term = apply_filters("get_$taxonomy", $_term, $taxonomy);
$_term = sanitize_term($_term, $taxonomy, $filter); $_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. * the same array. Only useful for taxonomies which are hierarchical.
* *
* Will return an empty array if $term does not exist in $taxonomy. * Will return an empty array if $term does not exist in $taxonomy.
* *
* @package WordPress * @package WordPress
* @subpackage Taxonomy * @subpackage Taxonomy
* @since 2.3 * @since 2.3
@ -396,7 +396,7 @@ function get_term_children( $term, $taxonomy ) {
/** /**
* get_term_field() - Get sanitized Term field * get_term_field() - Get sanitized Term field
* *
* Does checks for $term, based on the $taxonomy. The function is for * Does checks for $term, based on the $taxonomy. The function is for
* contextual reasons and for simplicity of usage. See sanitize_term_field() for * contextual reasons and for simplicity of usage. See sanitize_term_field() for
* more information. * 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 * Return value is sanitize_term() and usage is for sanitizing the term
* for editing. Function is for contextual and simplicity. * for editing. Function is for contextual and simplicity.
* *
* @package WordPress * @package WordPress
* @subpackage Taxonomy * @subpackage Taxonomy
* @since 2.3 * @since 2.3
@ -629,9 +629,9 @@ function &get_terms($taxonomies, $args = '') {
if ( !empty($number) ) { if ( !empty($number) ) {
if( $offset ) if( $offset )
$number = 'LIMIT ' . $offset . ',' . $number; $number = 'LIMIT ' . $offset . ',' . $number;
else else
$number = 'LIMIT ' . $number; $number = 'LIMIT ' . $number;
} else } else
$number = ''; $number = '';
@ -809,7 +809,7 @@ function sanitize_term_field($field, $value, $term_id, $taxonomy, $context) {
// Back compat filters // Back compat filters
if ( 'slug' == $field ) if ( 'slug' == $field )
$value = apply_filters('pre_category_nicename', $value); $value = apply_filters('pre_category_nicename', $value);
} else if ( 'rss' == $context ) { } else if ( 'rss' == $context ) {
$value = apply_filters("term_${field}_rss", $value, $taxonomy); $value = apply_filters("term_${field}_rss", $value, $taxonomy);
$value = apply_filters("${taxonomy}_${field}_rss", $value); $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.*'; $select_this = 't.*, tt.*';
else if ( 'ids' == $fields ) else if ( 'ids' == $fields )
$select_this = 't.term_id'; $select_this = 't.term_id';
else if ( 'names' == $fields ) else if ( 'names' == $fields )
$select_this = 't.name'; $select_this = 't.name';
else if ( 'all_with_object_id' == $fields ) else if ( 'all_with_object_id' == $fields )
$select_this = 't.*, tt.*, tr.object_id'; $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 * 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 * 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). * 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) { foreach ($terms as $term) {
if ( !strlen(trim($term)) ) if ( !strlen(trim($term)) )
continue; continue;
if ( !$id = is_term($term, $taxonomy) ) if ( !$id = is_term($term, $taxonomy) )
$id = wp_insert_term($term, $taxonomy); $id = wp_insert_term($term, $taxonomy);
if ( is_wp_error($id) ) 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 * 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 * 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 * term can't have a matching slug with another taxonomy term. Each slug has to be
* globally unique for every taxonomy. * 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 * 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. * it finds a number that is truely unique.
* *
* The only purpose for $term is for appending a parent, if one exists. * The only purpose for $term is for appending a parent, if one exists.
* *
* @package WordPress * @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 // if no value is supplied, the current value of the defer setting is returned
function wp_defer_term_counting($defer=NULL) { function wp_defer_term_counting($defer=NULL) {
static $_defer = false; static $_defer = false;
if ( is_bool($defer) ) { if ( is_bool($defer) ) {
$_defer = $defer; $_defer = $defer;
// flush any deferred counts // flush any deferred counts
if ( !$defer ) if ( !$defer )
wp_update_term_count( NULL, NULL, true ); wp_update_term_count( NULL, NULL, true );
} }
return $_defer; return $_defer;
} }
/** /**
* wp_update_term_count() - Updates the amount of terms in taxonomy * 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. * 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. * 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) ); $_deferred[$taxonomy] = array_unique( array_merge($_deferred[$taxonomy], $terms) );
return true; return true;
} }
return wp_update_term_count_now( $terms, $taxonomy ); return wp_update_term_count_now( $terms, $taxonomy );
} }
@ -1600,7 +1600,7 @@ function &get_object_term_cache($id, $taxonomy) {
* a string. * a string.
* *
* It should be noted that update_object_term_cache() is very time extensive. * 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 * 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 * increases for each term and it also increases for each taxonomy the term
* belongs to. * 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|array $object_ids Single or list of term object ID(s)
* @param string $object_type The taxonomy object type * @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) { function update_object_term_cache($object_ids, $object_type) {
if ( empty($object_ids) ) if ( empty($object_ids) )
@ -1719,7 +1719,7 @@ function _get_term_hierarchy($taxonomy) {
/** /**
* _get_term_children() - Get array of child terms * _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 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. * 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 * _pad_term_counts() - Add count of children to parent count
* *
* Recalculates term counts by including items from child terms. * Recalculates term counts by including items from child terms.
* Assumes all relevant children are already in the $terms argument * 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 ) foreach ( (array) $term_items as $id => $items )
if ( isset($terms_by_id[$id]) ) if ( isset($terms_by_id[$id]) )
$terms_by_id[$id]->count = count($items); $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 * _update_post_term_count() - Will update term count based on posts
* *
* Private function for the default callback for post_tag and category taxonomies. * Private function for the default callback for post_tag and category taxonomies.
* *
* @package WordPress * @package WordPress

View File

@ -9,7 +9,7 @@
/** /**
* wp_version_check() - Check WordPress version against the newest version. * 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. * api.wordpress.org server. Will only check if PHP has fsockopen enabled and WordPress isn't installing.
* *
* @package WordPress * @package WordPress

View File

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

View File

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

View File

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

View File

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

View File

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