Example #1
0
 function resolveURL()
 {
     if (isset($settings['urls']['APPEND_SLASH']) && $settings['urls']['APPEND_SLASH'] == true && !self::endswith($this->url, "/")) {
         $url = $this->url . "/";
         Application::redirect_301($url);
     }
     $count = 0;
     $config_size = count($this->urls_conf);
     foreach ($this->urls_conf as $pattern => $callback) {
         $count += 1;
         $this->attempted_patterns[] = $pattern;
         if (preg_match($this->patternize($pattern), substr($this->url, 1), $matches) != false) {
             return self::dispatch($callback, $matches);
         }
         // match
         if ($count == $config_size) {
             if (DEBUG) {
                 ExceptionsManager::UrlNotFoundException("Could not find a Valid Url Pattern", $this->attempted_patterns);
             } else {
                 Application::raise404();
             }
         }
     }
 }