Core/Router/Router.php
public function match($request_url = null, $request_method = null)
    {
        // Set Request Url if it isn't passed as parameter
        if ($request_url === null) {
            $request_url = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '/';
        }
        
        $this->request_url = $request_url;
        
        // Set Request Method if it isn't passed as a parameter
        if ($request_method === null) {
            $request_method = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : 'GET';
        }
        
        // Is this an ajax request?
        if (substr($request_url, - 5) == '/ajax') {
            $this->ajax = true;
            $request_url = str_replace('/ajax', '', $request_url);
        } elseif (isset($_GET['ajax'])) {
            $this->ajax = true;
        }
        
        $this->match = parent::match($request_url, $request_method);
        
        if (! empty($this->match)) {
            
            // Some parameters only have control or workflow character and are no parameters for public use.
            // Those will be removed from the parameters array after using them to set corresponding values and/or flags
            // in router.
            $controls = [
                'ajax',
                'format'
            ];
            
            foreach ($controls as $key) {
                
                if (isset($this->match['params'][$key])) {
                    
                    switch ($key) {
                        case 'ajax':
                            $this->ajax = true;
                            break;
                        case 'format':
                            $this->format = $this->match['params'][$key];
                            break;
                        default:
                            $this->{$key} = $this->match['params'][$key];
                    }
                    break;
                }
                
                unset($this->match['params'][$key]);
            }
        }
        
        if (! empty($this->match['params'])) {
            
            foreach ($this->match['params'] as $key => $val) {
                
                if (empty($val)) {
                    unset($this->match['params'][$key]);
                }
                
                if (in_array($key, $this->parameter_to_target)) {
                    $this->match['target'][$key] = $val;
                }
            }
        }
    }
public function match($request_url = null, $request_method = null)
    {
        // Set Request Url if it isn't passed as parameter
        if ($request_url === null) {
            $request_url = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '/';
        }
        
        $this->request_url = $request_url;
        
        // Set Request Method if it isn't passed as a parameter
        if ($request_method === null) {
            $request_method = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : 'GET';
        }
        
        // Is this an ajax request?
        if (substr($request_url, - 5) == '/ajax') {
            $this->ajax = true;
            $request_url = str_replace('/ajax', '', $request_url);
        } elseif (isset($_GET['ajax'])) {
            $this->ajax = true;
        }
        
        $this->match = parent::match($request_url, $request_method);
        
        if (! empty($this->match)) {
            
            // Some parameters only have control or workflow character and are no parameters for public use.
            // Those will be removed from the parameters array after using them to set corresponding values and/or flags
            // in router.
            $controls = [
                'ajax',
                'format'
            ];
            
            foreach ($controls as $key) {
                
                if (isset($this->match['params'][$key])) {
                    
                    switch ($key) {
                        case 'ajax':
                            $this->ajax = true;
                            break;
                        case 'format':
                            $this->format = $this->match['params'][$key];
                            break;
                        default:
                            $this->{$key} = $this->match['params'][$key];
                    }
                    break;
                }
                
                unset($this->match['params'][$key]);
            }
        }
        
        if (! empty($this->match['params'])) {
            
            foreach ($this->match['params'] as $key => $val) {
                
                if (empty($val)) {
                    unset($this->match['params'][$key]);
                }
                
                if (in_array($key, $this->parameter_to_target)) {
                    $this->match['target'][$key] = $val;
                }
            }
        }
    }
public function match ( $ request_url = null , $ request_method = null ) { // Set Request Url if it isn't passed as parameter if ( $ request_url === null ) { $ request_url = isset ( $ _SERVER [ 'REQUEST_URI' ] ) ? $ _SERVER [ 'REQUEST_URI' ] : '/' ; } $ this -> request_url = $ request_url ; // Set Request Method if it isn't passed as a parameter if ( $ request_method === null ) { $ request_method = isset ( $ _SERVER [ 'REQUEST_METHOD' ] ) ? $ _SERVER [ 'REQUEST_METHOD' ] : 'GET' ; } // Is this an ajax request? if ( substr ( $ request_url , - 5 ) == '/ajax' ) { $ this -> ajax = true ; $ request_url = str_replace ( '/ajax' , '' , $ request_url ) ; } elseif ( isset ( $ _GET [ 'ajax' ] ) ) { $ this -> ajax = true ; } $ this -> match = parent :: match ( $ request_url , $ request_method ) ; if ( ! empty ( $ this -> match ) ) { // Some parameters only have control or workflow character and are no parameters for public use. // Those will be removed from the parameters array after using them to set corresponding values and/or flags // in router. $ controls = [ 'ajax' , 'format' ] ; foreach ( $ controls as $ key ) { if ( isset ( $ this -> match [ 'params' ] [ $ key ] ) ) { switch ( $ key ) { case 'ajax' : $ this -> ajax = true ; break ; case 'format' : $ this -> format = $ this -> match [ 'params' ] [ $ key ] ; break ; default : $ this -> { $ key } = $ this -> match [ 'params' ] [ $ key ] ; } break ; } unset ( $ this -> match [ 'params' ] [ $ key ] ) ; } } if ( ! empty ( $ this -> match [ 'params' ] ) ) { foreach ( $ this -> match [ 'params' ] as $ key => $ val ) { if ( empty ( $ val ) ) { unset ( $ this -> match [ 'params' ] [ $ key ] ) ; } if ( in_array ( $ key , $ this -> parameter_to_target ) ) { $ this -> match [ 'target' ] [ $ key ] = $ val ; } } } }
Match a given request url against stored routes

@param string $request_url
@param string $request_method

@return array boolean with route information on success, false on failure (no match).
Match a given request url against stored routes