Source of file ProcessedEmail.php
Size: 1,099 Bytes - Last Modified: 2021-12-23T10:47:54+00:00
/var/www/docs.ssmods.com/process/src/code/emails/ProcessedEmail.php
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 | <?php /** * Same as the normal system email class, but runs the content through * Emogrifier to merge css rules inline before sending. * * @author Mark Guinn * @package swipestripe * @subpackage emails */ class ProcessedEmail extends Email { /** * Email signature * * @var String HTML content from central config for signature * @see ShopConfig */ public $signature; /** * Runs the content through Emogrifier to merge css style inline before sending * * @see Email::parseVariables() */ protected function parseVariables($isPlain = false) { parent::parseVariables($isPlain); // if it's an html email, filter it through emogrifier if (!$isPlain && preg_match('/<style[^>]*>(?:<\!--)?(.*)(?:-->)?<\/style>/ims', $this->body, $match)){ $css = $match[1]; $html = str_replace( array( "<p>\n<table>", "</table>\n</p>", '© ', $match[0], ), array( "<table>", "</table>", '', '', ), $this->body ); $emog = new \Pelago\Emogrifier($html, $css); $this->body = $emog->emogrify(); } } } |