summaryrefslogtreecommitdiffstats
path: root/system/core
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2013-04-04 15:53:21 +0200
committerAndrey Andreev <narf@bofh.bg>2013-04-04 15:53:21 +0200
commit0e4237f8fb01320fb7cc87b1fb93a552630505d6 (patch)
treee3e460b3ba37bc73a52cb49ee0a7ed88fb6ef350 /system/core
parent1ccaaaeb27d368e6bef5112aa00059eef1635c09 (diff)
Fix #2380 and deprecate CI_Router::fetch_*() methods
Diffstat (limited to 'system/core')
-rw-r--r--system/core/CodeIgniter.php8
-rw-r--r--system/core/Router.php17
2 files changed, 14 insertions, 11 deletions
diff --git a/system/core/CodeIgniter.php b/system/core/CodeIgniter.php
index 7f76977b5..3fe5c0648 100644
--- a/system/core/CodeIgniter.php
+++ b/system/core/CodeIgniter.php
@@ -241,12 +241,12 @@ defined('BASEPATH') OR exit('No direct script access allowed');
// Load the local application controller
// Note: The Router class automatically validates the controller path using the router->_validate_request().
// If this include fails it means that the default controller in the Routes.php file is not resolving to something valid.
- if ( ! file_exists(APPPATH.'controllers/'.$RTR->fetch_directory().$RTR->fetch_class().'.php'))
+ if ( ! file_exists(APPPATH.'controllers/'.$RTR->directory.$RTR->class.'.php'))
{
show_error('Unable to load your default controller. Please make sure the controller specified in your Routes.php file is valid.');
}
- include(APPPATH.'controllers/'.$RTR->fetch_directory().$RTR->fetch_class().'.php');
+ include(APPPATH.'controllers/'.$RTR->directory.$RTR->class.'.php');
// Set a mark point for benchmarking
$BM->mark('loading_time:_base_classes_end');
@@ -260,8 +260,8 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* loader class can be called via the URI, nor can
* controller functions that begin with an underscore.
*/
- $class = $RTR->fetch_class();
- $method = $RTR->fetch_method();
+ $class = $RTR->class;
+ $method = $RTR->method;
if ( ! class_exists($class, FALSE) OR $method[0] === '_' OR method_exists('CI_Controller', $method))
{
diff --git a/system/core/Router.php b/system/core/Router.php
index bb0ce16bd..c86ab9c20 100644
--- a/system/core/Router.php
+++ b/system/core/Router.php
@@ -119,16 +119,16 @@ class CI_Router {
if (isset($_GET[$this->config->item('directory_trigger')]) && is_string($_GET[$this->config->item('directory_trigger')]))
{
$this->set_directory(trim($this->uri->_filter_uri($_GET[$this->config->item('directory_trigger')])));
- $segments[] = $this->fetch_directory();
+ $segments[] = $this->directory;
}
$this->set_class(trim($this->uri->_filter_uri($_GET[$this->config->item('controller_trigger')])));
- $segments[] = $this->fetch_class();
+ $segments[] = $this->class;
if ( ! empty($_GET[$this->config->item('function_trigger')]) && is_string($_GET[$this->config->item('function_trigger')]))
{
$this->set_method(trim($this->uri->_filter_uri($_GET[$this->config->item('function_trigger')])));
- $segments[] = $this->fetch_method();
+ $segments[] = $this->method;
}
}
@@ -270,7 +270,7 @@ class CI_Router {
empty($segments[1]) OR $segments[1] = str_replace('-', '_', $segments[1]);
// Does the requested controller exist in the sub-folder?
- if ( ! file_exists(APPPATH.'controllers/'.$this->fetch_directory().$segments[0].'.php'))
+ if ( ! file_exists(APPPATH.'controllers/'.$this->directory.$segments[0].'.php'))
{
if ( ! empty($this->routes['404_override']))
{
@@ -279,7 +279,7 @@ class CI_Router {
}
else
{
- show_404($this->fetch_directory().$segments[0]);
+ show_404($this->directory.$segments[0]);
}
}
}
@@ -287,7 +287,7 @@ class CI_Router {
{
// Is the method being specified in the route?
$segments = explode('/', $this->default_controller);
- if ( ! file_exists(APPPATH.'controllers/'.$this->fetch_directory().$segments[0].'.php'))
+ if ( ! file_exists(APPPATH.'controllers/'.$this->directory.$segments[0].'.php'))
{
$this->directory = '';
}
@@ -413,6 +413,7 @@ class CI_Router {
/**
* Fetch the current class
*
+ * @deprecated 3.0.0 Read the 'class' property instead
* @return string
*/
public function fetch_class()
@@ -438,11 +439,12 @@ class CI_Router {
/**
* Fetch the current method
*
+ * @deprecated 3.0.0 Read the 'method' property instead
* @return string
*/
public function fetch_method()
{
- return ($this->method === $this->fetch_class()) ? 'index' : $this->method;
+ return $this->method;
}
// --------------------------------------------------------------------
@@ -466,6 +468,7 @@ class CI_Router {
* Feches the sub-directory (if any) that contains the requested
* controller class.
*
+ * @deprecated 3.0.0 Read the 'directory' property instead
* @return string
*/
public function fetch_directory()