Normalize the orientation of uploaded files
[GitHub/WoltLab/WCF.git] / wcfsetup / install / files / lib / system / template / ACPTemplateEngine.class.php
CommitLineData
11ade432 1<?php
a9229942 2
11ade432 3namespace wcf\system\template;
a9229942 4
2e9d8f0c 5use wcf\system\application\ApplicationHandler;
11ade432
AE
6
7/**
a17de04e 8 * Loads and displays template in the ACP.
a9229942
TD
9 *
10 * @author Alexander Ebert
11 * @copyright 2001-2019 WoltLab GmbH
12 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
11ade432 13 */
a9229942
TD
14class ACPTemplateEngine extends TemplateEngine
15{
16 /**
17 * @inheritDoc
18 */
19 protected $environment = 'admin';
20
21 /**
22 * @inheritDoc
23 */
24 protected function init()
25 {
26 parent::init();
27
28 $this->templatePaths = ['wcf' => WCF_DIR . 'acp/templates/'];
29 $this->compileDir = WCF_DIR . 'acp/templates/compiled/';
30 }
31
32 /**
33 * Deletes all compiled acp templates.
34 *
35 * @param string $compileDir
36 */
37 public static function deleteCompiledACPTemplates($compileDir = '')
38 {
39 if (empty($compileDir)) {
40 $compileDir = WCF_DIR . 'acp/templates/compiled/';
41 }
42
43 self::deleteCompiledTemplates($compileDir);
44 }
45
46 /**
47 * @inheritDoc
48 */
49 public function getCompiledFilename($templateName, $application)
50 {
51 $abbreviation = 'wcf';
52 if (PACKAGE_ID) {
53 $abbreviation = ApplicationHandler::getInstance()->getActiveApplication()->getAbbreviation();
54 }
55
c6a40168 56 return $this->getCompileFilePrefix($templateName) . '_' . $abbreviation . '_' . $this->languageID . '_' . $templateName . '.php';
a9229942
TD
57 }
58
59 /**
60 * This method always throws, because changing the template group is not supported.
61 *
62 * @param int $templateGroupID
63 * @throws \BadMethodCallException
64 */
65 public function setTemplateGroupID($templateGroupID)
66 {
67 throw new \BadMethodCallException("You may not change the template group of the acp template engine");
68 }
69
70 /**
71 * @inheritDoc
72 */
73 public function getTemplateListenerCode($templateName, $eventName)
74 {
75 // skip template listeners within WCFSetup
76 if (!PACKAGE_ID) {
77 return '';
78 }
79
80 return parent::getTemplateListenerCode($templateName, $eventName);
81 }
11ade432 82}