Admin
2 weeks ago
Builder
2 weeks ago
Helpers
2 weeks ago
Integrations
2 weeks ago
CFF_Autolink.php
2 weeks ago
CFF_Blocks.php
2 weeks ago
CFF_Cache.php
2 weeks ago
CFF_Education.php
2 weeks ago
CFF_Elementor_Base.php
2 weeks ago
CFF_Elementor_Widget.php
2 weeks ago
CFF_Error_Reporter.php
2 weeks ago
CFF_FB_Settings.php
2 weeks ago
CFF_Feed_Elementor_Control.php
2 weeks ago
CFF_Feed_Locator.php
2 weeks ago
CFF_Feed_Pro.php
2 weeks ago
CFF_GDPR_Integrations.php
2 weeks ago
CFF_Group_Posts.php
2 weeks ago
CFF_HTTP_Request.php
2 weeks ago
CFF_Oembed.php
2 weeks ago
CFF_Parse.php
2 weeks ago
CFF_Resizer.php
2 weeks ago
CFF_Response.php
2 weeks ago
CFF_Shortcode.php
2 weeks ago
CFF_Shortcode_Display.php
2 weeks ago
CFF_SiteHealth.php
2 weeks ago
CFF_Utils.php
2 weeks ago
CFF_View.php
2 weeks ago
Custom_Facebook_Feed.php
2 weeks ago
Email_Notification.php
2 weeks ago
Platform_Data.php
2 weeks ago
SB_Facebook_Data_Encryption.php
2 weeks ago
SB_Facebook_Data_Manager.php
2 weeks ago
index.php
2 weeks ago
CFF_Response.php
52 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * Class CFF_Response |
| 5 | * |
| 6 | * Sends back ajax response to client end |
| 7 | * |
| 8 | * @since 4.0 |
| 9 | */ |
| 10 | |
| 11 | namespace CustomFacebookFeed; |
| 12 | |
| 13 | if (! defined('ABSPATH')) { |
| 14 | exit; // Exit if accessed directly |
| 15 | } |
| 16 | |
| 17 | class CFF_Response |
| 18 | { |
| 19 | /** |
| 20 | * @var boolean |
| 21 | */ |
| 22 | private $is_success; |
| 23 | |
| 24 | /** |
| 25 | * @var array |
| 26 | */ |
| 27 | private $data; |
| 28 | /** |
| 29 | * Response constructor. |
| 30 | * |
| 31 | * @param $is_success |
| 32 | * @param $data |
| 33 | * |
| 34 | * @throws \Exception |
| 35 | */ |
| 36 | public function __construct($is_success, $data) |
| 37 | { |
| 38 | $this->is_success = $is_success; |
| 39 | $this->data = $data; |
| 40 | } |
| 41 | |
| 42 | /** |
| 43 | * Send JSON response |
| 44 | */ |
| 45 | public function send() |
| 46 | { |
| 47 | if ($this->is_success) { |
| 48 | wp_send_json_success($this->data); |
| 49 | } |
| 50 | } |
| 51 | } |
| 52 |