PluginProbe
Defender Security – Malware Scanner, Login Security & Firewall / trunk
Defender Security – Malware Scanner, Login Security & Firewall vtrunk
6.2.3 6.2.4 6.2.0 6.2.1 6.2.2 6.1.0 5.3.1 5.4.0 5.4.1 5.5.0 5.5.1 5.6.0 5.6.1 5.6.2 5.7.0 5.7.1 5.7.2 5.8.0 5.8.1 5.9.0 6.0.0 6.0.1 3.0.1 3.1.0 3.1.1 All 140 releases
defender-security / framework / component / class-response.php

class-response.php in Defender Security – Malware Scanner, Login Security & Firewall trunk, at framework/component/class-response.php

32 lines 962 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Response class
4 *
5 * @package Calotes\Component
6 */
7
8 namespace Calotes\Component;
9
10 /**
11 * Responsible for managing response data.
12 */
13 class Response {
14
15 /**
16 * We will need to have a standard of returning data, frontend will base on the return for handling behavior
17 * Behaviors:
18 * - message: Show a floating notice using this param as content
19 * - redirect: Redirect to the URL
20 * - interval: As second, if this is set, then we will reload the page in period of time, if we have this with
21 * redirect, then, redirect to the URL after period of time Data:
22 * - data: Contains the data that return to frontend, can be empty
23 * Response constructor.
24 *
25 * @param boolean $is_success Indicates if the response is a success or not.
26 * @param mixed $data The data to be sent in the response.
27 */
28 public function __construct( $is_success, $data ) {
29 $is_success ? wp_send_json_success( $data ) : wp_send_json_error( $data );
30 }
31 }
32