Ejemplo n.º 1
0
 protected function _renderTemplate($template, array $params = array())
 {
     extract($params);
     $compiler = new XenForo_Template_Compiler($template);
     XenForo_Application::disablePhpErrorHandler();
     @eval($compiler->compile());
     XenForo_Application::enablePhpErrorHandler();
     return htmlspecialchars_decode($__output, ENT_QUOTES);
 }
Ejemplo n.º 2
0
 /**
  * Prepares the subject, plain text body, and HTML body.
  *
  * @param string|null $emailTitle Title of email to send. If not specified, uses value from consructor.
  * @param array|null $params Params to pass to email template. If not specified, uses value from constructor.
  *
  * @return array|false False if the template can't be found; otherwise array with subject, bodyText, and bodyHtml keys
  */
 public function prepareMailContents($emailTitle = null, array $params = null)
 {
     if ($emailTitle === null) {
         $emailTitle = $this->_emailTitle;
     }
     if ($params === null) {
         $params = $this->_params;
     }
     $__template = $this->_loadEmailTemplate($emailTitle);
     if (!$__template) {
         return false;
     }
     $__defaultLanguage = XenForo_Template_Helper_Core::getDefaultLanguage();
     $__languages = XenForo_Application::get('languages');
     if (isset($__languages[$this->_languageId])) {
         XenForo_Template_Helper_Core::setDefaultLanguage($__languages[$this->_languageId]);
     }
     $xenOptions = XenForo_Application::get('options')->getOptions();
     extract($params);
     $__oldErrors = error_reporting(E_ALL & ~E_NOTICE);
     XenForo_Application::disablePhpErrorHandler();
     // these variables come from the $__template
     $__subject = $__bodyText = $__bodyHtml = '';
     eval($__template);
     XenForo_Application::enablePhpErrorHandler();
     error_reporting($__oldErrors);
     XenForo_Template_Helper_Core::setDefaultLanguage($__defaultLanguage);
     return array('subject' => $__subject, 'bodyText' => $__bodyText, 'bodyHtml' => $__bodyHtml);
 }
Ejemplo n.º 3
0
 /**
  * Prepares the subject, plain text body, and HTML body.
  *
  * @param string|null $emailTitle Title of email to send. If not specified, uses value from consructor.
  * @param array|null $params Params to pass to email template. If not specified, uses value from constructor.
  *
  * @return array|false False if the template can't be found; otherwise array with subject, bodyText, and bodyHtml keys
  */
 public function prepareMailContents($emailTitle = null, array $params = null)
 {
     if ($emailTitle === null) {
         $emailTitle = $this->_emailTitle;
     }
     if ($params === null) {
         $params = $this->_params;
     }
     $__template = $this->_loadEmailTemplate($emailTitle);
     if (!$__template) {
         return false;
     }
     $__defaultLanguage = XenForo_Template_Helper_Core::getDefaultLanguage();
     $__languages = XenForo_Application::get('languages');
     if (isset($__languages[$this->_languageId])) {
         XenForo_Template_Helper_Core::setDefaultLanguage($__languages[$this->_languageId]);
     }
     $xenOptions = XenForo_Application::get('options')->getOptions();
     extract($params);
     $emailLanguage = XenForo_Template_Helper_Core::getDefaultLanguage();
     $emailIsRtl = isset($emailLanguage['text_direction']) && $emailLanguage['text_direction'] == 'RTL';
     $__oldErrors = error_reporting(E_ALL & ~E_NOTICE);
     XenForo_Application::disablePhpErrorHandler();
     // these variables come from the $__template
     $__subject = $__bodyText = $__bodyHtml = '';
     eval($__template);
     XenForo_Application::enablePhpErrorHandler();
     error_reporting($__oldErrors);
     XenForo_Template_Helper_Core::setDefaultLanguage($__defaultLanguage);
     if ($emailIsRtl) {
         $__bodyHtml = preg_replace_callback('/<rtlcss>(.*)<\\/rtlcss>/sU', array($this, '_replaceRtlCss'), $__bodyHtml);
     } else {
         $__bodyHtml = preg_replace('/<rtlcss>(.*)<\\/rtlcss>/sU', '\\1', $__bodyHtml);
     }
     return array('subject' => $__subject, 'bodyText' => $__bodyText, 'bodyHtml' => $__bodyHtml);
 }