@@ -7,15 +7,15 @@ class REST_Controller extends CI_Controller {
77 protected $ request = NULL ; // Stores accept, language, body, headers, etc
88 protected $ response = NULL ; // What is gonna happen in output?
99 protected $ rest = NULL ; // Stores DB, keys, key level, etc
10- private $ _get_args = array ();
11- private $ _post_args = array ();
12- private $ _put_args = array ();
13- private $ _delete_args = array ();
14- private $ _args = array ();
15- private $ _allow = TRUE ;
10+ protected $ _get_args = array ();
11+ protected $ _post_args = array ();
12+ protected $ _put_args = array ();
13+ protected $ _delete_args = array ();
14+ protected $ _args = array ();
15+ protected $ _allow = TRUE ;
1616
1717 // List all supported methods, the first will be the default format
18- private $ _supported_formats = array (
18+ protected $ _supported_formats = array (
1919 'xml ' => 'application/xml ' ,
2020 'rawxml ' => 'application/xml ' ,
2121 'json ' => 'application/json ' ,
@@ -262,7 +262,7 @@ public function response($data = array(), $http_code = null)
262262 *
263263 * Detect which format the HTTP Body is provided in
264264 */
265- private function _detect_input_format ()
265+ protected function _detect_input_format ()
266266 {
267267 if ($ this ->input ->server ('CONTENT_TYPE ' ))
268268 {
@@ -289,7 +289,7 @@ private function _detect_input_format()
289289 *
290290 * Detect which format should be used to output the data
291291 */
292- private function _detect_output_format ()
292+ protected function _detect_output_format ()
293293 {
294294 $ pattern = '/\.( ' . implode ('| ' , array_keys ($ this ->_supported_formats )) . ')$/ ' ;
295295
@@ -369,7 +369,7 @@ private function _detect_output_format()
369369 * Detect which method (POST, PUT, GET, DELETE) is being used
370370 */
371371
372- private function _detect_method ()
372+ protected function _detect_method ()
373373 {
374374 $ method = strtolower ($ this ->input ->server ('REQUEST_METHOD ' ));
375375
@@ -392,7 +392,7 @@ private function _detect_method()
392392 * See if the user has provided an API key
393393 */
394394
395- private function _detect_api_key ()
395+ protected function _detect_api_key ()
396396 {
397397 // Work out the name of the SERVER entry based on config
398398 $ key_name = 'HTTP_ ' . strtoupper (str_replace ('- ' , '_ ' , config_item ('rest_key_name ' )));
@@ -427,7 +427,7 @@ private function _detect_api_key()
427427 * What language do they want it in?
428428 */
429429
430- private function _detect_lang ()
430+ protected function _detect_lang ()
431431 {
432432 if ( ! $ lang = $ this ->input ->server ('HTTP_ACCEPT_LANGUAGE ' ))
433433 {
@@ -461,7 +461,7 @@ private function _detect_lang()
461461 * Record the entry for awesomeness purposes
462462 */
463463
464- private function _log_request ($ authorized = FALSE )
464+ protected function _log_request ($ authorized = FALSE )
465465 {
466466 return $ this ->rest ->db ->insert (config_item ('rest_logs_table ' ), array (
467467 'uri ' => $ this ->uri ->uri_string (),
@@ -480,7 +480,7 @@ private function _log_request($authorized = FALSE)
480480 * Record the entry for awesomeness purposes
481481 */
482482
483- private function _check_limit ($ controller_method )
483+ protected function _check_limit ($ controller_method )
484484 {
485485 // They are special, or it might not even have a limit
486486 if (!empty ($ this ->rest ->ignore_limits ) OR !isset ($ this ->methods [$ controller_method ]['limit ' ]))
@@ -535,7 +535,7 @@ private function _check_limit($controller_method)
535535 * Check if there is a specific auth type set for the current class/method being called
536536 */
537537
538- private function _auth_override_check ()
538+ protected function _auth_override_check ()
539539 {
540540
541541 // Assign the class/method auth type override array from the config
@@ -620,7 +620,7 @@ public function delete($key = NULL, $xss_clean = TRUE)
620620 return array_key_exists ($ key , $ this ->_delete_args ) ? $ this ->_xss_clean ($ this ->_delete_args [$ key ], $ xss_clean ) : FALSE ;
621621 }
622622
623- private function _xss_clean ($ val , $ bool )
623+ protected function _xss_clean ($ val , $ bool )
624624 {
625625 if (CI_VERSION < 2 )
626626 {
@@ -641,7 +641,7 @@ public function validation_errors()
641641
642642 // SECURITY FUNCTIONS ---------------------------------------------------------
643643
644- private function _check_login ($ username = '' , $ password = NULL )
644+ protected function _check_login ($ username = '' , $ password = NULL )
645645 {
646646 if (empty ($ username ))
647647 {
@@ -664,7 +664,7 @@ private function _check_login($username = '', $password = NULL)
664664 return TRUE ;
665665 }
666666
667- private function _prepare_basic_auth ()
667+ protected function _prepare_basic_auth ()
668668 {
669669 $ username = NULL ;
670670 $ password = NULL ;
@@ -691,7 +691,7 @@ private function _prepare_basic_auth()
691691 }
692692 }
693693
694- private function _prepare_digest_auth ()
694+ protected function _prepare_digest_auth ()
695695 {
696696 $ uniqid = uniqid ("" ); // Empty argument for backward compatibility
697697 // We need to test which server authentication variable to use
@@ -742,7 +742,7 @@ private function _prepare_digest_auth()
742742 }
743743 }
744744
745- private function _force_login ($ nonce = '' )
745+ protected function _force_login ($ nonce = '' )
746746 {
747747 if ($ this ->config ->item ('rest_auth ' ) == 'basic ' )
748748 {
@@ -757,7 +757,7 @@ private function _force_login($nonce = '')
757757 }
758758
759759 // Force it into an array
760- private function _force_loopable ($ data )
760+ protected function _force_loopable ($ data )
761761 {
762762 // Force it to be something useful
763763 if ( ! is_array ($ data ) AND ! is_object ($ data ))
@@ -773,7 +773,7 @@ private function _force_loopable($data)
773773 // Many of these have been moved to the Format class for better separation, but these methods will be checked too
774774
775775 // Encode as JSONP
776- private function _format_jsonp ($ data = array ())
776+ protected function _format_jsonp ($ data = array ())
777777 {
778778 return $ this ->get ('callback ' ) . '( ' . json_encode ($ data ) . ') ' ;
779779 }
0 commit comments