| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Response object all non-error REST API requests should return |
| 5 |
* |
| 6 |
* @package Caldera_Forms Modified by QuantumCloud |
| 7 |
* @author Josh Pollock <Josh@CalderaWP.com> |
| 8 |
* @license GPL-2.0+ |
| 9 |
* @link |
| 10 |
* @copyright 2016 CalderaWP LLC |
| 11 |
*/ |
| 12 |
class Qcformbuilder_Forms_API_Response extends \WP_REST_Response { |
| 13 |
|
| 14 |
/** |
| 15 |
* @inheritdoc |
| 16 |
* |
| 17 |
* @since 1.4.4 |
| 18 |
*/ |
| 19 |
public function __construct( $data = null, $status = 200, $headers = array() ) { |
| 20 |
parent::__construct( $data, $status, $headers ); |
| 21 |
if ( empty( $data ) ) { |
| 22 |
$this->set_status( 404 ); |
| 23 |
} |
| 24 |
|
| 25 |
} |
| 26 |
|
| 27 |
public function set_total_header( $total ){ |
| 28 |
$this->header( 'X-CF-API-TOTAL', (int) $total ); |
| 29 |
} |
| 30 |
|
| 31 |
public function set_total_pages_header( $total_pages ){ |
| 32 |
$this->header( 'X-CF-API-TOTAL-PAGES', (int) $total_pages ); |
| 33 |
} |
| 34 |
|
| 35 |
|
| 36 |
} |