/** * private static function lang_by_url($uri) { $lang = self::$language = Config::get('default_language'); $uri_elements = self::url_to_array($uri); if(count($uri_elements)){ if(strtolower(current($uri_elements)!= 'admin')){ if(in_array(strtolower(current($uri_elements)),Config::get('languages'))){ $lang = self::$language = strtolower(current($uri_elements)); } } } return $lang; } **/ private static function find_alias($url) { require LIB_DIR . 'alias.php'; require LIB_DIR . 'patterns.php'; foreach ($url_patterns as $k => $v) { $regex = $v['pattern_' . self::getLanguage()]; //echo $regex; if (preg_match('@^' . $regex . '$@', $url, $match)) { // echo "OK"; $url_parts = explode('/', $match[0]); //print_r($url_parts); //echo $val['elements_before_alias']; for ($i = 1; $i <= $v['elements_before_alias']; $i++) { array_shift($url_parts); } // print_r($url_parts); $url = implode('/', $url_parts); if (isset($v['action'])) { $action = $v['action']; self::$action = $action; } if (isset($v['controller'])) { $controller = $v['controller']; self::$controller = $controller; } $rout = $k; if ($rout) { self::$rout = $rout; } //echo $urll; } } if ($url) { // $url_alias_ = 'url_alias_'.self::getLanguage(); // print_r($$url_alias_) ; // Debugger::PrintR($url_alias); $result = ''; foreach ($url_alias as $key => $val) { if (isset($val['alias_' . self::getLanguage()])) { if ($val['alias_' . self::getLanguage()] == $url) { self::$controller = isset($controller) ? $controller : $val['controller']; self::$action = isset($action) ? $action : $val['action']; self::$id = $key; $result = 'found'; } } } if ($result != 'found') { throw new Exception('Page (' . $_SERVER['REQUEST_URI'] . ') not found', 404); } } //echo $url; }