Skip to content
This repository has been archived by the owner on Jan 21, 2020. It is now read-only.

Commit

Permalink
Merge pull request #1726 from ppp0/issue-1726
Browse files Browse the repository at this point in the history
Move mail img tag generation to protected function
  • Loading branch information
ppp0 committed Apr 16, 2015
2 parents 4ea88f0 + 333b97e commit e06242b
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions library/CM/RenderAdapter/Mail.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ public function fetch() {
$html = $htmlBody;
}
if ($mail->getRecipient()) {
$imageTag = '<img style="display: none; width: 0px; height: 0px;" src="' .
CM_Util::htmlspecialchars($this->getRender()->getUrlEmailTracking($mail)) . '" />';
$html = preg_replace('#</body>#', $imageTag . '$0', $html);
$html = preg_replace('#</body>#', $this->_getTrackingImageTag($mail) . '$0', $html);
}

if (!($text = $mail->getText())) {
Expand All @@ -56,6 +54,15 @@ public function fetch() {
return array($subject, $html, $text);
}

/**
* @param CM_Mail $mail
* @return string
*/
protected function _getTrackingImageTag(CM_Mail $mail) {
return '<img style="display: none; width: 0px; height: 0px;" src="' .
CM_Util::htmlspecialchars($this->getRender()->getUrlEmailTracking($mail)) . '" />';
}

/**
* @param string $tplName
* @throws CM_Exception_Invalid
Expand Down

0 comments on commit e06242b

Please sign in to comment.