PluginProbe
Force Refresh / 2.7.0
Force Refresh v2.7.0
3.2.0 3.1.2 3.1.1 3.1.0 trunk 1.0.0 1.1.0 1.1.1 1.1.2 1.2.0 2.0.0 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.10.0 2.10.1 2.10.2 2.11.0 2.11.1 2.12.0 2.12.1 All 53 releases
force-refresh / includes / api / api.php

api.php in Force Refresh 2.7.0, at includes/api/api.php

36 lines 1018 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Our API calls responsible for handling requests from website visitors.
4 *
5 * @package ForceRefresh
6 * @subpackage ApiCalls
7 */
8
9 /**
10 * Function to reply to the client with a response.
11 *
12 * @param int $status_code The standardized HTTP status code.
13 * @param string $message The plaintext message displayed to the user
14 * that explains the status.
15 * @param array $data An array of data to sent as the response.
16 *
17 * @return void
18 */
19 function return_api_response( int $status_code, string $message, $data = array() ) {
20 status_header( $status_code );
21 print wp_json_encode(
22 array(
23 'status_code' => $status_code,
24 'status_text' => $message,
25 'success' => 200 === $status_code,
26 'data' => $data,
27 )
28 );
29 wp_die();
30 }
31
32 // All ajax calls from admins.
33 require_once __DIR__ . '/admin/admin.php';
34 // All ajax calls from clients.
35 require_once __DIR__ . '/client/client.php';
36