Andrey Andreev | c5536aa | 2012-11-01 17:33:58 +0200 | [diff] [blame] | 1 | <?php |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 2 | /** |
| 3 | * CodeIgniter |
| 4 | * |
Phil Sturgeon | 07c1ac8 | 2012-03-09 17:03:37 +0000 | [diff] [blame] | 5 | * An open source application development framework for PHP 5.2.4 or newer |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 6 | * |
Derek Jones | f4a4bd8 | 2011-10-20 12:18:42 -0500 | [diff] [blame] | 7 | * NOTICE OF LICENSE |
Andrey Andreev | ba6c041 | 2012-01-07 21:10:09 +0200 | [diff] [blame] | 8 | * |
Derek Jones | f4a4bd8 | 2011-10-20 12:18:42 -0500 | [diff] [blame] | 9 | * Licensed under the Open Software License version 3.0 |
Andrey Andreev | ba6c041 | 2012-01-07 21:10:09 +0200 | [diff] [blame] | 10 | * |
Derek Jones | f4a4bd8 | 2011-10-20 12:18:42 -0500 | [diff] [blame] | 11 | * This source file is subject to the Open Software License (OSL 3.0) that is |
| 12 | * bundled with this package in the files license.txt / license.rst. It is |
| 13 | * also available through the world wide web at this URL: |
| 14 | * http://opensource.org/licenses/OSL-3.0 |
| 15 | * If you did not receive a copy of the license and are unable to obtain it |
| 16 | * through the world wide web, please send an email to |
| 17 | * licensing@ellislab.com so we can send you a copy immediately. |
| 18 | * |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 19 | * @package CodeIgniter |
Derek Jones | f4a4bd8 | 2011-10-20 12:18:42 -0500 | [diff] [blame] | 20 | * @author EllisLab Dev Team |
darwinel | 871754a | 2014-02-11 17:34:57 +0100 | [diff] [blame] | 21 | * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) |
Derek Jones | f4a4bd8 | 2011-10-20 12:18:42 -0500 | [diff] [blame] | 22 | * @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 23 | * @link http://codeigniter.com |
| 24 | * @since Version 1.0 |
| 25 | * @filesource |
| 26 | */ |
Andrey Andreev | c5536aa | 2012-11-01 17:33:58 +0200 | [diff] [blame] | 27 | defined('BASEPATH') OR exit('No direct script access allowed'); |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 28 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 29 | /** |
| 30 | * Router Class |
| 31 | * |
| 32 | * Parses URIs and determines routing |
| 33 | * |
| 34 | * @package CodeIgniter |
| 35 | * @subpackage Libraries |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 36 | * @category Libraries |
Andrey Andreev | 92ebfb6 | 2012-05-17 12:49:24 +0300 | [diff] [blame] | 37 | * @author EllisLab Dev Team |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 38 | * @link http://codeigniter.com/user_guide/general/routing.html |
| 39 | */ |
| 40 | class CI_Router { |
| 41 | |
David Behler | 07b5342 | 2011-08-15 00:25:06 +0200 | [diff] [blame] | 42 | /** |
Andrey Andreev | b9fe7e9 | 2012-10-27 18:45:59 +0300 | [diff] [blame] | 43 | * CI_Config class object |
David Behler | 07b5342 | 2011-08-15 00:25:06 +0200 | [diff] [blame] | 44 | * |
Andrey Andreev | b9fe7e9 | 2012-10-27 18:45:59 +0300 | [diff] [blame] | 45 | * @var object |
David Behler | 07b5342 | 2011-08-15 00:25:06 +0200 | [diff] [blame] | 46 | */ |
Andrey Andreev | ba6c041 | 2012-01-07 21:10:09 +0200 | [diff] [blame] | 47 | public $config; |
Andrey Andreev | 92ebfb6 | 2012-05-17 12:49:24 +0300 | [diff] [blame] | 48 | |
David Behler | 07b5342 | 2011-08-15 00:25:06 +0200 | [diff] [blame] | 49 | /** |
| 50 | * List of routes |
| 51 | * |
Andrey Andreev | b9fe7e9 | 2012-10-27 18:45:59 +0300 | [diff] [blame] | 52 | * @var array |
David Behler | 07b5342 | 2011-08-15 00:25:06 +0200 | [diff] [blame] | 53 | */ |
Timothy Warren | 48a7fbb | 2012-04-23 11:58:16 -0400 | [diff] [blame] | 54 | public $routes = array(); |
Andrey Andreev | 92ebfb6 | 2012-05-17 12:49:24 +0300 | [diff] [blame] | 55 | |
David Behler | 07b5342 | 2011-08-15 00:25:06 +0200 | [diff] [blame] | 56 | /** |
David Behler | 07b5342 | 2011-08-15 00:25:06 +0200 | [diff] [blame] | 57 | * Current class name |
| 58 | * |
Andrey Andreev | b9fe7e9 | 2012-10-27 18:45:59 +0300 | [diff] [blame] | 59 | * @var string |
David Behler | 07b5342 | 2011-08-15 00:25:06 +0200 | [diff] [blame] | 60 | */ |
Andrey Andreev | 92ebfb6 | 2012-05-17 12:49:24 +0300 | [diff] [blame] | 61 | public $class = ''; |
| 62 | |
David Behler | 07b5342 | 2011-08-15 00:25:06 +0200 | [diff] [blame] | 63 | /** |
| 64 | * Current method name |
| 65 | * |
Andrey Andreev | b9fe7e9 | 2012-10-27 18:45:59 +0300 | [diff] [blame] | 66 | * @var string |
David Behler | 07b5342 | 2011-08-15 00:25:06 +0200 | [diff] [blame] | 67 | */ |
Timothy Warren | 48a7fbb | 2012-04-23 11:58:16 -0400 | [diff] [blame] | 68 | public $method = 'index'; |
Andrey Andreev | 92ebfb6 | 2012-05-17 12:49:24 +0300 | [diff] [blame] | 69 | |
David Behler | 07b5342 | 2011-08-15 00:25:06 +0200 | [diff] [blame] | 70 | /** |
| 71 | * Sub-directory that contains the requested controller class |
| 72 | * |
Andrey Andreev | b9fe7e9 | 2012-10-27 18:45:59 +0300 | [diff] [blame] | 73 | * @var string |
David Behler | 07b5342 | 2011-08-15 00:25:06 +0200 | [diff] [blame] | 74 | */ |
Timothy Warren | 48a7fbb | 2012-04-23 11:58:16 -0400 | [diff] [blame] | 75 | public $directory = ''; |
Andrey Andreev | 92ebfb6 | 2012-05-17 12:49:24 +0300 | [diff] [blame] | 76 | |
David Behler | 07b5342 | 2011-08-15 00:25:06 +0200 | [diff] [blame] | 77 | /** |
| 78 | * Default controller (and method if specific) |
| 79 | * |
Andrey Andreev | b9fe7e9 | 2012-10-27 18:45:59 +0300 | [diff] [blame] | 80 | * @var string |
David Behler | 07b5342 | 2011-08-15 00:25:06 +0200 | [diff] [blame] | 81 | */ |
Andrey Andreev | ba6c041 | 2012-01-07 21:10:09 +0200 | [diff] [blame] | 82 | public $default_controller; |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 83 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 84 | /** |
Andrey Andreev | 08fec7b | 2013-07-19 16:25:51 +0300 | [diff] [blame] | 85 | * Translate URI dashes |
| 86 | * |
| 87 | * Determines whether dashes in controller & method segments |
| 88 | * should be automatically replaced by underscores. |
| 89 | * |
| 90 | * @var bool |
| 91 | */ |
| 92 | public $translate_uri_dashes = FALSE; |
| 93 | |
Andrey Andreev | 30d5324 | 2014-01-16 14:41:46 +0200 | [diff] [blame] | 94 | /** |
| 95 | * Enable query strings flag |
| 96 | * |
| 97 | * Determines wether to use GET parameters or segment URIs |
| 98 | * |
| 99 | * @var bool |
| 100 | */ |
| 101 | public $enable_query_strings = FALSE; |
| 102 | |
Andrey Andreev | 08fec7b | 2013-07-19 16:25:51 +0300 | [diff] [blame] | 103 | // -------------------------------------------------------------------- |
| 104 | |
| 105 | /** |
Andrey Andreev | b9fe7e9 | 2012-10-27 18:45:59 +0300 | [diff] [blame] | 106 | * Class constructor |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 107 | * |
| 108 | * Runs the route mapping function. |
Andrey Andreev | 92ebfb6 | 2012-05-17 12:49:24 +0300 | [diff] [blame] | 109 | * |
| 110 | * @return void |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 111 | */ |
Andrey Andreev | c26b9eb | 2014-02-24 11:31:36 +0200 | [diff] [blame^] | 112 | public function __construct($routing = NULL) |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 113 | { |
Derek Jones | c773840 | 2010-03-02 13:55:13 -0600 | [diff] [blame] | 114 | $this->config =& load_class('Config', 'core'); |
| 115 | $this->uri =& load_class('URI', 'core'); |
Andrey Andreev | 30d5324 | 2014-01-16 14:41:46 +0200 | [diff] [blame] | 116 | |
| 117 | $this->enable_query_strings = ( ! is_cli() && $this->config->item('enable_query_strings') === TRUE); |
Andrey Andreev | 08fec7b | 2013-07-19 16:25:51 +0300 | [diff] [blame] | 118 | $this->_set_routing(); |
Andrey Andreev | 4e6c528 | 2014-01-10 19:29:49 +0200 | [diff] [blame] | 119 | |
| 120 | // Set any routing overrides that may exist in the main index file |
Andrey Andreev | c26b9eb | 2014-02-24 11:31:36 +0200 | [diff] [blame^] | 121 | if (is_array($routing)) |
Andrey Andreev | 4e6c528 | 2014-01-10 19:29:49 +0200 | [diff] [blame] | 122 | { |
| 123 | if (isset($routing['directory'])) |
| 124 | { |
| 125 | $this->set_directory($routing['directory']); |
| 126 | } |
| 127 | |
| 128 | if ( ! empty($routing['controller'])) |
| 129 | { |
| 130 | $this->set_class($routing['controller']); |
| 131 | } |
| 132 | |
| 133 | if (isset($routing['function'])) |
| 134 | { |
| 135 | $routing['function'] = empty($routing['function']) ? 'index' : $routing['function']; |
| 136 | $this->set_method($routing['function']); |
| 137 | } |
| 138 | } |
| 139 | |
Andrey Andreev | ba6c041 | 2012-01-07 21:10:09 +0200 | [diff] [blame] | 140 | log_message('debug', 'Router Class Initialized'); |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 141 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 142 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 143 | // -------------------------------------------------------------------- |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 144 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 145 | /** |
Andrey Andreev | b9fe7e9 | 2012-10-27 18:45:59 +0300 | [diff] [blame] | 146 | * Set route mapping |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 147 | * |
Andrey Andreev | b9fe7e9 | 2012-10-27 18:45:59 +0300 | [diff] [blame] | 148 | * Determines what should be served based on the URI request, |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 149 | * as well as any "routes" that have been set in the routing config file. |
| 150 | * |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 151 | * @return void |
| 152 | */ |
Andrey Andreev | 08fec7b | 2013-07-19 16:25:51 +0300 | [diff] [blame] | 153 | protected function _set_routing() |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 154 | { |
Andrey Andreev | ba6c041 | 2012-01-07 21:10:09 +0200 | [diff] [blame] | 155 | // Are query strings enabled in the config file? Normally CI doesn't utilize query strings |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 156 | // since URI segments are more search-engine friendly, but they can optionally be used. |
Derek Jones | c773840 | 2010-03-02 13:55:13 -0600 | [diff] [blame] | 157 | // If this feature is enabled, we will gather the directory/class/method a little differently |
Andrey Andreev | 30d5324 | 2014-01-16 14:41:46 +0200 | [diff] [blame] | 158 | if ($this->enable_query_strings) |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 159 | { |
Andrey Andreev | 30d5324 | 2014-01-16 14:41:46 +0200 | [diff] [blame] | 160 | $_d = $this->config->item('directory_trigger'); |
| 161 | $_d = isset($_GET[$_d]) ? trim($_GET[$_d], " \t\n\r\0\x0B/") : ''; |
| 162 | if ($_d !== '') |
Derek Jones | c773840 | 2010-03-02 13:55:13 -0600 | [diff] [blame] | 163 | { |
Andrey Andreev | 30d5324 | 2014-01-16 14:41:46 +0200 | [diff] [blame] | 164 | $this->set_directory($this->uri->filter_uri($_d)); |
Derek Jones | c773840 | 2010-03-02 13:55:13 -0600 | [diff] [blame] | 165 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 166 | |
Andrey Andreev | 30d5324 | 2014-01-16 14:41:46 +0200 | [diff] [blame] | 167 | $_c = $this->config->item('controller_trigger'); |
| 168 | if ( ! empty($_GET[$_c])) |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 169 | { |
Andrey Andreev | 30d5324 | 2014-01-16 14:41:46 +0200 | [diff] [blame] | 170 | $this->set_class(trim($this->uri->filter_uri(trim($_GET[$_c])))); |
| 171 | |
| 172 | $_f = $this->config->item('function_trigger'); |
| 173 | if ( ! empty($_GET[$_f])) |
| 174 | { |
| 175 | $this->set_method(trim($this->uri->filter_uri($_GET[$_f]))); |
| 176 | } |
| 177 | |
| 178 | $this->uri->rsegments = array( |
| 179 | 1 => $this->class, |
| 180 | 2 => $this->method |
| 181 | ); |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 182 | } |
Andrey Andreev | 30d5324 | 2014-01-16 14:41:46 +0200 | [diff] [blame] | 183 | else |
| 184 | { |
| 185 | $this->_set_default_controller(); |
| 186 | } |
| 187 | |
| 188 | // Routing rules don't apply to query strings and we don't need to detect |
| 189 | // directories, so we're done here |
| 190 | return; |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 191 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 192 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 193 | // Load the routes.php file. |
Andrey Andreev | 0687911 | 2013-01-29 15:05:02 +0200 | [diff] [blame] | 194 | if (file_exists(APPPATH.'config/routes.php')) |
Greg Aker | d96f882 | 2011-12-27 16:23:47 -0600 | [diff] [blame] | 195 | { |
| 196 | include(APPPATH.'config/routes.php'); |
| 197 | } |
David Behler | 07b5342 | 2011-08-15 00:25:06 +0200 | [diff] [blame] | 198 | |
Andrey Andreev | 0687911 | 2013-01-29 15:05:02 +0200 | [diff] [blame] | 199 | if (file_exists(APPPATH.'config/'.ENVIRONMENT.'/routes.php')) |
| 200 | { |
| 201 | include(APPPATH.'config/'.ENVIRONMENT.'/routes.php'); |
| 202 | } |
| 203 | |
Andrey Andreev | 08fec7b | 2013-07-19 16:25:51 +0300 | [diff] [blame] | 204 | // Validate & get reserved routes |
| 205 | if (isset($route) && is_array($route)) |
| 206 | { |
| 207 | isset($route['default_controller']) && $this->default_controller = $route['default_controller']; |
| 208 | isset($route['translate_uri_dashes']) && $this->translate_uri_dashes = $route['translate_uri_dashes']; |
| 209 | unset($route['default_controller'], $route['translate_uri_dashes']); |
| 210 | $this->routes = $route; |
| 211 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 212 | |
Andrey Andreev | 30d5324 | 2014-01-16 14:41:46 +0200 | [diff] [blame] | 213 | // Is there anything to parse? |
| 214 | if ($this->uri->uri_string !== '') |
Derek Jones | c773840 | 2010-03-02 13:55:13 -0600 | [diff] [blame] | 215 | { |
Andrey Andreev | 30d5324 | 2014-01-16 14:41:46 +0200 | [diff] [blame] | 216 | $this->_parse_routes(); |
| 217 | } |
| 218 | else |
| 219 | { |
| 220 | $this->_set_default_controller(); |
| 221 | } |
| 222 | } |
| 223 | |
| 224 | // -------------------------------------------------------------------- |
| 225 | |
| 226 | /** |
| 227 | * Set request route |
| 228 | * |
| 229 | * Takes an array of URI segments as input and sets the class/method |
| 230 | * to be called. |
| 231 | * |
| 232 | * @used-by CI_Router::_parse_routes() |
| 233 | * @param array $segments URI segments |
| 234 | * @return void |
| 235 | */ |
| 236 | protected function _set_request($segments = array()) |
| 237 | { |
| 238 | $segments = $this->_validate_request($segments); |
| 239 | // If we don't have any segments left - try the default controller; |
| 240 | // WARNING: Directories get shifted out of the segments array! |
| 241 | if (empty($segments)) |
| 242 | { |
| 243 | $this->_set_default_controller(); |
| 244 | return; |
Derek Jones | c773840 | 2010-03-02 13:55:13 -0600 | [diff] [blame] | 245 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 246 | |
Andrey Andreev | 30d5324 | 2014-01-16 14:41:46 +0200 | [diff] [blame] | 247 | if ($this->translate_uri_dashes === TRUE) |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 248 | { |
Andrey Andreev | 30d5324 | 2014-01-16 14:41:46 +0200 | [diff] [blame] | 249 | $segments[0] = str_replace('-', '_', $segments[0]); |
| 250 | if (isset($segments[1])) |
| 251 | { |
| 252 | $segments[1] = str_replace('-', '_', $segments[1]); |
| 253 | } |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 254 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 255 | |
Andrey Andreev | 30d5324 | 2014-01-16 14:41:46 +0200 | [diff] [blame] | 256 | $this->set_class($segments[0]); |
| 257 | if (isset($segments[1])) |
| 258 | { |
| 259 | $this->set_method($segments[1]); |
| 260 | } |
| 261 | |
| 262 | array_unshift($segments, NULL); |
| 263 | unset($segments[0]); |
| 264 | $this->uri->rsegments = $segments; |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 265 | } |
Derek Jones | c773840 | 2010-03-02 13:55:13 -0600 | [diff] [blame] | 266 | |
| 267 | // -------------------------------------------------------------------- |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 268 | |
Derek Jones | c773840 | 2010-03-02 13:55:13 -0600 | [diff] [blame] | 269 | /** |
Andrey Andreev | b9fe7e9 | 2012-10-27 18:45:59 +0300 | [diff] [blame] | 270 | * Set default controller |
Derek Jones | c773840 | 2010-03-02 13:55:13 -0600 | [diff] [blame] | 271 | * |
Derek Jones | c773840 | 2010-03-02 13:55:13 -0600 | [diff] [blame] | 272 | * @return void |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 273 | */ |
Andrey Andreev | ba6c041 | 2012-01-07 21:10:09 +0200 | [diff] [blame] | 274 | protected function _set_default_controller() |
Derek Jones | c773840 | 2010-03-02 13:55:13 -0600 | [diff] [blame] | 275 | { |
Andrey Andreev | 533bf2d | 2012-11-02 22:44:29 +0200 | [diff] [blame] | 276 | if (empty($this->default_controller)) |
Derek Jones | c773840 | 2010-03-02 13:55:13 -0600 | [diff] [blame] | 277 | { |
Andrey Andreev | ba6c041 | 2012-01-07 21:10:09 +0200 | [diff] [blame] | 278 | show_error('Unable to determine what should be displayed. A default route has not been specified in the routing file.'); |
Derek Jones | c773840 | 2010-03-02 13:55:13 -0600 | [diff] [blame] | 279 | } |
Andrey Andreev | d1097a1 | 2012-11-01 19:55:42 +0200 | [diff] [blame] | 280 | |
Derek Jones | c773840 | 2010-03-02 13:55:13 -0600 | [diff] [blame] | 281 | // Is the method being specified? |
Andrey Andreev | 533bf2d | 2012-11-02 22:44:29 +0200 | [diff] [blame] | 282 | if (sscanf($this->default_controller, '%[^/]/%s', $class, $method) !== 2) |
Derek Jones | c773840 | 2010-03-02 13:55:13 -0600 | [diff] [blame] | 283 | { |
Andrey Andreev | 533bf2d | 2012-11-02 22:44:29 +0200 | [diff] [blame] | 284 | $method = 'index'; |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 285 | } |
Andrey Andreev | 533bf2d | 2012-11-02 22:44:29 +0200 | [diff] [blame] | 286 | |
Andrey Andreev | 30d5324 | 2014-01-16 14:41:46 +0200 | [diff] [blame] | 287 | if ( ! file_exists(APPPATH.'controllers/'.$this->directory.ucfirst($class).'.php')) |
| 288 | { |
| 289 | // This will trigger 404 later |
| 290 | return; |
| 291 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 292 | |
Andrey Andreev | 30d5324 | 2014-01-16 14:41:46 +0200 | [diff] [blame] | 293 | $this->set_class($class); |
| 294 | $this->set_method($method); |
| 295 | |
| 296 | // Assign routed segments, index starting from 1 |
| 297 | $this->uri->rsegments = array( |
| 298 | 1 => $class, |
| 299 | 2 => $method |
| 300 | ); |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 301 | |
Andrey Andreev | ba6c041 | 2012-01-07 21:10:09 +0200 | [diff] [blame] | 302 | log_message('debug', 'No URI present. Default controller set.'); |
Derek Jones | c773840 | 2010-03-02 13:55:13 -0600 | [diff] [blame] | 303 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 304 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 305 | // -------------------------------------------------------------------- |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 306 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 307 | /** |
Andrey Andreev | b9fe7e9 | 2012-10-27 18:45:59 +0300 | [diff] [blame] | 308 | * Validate request |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 309 | * |
Andrey Andreev | b9fe7e9 | 2012-10-27 18:45:59 +0300 | [diff] [blame] | 310 | * Attempts validate the URI request and determine the controller path. |
| 311 | * |
Andrey Andreev | 30d5324 | 2014-01-16 14:41:46 +0200 | [diff] [blame] | 312 | * @used-by CI_Router::_set_request() |
Andrey Andreev | b9fe7e9 | 2012-10-27 18:45:59 +0300 | [diff] [blame] | 313 | * @param array $segments URI segments |
Andrey Andreev | 30d5324 | 2014-01-16 14:41:46 +0200 | [diff] [blame] | 314 | * @return mixed URI segments |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 315 | */ |
Andrey Andreev | ba6c041 | 2012-01-07 21:10:09 +0200 | [diff] [blame] | 316 | protected function _validate_request($segments) |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 317 | { |
Andrey Andreev | 30d5324 | 2014-01-16 14:41:46 +0200 | [diff] [blame] | 318 | $c = count($segments); |
| 319 | // Loop through our segments and return as soon as a controller |
| 320 | // is found or when such a directory doesn't exist |
| 321 | while ($c-- > 0) |
Derek Jones | c773840 | 2010-03-02 13:55:13 -0600 | [diff] [blame] | 322 | { |
Andrey Andreev | 30d5324 | 2014-01-16 14:41:46 +0200 | [diff] [blame] | 323 | $test = $this->directory |
| 324 | .ucfirst($this->translate_uri_dashes === TRUE ? str_replace('-', '_', $segments[0]) : $segments[0]); |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 325 | |
Andrey Andreev | 30d5324 | 2014-01-16 14:41:46 +0200 | [diff] [blame] | 326 | if ( ! file_exists(APPPATH.'controllers/'.$test.'.php') && is_dir(APPPATH.'controllers/'.$this->directory.$segments[0])) |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 327 | { |
Andrey Andreev | 30d5324 | 2014-01-16 14:41:46 +0200 | [diff] [blame] | 328 | $this->set_directory(array_shift($segments), TRUE); |
| 329 | continue; |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 330 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 331 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 332 | return $segments; |
| 333 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 334 | |
Andrey Andreev | 30d5324 | 2014-01-16 14:41:46 +0200 | [diff] [blame] | 335 | // This means that all segments were actually directories |
| 336 | return $segments; |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 337 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 338 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 339 | // -------------------------------------------------------------------- |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 340 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 341 | /** |
Andrey Andreev | 7b53d04 | 2012-03-26 23:02:32 +0300 | [diff] [blame] | 342 | * Parse Routes |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 343 | * |
Andrey Andreev | b9fe7e9 | 2012-10-27 18:45:59 +0300 | [diff] [blame] | 344 | * Matches any routes that may exist in the config/routes.php file |
| 345 | * against the URI to determine if the class/method need to be remapped. |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 346 | * |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 347 | * @return void |
| 348 | */ |
Andrey Andreev | ba6c041 | 2012-01-07 21:10:09 +0200 | [diff] [blame] | 349 | protected function _parse_routes() |
Jonatas Miguel | 59dbe85 | 2012-08-07 12:13:32 +0100 | [diff] [blame] | 350 | { |
| 351 | // Turn the segment array into a URI string |
| 352 | $uri = implode('/', $this->uri->segments); |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 353 | |
Fatih Kalifa | 442b50b | 2013-11-01 02:44:56 +0700 | [diff] [blame] | 354 | // Get HTTP verb |
Andrey Andreev | c761a20 | 2013-11-11 14:02:15 +0200 | [diff] [blame] | 355 | $http_verb = isset($_SERVER['REQUEST_METHOD']) ? strtolower($_SERVER['REQUEST_METHOD']) : 'cli'; |
Fatih Kalifa | 442b50b | 2013-11-01 02:44:56 +0700 | [diff] [blame] | 356 | |
Jonatas Miguel | 59dbe85 | 2012-08-07 12:13:32 +0100 | [diff] [blame] | 357 | // Is there a literal match? If so we're done |
Fatih Kalifa | 0b58b3c | 2013-11-05 15:36:40 +0700 | [diff] [blame] | 358 | if (isset($this->routes[$uri])) |
Fatih Kalifa | 442b50b | 2013-11-01 02:44:56 +0700 | [diff] [blame] | 359 | { |
Fatih Kalifa | 0b58b3c | 2013-11-05 15:36:40 +0700 | [diff] [blame] | 360 | // Check default routes format |
| 361 | if (is_string($this->routes[$uri])) |
| 362 | { |
Andrey Andreev | 30d5324 | 2014-01-16 14:41:46 +0200 | [diff] [blame] | 363 | $this->_set_request(explode('/', $this->routes[$uri])); |
| 364 | return; |
Fatih Kalifa | 0b58b3c | 2013-11-05 15:36:40 +0700 | [diff] [blame] | 365 | } |
Andrey Andreev | c761a20 | 2013-11-11 14:02:15 +0200 | [diff] [blame] | 366 | // Is there a matching http verb? |
Fatih Kalifa | 0b58b3c | 2013-11-05 15:36:40 +0700 | [diff] [blame] | 367 | elseif (is_array($this->routes[$uri]) && isset($this->routes[$uri][$http_verb])) |
| 368 | { |
Andrey Andreev | 30d5324 | 2014-01-16 14:41:46 +0200 | [diff] [blame] | 369 | $this->_set_request(explode('/', $this->routes[$uri][$http_verb])); |
| 370 | return; |
Fatih Kalifa | 0b58b3c | 2013-11-05 15:36:40 +0700 | [diff] [blame] | 371 | } |
Jonatas Miguel | 59dbe85 | 2012-08-07 12:13:32 +0100 | [diff] [blame] | 372 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 373 | |
vlakoff | c941d85 | 2013-08-06 14:44:40 +0200 | [diff] [blame] | 374 | // Loop through the route array looking for wildcards |
Jonatas Miguel | 59dbe85 | 2012-08-07 12:13:32 +0100 | [diff] [blame] | 375 | foreach ($this->routes as $key => $val) |
| 376 | { |
Fatih Kalifa | 0b58b3c | 2013-11-05 15:36:40 +0700 | [diff] [blame] | 377 | // Check if route format is using http verb |
Fatih Kalifa | 442b50b | 2013-11-01 02:44:56 +0700 | [diff] [blame] | 378 | if (is_array($val)) |
| 379 | { |
Fatih Kalifa | 442b50b | 2013-11-01 02:44:56 +0700 | [diff] [blame] | 380 | if (isset($val[$http_verb])) |
| 381 | { |
| 382 | $val = $val[$http_verb]; |
| 383 | } |
Fatih Kalifa | 442b50b | 2013-11-01 02:44:56 +0700 | [diff] [blame] | 384 | else |
| 385 | { |
Fatih Kalifa | 442b50b | 2013-11-01 02:44:56 +0700 | [diff] [blame] | 386 | continue; |
| 387 | } |
| 388 | } |
| 389 | |
vlakoff | c941d85 | 2013-08-06 14:44:40 +0200 | [diff] [blame] | 390 | // Convert wildcards to RegEx |
Andrey Andreev | 7676c2d | 2012-10-30 13:42:01 +0200 | [diff] [blame] | 391 | $key = str_replace(array(':any', ':num'), array('[^/]+', '[0-9]+'), $key); |
Derek Jones | c773840 | 2010-03-02 13:55:13 -0600 | [diff] [blame] | 392 | |
Jonatas Miguel | 59dbe85 | 2012-08-07 12:13:32 +0100 | [diff] [blame] | 393 | // Does the RegEx match? |
| 394 | if (preg_match('#^'.$key.'$#', $uri, $matches)) |
| 395 | { |
Jonatas Miguel | 59dbe85 | 2012-08-07 12:13:32 +0100 | [diff] [blame] | 396 | // Are we using callbacks to process back-references? |
Andrey Andreev | da5562a | 2012-11-08 12:34:38 +0200 | [diff] [blame] | 397 | if ( ! is_string($val) && is_callable($val)) |
Jonatas Miguel | 59dbe85 | 2012-08-07 12:13:32 +0100 | [diff] [blame] | 398 | { |
| 399 | // Remove the original string from the matches array. |
| 400 | array_shift($matches); |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 401 | |
Jonatas Miguel | 59dbe85 | 2012-08-07 12:13:32 +0100 | [diff] [blame] | 402 | // Get the match count. |
| 403 | $match_count = count($matches); |
Jonatas Miguel | c0d98b2 | 2012-08-06 15:42:50 +0100 | [diff] [blame] | 404 | |
Jonatas Miguel | 59dbe85 | 2012-08-07 12:13:32 +0100 | [diff] [blame] | 405 | // Determine how many parameters the callback has. |
| 406 | $reflection = new ReflectionFunction($val); |
| 407 | $param_count = $reflection->getNumberOfParameters(); |
Jonatas Miguel | c0d98b2 | 2012-08-06 15:42:50 +0100 | [diff] [blame] | 408 | |
Jonatas Miguel | 59dbe85 | 2012-08-07 12:13:32 +0100 | [diff] [blame] | 409 | // Are there more parameters than matches? |
Jonatas Miguel | 24296ca | 2012-09-27 12:10:01 +0100 | [diff] [blame] | 410 | if ($param_count > $match_count) |
Jonatas Miguel | 59dbe85 | 2012-08-07 12:13:32 +0100 | [diff] [blame] | 411 | { |
| 412 | // Any params without matches will be set to an empty string. |
| 413 | $matches = array_merge($matches, array_fill($match_count, $param_count - $match_count, '')); |
Jonatas Miguel | efb8166 | 2012-10-23 19:52:46 +0100 | [diff] [blame] | 414 | |
| 415 | $match_count = $param_count; |
| 416 | } |
| 417 | |
| 418 | // Get the parameters so we can use their default values. |
| 419 | $params = $reflection->getParameters(); |
| 420 | |
| 421 | for ($m = 0; $m < $match_count; $m++) |
| 422 | { |
| 423 | // Is the match empty and does a default value exist? |
| 424 | if (empty($matches[$m]) && $params[$m]->isDefaultValueAvailable()) |
| 425 | { |
| 426 | // Substitute the empty match for the default value. |
| 427 | $matches[$m] = $params[$m]->getDefaultValue(); |
| 428 | } |
Jonatas Miguel | 59dbe85 | 2012-08-07 12:13:32 +0100 | [diff] [blame] | 429 | } |
Jonatas Miguel | c0d98b2 | 2012-08-06 15:42:50 +0100 | [diff] [blame] | 430 | |
Jonatas Miguel | 59dbe85 | 2012-08-07 12:13:32 +0100 | [diff] [blame] | 431 | // Execute the callback using the values in matches as its parameters. |
| 432 | $val = call_user_func_array($val, $matches); |
| 433 | } |
Andrey Andreev | da5562a | 2012-11-08 12:34:38 +0200 | [diff] [blame] | 434 | // Are we using the default routing method for back-references? |
| 435 | elseif (strpos($val, '$') !== FALSE && strpos($key, '(') !== FALSE) |
| 436 | { |
| 437 | $val = preg_replace('#^'.$key.'$#', $val, $uri); |
| 438 | } |
Jonatas Miguel | c0d98b2 | 2012-08-06 15:42:50 +0100 | [diff] [blame] | 439 | |
Andrey Andreev | 30d5324 | 2014-01-16 14:41:46 +0200 | [diff] [blame] | 440 | $this->_set_request(explode('/', $val)); |
| 441 | return; |
Jonatas Miguel | 59dbe85 | 2012-08-07 12:13:32 +0100 | [diff] [blame] | 442 | } |
| 443 | } |
Jonatas Miguel | c0d98b2 | 2012-08-06 15:42:50 +0100 | [diff] [blame] | 444 | |
Jonatas Miguel | 59dbe85 | 2012-08-07 12:13:32 +0100 | [diff] [blame] | 445 | // If we got this far it means we didn't encounter a |
| 446 | // matching route so we'll set the site default route |
Andrey Andreev | a9237cb | 2014-01-18 19:07:20 +0200 | [diff] [blame] | 447 | $this->_set_request(array_values($this->uri->segments)); |
Jonatas Miguel | 59dbe85 | 2012-08-07 12:13:32 +0100 | [diff] [blame] | 448 | } |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 449 | |
| 450 | // -------------------------------------------------------------------- |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 451 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 452 | /** |
Andrey Andreev | b9fe7e9 | 2012-10-27 18:45:59 +0300 | [diff] [blame] | 453 | * Set class name |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 454 | * |
Andrey Andreev | b9fe7e9 | 2012-10-27 18:45:59 +0300 | [diff] [blame] | 455 | * @param string $class Class name |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 456 | * @return void |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 457 | */ |
Andrey Andreev | ba6c041 | 2012-01-07 21:10:09 +0200 | [diff] [blame] | 458 | public function set_class($class) |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 459 | { |
Derek Jones | 2615e41 | 2010-10-06 17:51:16 -0500 | [diff] [blame] | 460 | $this->class = str_replace(array('/', '.'), '', $class); |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 461 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 462 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 463 | // -------------------------------------------------------------------- |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 464 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 465 | /** |
| 466 | * Fetch the current class |
| 467 | * |
Andrey Andreev | 0e4237f | 2013-04-04 16:53:21 +0300 | [diff] [blame] | 468 | * @deprecated 3.0.0 Read the 'class' property instead |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 469 | * @return string |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 470 | */ |
Andrey Andreev | ba6c041 | 2012-01-07 21:10:09 +0200 | [diff] [blame] | 471 | public function fetch_class() |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 472 | { |
| 473 | return $this->class; |
| 474 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 475 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 476 | // -------------------------------------------------------------------- |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 477 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 478 | /** |
Andrey Andreev | b9fe7e9 | 2012-10-27 18:45:59 +0300 | [diff] [blame] | 479 | * Set method name |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 480 | * |
Andrey Andreev | b9fe7e9 | 2012-10-27 18:45:59 +0300 | [diff] [blame] | 481 | * @param string $method Method name |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 482 | * @return void |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 483 | */ |
Andrey Andreev | ba6c041 | 2012-01-07 21:10:09 +0200 | [diff] [blame] | 484 | public function set_method($method) |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 485 | { |
| 486 | $this->method = $method; |
| 487 | } |
| 488 | |
| 489 | // -------------------------------------------------------------------- |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 490 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 491 | /** |
Andrey Andreev | 7b53d04 | 2012-03-26 23:02:32 +0300 | [diff] [blame] | 492 | * Fetch the current method |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 493 | * |
Andrey Andreev | 0e4237f | 2013-04-04 16:53:21 +0300 | [diff] [blame] | 494 | * @deprecated 3.0.0 Read the 'method' property instead |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 495 | * @return string |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 496 | */ |
Andrey Andreev | ba6c041 | 2012-01-07 21:10:09 +0200 | [diff] [blame] | 497 | public function fetch_method() |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 498 | { |
Andrey Andreev | 0e4237f | 2013-04-04 16:53:21 +0300 | [diff] [blame] | 499 | return $this->method; |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 500 | } |
| 501 | |
| 502 | // -------------------------------------------------------------------- |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 503 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 504 | /** |
Andrey Andreev | b9fe7e9 | 2012-10-27 18:45:59 +0300 | [diff] [blame] | 505 | * Set directory name |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 506 | * |
Andrey Andreev | b9fe7e9 | 2012-10-27 18:45:59 +0300 | [diff] [blame] | 507 | * @param string $dir Directory name |
Andrey Andreev | 30d5324 | 2014-01-16 14:41:46 +0200 | [diff] [blame] | 508 | * @param bool $appent Whether we're appending rather then setting the full value |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 509 | * @return void |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 510 | */ |
Andrey Andreev | 30d5324 | 2014-01-16 14:41:46 +0200 | [diff] [blame] | 511 | public function set_directory($dir, $append = FALSE) |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 512 | { |
Andrey Andreev | 30d5324 | 2014-01-16 14:41:46 +0200 | [diff] [blame] | 513 | if ($append !== TRUE OR empty($this->directory)) |
| 514 | { |
| 515 | $this->directory = str_replace('.', '', trim($dir, '/')).'/'; |
| 516 | } |
| 517 | else |
| 518 | { |
| 519 | $this->directory .= str_replace('.', '', trim($dir, '/')).'/'; |
| 520 | } |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 521 | } |
| 522 | |
| 523 | // -------------------------------------------------------------------- |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 524 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 525 | /** |
Andrey Andreev | b9fe7e9 | 2012-10-27 18:45:59 +0300 | [diff] [blame] | 526 | * Fetch directory |
| 527 | * |
| 528 | * Feches the sub-directory (if any) that contains the requested |
| 529 | * controller class. |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 530 | * |
Andrey Andreev | 0e4237f | 2013-04-04 16:53:21 +0300 | [diff] [blame] | 531 | * @deprecated 3.0.0 Read the 'directory' property instead |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 532 | * @return string |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 533 | */ |
Andrey Andreev | ba6c041 | 2012-01-07 21:10:09 +0200 | [diff] [blame] | 534 | public function fetch_directory() |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 535 | { |
| 536 | return $this->directory; |
| 537 | } |
| 538 | |
| 539 | } |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 540 | |
| 541 | /* End of file Router.php */ |
Andrey Andreev | 7b53d04 | 2012-03-26 23:02:32 +0300 | [diff] [blame] | 542 | /* Location: ./system/core/Router.php */ |