PluginProbe
Assistant – Every Day Productivity Apps / 0.3.1
Assistant – Every Day Productivity Apps v0.3.1
1.5.5 trunk 0.1.0 0.2.0 0.2.1 0.2.2 0.3.0 0.3.1 0.4 0.4.1 0.4.2 0.5.0 0.5.1 0.6.0 0.7.0 0.7.0.2 0.7.0.3 0.7.0.4 0.7.0.5 0.7.0.6 0.7.0.7 0.7.0.8 0.7.0.9 0.7.1 1.0 All 71 releases
assistant / backend / src / Data / Transformers / CommentTransformer.php

CommentTransformer.php in Assistant – Every Day Productivity Apps 0.3.1, at backend/src/Data/Transformers/CommentTransformer.php

34 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3
4 namespace FL\Assistant\Data\Transformers;
5
6
7 class CommentTransformer {
8 public function __invoke( \WP_Comment $comment ) {
9 $post = get_post( $comment->comment_post_ID );
10 $date = mysql2date( get_option( 'date_format' ), $comment->comment_date );
11 $time = mysql2date( get_option( 'time_format' ), $comment->comment_date );
12
13 return [
14 'approved' => $comment->comment_approved ? true : false,
15 'author' => $comment->comment_author,
16 'authorEmail' => $comment->comment_author_email,
17 'authorIP' => $comment->comment_author_IP,
18 'content' => $comment->comment_content,
19 'date' => $date,
20 'editUrl' => admin_url( 'comment.php?action=editcomment&c=' ) . $comment->comment_ID,
21 'id' => $comment->comment_ID,
22 'meta' => $comment->comment_author . ' - ' . $date,
23 'postId' => $post->ID,
24 'postTitle' => $post->post_title,
25 'spam' => 'spam' === $comment->comment_approved,
26 'time' => $time,
27 'thumbnail' => get_avatar_url( $comment->comment_author_email ),
28 'title' => strip_tags( $comment->comment_content ),
29 'trash' => 'trash' === $comment->comment_approved,
30 'url' => get_comment_link( $comment ),
31 ];
32 }
33 }
34