PluginProbe
Force Refresh / 3.2.1
Force Refresh v3.2.1
3.2.1 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 All 54 releases
← All changes | includes/api/api.php +12 -26 2.1.43.2.1 View file →
@@ -2,34 +2,20 @@
2 2 /**
3 3 * Our API calls responsible for handling requests from website visitors.
4 4 *
5 5 * @package ForceRefresh
6 - * @subpackage ApiCalls
7 6 */
8 7
8 +namespace JordanLeven\Plugins\ForceRefresh\Api;
9 +
9 10 /**
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 -}
11 +* Custom intervals must be at least 30 seconds.
12 +*/
13 +define( 'REFRESH_INTERVAL_CUSTOM_MINIMUM_IN_SECONDS', 30 );
31 14
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';
15 +/**
16 +* Custom intervals must be, at max, four hours.
17 +*/
18 +define( 'REFRESH_INTERVAL_CUSTOM_MAXIMUM_IN_SECONDS', 4 * 3600 );
19 +
20 +// Our admin API handlers.
21 +require_once __DIR__ . '/register-endpoints.php';