use wcf\system\session\SessionFactory;
use wcf\system\session\SessionHandler;
use wcf\system\style\StyleHandler;
+use wcf\system\template\EmailTemplateEngine;
use wcf\system\template\TemplateEngine;
use wcf\system\user\storage\UserStorageHandler;
use wcf\util\FileUtil;
// add template path and abbreviation
$this->getTPL()->addApplication($abbreviation, $packageDir . 'templates/');
}
+ EmailTemplateEngine::getInstance()->addApplication($abbreviation, $packageDir . 'templates/');
// init application and assign it as template variable
self::$applicationObjects[$application->packageID] = call_user_func([$className, 'getInstance']);
$this->getTPL()->assign('__'.$abbreviation, self::$applicationObjects[$application->packageID]);
+ EmailTemplateEngine::getInstance()->assign('__'.$abbreviation, self::$applicationObjects[$application->packageID]);
}
else {
unset(self::$autoloadDirectories[$abbreviation]);
'__wcf' => $this,
'__wcfVersion' => LAST_UPDATE_TIME // @deprecated since 2.1, use LAST_UPDATE_TIME directly
]);
+ EmailTemplateEngine::getInstance()->registerPrefilter(['event', 'hascontent', 'lang']);
+ EmailTemplateEngine::getInstance()->assign([
+ '__wcf' => $this
+ ]);
}
/**
--- /dev/null
+<?php
+namespace wcf\system\template;
+use wcf\system\WCF;
+
+/**
+ * Loads and displays templates in emails.
+ *
+ * @author Tim Duesterhus
+ * @copyright 2001-2016 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package com.woltlab.wcf
+ * @subpackage system.template
+ * @category Community Framework
+ */
+class EmailTemplateEngine extends TemplateEngine {
+ /**
+ * @inheritDoc
+ */
+ protected $environment = 'email';
+
+ /**
+ * @inheritDoc
+ */
+ protected function init() {
+ parent::init();
+
+ $sql = "SELECT templateGroupID
+ FROM wcf".WCF_N."_template_group
+ WHERE templateGroupFolderName = ?";
+ $statement = WCF::getDB()->prepareStatement($sql);
+ $statement->execute(['_wcf_email/']);
+
+ parent::setTemplateGroupID($statement->fetchSingleColumn());
+ }
+
+ /**
+ * This method always throws, because changing the template
+ * group is not supported.
+ *
+ * @throws \BadMethodCallException
+ */
+ public function setTemplateGroupID($templateGroupID) {
+ throw new \BadMethodCallException("You may not change the template group of the email template engine");
+ }
+}