#279 增加了邮件模板中标题的替换功能
This commit is contained in:
parent
0d1f51a6b2
commit
754320b7d2
|
@ -6,10 +6,10 @@ class EmailText{
|
|||
protected $tmpinfo;
|
||||
|
||||
function __construct($db,$id,$replace)
|
||||
{
|
||||
$this->db=$db;
|
||||
$this->tmpid=$id;
|
||||
$this->data=$replace;
|
||||
{
|
||||
$this->db=$db;
|
||||
$this->tmpid=$id;
|
||||
$this->data=$replace;
|
||||
$this->load();
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@ class EmailText{
|
|||
if(is_numeric($this->tmpid))
|
||||
$sql = "select * from emailtext where id='".$this->tmpid."'";
|
||||
else
|
||||
$sql = "select * from emailtext where template='".$this->tmpid."'";
|
||||
$sql = "select * from emailtext where template='".$this->tmpid."'";
|
||||
$t=$this->db->getFetchMode();
|
||||
$this->db->setFetchMode(Zend_Db::FETCH_ASSOC);
|
||||
$rs = $this->db->query($sql);
|
||||
|
@ -33,10 +33,15 @@ class EmailText{
|
|||
{
|
||||
return false;
|
||||
}else{
|
||||
if (empty($body))
|
||||
{
|
||||
$this->getinfo();
|
||||
$body=$this->tmpinfo['body'];
|
||||
if (empty($body))
|
||||
{
|
||||
$this->getinfo();
|
||||
$body=$this->tmpinfo['body'];
|
||||
}
|
||||
|
||||
if (empty($this->tmpinfo['subject']))
|
||||
{
|
||||
$this->getinfo();
|
||||
}
|
||||
|
||||
if(!empty($body))
|
||||
|
@ -56,7 +61,8 @@ class EmailText{
|
|||
}
|
||||
ksort($patterns);
|
||||
ksort($replacements);
|
||||
$this->tmpinfo['body']=preg_replace($patterns, $replacements, $body);
|
||||
$this->tmpinfo['body'] = preg_replace($patterns, $replacements, $body);
|
||||
$this->tmpinfo['subject'] = preg_replace($patterns, $replacements, $this->tmpinfo['subject']);
|
||||
return true;
|
||||
}//count($this->data)
|
||||
}
|
||||
|
@ -65,11 +71,11 @@ class EmailText{
|
|||
return false;
|
||||
}
|
||||
}//empty($this->tmpid)
|
||||
}//function loadtmp
|
||||
public function getBody() {
|
||||
return $this->tmpinfo['body'];
|
||||
}
|
||||
public function getSubject() {
|
||||
return $this->tmpinfo['subject'];
|
||||
}//function loadtmp
|
||||
public function getBody() {
|
||||
return $this->tmpinfo['body'];
|
||||
}
|
||||
public function getSubject() {
|
||||
return $this->tmpinfo['subject'];
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue