コード例 #1
0
 protected function getNewComment()
 {
     $comment = new rtComment();
     if ($this->getUser()->isAuthenticated()) {
         $this->getUser()->getGuardUser();
         $comment->setAuthorName($this->getUser()->getGuardUser()->getFirstName() . ' ' . $this->getUser()->getGuardUser()->getLastName());
         $comment->setAuthorEmail($this->getUser()->getGuardUser()->getEmailAddress());
     }
     return $comment;
 }
コード例 #2
0
 /**
  * Notify the administrator about new classified
  *
  * @param rtComment $comment
  */
 protected function notifyAdministrator($comment)
 {
     if (!sfConfig::has('app_rt_comment_moderation_email')) {
         return;
     }
     $from = $comment->getAuthorEmail();
     $to = sfConfig::get('app_rt_comment_moderation_email', '*****@*****.**');
     $subject = 'New comment requires activation!';
     $body = sprintf('A new comment was created by %s (%s)', $comment->getAuthorName(), $comment->getAuthorEmail()) . ":\n\n";
     $body .= '--' . "\n\n";
     $body .= strip_tags($comment->getContent()) . "\n\n";
     $body .= '--' . "\n\n";
     $body .= 'Click here if you would like to activate this comment:' . "\n";
     $body .= $this->generateUrl('rt_comment_enable', array('id' => $comment->getId()), true);
     $this->getMailer()->composeAndSend($from, $to, $subject, $body);
 }
コード例 #3
0
 protected function clearObjectCache(rtComment $rt_comment)
 {
     $cache_class = $rt_comment->getModel() . 'CacheToolkit';
     if (class_exists($cache_class)) {
         call_user_func($cache_class . '::clearCache', $rt_comment->getObject());
     }
 }