public function execute(EmailTemplate $template) { $header = $this->headerTemplate ? sprintf(static::INCLUDE_EXTENSION, $this->headerTemplate) : ''; $footer = $this->footerTemplate ? sprintf(static::INCLUDE_EXTENSION, $this->footerTemplate) : ''; $cssStyles = $this->stylesTemplate ? sprintf(static::INCLUDE_EXTENSION, $this->stylesTemplate) : ''; $template->setBody(sprintf(static::LAYOUT_EXTENSION, $this->baseEmailTemplate, $cssStyles, $header, $template->getBody(), $footer)); }
public function execute(EmailTemplate $template) { $body = $template->getBody(); $regex = "/{{\\s*(?<variable>.*?)\\s*}}/uis"; preg_match_all($regex, $body, $matches); $foundVariables = $matches['variable']; $availableTags = $template->getTags(); foreach ($foundVariables as $variable) { if (!in_array($variable, $availableTags)) { $search = "/({{\\s*" . preg_quote($variable) . "\\s*}})/ui"; $body = preg_replace($search, $variable, $body, 1); } } $template->setBody($body); }
public function execute(EmailTemplate $template) { $body = $template->getBody(); $regex = '/(?<instruction>{%.*?%})/uis'; preg_match_all($regex, $body, $matches); $foundInstructions = $matches['instruction']; foreach ($foundInstructions as $instruction) { // the only instructions we don't "escape" is "block" cause we need it :) if (strpos($instruction, 'block') || strpos($instruction, 'endblock')) { continue; } $search = "/{$instruction}/uis"; $body = preg_replace($search, '', $body, 1); } $template->setBody($body); }
/** * @param EmailTemplate $template */ public function execute(EmailTemplate $template) { $template->setSubject($this->process($template->getSubject())); $template->setBody($this->process($template->getBody())); }
public function execute(EmailTemplate $template) { $body = $template->getBody(); $body = nl2br($body); $template->setBody($body); }
public function execute(EmailTemplate $template) { $body = $template->getBody(); $updated = $this->replaceBlocksWithBlocksEmbed($body); $template->setBody($updated); }