Example #1
0
 static function getTopAssets($type, $which_end)
 {
     $rtn = array();
     $keys = array();
     foreach (self::getAllAssets($which_end) as $asset) {
         if ($asset->position == 'top' && $asset->type == $type && preg_match('/' . $asset->path . '/', get_request_uri_relative())) {
             // check if already included
             if (in_array($asset->key, $keys)) {
                 continue;
             }
             $keys[] = $asset->key;
             $rtn[] = $asset;
         }
     }
     return $rtn;
 }
Example #2
0
<?php

require_once 'bootstrap.php';
$settings = Vars::getSettings();
/** rounting **/
$relative_uri;
if ($settings['i18n']) {
    $relative_uri = get_request_uri_relative();
} else {
    $relative_uri = str_replace(get_sub_root(), '', get_request_uri());
}
//_debug($settings['routing']);
// try to match a route
foreach ($settings['routing'] as $route) {
    $path = $route['path'];
    $isSecure = $route['isSecure'];
    $controller = $route['controller'];
    $i18n = $route['i18n'];
    //  _debug($relative_uri);
    $vars = array();
    $user = User::getInstance();
    if (preg_match('/' . $path . '/', $relative_uri, $vars)) {
        // redirect to lang url if lang code is not here
        if ($i18n && $settings['i18n']) {
            HTML::redirectToI18nUrl();
        }
        if ($isSecure && !$user->isLogin()) {
            dispatch('core/login');
        } else {
            dispatch($controller, $vars);
        }
Example #3
0
/**
 * If we are not at backend of not
 * 
 * @return type
 */
function is_backend()
{
    return preg_match('/^\\/admin/', get_request_uri_relative()) && !is_cli();
}