/**
  * Notify the user from oldComment about newComment
  *
  * @param Fishpig_Wordpress_Model_Post_Comment $oldComment
  * @param Fishpig_Wordpress_Model_Post_Comment $newComment
  * @return bool
  */
 protected function _notify(Fishpig_Wordpress_Model_Post_Comment $oldComment, Fishpig_Wordpress_Model_Post_Comment $newComment)
 {
     $subject = $this->getPluginOption('mail_subject');
     $body = $this->getPluginOption('mail_message');
     if ($body) {
         $mailVars = array('blogname' => Mage::helper('wordpress')->getWpOption('blogname'), 'blogurl' => Mage::helper('wordpress')->getUrl(), 'postname' => $newComment->getPost()->getPostTitle(), 'pc_content' => trim($oldComment->getCommentContent()), 'pc_author' => $oldComment->getCommentAuthor(), 'pc_date' => $oldComment->getCommentDate(), 'cc_content' => trim($newComment->getCommentContent()), 'cc_author' => $newComment->getCommentAuthor(), 'cc_date' => $newComment->getCommentDate(), 'cc_url' => $newComment->getCommentAuthorUrl(), 'commentlink' => $newComment->getUrl());
         foreach ($mailVars as $mailVar => $value) {
             $subject = preg_replace('/(\\[' . $mailVar . '\\])/i', $value, $subject);
             $body = preg_replace('/(\\[' . $mailVar . '\\])/i', $value, $body);
         }
         $mail = new Zend_Mail();
         $mail->setBodyHtml($body);
         $mail->setFrom(Mage::getStoreConfig('trans_email/ident_general/email'), Mage::getStoreConfig('trans_email/ident_general/name'));
         $mail->addTo($oldComment->getCommentAuthorEmail());
         $mail->setSubject($subject);
         try {
             $mail->send();
             return true;
         } catch (Exception $e) {
             Mage::helper('wordpress')->log($e->getMessage());
         }
     }
     return false;
 }
 /**
  * Get the HTML of the child comments
  *
  * @param Fishpig_Wordpress_Model_Post_Comment $comment
  * @return string
  */
 public function getChildrenCommentsHtml(Fishpig_Wordpress_Model_Post_Comment $comment)
 {
     return $this->getLayout()->createBlock('wordpress/post_view_comments')->setTemplate($this->getTemplate())->setParentId($comment->getId())->setComments($comment->getChildrenComments())->toHtml();
 }
 /**
  * Get the comment content
  * Filter out certain HTML tags
  *
  * @param Fishpig_Wordpress_Model_Post_Comment $comment
  * @return string
  */
 public function getCommentContent(Fishpig_Wordpress_Model_Post_Comment $comment)
 {
     $content = strip_tags(trim($comment->getCommentContent()), $this->getAllowedHtmlTags());
     return $this->canConvertNewLines() ? nl2br($content) : $content;
 }
Beispiel #4
0
	/**
	 * Retrieve the status of the comment
	 *
	 * @param Fishpig_Wordpress_Model_Post_Comment $comment
	 * @return string
	 */
	public function getCommentStatus(Fishpig_Wordpress_Model_Post_Comment $comment)
	{
		if ($comment->getCommentApproved() == '0') {
			return $this->__('Pending');
		}
		elseif ($comment->getCommentApproved() == '1') {
			return $this->__('Approved');
		}
		
		return $this->__('Not Approved');
	}