mvc, move view_fetch_themed_filename() to index, so a stub can overwrite it's behaviour (when developing locally)

This commit is contained in:
Ad Schellevis 2018-03-06 21:16:02 +01:00
parent 67e95c4f52
commit ec819ca59c
2 changed files with 21 additions and 21 deletions

View File

@ -9,27 +9,6 @@ use Phalcon\Session\Adapter\Files as SessionAdapter;
use OPNsense\Core\Config;
use OPNsense\Core\Routing;
/**
* 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) {
$filename = __DIR__ . "/../../../www{$pattern}{$url}";
if (file_exists($filename)) {
return str_replace("//", "/", "/ui{$pattern}{$url}");
}
}
return $url; // not found, return source
}
/**
* The FactoryDefault Dependency Injector automatically register the right services providing a full stack framework
*/

View File

@ -2,6 +2,27 @@
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) {
$filename = __DIR__ . "{$pattern}{$url}";
if (file_exists($filename)) {
return str_replace("//", "/", "/ui{$pattern}{$url}");
}
}
return $url; // not found, return source
}
try {
/**
* Read the configuration