@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | if (ENVIRONMENT != 'production') |
| 96 | 96 | show_error('The request method '.$this->requestMethod.' is not allowed to view the resource', 403, 'Forbidden method'); |
| 97 | 97 | |
| 98 | - if(is_null(Route::get404())) |
|
| 98 | + if (is_null(Route::get404())) |
|
| 99 | 99 | show_404(); |
| 100 | 100 | |
| 101 | 101 | if (Route::get404()->controller != get_class($this->CI)) |
@@ -110,16 +110,16 @@ discard block |
||
| 110 | 110 | |
| 111 | 111 | // Redirect to 404 if not enough parameters provided |
| 112 | 112 | |
| 113 | - if(count($path_args) < count($route_args['required'])) |
|
| 113 | + if (count($path_args) < count($route_args['required'])) |
|
| 114 | 114 | redirect(Route::get404()->path); |
| 115 | 115 | |
| 116 | - if(count($path_args) == 0) |
|
| 116 | + if (count($path_args) == 0) |
|
| 117 | 117 | { |
| 118 | 118 | $this->CI->{$this->route->method}(); |
| 119 | 119 | } |
| 120 | 120 | else |
| 121 | 121 | { |
| 122 | - call_user_func_array( [$this->CI, $this->route->method], array_values($path_args) ); |
|
| 122 | + call_user_func_array([$this->CI, $this->route->method], array_values($path_args)); |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | // TODO: Add support to hooks in this execution thread |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | if (ENVIRONMENT != 'production') |
| 133 | 133 | show_error('The method '.$this->route->controller.'::'.$this->route->method.'() does not exists', 500, 'Method not found'); |
| 134 | 134 | |
| 135 | - if(is_null(Route::get404())) |
|
| 135 | + if (is_null(Route::get404())) |
|
| 136 | 136 | show_404(); |
| 137 | 137 | |
| 138 | 138 | if (Route::get404()->controller != get_class($this->CI)) |
@@ -64,20 +64,22 @@ discard block |
||
| 64 | 64 | |
| 65 | 65 | // FIXME: Solve ambiguity here! POST with _method="GET" makes no sense |
| 66 | 66 | |
| 67 | - if (isset($_POST['_method']) && in_array(strtoupper($_POST['_method']), $validMethods, TRUE)) |
|
| 68 | - $formMethod = strtoupper($_POST['_method']); |
|
| 67 | + if (isset($_POST['_method']) && in_array(strtoupper($_POST['_method']), $validMethods, TRUE)) { |
|
| 68 | + $formMethod = strtoupper($_POST['_method']); |
|
| 69 | + } |
|
| 69 | 70 | |
| 70 | 71 | if (is_null($formMethod)) |
| 71 | 72 | { |
| 72 | 73 | $this->requestMethod = $requestMethod; |
| 73 | - } |
|
| 74 | - else |
|
| 74 | + } else |
|
| 75 | 75 | { |
| 76 | - if ($requestMethod == 'POST') |
|
| 77 | - $this->requestMethod = $formMethod; |
|
| 76 | + if ($requestMethod == 'POST') { |
|
| 77 | + $this->requestMethod = $formMethod; |
|
| 78 | + } |
|
| 78 | 79 | |
| 79 | - if (!$this->CI->input->is_ajax_request() && $this->requestMethod == 'HEAD') |
|
| 80 | - $this->requestMethod = 'POST'; |
|
| 80 | + if (!$this->CI->input->is_ajax_request() && $this->requestMethod == 'HEAD') { |
|
| 81 | + $this->requestMethod = 'POST'; |
|
| 82 | + } |
|
| 81 | 83 | } |
| 82 | 84 | } |
| 83 | 85 | |
@@ -92,16 +94,18 @@ discard block |
||
| 92 | 94 | { |
| 93 | 95 | if (!$this->route) |
| 94 | 96 | { |
| 95 | - if (ENVIRONMENT != 'production') |
|
| 96 | - show_error('The request method '.$this->requestMethod.' is not allowed to view the resource', 403, 'Forbidden method'); |
|
| 97 | + if (ENVIRONMENT != 'production') { |
|
| 98 | + show_error('The request method '.$this->requestMethod.' is not allowed to view the resource', 403, 'Forbidden method'); |
|
| 99 | + } |
|
| 97 | 100 | |
| 98 | - if(is_null(Route::get404())) |
|
| 99 | - show_404(); |
|
| 101 | + if(is_null(Route::get404())) { |
|
| 102 | + show_404(); |
|
| 103 | + } |
|
| 100 | 104 | |
| 101 | - if (Route::get404()->controller != get_class($this->CI)) |
|
| 102 | - Route::trigger404(); |
|
| 103 | - } |
|
| 104 | - else |
|
| 105 | + if (Route::get404()->controller != get_class($this->CI)) { |
|
| 106 | + Route::trigger404(); |
|
| 107 | + } |
|
| 108 | + } else |
|
| 105 | 109 | { |
| 106 | 110 | if (method_exists($this->CI, $this->route->method)) |
| 107 | 111 | { |
@@ -110,14 +114,14 @@ discard block |
||
| 110 | 114 | |
| 111 | 115 | // Redirect to 404 if not enough parameters provided |
| 112 | 116 | |
| 113 | - if(count($path_args) < count($route_args['required'])) |
|
| 114 | - redirect(Route::get404()->path); |
|
| 117 | + if(count($path_args) < count($route_args['required'])) { |
|
| 118 | + redirect(Route::get404()->path); |
|
| 119 | + } |
|
| 115 | 120 | |
| 116 | 121 | if(count($path_args) == 0) |
| 117 | 122 | { |
| 118 | 123 | $this->CI->{$this->route->method}(); |
| 119 | - } |
|
| 120 | - else |
|
| 124 | + } else |
|
| 121 | 125 | { |
| 122 | 126 | call_user_func_array( [$this->CI, $this->route->method], array_values($path_args) ); |
| 123 | 127 | } |
@@ -126,17 +130,19 @@ discard block |
||
| 126 | 130 | |
| 127 | 131 | $this->CI->output->_display(); |
| 128 | 132 | exit(0); |
| 129 | - } |
|
| 130 | - else |
|
| 133 | + } else |
|
| 131 | 134 | { |
| 132 | - if (ENVIRONMENT != 'production') |
|
| 133 | - show_error('The method '.$this->route->controller.'::'.$this->route->method.'() does not exists', 500, 'Method not found'); |
|
| 135 | + if (ENVIRONMENT != 'production') { |
|
| 136 | + show_error('The method '.$this->route->controller.'::'.$this->route->method.'() does not exists', 500, 'Method not found'); |
|
| 137 | + } |
|
| 134 | 138 | |
| 135 | - if(is_null(Route::get404())) |
|
| 136 | - show_404(); |
|
| 139 | + if(is_null(Route::get404())) { |
|
| 140 | + show_404(); |
|
| 141 | + } |
|
| 137 | 142 | |
| 138 | - if (Route::get404()->controller != get_class($this->CI)) |
|
| 139 | - Route::trigger404(); |
|
| 143 | + if (Route::get404()->controller != get_class($this->CI)) { |
|
| 144 | + Route::trigger404(); |
|
| 145 | + } |
|
| 140 | 146 | } |
| 141 | 147 | } |
| 142 | 148 | } |