From 947b907efef43704c620507db17aff4fe115f219 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Thu, 11 Jul 2013 11:28:35 -0500 Subject: [PATCH] [ticket/11388] Do not append assets_version if using remote path (e.g. http) PHPBB3-11388 --- phpBB/includes/template/twig/node/includeasset.php | 5 ++--- tests/template/template_includejs_test.php | 6 +++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/phpBB/includes/template/twig/node/includeasset.php b/phpBB/includes/template/twig/node/includeasset.php index 647ae22d81..5abff10e3f 100644 --- a/phpBB/includes/template/twig/node/includeasset.php +++ b/phpBB/includes/template/twig/node/includeasset.php @@ -33,8 +33,7 @@ class phpbb_template_twig_node_includeasset extends Twig_Node ->write("\$asset_file = ") ->subcompile($this->getNode('expr')) ->raw(";\n") - ->write("\$argument_string = '?assets_version={$config['assets_version']}';\n") - ->write("\$anchor_string = '';\n") + ->write("\$argument_string = \$anchor_string = '';\n") ->write("if ((\$argument_string_start = strpos(\$asset_file, '?')) !== false) {\n") ->indent() ->write("\$argument_string = substr(\$asset_file, \$argument_string_start);\n") @@ -45,12 +44,12 @@ class phpbb_template_twig_node_includeasset extends Twig_Node ->write("\$argument_string = substr(\$argument_string, 0, \$anchor_string_start);\n") ->outdent() ->write("}\n") - ->write("\$argument_string .= '&assets_version=" . $config['assets_version'] . "';\n") ->outdent() ->write("}\n") ->write("if (strpos(\$asset_file, '//') !== 0 && strpos(\$asset_file, 'http://') !== 0 && strpos(\$asset_file, 'https://') !== 0 && !file_exists(\$asset_file)) {\n") ->indent() ->write("\$asset_file = \$this->getEnvironment()->getLoader()->getCacheKey(\$asset_file);\n") + ->write("\$argument_string .= ((\$argument_string) ? '&' : '?') . 'assets_version={$config['assets_version']}';\n") ->outdent() ->write("}\n") ->write("\$asset_file .= \$argument_string . \$anchor_string;\n") diff --git a/tests/template/template_includejs_test.php b/tests/template/template_includejs_test.php index d4a384a1c5..ea5c30891b 100644 --- a/tests/template/template_includejs_test.php +++ b/tests/template/template_includejs_test.php @@ -78,15 +78,15 @@ class phpbb_template_template_includejs_test extends phpbb_template_template_tes ), array( array('TEST' => 15), - '', + '', ), array( array('TEST' => 16), - '', + '', ), array( array('TEST' => 17), - '', + '', ), ); }