File tree Expand file tree Collapse file tree 1 file changed +2
-15
lines changed
Expand file tree Collapse file tree 1 file changed +2
-15
lines changed Original file line number Diff line number Diff line change @@ -798,25 +798,12 @@ protected function _detect_output_format()
798798
799799 // Check if a file extension is used when no get arguments provided
800800 $ matches = [];
801- if (!$ this ->_get_args && preg_match ($ pattern , $ this ->uri ->uri_string (), $ matches ))
801+ // Check if a file extension is used e.g. http://example.com/api/index.json?param1=param2
802+ if (preg_match ($ pattern , $ this ->uri ->uri_string (), $ matches ))
802803 {
803804 return $ matches [1 ];
804805 }
805806
806- // Check if a file extension is used
807- elseif ($ this ->_get_args && is_array (end ($ this ->_get_args )) === FALSE && preg_match ($ pattern , end ($ this ->_get_args ), $ matches ))
808- {
809- // The key of the last argument
810- $ arg_keys = array_keys ($ this ->_get_args );
811- $ last_key = end ($ arg_keys );
812-
813- // Remove the extension from arguments too
814- $ this ->_get_args [$ last_key ] = preg_replace ($ pattern , '' , $ this ->_get_args [$ last_key ]);
815- $ this ->_args [$ last_key ] = preg_replace ($ pattern , '' , $ this ->_args [$ last_key ]);
816-
817- return $ matches [1 ];
818- }
819-
820807 // Get the format
821808 $ format = isset ($ this ->_get_args ['format ' ]) ? strtolower ($ this ->_get_args ['format ' ]) : NULL ;
822809
You can’t perform that action at this time.
0 commit comments