| | 828 | * Prepares comment data for return in an XML-RPC object. |
| | 829 | * |
| | 830 | * @access protected |
| | 831 | * |
| | 832 | * @param object $comment The unprepared comment data |
| | 833 | * @return array The prepared comment data |
| | 834 | */ |
| | 835 | protected function _prepare_comment( $comment ) { |
| | 836 | // Format page date. |
| | 837 | $comment_date = $this->_convert_date( $comment->comment_date ); |
| | 838 | $comment_date_gmt = $this->_convert_date_gmt( $comment->comment_date_gmt, $comment->comment_date ); |
| | 839 | |
| | 840 | if ( '0' == $comment->comment_approved ) |
| | 841 | $comment_status = 'hold'; |
| | 842 | else if ( 'spam' == $comment->comment_approved ) |
| | 843 | $comment_status = 'spam'; |
| | 844 | else if ( '1' == $comment->comment_approved ) |
| | 845 | $comment_status = 'approve'; |
| | 846 | else |
| | 847 | $comment_status = $comment->comment_approved; |
| | 848 | |
| | 849 | $_comment = array( |
| | 850 | 'date_created_gmt' => $comment_date_gmt, |
| | 851 | 'user_id' => $comment->user_id, |
| | 852 | 'comment_id' => $comment->comment_ID, |
| | 853 | 'parent' => $comment->comment_parent, |
| | 854 | 'status' => $comment_status, |
| | 855 | 'content' => $comment->comment_content, |
| | 856 | 'link' => get_comment_link($comment), |
| | 857 | 'post_id' => $comment->comment_post_ID, |
| | 858 | 'post_title' => get_the_title($comment->comment_post_ID), |
| | 859 | 'author' => $comment->comment_author, |
| | 860 | 'author_url' => $comment->comment_author_url, |
| | 861 | 'author_email' => $comment->comment_author_email, |
| | 862 | 'author_ip' => $comment->comment_author_IP, |
| | 863 | 'type' => $comment->comment_type, |
| | 864 | ); |
| | 865 | |
| | 866 | return apply_filters( 'xmlrpc_prepare_comment', $_comment, $comment ); |
| | 867 | } |
| | 868 | |
| | 869 | /** |
| 2364 | | // Format page date. |
| 2365 | | $comment_date = $this->_convert_date( $comment->comment_date ); |
| 2366 | | $comment_date_gmt = $this->_convert_date_gmt( $comment->comment_date_gmt, $comment->comment_date ); |
| 2367 | | |
| 2368 | | if ( '0' == $comment->comment_approved ) |
| 2369 | | $comment_status = 'hold'; |
| 2370 | | else if ( 'spam' == $comment->comment_approved ) |
| 2371 | | $comment_status = 'spam'; |
| 2372 | | else if ( '1' == $comment->comment_approved ) |
| 2373 | | $comment_status = 'approve'; |
| 2374 | | else |
| 2375 | | $comment_status = $comment->comment_approved; |
| 2376 | | |
| 2377 | | $link = get_comment_link($comment); |
| 2378 | | |
| 2379 | | $comment_struct = array( |
| 2380 | | 'date_created_gmt' => $comment_date_gmt, |
| 2381 | | 'user_id' => $comment->user_id, |
| 2382 | | 'comment_id' => $comment->comment_ID, |
| 2383 | | 'parent' => $comment->comment_parent, |
| 2384 | | 'status' => $comment_status, |
| 2385 | | 'content' => $comment->comment_content, |
| 2386 | | 'link' => $link, |
| 2387 | | 'post_id' => $comment->comment_post_ID, |
| 2388 | | 'post_title' => get_the_title($comment->comment_post_ID), |
| 2389 | | 'author' => $comment->comment_author, |
| 2390 | | 'author_url' => $comment->comment_author_url, |
| 2391 | | 'author_email' => $comment->comment_author_email, |
| 2392 | | 'author_ip' => $comment->comment_author_IP, |
| 2393 | | 'type' => $comment->comment_type, |
| 2394 | | ); |
| 2395 | | |
| 2396 | | return $comment_struct; |
| | 2406 | return $this->_prepare_comment( $comment ); |
| 2460 | | // FIXME: we already have the comments, why query them again? |
| 2461 | | for ( $i = 0; $i < $num_comments; $i++ ) { |
| 2462 | | $comment = wp_xmlrpc_server::wp_getComment(array( |
| 2463 | | $raw_args[0], $raw_args[1], $raw_args[2], $comments[$i]->comment_ID, |
| 2464 | | )); |
| 2465 | | $comments_struct[] = $comment; |
| | 2465 | foreach ( $comments as $comment ) { |
| | 2466 | $comments_struct[] = $this->_prepare_comment( $comment ); |