Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class MY_Router extends CI_Router {
- public $suffix = 'Action';
- public function __construct($routing = NULL) {
- parent::__construct();
- log_message('info', 'MY _ Router Class Initialized');
- }
- /**
- * Set method name
- * Change 'method-name' to 'methodNameAction'
- *
- * @param string $method Method name
- * @return void
- */
- public function set_method($method)
- {
- $method_parts = explode('-', $method);
- if(count($method_parts) >= 2) {
- $build_name = '';
- for($i = 0; $i < count($method_parts); $i++) {
- if($i > 0){
- $build_name .= ucfirst($method_parts[$i]);
- } else {
- $build_name .= $method_parts[$i];
- }
- }
- } else {
- $build_name = $method;
- }
- $build_name = $build_name.$this->suffix;
- $this->method = isset($build_name) ? $build_name : $method;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment