Skip to content

Instantly share code, notes, and snippets.

@nickvergessen
Last active December 23, 2015 03:09
Show Gist options
  • Save nickvergessen/6571835 to your computer and use it in GitHub Desktop.
Save nickvergessen/6571835 to your computer and use it in GitHub Desktop.
$asset_file = "../theme/newspage.css";
$asset = new phpbb_template_asset($asset_file);
if (substr($asset_file, 0, 2) !== './' && $asset->is_relative()) {
$asset_path = $asset->get_path();
$local_file = $this->getEnvironment()->get_web_root_path() . $asset_path;
// string(35) "./../../../../../theme/newspage.css" bool(true)
// Missing extension and template path
var_dump($local_file, !file_exists($local_file));
if (!file_exists($local_file)) {
$local_file = $this->getEnvironment()->findTemplate($asset_path);
// string(76) "./ext/nickvergessen/newspage/styles/prosilver/template/../theme/newspage.css" bool(false)
// SHOULD BE (using wrong root path)
//string(xxx) "./../../../../../ext/nickvergessen/newspage/styles/prosilver/template/../theme/newspage.css" bool(false)
var_dump($local_file, !file_exists($local_file));
$asset->set_path($local_file, true);
$asset->add_assets_version('1');
$asset_file = $asset->get_url();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment