router.php (1041B)
1 <?php 2 class ControllerStartupRouter extends Controller { 3 public function index() { 4 // Route 5 if (isset($this->request->get['route']) && $this->request->get['route'] != 'startup/router') { 6 $route = $this->request->get['route']; 7 } else { 8 $route = $this->config->get('action_default'); 9 } 10 11 // Sanitize the call 12 $route = preg_replace('/[^a-zA-Z0-9_\/]/', '', (string)$route); 13 14 // Trigger the pre events 15 $result = $this->event->trigger('controller/' . $route . '/before', array(&$route, &$data)); 16 17 if (!is_null($result)) { 18 return $result; 19 } 20 21 // We dont want to use the loader class as it would make an controller callable. 22 $action = new Action($route); 23 24 // Any output needs to be another Action object. 25 $output = $action->execute($this->registry); 26 27 // Trigger the post events 28 $result = $this->event->trigger('controller/' . $route . '/after', array(&$route, &$data, &$output)); 29 30 if (!is_null($result)) { 31 return $result; 32 } 33 34 return $output; 35 } 36 }