mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 22:28:51 +00:00
Merge remote-tracking branch 'naderman/ticket/10783' into develop
* naderman/ticket/10783: [ticket/10783] Correctly add assets_version config var to includejs urls
This commit is contained in:
commit
2c9d984049
3 changed files with 11 additions and 10 deletions
|
@ -507,6 +507,9 @@ class phpbb_style_template
|
||||||
$file = $this->locator->get_first_file_location(array($file), true, true);
|
$file = $this->locator->get_first_file_location(array($file), true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$file .= (strpos($file, '?') === false) ? '?' : '&';
|
||||||
|
$file .= 'assets_version=' . $this->config['assets_version'];
|
||||||
|
|
||||||
// Add HTML code
|
// Add HTML code
|
||||||
$code = '<script src="' . htmlspecialchars($file) . '"></script>';
|
$code = '<script src="' . htmlspecialchars($file) . '"></script>';
|
||||||
$this->context->append_var('SCRIPTS', $code);
|
$this->context->append_var('SCRIPTS', $code);
|
||||||
|
|
|
@ -882,8 +882,6 @@ class phpbb_style_template_filter extends php_user_filter
|
||||||
*/
|
*/
|
||||||
private function compile_tag_include_js($tag_args)
|
private function compile_tag_include_js($tag_args)
|
||||||
{
|
{
|
||||||
global $config;
|
|
||||||
|
|
||||||
// Process dynamic includes
|
// Process dynamic includes
|
||||||
if ($tag_args[0] == '{')
|
if ($tag_args[0] == '{')
|
||||||
{
|
{
|
||||||
|
@ -896,7 +894,7 @@ class phpbb_style_template_filter extends php_user_filter
|
||||||
}
|
}
|
||||||
|
|
||||||
// Locate file
|
// Locate file
|
||||||
$filename = $this->locator->get_first_file_location(array($tag_args), false, true) . '?assets_version=' . $config['assets_version'];
|
$filename = $this->locator->get_first_file_location(array($tag_args), false, true);
|
||||||
|
|
||||||
if ($filename === false)
|
if ($filename === false)
|
||||||
{
|
{
|
||||||
|
|
|
@ -14,14 +14,14 @@ class phpbb_template_template_includejs_test extends phpbb_template_template_tes
|
||||||
public function test_includejs_compilation()
|
public function test_includejs_compilation()
|
||||||
{
|
{
|
||||||
// Reset the engine state
|
// Reset the engine state
|
||||||
$this->setup_engine();
|
$this->setup_engine(array('assets_version' => 1));
|
||||||
|
|
||||||
// Prepare correct result
|
// Prepare correct result
|
||||||
$dir = dirname(__FILE__);
|
$dir = dirname(__FILE__);
|
||||||
$scripts = array(
|
$scripts = array(
|
||||||
'<script src="' . $dir . '/templates/parent_and_child.html"></script>',
|
'<script src="' . $dir . '/templates/parent_and_child.html?assets_version=1"></script>',
|
||||||
'<script src="' . $dir . '/parent_templates/parent_only.html"></script>',
|
'<script src="' . $dir . '/parent_templates/parent_only.html?assets_version=1"></script>',
|
||||||
'<script src="' . $dir . '/templates/child_only.html"></script>'
|
'<script src="' . $dir . '/templates/child_only.html?assets_version=1"></script>'
|
||||||
);
|
);
|
||||||
|
|
||||||
// Run test
|
// Run test
|
||||||
|
|
Loading…
Add table
Reference in a new issue