← All changes
|
includes/Core/Integration/ActiveCampaign/ActiveCampaignHandler.php
+14
-39
3.2.2
→
2.15.3
View file →
| @@ -6,15 +6,10 @@ | ||
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | 8 | namespace BitCode\BitForm\Core\Integration\ActiveCampaign; |
| 9 | 9 | |
| 10 | -if (!defined('ABSPATH')) { | |
| 11 | - exit; | |
| 12 | -} | |
| 13 | - | |
| 14 | 10 | use BitCode\BitForm\Core\Integration\IntegrationHandler; |
| 15 | 11 | use BitCode\BitForm\Core\Util\HttpHelper; |
| 16 | -use BitCode\BitForm\GlobalHelper; | |
| 17 | 12 | use WP_Error; |
| 18 | 13 | |
| 19 | 14 | /** |
| 20 | 15 | * Provide functionality for ZohoCrm integration |
| @@ -54,17 +49,11 @@ | ||
| 54 | 49 | * @return string Active Campaign api response and status |
| 55 | 50 | */ |
| 56 | 51 | public static function activeCampaignAuthorize() |
| 57 | 52 | { |
| 58 | - if (isset($_REQUEST['_ajax_nonce']) && wp_verify_nonce(sanitize_text_field(wp_unslash($_REQUEST['_ajax_nonce'])), 'bitforms_save')) { | |
| 59 | - GlobalHelper::requirePostMethod(); | |
| 60 | - | |
| 61 | - try { | |
| 62 | - $requestsParams = GlobalHelper::formatRequestData(); | |
| 63 | - } catch (\InvalidArgumentException $e) { | |
| 64 | - wp_send_json_error($e->getMessage(), 400); | |
| 65 | - } | |
| 66 | - | |
| 53 | + if (isset($_REQUEST['_ajax_nonce']) && wp_verify_nonce($_REQUEST['_ajax_nonce'], 'bitforms_save')) { | |
| 54 | + $inputJSON = file_get_contents('php://input'); | |
| 55 | + $requestsParams = json_decode($inputJSON); | |
| 67 | 56 | if ( |
| 68 | 57 | empty($requestsParams->api_key) |
| 69 | 58 | || empty($requestsParams->api_url) |
| 70 | 59 | ) { |
| @@ -107,15 +96,12 @@ | ||
| 107 | 96 | * @return JSON active campaign list data |
| 108 | 97 | */ |
| 109 | 98 | public static function activeCampaignLists() |
| 110 | 99 | { |
| 111 | - if (isset($_REQUEST['_ajax_nonce']) && wp_verify_nonce(sanitize_text_field(wp_unslash($_REQUEST['_ajax_nonce'])), 'bitforms_save')) { | |
| 112 | - GlobalHelper::requirePostMethod(); | |
| 113 | - try { | |
| 114 | - $queryParams = GlobalHelper::formatRequestData(); | |
| 115 | - } catch (\InvalidArgumentException $e) { | |
| 116 | - wp_send_json_error($e->getMessage(), 400); | |
| 117 | - } | |
| 100 | + if (isset($_REQUEST['_ajax_nonce']) && wp_verify_nonce($_REQUEST['_ajax_nonce'], 'bitforms_save')) { | |
| 101 | + $inputJSON = file_get_contents('php://input'); | |
| 102 | + $queryParams = json_decode($inputJSON); | |
| 103 | + | |
| 118 | 104 | if ( |
| 119 | 105 | empty($queryParams->api_key) |
| 120 | 106 | || empty($queryParams->api_url) |
| 121 | 107 | ) { |
| @@ -164,17 +150,12 @@ | ||
| 164 | 150 | * @return JSON active campaign tags data |
| 165 | 151 | */ |
| 166 | 152 | public static function activeCampaignTags() |
| 167 | 153 | { |
| 168 | - if (isset($_REQUEST['_ajax_nonce']) && wp_verify_nonce(sanitize_text_field(wp_unslash($_REQUEST['_ajax_nonce'])), 'bitforms_save')) { | |
| 169 | - GlobalHelper::requirePostMethod(); | |
| 154 | + if (isset($_REQUEST['_ajax_nonce']) && wp_verify_nonce($_REQUEST['_ajax_nonce'], 'bitforms_save')) { | |
| 155 | + $inputJSON = file_get_contents('php://input'); | |
| 156 | + $queryParams = json_decode($inputJSON); | |
| 170 | 157 | |
| 171 | - try { | |
| 172 | - $queryParams = GlobalHelper::formatRequestData(); | |
| 173 | - } catch (\InvalidArgumentException $e) { | |
| 174 | - wp_send_json_error($e->getMessage(), 400); | |
| 175 | - } | |
| 176 | - | |
| 177 | 158 | if ( |
| 178 | 159 | empty($queryParams->api_key) |
| 179 | 160 | || empty($queryParams->api_url) |
| 180 | 161 | ) { |
| @@ -224,17 +205,12 @@ | ||
| 224 | 205 | */ |
| 225 | 206 | public static function activeCampaignHeaders() |
| 226 | 207 | { |
| 227 | 208 | $authorizationHeader = null; |
| 228 | - if (isset($_REQUEST['_ajax_nonce']) && wp_verify_nonce(sanitize_text_field(wp_unslash($_REQUEST['_ajax_nonce'])), 'bitforms_save')) { | |
| 229 | - GlobalHelper::requirePostMethod(); | |
| 209 | + if (isset($_REQUEST['_ajax_nonce']) && wp_verify_nonce($_REQUEST['_ajax_nonce'], 'bitforms_save')) { | |
| 210 | + $inputJSON = file_get_contents('php://input'); | |
| 211 | + $queryParams = json_decode($inputJSON); | |
| 230 | 212 | |
| 231 | - try { | |
| 232 | - $queryParams = GlobalHelper::formatRequestData(); | |
| 233 | - } catch (\InvalidArgumentException $e) { | |
| 234 | - wp_send_json_error($e->getMessage(), 400); | |
| 235 | - } | |
| 236 | - | |
| 237 | 213 | if ( |
| 238 | 214 | empty($queryParams->api_key) |
| 239 | 215 | || empty($queryParams->api_url) |
| 240 | 216 | ) { |
| @@ -304,10 +280,9 @@ | ||
| 304 | 280 | $fieldValues, |
| 305 | 281 | $fieldMap, |
| 306 | 282 | $actions, |
| 307 | 283 | $listId, |
| 308 | - $tags, | |
| 309 | - $this->_formID | |
| 284 | + $tags | |
| 310 | 285 | ); |
| 311 | 286 | |
| 312 | 287 | if (is_wp_error($activeCampaignApiResponse)) { |
| 313 | 288 | return $activeCampaignApiResponse; |