@@ -189,7 +189,7 @@ public static function baseUrl()
189189 /**
190190 * Prevent Cross-Site Request Forgery (CSRF)
191191 * Create a per request token to handle CSRF using sessions
192- * Basic::firewall () should be executed. $verify_csrf_token = TRUE (default)
192+ * Basic::setFirewall () should be executed. $verify_csrf_token = TRUE (default)
193193 */
194194
195195 public static function csrfToken ()
@@ -211,7 +211,7 @@ public static function encrypt($plaintext)
211211 {
212212 // Require encryption middleware
213213 if (! defined ('PASS_PHRASE ' ) || ! defined ('CIPHER_METHOD ' )) {
214- self ::apiResponse (501 , 'Please activate Basic::encryption () middleware and set the pass phrase. ' );
214+ self ::apiResponse (501 , 'Please activate Basic::setEncryption () middleware and set the pass phrase. ' );
215215 }
216216
217217 // Encryption - Version 1
@@ -261,7 +261,7 @@ public static function decrypt($encrypted)
261261 {
262262 // Require encryption middleware
263263 if (! defined ('PASS_PHRASE ' ) || ! defined ('CIPHER_METHOD ' )) {
264- self ::apiResponse (501 , 'Please activate Basic::encryption () middleware and set the pass phrase. ' );
264+ self ::apiResponse (501 , 'Please activate Basic::setEncryption () middleware and set the pass phrase. ' );
265265 }
266266
267267 // Decryption - Version 1
@@ -362,6 +362,15 @@ public static function setErrorReporting($boolean=TRUE)
362362 }
363363 }
364364
365+ /**
366+ * JSON Request Body as $_POST
367+ */
368+
369+ public static function setJsonBodyAsPOST () {
370+ $ body = file_get_contents ('php://input ' );
371+ if ( ! empty ($ body ) && is_array (json_decode ($ body , TRUE )) ) $ _POST = json_decode ($ body , TRUE );
372+ }
373+
365374 /**
366375 * Web Application Firewall
367376 *
0 commit comments