Conditions | 3 |
Paths | 3 |
Total Lines | 32 |
Code Lines | 25 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
19 | protected function result() { |
||
20 | $comment = get_comment( $this->comment_id ); |
||
21 | if ( empty( $comment ) ) { |
||
22 | return new WP_Error( 'comment_not_found', __( 'Comment not found', 'jetpack' ), 404 ); |
||
23 | } |
||
24 | |||
25 | $allowed_keys = array( |
||
26 | 'comment_ID', |
||
27 | 'comment_post_ID', |
||
28 | 'comment_author', |
||
29 | 'comment_author_email', |
||
30 | 'comment_author_url', |
||
31 | 'comment_author_IP', |
||
32 | 'comment_date', |
||
33 | 'comment_date_gmt', |
||
34 | 'comment_content', |
||
35 | 'comment_karma', |
||
36 | 'comment_approved', |
||
37 | 'comment_agent', |
||
38 | 'comment_type', |
||
39 | 'comment_parent', |
||
40 | 'user_id', |
||
41 | ); |
||
42 | |||
43 | $comment = array_intersect_key( $comment->to_array(), array_flip( $allowed_keys ) ); |
||
44 | $comment_meta = get_comment_meta( $comment['comment_ID'] ); |
||
45 | |||
46 | return array( |
||
47 | 'comment' => $comment, |
||
48 | 'meta' => is_array( $comment_meta ) ? $comment_meta : array(), |
||
49 | ); |
||
50 | } |
||
51 | |||
53 |