Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: WordPress/WordPress
...
head fork: WordPress/WordPress
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 2 files changed
  • 0 commit comments
  • 2 contributors
Commits on May 23, 2012
duck_ Fix minor typos in about.php. See #20423.
git-svn-id: http://core.svn.wordpress.org/trunk@20855 1a063a9b-81f0-0310-95a4-ce76da25c4cd
c4ff39e
ryan Introduce _prepare_comment(). Avoid repeated auth attempts. Props max…
…cutler. fixes #20703

git-svn-id: http://core.svn.wordpress.org/trunk@20856 1a063a9b-81f0-0310-95a4-ce76da25c4cd
f35fdc6
Showing with 49 additions and 48 deletions.
  1. +3 −3 wp-admin/about.php
  2. +46 −45 wp-includes/class-wp-xmlrpc-server.php
View
6 wp-admin/about.php
@@ -39,7 +39,7 @@
<div class="feature-section images-stagger-right">
<img src="<?php echo esc_url( admin_url( 'images/screenshots/theme-customizer.png' ) ); ?>" class="image-50" />
<h4><?php _e( 'Try on New Themes' ); ?></h4>
- <p><?php _e( 'Gone are the days of rushing to update your header, background, and the like as soon as you activate a new theme. You can now customize these options <strong>before</strong> activating a new theme. Note: This feature is available for installed themes only.' ); ?></p>
+ <p><?php _e( 'Gone are the days of rushing to update your header, background, and the like as soon as you activate a new theme. You can now customize these options <strong>before</strong> activating a new theme. Note: this feature is available for installed themes only.' ); ?></p>
<h4><?php _e( 'Customize Current Theme' ); ?></h4>
<p><?php _e( 'Satisfy your curiosity and try on a fresh coat of paint &mdash; you can also use the live preview mode to customize your current theme. Look for the Customize link on the Themes screen.' ); ?></p>
@@ -81,7 +81,7 @@
<div class="feature-section three-col">
<div>
<h4><?php _e( 'Themes API' ); ?></h4>
- <p><?php _e( 'WP_Theme, wp_get_themes(), wp_get_theme(). Faster, uses less memory, make uses of persistent caching.' ); ?></p>
+ <p><?php _e( 'WP_Theme, wp_get_themes(), wp_get_theme(). Faster, uses less memory, makes use of persistent caching.' ); ?></p>
<h4><?php _e( 'Faster Main Query' ); ?></h4>
<p><?php _e( 'Post query optimized to avoid table scans.' ); ?></p>
@@ -91,7 +91,7 @@
<p><?php _e( 'Custom header and background API relocated into the theme support API.' ); ?></p>
<h4><?php _e( 'Faster I18N' ); ?></h4>
- <p><?php _e( 'The number of strings loaded on the front end were greatly reduced, resulting in faster front page load times for I18N users.' ); ?></p>
+ <p><?php _e( 'The number of strings loaded on the front end was greatly reduced, resulting in faster front page load times for I18N users.' ); ?></p>
</div>
<div class="last-feature">
<h4><?php _e( 'WP_Screen API' ); ?></h4>
View
91 wp-includes/class-wp-xmlrpc-server.php
@@ -825,6 +825,48 @@ protected function _prepare_page( $page ) {
}
/**
+ * Prepares comment data for return in an XML-RPC object.
+ *
+ * @access protected
+ *
+ * @param object $comment The unprepared comment data
+ * @return array The prepared comment data
+ */
+ protected function _prepare_comment( $comment ) {
+ // Format page date.
+ $comment_date = $this->_convert_date( $comment->comment_date );
+ $comment_date_gmt = $this->_convert_date_gmt( $comment->comment_date_gmt, $comment->comment_date );
+
+ if ( '0' == $comment->comment_approved )
+ $comment_status = 'hold';
+ else if ( 'spam' == $comment->comment_approved )
+ $comment_status = 'spam';
+ else if ( '1' == $comment->comment_approved )
+ $comment_status = 'approve';
+ else
+ $comment_status = $comment->comment_approved;
+
+ $_comment = array(
+ 'date_created_gmt' => $comment_date_gmt,
+ 'user_id' => $comment->user_id,
+ 'comment_id' => $comment->comment_ID,
+ 'parent' => $comment->comment_parent,
+ 'status' => $comment_status,
+ 'content' => $comment->comment_content,
+ 'link' => get_comment_link($comment),
+ 'post_id' => $comment->comment_post_ID,
+ 'post_title' => get_the_title($comment->comment_post_ID),
+ 'author' => $comment->comment_author,
+ 'author_url' => $comment->comment_author_url,
+ 'author_email' => $comment->comment_author_email,
+ 'author_ip' => $comment->comment_author_IP,
+ 'type' => $comment->comment_type,
+ );
+
+ return apply_filters( 'xmlrpc_prepare_comment', $_comment, $comment );
+ }
+
+ /**
* Create a new post for any registered post type.
*
* @since 3.4.0
@@ -2361,39 +2403,7 @@ function wp_getComment($args) {
if ( ! $comment = get_comment($comment_id) )
return new IXR_Error( 404, __( 'Invalid comment ID.' ) );
- // Format page date.
- $comment_date = $this->_convert_date( $comment->comment_date );
- $comment_date_gmt = $this->_convert_date_gmt( $comment->comment_date_gmt, $comment->comment_date );
-
- if ( '0' == $comment->comment_approved )
- $comment_status = 'hold';
- else if ( 'spam' == $comment->comment_approved )
- $comment_status = 'spam';
- else if ( '1' == $comment->comment_approved )
- $comment_status = 'approve';
- else
- $comment_status = $comment->comment_approved;
-
- $link = get_comment_link($comment);
-
- $comment_struct = array(
- 'date_created_gmt' => $comment_date_gmt,
- 'user_id' => $comment->user_id,
- 'comment_id' => $comment->comment_ID,
- 'parent' => $comment->comment_parent,
- 'status' => $comment_status,
- 'content' => $comment->comment_content,
- 'link' => $link,
- 'post_id' => $comment->comment_post_ID,
- 'post_title' => get_the_title($comment->comment_post_ID),
- 'author' => $comment->comment_author,
- 'author_url' => $comment->comment_author_url,
- 'author_email' => $comment->comment_author_email,
- 'author_ip' => $comment->comment_author_IP,
- 'type' => $comment->comment_type,
- );
-
- return $comment_struct;
+ return $this->_prepare_comment( $comment );
}
/**
@@ -2416,13 +2426,12 @@ function wp_getComment($args) {
* @return array. Contains a collection of comments. See {@link wp_xmlrpc_server::wp_getComment()} for a description of each item contents
*/
function wp_getComments($args) {
- $raw_args = $args;
$this->escape($args);
$blog_id = (int) $args[0];
$username = $args[1];
$password = $args[2];
- $struct = $args[3];
+ $struct = isset( $args[3] ) ? $args[3] : array();
if ( !$user = $this->login($username, $password) )
return $this->error;
@@ -2450,19 +2459,11 @@ function wp_getComments($args) {
$number = absint($struct['number']);
$comments = get_comments( array('status' => $status, 'post_id' => $post_id, 'offset' => $offset, 'number' => $number ) );
- $num_comments = count($comments);
-
- if ( ! $num_comments )
- return array();
$comments_struct = array();
- // FIXME: we already have the comments, why query them again?
- for ( $i = 0; $i < $num_comments; $i++ ) {
- $comment = wp_xmlrpc_server::wp_getComment(array(
- $raw_args[0], $raw_args[1], $raw_args[2], $comments[$i]->comment_ID,
- ));
- $comments_struct[] = $comment;
+ foreach ( $comments as $comment ) {
+ $comments_struct[] = $this->_prepare_comment( $comment );
}
return $comments_struct;

No commit comments for this range

Something went wrong with that request. Please try again.