From: Alexander Ebert Date: Fri, 26 Jun 2015 12:58:52 +0000 (+0200) Subject: Skip already included JavaScript files X-Git-Tag: 3.0.0_Beta_1~2241^2~1 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=d5cccc0ce3bbe1d82670f397de83649850a32719;p=GitHub%2FWoltLab%2FWCF.git Skip already included JavaScript files --- 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";