| @@ -7,9 +7,8 @@ | ||
| 7 | 7 | |
| 8 | 8 | namespace Calotes\Component; |
| 9 | 9 | |
| 10 | 10 | use Calotes\Base\Model; |
| 11 | -use Calotes\Helper\HTTP; | |
| 12 | 11 | |
| 13 | 12 | /** |
| 14 | 13 | * Parse and validate request data. |
| 15 | 14 | */ |
| @@ -26,11 +25,15 @@ | ||
| 26 | 25 | * Constructor to initialize the object with data from the POST or GET request. |
| 27 | 26 | */ |
| 28 | 27 | public function __construct() { |
| 29 | 28 | if ( 'POST' === defender_get_data_from_request( 'REQUEST_METHOD', 's' ) ) { |
| 30 | - $this->data = HTTP::post( 'data', '' ); | |
| 29 | + $this->data = defender_get_data_from_request( 'data', 'p' ); | |
| 31 | 30 | } else { |
| 32 | - $this->data = HTTP::get( 'data', '' ); | |
| 31 | + $this->data = defender_get_data_from_request( 'data', 'g' ); | |
| 32 | + } | |
| 33 | + // defender_get_data_from_request( 'data', … ) JSON-decodes; empty/malformed yields null. Central assigns get_data() to $_POST — must stay array (PHP 8+). | |
| 34 | + if ( ! is_array( $this->data ) ) { | |
| 35 | + $this->data = array(); | |
| 33 | 36 | } |
| 34 | 37 | } |
| 35 | 38 | |
| 36 | 39 | /** |