PluginProbe
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress / 10.2.2
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress v10.2.2
11.1.1 11.1.0 11.0.5 11.0.4 11.0.3 11.0.2 11.0.1 11.0.0 10.11.1 10.11.0 10.10.2 10.10.1 10.10.0 10.9.1 trunk 10.0.0 10.0.1 10.1.0 10.1.1 10.1.2 10.1.3 10.1.4 10.2.0 10.2.1 10.2.2 All 62 releases
acymailing / back / dynamics / sendinblue / sendinblue.php

sendinblue.php in AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress 10.2.2, at back/dynamics/sendinblue/sendinblue.php

46 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 use AcyMailing\Core\AcymPlugin;
4
5 class SendinblueClass extends AcymPlugin
6 {
7 protected $headers;
8 public $plugin;
9
10 public function __construct(&$plugin, $headers = null)
11 {
12 parent::__construct();
13 $this->plugin = &$plugin;
14 $this->headers = $headers;
15 }
16
17 protected function callApiSendingMethod($url, $data = [], $headers = [], $type = 'GET', $authentication = [], $dataDecoded = false)
18 {
19 $response = parent::callApiSendingMethod(plgAcymSendinblue::SENDING_METHOD_API_URL.$url, $data, $headers, $type, $authentication, $dataDecoded);
20
21 $backtrace = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, 2);
22 if (!empty($response['error_curl'])) {
23 if (!$backtrace[0]['file'] && !empty($backtrace[1]['function'])) {
24 $this->plugin->errors[] = $backtrace[0]['file'].': '.$backtrace[1]['function'];
25 }
26 acym_logError('Error calling the URL '.$url.': '.$response['error_curl'], 'sendinblue');
27 $this->plugin->errors[] = $response['error_curl'];
28 } elseif (!empty($response['message'])) {
29 acym_logError('Error calling the URL '.$url.': '.$response['message'], 'sendinblue');
30
31 if (strpos($response['message'], 'Contact already in list') === false) {
32 if (!$backtrace[0]['file'] && !empty($backtrace[1]['function'])) {
33 $this->plugin->errors[] = $backtrace[0]['file'].': '.$backtrace[1]['function'];
34 }
35 $this->plugin->errors[] = $response['message'];
36 }
37
38 if (strpos($response['message'], 'Your account is under validation.') !== false) {
39 $this->config->save(['sendinblue_validation' => 1]);
40 }
41 }
42
43 return $response;
44 }
45 }
46