From d5cccc0ce3bbe1d82670f397de83649850a32719 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Fri, 26 Jun 2015 14:58:52 +0200 Subject: [PATCH] Skip already included JavaScript files --- .../plugin/JsFunctionTemplatePlugin.class.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/wcfsetup/install/files/lib/system/template/plugin/JsFunctionTemplatePlugin.class.php b/wcfsetup/install/files/lib/system/template/plugin/JsFunctionTemplatePlugin.class.php index c71989c2d8..a318370a21 100644 --- a/wcfsetup/install/files/lib/system/template/plugin/JsFunctionTemplatePlugin.class.php +++ b/wcfsetup/install/files/lib/system/template/plugin/JsFunctionTemplatePlugin.class.php @@ -33,6 +33,12 @@ use wcf\util\StringUtil; * @category Community Framework */ class JsFunctionTemplatePlugin implements IFunctionTemplatePlugin { + /** + * list of already included JavaScript files + * @var array + */ + protected $includedFiles = []; + /** * @see \wcf\system\template\IFunctionTemplatePlugin::execute() */ @@ -66,6 +72,11 @@ class JsFunctionTemplatePlugin implements IFunctionTemplatePlugin { $src .= $tagArgs['file']; } + if (in_array($src, $this->includedFiles)) { + return ''; + } + + $this->includedFiles[] = $src; $src .= (!ENABLE_DEBUG_MODE ? '.min' : '') . '.js?v=' . LAST_UPDATE_TIME; $html = ''."\n"; -- 2.20.1