コード例 #1
0
 public function onCommentSubmitted(CommentEvent $event)
 {
     $comment = $event->getComment();
     foreach ($this->bannedWords as $bannedWord) {
         if (in_array($bannedWord, explode(" ", $comment->message))) {
             $comment->approved = false;
             $event->stopPropagation();
             return;
         }
     }
 }
コード例 #2
0
 public function onCommentSubmitted(CommentEvent $event)
 {
     $comment = $event->getComment();
     $request = $event->getRequest();
     $comment->ip = $request->getClientIp();
 }
コード例 #3
0
 public function onCommentSubmitted(CommentEvent $event)
 {
     $comment = $event->getComment();
     // Send to the comment's author a notification
     $comment->notified = true;
 }