Subversion Repositories web.creative

Rev

Rev 20 | Details | Compare with Previous | Last modification | View Log

Rev Author Line No. Line
1 mjordaan 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
		$data = array();
12
 
13
		// Sanitize the call
14
		$route = preg_replace('/[^a-zA-Z0-9_\/]/', '', (string)$route);
15
 
16
		// Trigger the pre events
17
		$result = $this->event->trigger('controller/' . $route . '/before', array(&$route, &$data));
18
 
19
		if (!is_null($result)) {
20
			return $result;
21
		}
22
 
23
		$action = new Action($route);
24
 
25
		// Any output needs to be another Action object. 
26
		$output = $action->execute($this->registry, $data);
27
 
28
		// Trigger the post events
29
		$result = $this->event->trigger('controller/' . $route . '/after', array(&$route, &$output));
30
 
31
		if (!is_null($result)) {
32
			return $result;
33
		}
34
 
35
		return $output;
36
	}
37
}