public static function renderTemplate($template, $data = array()) { $email = array('from' => null, 'subject' => null, 'body' => trim(\Emergence\Dwoo\Engine::getSource($template . '.email', $data))); $templateVars = \Emergence\Dwoo\Engine::getInstance()->scope; if (isset($templateVars['from'])) { $email['from'] = trim(preg_replace('/\\s+/', ' ', $templateVars['from'])); } if (isset($templateVars['subject'])) { $email['subject'] = trim(preg_replace('/\\s+/', ' ', $templateVars['subject'])); } return $email; }