Commit | Line | Data |
---|---|---|
11ade432 AE |
1 | <?php |
2 | namespace wcf\system\template; | |
2e9d8f0c | 3 | use wcf\system\application\ApplicationHandler; |
11ade432 AE |
4 | |
5 | /** | |
a17de04e | 6 | * Loads and displays template in the ACP. |
11ade432 | 7 | * |
9f959ced | 8 | * @author Alexander Ebert |
2b6cb5c2 | 9 | * @copyright 2001-2015 WoltLab GmbH |
11ade432 AE |
10 | * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php> |
11 | * @package com.woltlab.wcf | |
12 | * @subpackage system.template | |
9f959ced | 13 | * @category Community Framework |
11ade432 AE |
14 | */ |
15 | class ACPTemplateEngine extends TemplateEngine { | |
16 | /** | |
0ad90fc3 | 17 | * @see \wcf\system\template\TemplateEngine::$environment |
11ade432 AE |
18 | */ |
19 | protected $environment = 'admin'; | |
20 | ||
21 | /** | |
0ad90fc3 | 22 | * @see \wcf\system\template\TemplateEngine::__construct() |
11ade432 AE |
23 | */ |
24 | protected function init() { | |
25 | parent::init(); | |
26 | ||
563452fd | 27 | $this->templatePaths = array('wcf' => WCF_DIR.'acp/templates/'); |
11ade432 AE |
28 | $this->compileDir = WCF_DIR.'acp/templates/compiled/'; |
29 | ||
30 | if (!defined('NO_IMPORTS')) { | |
31 | $this->loadTemplateListeners(); | |
32 | } | |
33 | } | |
34 | ||
35 | /** | |
36 | * Deletes all compiled acp templates. | |
37 | * | |
39bea7dd | 38 | * @param string $compileDir |
11ade432 AE |
39 | */ |
40 | public static function deleteCompiledACPTemplates($compileDir = '') { | |
41 | if (empty($compileDir)) $compileDir = WCF_DIR.'acp/templates/compiled/'; | |
42 | ||
43 | self::deleteCompiledTemplates($compileDir); | |
44 | } | |
45 | ||
2e9d8f0c MS |
46 | /** |
47 | * @see \wcf\system\template\TemplateEngine::getCompiledFilename() | |
48 | */ | |
49 | public function getCompiledFilename($templateName, $application) { | |
b76aeba3 AE |
50 | $abbreviation = 'wcf'; |
51 | if (PACKAGE_ID) { | |
52 | $abbreviation = ApplicationHandler::getInstance()->getActiveApplication()->getAbbreviation(); | |
53 | } | |
54 | ||
55 | return $this->compileDir.$this->templateGroupID.'_'.$abbreviation.'_'.$this->languageID.'_'.$templateName.'.php'; | |
2e9d8f0c MS |
56 | } |
57 | ||
11ade432 | 58 | /** |
0ad90fc3 | 59 | * @see \wcf\system\template\TemplateEngine::setTemplateGroupID() |
11ade432 AE |
60 | */ |
61 | public final function setTemplateGroupID($templateGroupID) { | |
9f959ced | 62 | // template groups are not supported by the acp template engine |
11ade432 AE |
63 | $this->templateGroupID = 0; |
64 | } | |
6e645852 AE |
65 | |
66 | /** | |
67 | * @see \wcf\system\template\TemplateEngine::getTemplateListenerCode() | |
68 | */ | |
69 | public function getTemplateListenerCode($templateName, $eventName) { | |
70 | // skip template listeners within WCF ACP | |
71 | if (defined('PACKAGE_ID') && PACKAGE_ID == 1) { | |
72 | return ''; | |
73 | } | |
74 | ||
75 | return parent::getTemplateListenerCode($templateName, $eventName); | |
76 | } | |
11ade432 | 77 | } |