Skip to content
This repository has been archived by the owner on Apr 30, 2020. It is now read-only.

Commit

Permalink
fix(Features/TimberLoader): use relative file path in renderComponent…
Browse files Browse the repository at this point in the history
… hook (#265)

fixes possible open_basedir issues
  • Loading branch information
Doğa Gürdal committed Jul 16, 2018
1 parent 2bfd385 commit 886c94e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Features/TimberLoader/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
// get index file
$componentManager = Flynt\ComponentManager::getInstance();
$filePath = $componentManager->getComponentFilePath($componentName, 'index.twig');
$relativeFilePath = ltrim(str_replace(get_template_directory(), '', $filePath), '/');

if (!is_file($filePath)) {
trigger_error("Template not found: {$filePath}", E_USER_WARNING);
Expand All @@ -41,7 +42,7 @@

add_filter('timber/loader/paths', $returnTimberPaths);

$output = Timber::fetch($filePath, $componentData);
$output = Timber::fetch($relativeFilePath, $componentData);

remove_filter('timber/loader/paths', $returnTimberPaths);

Expand Down

0 comments on commit 886c94e

Please sign in to comment.