public static function parseResourceFile()
{
if (Cml::$debug) {
$pathInfo = Route::getPathInfo();
array_shift($pathInfo);
$resource = implode('/', $pathInfo);
$appName = $file = '';
$i = 0;
$routeAppHierarchy = Config::get('route_app_hierarchy', 1);
while (true) {
$resource = ltrim($resource, '/');
$pos = strpos($resource, '/');
$appName = ($appName == '' ? '' : $appName . DIRECTORY_SEPARATOR) . substr($resource, 0, $pos);
$resource = substr($resource, $pos);
$file = Cml::getApplicationDir('apps_path') . DIRECTORY_SEPARATOR . $appName . DIRECTORY_SEPARATOR . Cml::getApplicationDir('app_static_path_name') . $resource;
if (is_file($file) || ++$i >= $routeAppHierarchy) {
break;
}
}
if (is_file($file)) {
Response::sendContentTypeBySubFix(substr($resource, strrpos($resource, '.') + 1));
exit(file_get_contents($file));
} else {
Response::sendHttpStatus(404);
}
}
}