Use include instant of sharedInclude
authorCyperghost <olaf_schmitz_1@t-online.de>
Fri, 26 Jan 2024 14:34:59 +0000 (15:34 +0100)
committerCyperghost <olaf_schmitz_1@t-online.de>
Fri, 26 Jan 2024 14:34:59 +0000 (15:34 +0100)
21 files changed:
com.woltlab.wcf/templates/__multifactorTotpDevicesContainer.tpl
com.woltlab.wcf/templates/__multifactorTotpNewDeviceContainer.tpl
com.woltlab.wcf/templates/shared_formContainer.tpl
com.woltlab.wcf/templates/shared_formField.tpl
wcfsetup/install/files/lib/system/WCF.class.php
wcfsetup/install/files/lib/system/bbcode/WoltLabSuiteArticleBBCode.class.php
wcfsetup/install/files/lib/system/bbcode/WoltLabSuiteMediaBBCode.class.php
wcfsetup/install/files/lib/system/form/builder/FormDocument.class.php
wcfsetup/install/files/lib/system/form/builder/TemplateFormNode.class.php
wcfsetup/install/files/lib/system/form/builder/button/FormButton.class.php
wcfsetup/install/files/lib/system/form/builder/container/FormContainer.class.php
wcfsetup/install/files/lib/system/form/builder/container/SuffixFormFieldContainer.class.php
wcfsetup/install/files/lib/system/form/builder/field/AbstractFormField.class.php
wcfsetup/install/files/lib/system/form/builder/field/CheckboxFormField.class.php
wcfsetup/install/files/lib/system/form/builder/field/SingleSelectionFormField.class.php
wcfsetup/install/files/lib/system/form/builder/field/dependency/AbstractFormFieldDependency.class.php
wcfsetup/install/files/lib/system/form/builder/field/devtools/project/DevtoolsProjectInstructionsFormField.class.php
wcfsetup/install/files/lib/system/form/builder/field/validation/FormFieldValidationError.class.php
wcfsetup/install/files/lib/system/form/builder/wysiwyg/WysiwygSmileyFormNode.class.php
wcfsetup/install/files/lib/system/template/TemplateEngine.class.php
wcfsetup/install/files/lib/system/template/plugin/SharedIncludeFunctionTemplatePlugin.class.php

index 9a6fcd4e076efaaf1d9a81bd82fe80991c449449..8de65becf64c1f41d481a73a818572ae39f577d0 100644 (file)
@@ -36,7 +36,7 @@
        </div>
 </section>
 
-{sharedInclude file='formContainerDependencies'}
+{include file='shared_formContainerDependencies'}
 
 <script data-relocate="true">
        require(['WoltLabSuite/Core/Form/Builder/Field/Dependency/Container/Default'], function(DefaultContainerDependency) {
index 8b43a2b4f6dbaac2275a8f95eea44c999c3ca274..ec03fcb35d2477ea50a6b0d3eb33ff588d15f46b 100644 (file)
@@ -37,7 +37,7 @@
        </div>
 </section>
 
-{sharedInclude file='formContainerDependencies'}
+{include file='shared_formContainerDependencies'}
 
 <script data-relocate="true">
        require(['WoltLabSuite/Core/Form/Builder/Field/Dependency/Container/Default'], function(DefaultContainerDependency) {
index a30657efd3ba6312079209b5b3dd0ee73bf5ed8f..50bac7d81b055013cefbe3bf20e0ca60aa8c2a0c 100644 (file)
                {/if}
        {/if}
 
-       {sharedInclude file='formContainerChildren'}
+       {include file='shared_formContainerChildren'}
 </section>
 
-{sharedInclude file='formContainerDependencies'}
+{include file='shared_formContainerDependencies'}
 
 <script data-relocate="true">
        require(['WoltLabSuite/Core/Form/Builder/Field/Dependency/Container/Default'], function(DefaultContainerDependency) {
index 53ed2e78d2cf1b60b9eb102a3f6e1954007b050b..9a3f40c80a9f99779d5622aecb55a73cab953cf1 100644 (file)
@@ -7,9 +7,9 @@
        <dd>
                {@$field->getFieldHtml()}
 
-               {sharedInclude file='formFieldErrors'}
-               {sharedInclude file='formFieldDescription'}
-               {sharedInclude file='formFieldDependencies'}
-               {sharedInclude file='formFieldDataHandler'}
+               {include file='shared_formFieldErrors'}
+               {include file='shared_formFieldDescription'}
+               {include file='shared_formFieldDependencies'}
+               {include file='shared_formFieldDataHandler'}
        </dd>
 </dl>
index a3c38d11b3eb6d8df7c9de720cb5eb2f2a1e82d7..8da47de1b67494c629fd09ca633f88c41eaf3dcd 100644 (file)
@@ -29,7 +29,6 @@ use wcf\system\session\SessionFactory;
 use wcf\system\session\SessionHandler;
 use wcf\system\style\StyleHandler;
 use wcf\system\template\EmailTemplateEngine;
-use wcf\system\template\SharedTemplateEngine;
 use wcf\system\template\TemplateEngine;
 use wcf\system\user\storage\UserStorageHandler;
 use wcf\util\DirectoryUtil;
@@ -657,7 +656,6 @@ class WCF
                 static::getTPL()->addApplication($abbreviation, $packageDir . 'templates/');
             }
             EmailTemplateEngine::getInstance()->addApplication($abbreviation, $packageDir . 'templates/');
-            SharedTemplateEngine::getInstance()->addApplication($abbreviation, $packageDir . 'templates/');
 
             // init application and assign it as template variable
             self::$applicationObjects[$application->packageID] = \call_user_func([$className, 'getInstance']);
@@ -666,10 +664,6 @@ class WCF
                 '__' . $abbreviation,
                 self::$applicationObjects[$application->packageID]
             );
-            SharedTemplateEngine::getInstance()->assign(
-                '__' . $abbreviation,
-                self::$applicationObjects[$application->packageID]
-            );
         } else {
             unset(self::$autoloadDirectories[$abbreviation]);
             throw new SystemException("Unable to run '" . $package->package . "', '" . $className . "' is missing or does not implement '" . IApplication::class . "'.");
@@ -747,24 +741,20 @@ class WCF
         if (ENABLE_ENTERPRISE_MODE) {
             $wcf = new TemplateScriptingCore($wcf);
         }
-        $tplEngines = [self::getTPL(), SharedTemplateEngine::getInstance()];
-        /** @var TemplateEngine[] $tplEngines */
-        foreach ($tplEngines as $tplEngine) {
-            $tplEngine->registerPrefilter(['event', 'hascontent', 'lang', 'jsphrase', 'jslang', 'csrfToken', 'icon']);
-            $tplEngine->assign([
-                '__wcf' => $wcf,
-            ]);
-
-            $isAjax = isset($_SERVER['HTTP_X_REQUESTED_WITH']) && ($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest');
-            // Execute background queue in this request, if it was requested and AJAX isn't used.
-            if (!$isAjax) {
-                if (self::getSession()->getVar('forceBackgroundQueuePerform')) {
-                    $tplEngine->assign([
-                        'forceBackgroundQueuePerform' => true,
-                    ]);
-
-                    self::getSession()->unregister('forceBackgroundQueuePerform');
-                }
+        self::getTPL()->registerPrefilter(['event', 'hascontent', 'lang', 'jsphrase', 'jslang', 'csrfToken', 'icon']);
+        self::getTPL()->assign([
+            '__wcf' => $wcf,
+        ]);
+
+        $isAjax = isset($_SERVER['HTTP_X_REQUESTED_WITH']) && ($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest');
+        // Execute background queue in this request, if it was requested and AJAX isn't used.
+        if (!$isAjax) {
+            if (self::getSession()->getVar('forceBackgroundQueuePerform')) {
+                self::getTPL()->assign([
+                    'forceBackgroundQueuePerform' => true,
+                ]);
+
+                self::getSession()->unregister('forceBackgroundQueuePerform');
             }
         }
 
@@ -814,7 +804,7 @@ class WCF
         if (self::$tplObj !== null) {
             self::getTPL()->setLanguageID(self::getLanguage()->languageID);
             EmailTemplateEngine::getInstance()->setLanguageID(self::getLanguage()->languageID);
-            SharedTemplateEngine::getInstance()->setLanguageID(self::getLanguage()->languageID);
+            WCF::getTPL()->setLanguageID(self::getLanguage()->languageID);
         }
     }
 
index 0c95c709b3c13f32a4675c0a8cb7f0855a715510..60d1091dd22fade947fd3608aadc3bfecc9a0ca2 100644 (file)
@@ -4,7 +4,6 @@ namespace wcf\system\bbcode;
 
 use wcf\data\article\ViewableArticle;
 use wcf\system\message\embedded\object\MessageEmbeddedObjectManager;
-use wcf\system\template\SharedTemplateEngine;
 use wcf\system\WCF;
 use wcf\util\StringUtil;
 
@@ -41,7 +40,7 @@ final class WoltLabSuiteArticleBBCode extends AbstractBBCode
                 'message' => WCF::getLanguage()->getDynamicVariable('wcf.message.content.no.permission.title')
             ], true);
         } elseif ($parser->getOutputType() == 'text/html') {
-            return SharedTemplateEngine::getInstance()->fetch('shared_articleBBCode', 'wcf', [
+            return WCF::getTPL()->fetch('shared_articleBBCode', 'wcf', [
                 'article' => $article,
                 'articleID' => $article->articleID,
                 'titleHash' => \substr(StringUtil::getRandomID(), 0, 8),
index 8367503edb089eccf57fdd919bc7a32f43e99869..258f903e7564cf5a3cf87090e7ad710652ab6259 100644 (file)
@@ -5,7 +5,6 @@ namespace wcf\system\bbcode;
 use wcf\data\media\ViewableMedia;
 use wcf\system\message\embedded\object\MessageEmbeddedObjectManager;
 use wcf\system\request\LinkHandler;
-use wcf\system\template\SharedTemplateEngine;
 use wcf\system\WCF;
 use wcf\util\StringUtil;
 
@@ -67,7 +66,7 @@ final class WoltLabSuiteMediaBBCode extends AbstractBBCode
                     $float = (!empty($openingTag['attributes'][2])) ? $openingTag['attributes'][2] : 'none';
                     $width = (!empty($openingTag['attributes'][3])) ? $openingTag['attributes'][3] : 'auto';
 
-                    return SharedTemplateEngine::getInstance()->fetch('shared_mediaBBCodeTag', 'wcf', [
+                    return WCF::getTPL()->fetch('shared_mediaBBCodeTag', 'wcf', [
                         'mediaLink' => $this->getLink($media),
                         'removeLinks' => $removeLinks,
                         'thumbnailLink' => $thumbnailSize !== 'original' ? $this->getThumbnailLink(
@@ -80,7 +79,7 @@ final class WoltLabSuiteMediaBBCode extends AbstractBBCode
                         'width' => $width,
                     ]);
                 } elseif ($media->isVideo() || $media->isAudio()) {
-                    return SharedTemplateEngine::getInstance()->fetch('shared_mediaBBCodeTag', 'wcf', [
+                    return WCF::getTPL()->fetch('shared_mediaBBCodeTag', 'wcf', [
                         'mediaLink' => $this->getLink($media),
                         'removeLinks' => $removeLinks,
                         'float' => 'none',
index 70fb8aa1d72bce89345d7179f66330211e172060..b792e0e9c43620b9cd1a10391117c79b90a053ea 100644 (file)
@@ -11,7 +11,6 @@ use wcf\system\form\builder\data\IFormDataHandler;
 use wcf\system\form\builder\data\processor\DefaultFormDataProcessor;
 use wcf\system\form\builder\field\IFileFormField;
 use wcf\system\form\builder\field\IFormField;
-use wcf\system\template\SharedTemplateEngine;
 use wcf\system\WCF;
 
 /**
@@ -443,7 +442,7 @@ class FormDocument implements IFormDocument
             throw new \BadMethodCallException("The form document has to be built before it can be rendered.");
         }
 
-        return SharedTemplateEngine::getInstance()->fetch(
+        return WCF::getTPL()->fetch(
             'shared_form',
             'wcf',
             \array_merge($this->getHtmlVariables(), ['form' => $this])
index 29f5baf5e279fd3b21d36b4cbf26f16035276e9d..f95991298648a346da5017971ddafd4779eb361a 100644 (file)
@@ -3,7 +3,7 @@
 namespace wcf\system\form\builder;
 
 use wcf\system\application\ApplicationHandler;
-use wcf\system\template\SharedTemplateEngine;
+use wcf\system\WCF;
 
 /**
  * Form node that shows the contents of a specific template.
@@ -79,7 +79,7 @@ class TemplateFormNode implements IFormChildNode
      */
     public function getHtml()
     {
-        return SharedTemplateEngine::getInstance()->fetch(
+        return WCF::getTPL()->fetch(
             $this->getTemplateName(),
             $this->getApplication(),
             $this->getVariables(),
index 9bc3b43b9d693c519b85856ff2438b92551b041f..73810d59842454688ccb632cc98129866c9a8af7 100644 (file)
@@ -4,7 +4,7 @@ namespace wcf\system\form\builder\button;
 
 use wcf\system\form\builder\TFormChildNode;
 use wcf\system\form\builder\TFormElement;
-use wcf\system\template\SharedTemplateEngine;
+use wcf\system\WCF;
 
 /**
  * Default implementation of a form button.
@@ -74,7 +74,7 @@ class FormButton implements IFormButton
      */
     public function getHtml()
     {
-        return SharedTemplateEngine::getInstance()->fetch(
+        return WCF::getTPL()->fetch(
             $this->templateName,
             'wcf',
             [
index d794b1e49ef6f30a61608e3803c1246dbdac1013..e3b37a651913d41589b181aa2b4d725c8ee3df08 100644 (file)
@@ -9,7 +9,7 @@ use wcf\system\form\builder\IFormDocument;
 use wcf\system\form\builder\TFormChildNode;
 use wcf\system\form\builder\TFormElement;
 use wcf\system\form\builder\TFormParentNode;
-use wcf\system\template\SharedTemplateEngine;
+use wcf\system\WCF;
 
 /**
  * Represents a default container.
@@ -54,7 +54,7 @@ class FormContainer implements IFormContainer
      */
     public function getHtml()
     {
-        return SharedTemplateEngine::getInstance()->fetch(
+        return WCF::getTPL()->fetch(
             $this->templateName,
             $this->templateApplication,
             \array_merge($this->getHtmlVariables(), [
index 57781661981063f68fdb5d704fb88fd7adca1193..0c92bd44372716f3272db7699a55b73ea2a0bf97 100644 (file)
@@ -5,7 +5,7 @@ namespace wcf\system\form\builder\container;
 use wcf\system\form\builder\field\IFormField;
 use wcf\system\form\builder\field\IImmutableFormField;
 use wcf\system\form\builder\field\ISelectionFormField;
-use wcf\system\template\SharedTemplateEngine;
+use wcf\system\WCF;
 
 /**
  * Represents a form field container for one main field with (optional) support for a suffix selection
@@ -69,7 +69,7 @@ class SuffixFormFieldContainer extends FormContainer
      */
     public function getHtml()
     {
-        return SharedTemplateEngine::getInstance()->fetch('shared_suffixFormFieldContainer', 'wcf', [
+        return WCF::getTPL()->fetch('shared_suffixFormFieldContainer', 'wcf', [
             'element' => $this,
         ]);
     }
index 622554ca0ddff547f35cd8df99553d8fdb6934ae..0f0dd4697c57d1a11cba5ae6d5c7241cc981b583 100644 (file)
@@ -8,7 +8,7 @@ use wcf\system\form\builder\field\validation\IFormFieldValidationError;
 use wcf\system\form\builder\field\validation\IFormFieldValidator;
 use wcf\system\form\builder\TFormChildNode;
 use wcf\system\form\builder\TFormElement;
-use wcf\system\template\SharedTemplateEngine;
+use wcf\system\WCF;
 
 /**
  * Abstract implementation of a form field.
@@ -108,7 +108,7 @@ abstract class AbstractFormField implements IFormField
             throw new \LogicException("\$templateName property has not been set for class '" . static::class . "'.");
         }
 
-        return SharedTemplateEngine::getInstance()->fetch(
+        return WCF::getTPL()->fetch(
             $this->templateName,
             $this->templateApplication,
             \array_merge($this->getHtmlVariables(), [
@@ -127,7 +127,7 @@ abstract class AbstractFormField implements IFormField
             throw new \UnexpectedValueException("Form field '{$this->getPrefixedId()}' requires a label.");
         }
 
-        return SharedTemplateEngine::getInstance()->fetch(
+        return WCF::getTPL()->fetch(
             'shared_formField',
             'wcf',
             ['field' => $this],
index 04dfc6e657b2f28c881b1faa48329f54a70afb49..ce0951f67ae17b5756af6e74254194c321aefe57 100644 (file)
@@ -2,7 +2,7 @@
 
 namespace wcf\system\form\builder\field;
 
-use wcf\system\template\SharedTemplateEngine;
+use wcf\system\WCF;
 
 /**
  * Implementation of a checkbox form field for boolean values.
@@ -38,7 +38,7 @@ class CheckboxFormField extends BooleanFormField
             throw new \UnexpectedValueException("Form field '{$this->getPrefixedId()}' requires a label.");
         }
 
-        return SharedTemplateEngine::getInstance()->fetch(
+        return WCF::getTPL()->fetch(
             'shared_checkboxFormField',
             'wcf',
             [
index 72ef9798152d24ccc69cc9889a829c3379dcf1a2..8d71a7d203377dd70eae5dff3c8349df047bcfa0 100644 (file)
@@ -33,7 +33,7 @@ class SingleSelectionFormField extends AbstractFormField implements
     /**
      * @inheritDoc
      */
-    protected $templateName = '__singleSelectionFormField';
+    protected $templateName = 'shared_singleSelectionFormField';
 
     /**
      * @inheritDoc
index 1a40127766471d7d744dccc300108959d6a700c5..6fb2fff8f47b2e836d4e16abec38218aa9445747 100644 (file)
@@ -5,7 +5,7 @@ namespace wcf\system\form\builder\field\dependency;
 use wcf\system\application\ApplicationHandler;
 use wcf\system\form\builder\field\IFormField;
 use wcf\system\form\builder\IFormNode;
-use wcf\system\template\SharedTemplateEngine;
+use wcf\system\WCF;
 
 /**
  * Abstract implementation of a form field dependency.
@@ -144,7 +144,7 @@ abstract class AbstractFormFieldDependency implements IFormFieldDependency
             throw new \LogicException("Unknown application with abbreviation '{$this->templateNameApplication}'.");
         }
 
-        return SharedTemplateEngine::getInstance()->fetch($this->templateName, $this->templateNameApplication, [
+        return WCF::getTPL()->fetch($this->templateName, $this->templateNameApplication, [
             'dependency' => $this,
         ], true);
     }
index dff3590c89a2f49c5b56b3ea89456acd609e3a12..52e022c9da403845dc3d870db0e69023fd281abe 100644 (file)
@@ -9,7 +9,7 @@ use wcf\system\application\ApplicationHandler;
 use wcf\system\form\builder\field\AbstractFormField;
 use wcf\system\form\builder\field\TDefaultIdFormField;
 use wcf\system\form\builder\field\validation\FormFieldValidationError;
-use wcf\system\template\SharedTemplateEngine;
+use wcf\system\WCF;
 
 /**
  * Form field implementation for the instructions of a devtools project.
@@ -90,7 +90,7 @@ final class DevtoolsProjectInstructionsFormField extends AbstractFormField
 
         $this->removeClass('formError');
 
-        return SharedTemplateEngine::getInstance()->fetch(
+        return WCF::getTPL()->fetch(
             $this->templateName,
             'wcf',
             [
index 6f7f15c9eeddf0427a4fd8d24c63b73f6353df96..98c8f33b81742b11b6fae0553956f4a376d12669 100644 (file)
@@ -2,7 +2,6 @@
 
 namespace wcf\system\form\builder\field\validation;
 
-use wcf\system\template\SharedTemplateEngine;
 use wcf\system\WCF;
 
 /**
@@ -56,7 +55,7 @@ final class FormFieldValidationError implements IFormFieldValidationError
      */
     public function getHtml()
     {
-        return SharedTemplateEngine::getInstance()->fetch('shared_formFieldError', 'wcf', [
+        return WCF::getTPL()->fetch('shared_formFieldError', 'wcf', [
             'error' => $this,
         ]);
     }
index c262b6e0345e9f6e7c398cdf41f11044f1f8b0c6..65738634417dba6df007b87b6b8c3c35218f5d04 100644 (file)
@@ -6,7 +6,7 @@ use wcf\data\smiley\Smiley;
 use wcf\system\form\builder\IFormChildNode;
 use wcf\system\form\builder\TFormChildNode;
 use wcf\system\form\builder\TFormNode;
-use wcf\system\template\SharedTemplateEngine;
+use wcf\system\WCF;
 
 /**
  * Implementation of a form field for the list smilies of a certain category used by a wysiwyg
@@ -35,7 +35,7 @@ class WysiwygSmileyFormNode implements IFormChildNode
      */
     public function getHtml()
     {
-        return SharedTemplateEngine::getInstance()->fetch('shared_wysiwygSmileyFormNode', 'wcf', [
+        return WCF::getTPL()->fetch('shared_wysiwygSmileyFormNode', 'wcf', [
             'node' => $this,
         ]);
     }
index 60e14c7173880160034be511039c71fa64e7204d..c040f2c22d9a6943d5c77dbaeb51317364ee45a1 100755 (executable)
@@ -11,6 +11,7 @@ use wcf\system\event\EventHandler;
 use wcf\system\exception\SystemException;
 use wcf\system\Regex;
 use wcf\system\SingletonFactory;
+use wcf\system\WCF;
 use wcf\util\DirectoryUtil;
 use wcf\util\HeaderUtil;
 use wcf\util\StringUtil;
@@ -125,6 +126,8 @@ class TemplateEngine extends SingletonFactory
 
     protected $tagStack = [];
 
+    private int $sharedTemplateGroupID = 0;
+
     /**
      * @inheritDoc
      */
@@ -134,6 +137,14 @@ class TemplateEngine extends SingletonFactory
         $this->pluginNamespace = 'wcf\system\template\plugin\\';
         $this->compileDir = WCF_DIR . 'templates/compiled/';
 
+        $sql = "SELECT  templateGroupID
+                FROM    wcf" . WCF_N . "_template_group
+                WHERE   templateGroupFolderName = ?";
+        $statement = WCF::getDB()->prepareStatement($sql);
+        $statement->execute(['_wcf_shared/']);
+
+        $this->sharedTemplateGroupID = $statement->fetchSingleColumn();
+
         $this->loadTemplateGroupCache();
         $this->assignSystemVariables();
     }
@@ -354,11 +365,11 @@ class TemplateEngine extends SingletonFactory
      */
     public function getSourceFilename($templateName, $application)
     {
-        if (\str_starts_with($templateName, 'shared_') && !($this instanceof SharedTemplateEngine)) {
-            throw new \LogicException('Shared templates can only be used with SharedTemplateEngine');
+        if ($this->isSharedTemplate($templateName)) {
+            $sourceFilename = $this->getPath(TemplateEngine::getInstance()->templatePaths[$application], $templateName);
+        } else {
+            $sourceFilename = $this->getPath($this->templatePaths[$application], $templateName);
         }
-
-        $sourceFilename = $this->getPath($this->templatePaths[$application], $templateName);
         if (!empty($sourceFilename)) {
             return $sourceFilename;
         }
@@ -385,7 +396,6 @@ class TemplateEngine extends SingletonFactory
     {
         if (!Template::isSystemCritical($templateName)) {
             $templateGroupID = $this->getTemplateGroupID();
-
             while ($templateGroupID != 0) {
                 $templateGroup = $this->templateGroupCache[$templateGroupID];
 
@@ -417,7 +427,13 @@ class TemplateEngine extends SingletonFactory
      */
     public function getCompiledFilename($templateName, $application)
     {
-        return $this->compileDir . $this->getTemplateGroupID() . '_' . $application . '_' . $this->languageID . '_' . $templateName . '.php';
+        $path = $this->compileDir;
+        if ($this->isSharedTemplate($templateName)) {
+            $path .= $this->sharedTemplateGroupID;
+        } else {
+            $path .= $this->getTemplateGroupID();
+        }
+        return $path . '_' . $application . '_' . $this->languageID . '_' . $templateName . '.php';
     }
 
     /**
@@ -428,7 +444,13 @@ class TemplateEngine extends SingletonFactory
      */
     public function getMetaDataFilename($templateName)
     {
-        return $this->compileDir . $this->getTemplateGroupID() . '_' . $templateName . '.meta.php';
+        $path = $this->compileDir;
+        if ($this->isSharedTemplate($templateName)) {
+            $path .= $this->sharedTemplateGroupID;
+        } else {
+            $path .= $this->getTemplateGroupID();
+        }
+        return $path . '_' . $templateName . '.meta.php';
     }
 
     /**
@@ -880,4 +902,9 @@ class TemplateEngine extends SingletonFactory
 
         return $data;
     }
+
+    protected function isSharedTemplate(string $templateName): bool
+    {
+        return \str_starts_with($templateName, 'shared_');
+    }
 }
index 720eb6ec0a8125f9ec5b3d51753a3b47b6d81358..90b3485b0617c264160355abbc5560f990f569dd 100644 (file)
@@ -2,7 +2,6 @@
 
 namespace wcf\system\template\plugin;
 
-use wcf\system\template\SharedTemplateEngine;
 use wcf\system\template\TemplateEngine;
 
 /**
@@ -29,6 +28,6 @@ final class SharedIncludeFunctionTemplatePlugin implements IFunctionTemplatePlug
 
         unset($tagArgs['file'], $tagArgs['application'], $tagArgs['sandbox']);
 
-        return SharedTemplateEngine::getInstance()->fetch($file, $application, $tagArgs, $sandbox);
+        return WCF::getTPL()->fetch($file, $application, $tagArgs, $sandbox);
     }
 }