From e580ad27f5d06b60c74e86ec7177a824cad9b1dc Mon Sep 17 00:00:00 2001 From: Ad Schellevis Date: Tue, 6 Mar 2018 21:20:07 +0100 Subject: [PATCH] customize view_fetch_themed_filename() to support multiple document roots --- stubs/index.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/stubs/index.php b/stubs/index.php index 3aee614..760945b 100644 --- a/stubs/index.php +++ b/stubs/index.php @@ -28,6 +28,30 @@ */ error_reporting(E_ALL); +/** + * search for a themed filename or return distribution standard + * @param string $url relative url + * @param array $theme theme name + * @return string + */ +function view_fetch_themed_filename($url, $theme) +{ + $search_pattern = array( + "/themes/{$theme}/build/", + "/" + ); + foreach ($search_pattern as $pattern) { + foreach (\Phalcon\DI\FactoryDefault::getDefault()->get('config')->application->docroot as $path) { + $filename = "{$path}{$pattern}{$url}"; + if (file_exists($filename)) { + return str_replace("//", "/", "/ui{$pattern}{$url}"); + } + } + } + return $url; // not found, return source +} + + try { /** * Read the configuration