mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
[ticket/11832] get_url() from phpbb_template_asset should return web path
PHPBB3-11832
This commit is contained in:
parent
b4a374dc73
commit
9e8babbf6e
2 changed files with 9 additions and 4 deletions
|
@ -19,13 +19,18 @@ class phpbb_template_asset
|
||||||
{
|
{
|
||||||
protected $components = array();
|
protected $components = array();
|
||||||
|
|
||||||
|
/** @var phpbb_filesystem **/
|
||||||
|
protected $phpbb_filesystem;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param string $url URL
|
* @param string $url URL
|
||||||
*/
|
*/
|
||||||
public function __construct($url)
|
public function __construct($url, phpbb_filesystem $phpbb_filesystem)
|
||||||
{
|
{
|
||||||
|
$this->phpbb_filesystem = $phpbb_filesystem;
|
||||||
|
|
||||||
$this->set_url($url);
|
$this->set_url($url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,7 +117,7 @@ class phpbb_template_asset
|
||||||
*/
|
*/
|
||||||
public function get_url()
|
public function get_url()
|
||||||
{
|
{
|
||||||
return $this->join_url($this->components);
|
return $this->phpbb_filesystem->update_web_root_path($this->join_url($this->components));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -33,11 +33,11 @@ abstract class phpbb_template_twig_node_includeasset extends Twig_Node
|
||||||
->write("\$asset_file = ")
|
->write("\$asset_file = ")
|
||||||
->subcompile($this->getNode('expr'))
|
->subcompile($this->getNode('expr'))
|
||||||
->raw(";\n")
|
->raw(";\n")
|
||||||
->write("\$asset = new phpbb_template_asset(\$asset_file);\n")
|
->write("\$asset = new phpbb_template_asset(\$asset_file, \$this->getEnvironment()->get_filesystem());\n")
|
||||||
->write("if (substr(\$asset_file, 0, 2) !== './' && \$asset->is_relative()) {\n")
|
->write("if (substr(\$asset_file, 0, 2) !== './' && \$asset->is_relative()) {\n")
|
||||||
->indent()
|
->indent()
|
||||||
->write("\$asset_path = \$asset->get_path();")
|
->write("\$asset_path = \$asset->get_path();")
|
||||||
->write("\$local_file = \$this->getEnvironment()->get_web_root_path() . \$asset_path;\n")
|
->write("\$local_file = \$this->getEnvironment()->get_phpbb_root_path() . \$asset_path;\n")
|
||||||
->write("if (!file_exists(\$local_file)) {\n")
|
->write("if (!file_exists(\$local_file)) {\n")
|
||||||
->indent()
|
->indent()
|
||||||
->write("\$local_file = \$this->getEnvironment()->findTemplate(\$asset_path);\n")
|
->write("\$local_file = \$this->getEnvironment()->findTemplate(\$asset_path);\n")
|
||||||
|
|
Loading…
Add table
Reference in a new issue