Skip to content
This repository has been archived by the owner on Sep 10, 2020. It is now read-only.

Commit

Permalink
Adding the ability to have dashed methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
srtfisher committed Jan 25, 2012
1 parent b1a9362 commit a13418f
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions application/core/MY_Controller.php
Expand Up @@ -25,7 +25,7 @@ class MY_Controller extends CI_Controller
* @global object
* @access protected
**/
protected $request = NULL;
protected $method = NULL;

/**
* The Constructor
Expand All @@ -38,7 +38,7 @@ public function __construct()
parent::__construct();

// Find the method
$this->request->method = $this->_detect_method();
$this->method = $this->_detect_method();
}

/**
Expand All @@ -49,26 +49,29 @@ public function __construct()
**/
public function _remap($method, $params = array())
{
// We allow dashes in our method names
$method = str_replace('-', '_DASH_', $method);

// The Methods we are going to generate in order of priority
$methods = array(

// `action_method_get`, `action_method_post`, ..
$this->prefix.$method.'_'.$this->request->method,
$this->prefix.$method.'_'.$this->method,

// `action_method`
$this->prefix.$method,

// `method_get`, `method_post`, ..
$method.'_'.$this->request->method,
$method.'_'.$this->method,

// `action_method`
$this->prefix.$method,

// `action_four_oh_four`
$this->prefix.'four_oh_four',

// `method`
$method,

// `action_four_oh_four_get`
$this->prefix.'four_oh_four.'.$this->method,
);

// Loop though them in priority
Expand Down

0 comments on commit a13418f

Please sign in to comment.