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