Location: PHPKode > projects > Anahita Social Engine > dependencies/plg_system_socialengine/socialengine/model/story/template/email.php
<?php

/**
 * 
 */
class AnModelStoryTemplateEmail extends AnModelStoryTemplateAbstract
{
	/**
	 * Subject of email
	 * 
	 * @var string
	 */
	protected $_subject;
	
	/**
	 * Body of email
	 * 
	 * @var string
	 */
	protected $_body;
	
	/**
	 * Tokens used in the email template
	 * 
	 * @var array
	 */
	protected $_tokens;
	
	/**
	 * Construct template
	 * @return 
	 * @param $options array
	 */
	public function __construct($options=array())
	{
		$options = $this->_initialize($options);
		
		$this->_subject = $options['subject'];
		
		$this->_body 	= $options['body'];
		
		$this->_type	= $options['type'];
		
		$this->_name	= $options['name'];
	}
	
	/**
	 * Initialize
	 * @return 
	 * @param $options Object
	 */
	protected function _initialize($options)
	{
		$default = array(
			'subject' => '' ,
			'body'	  => '' ,
			'type'	  => '' ,
			'name'	  => ''
		);
		
		return array_merge($default, $options);
	}
		
	/**
	 * Parse the subject of the template using the story data
	 * @return 
	 * @param $story Object
	 */	
	public function parseSubject($story)
	{
		$subject = $this->getSubject();
		$subject = JText::_($subject);
		$this->_parse($subject, $story);
		$subject = KFactory::tmp('lib.koowa.filter.html')->sanitize($subject);
		return $subject;
	}
		
	/**
	 * Parse the body of the template using the story data
	 * @return 
	 * @param $story Object
	 */
	public function parseBody($story)
	{
		$body    = $this->getBody();
		$body    = JText::_($body);
		$this->_parse($body, $story);
		return $body;
	}
			
	/**
	 * Return subject of the email template
	 * @return string
	 */
	public function getSubject()
	{
		return $this->_subject;
	}
	
	/**
	 * Return body of the email template
	 * @return string
	 */
	public function getBody()
	{
		return $this->_body;
	}
}
Return current item: Anahita Social Engine