PluginProbe
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress / 11.0.2
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress v11.0.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 11.0.2, at back/dynamics/sendinblue/sendinblue.php

74 lines 2.4 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 array $headers;
8 public plgAcymSendinblue $plugin;
9
10 public function __construct(&$plugin, $headers = [])
11 {
12 parent::__construct();
13 $this->plugin = &$plugin;
14 $this->headers = $headers;
15 }
16
17 protected function callApiSendingMethod(
18 string $url,
19 array $data = [],
20 array $headers = [],
21 string $type = 'GET',
22 array $authentication = [],
23 bool $dataDecoded = false,
24 array $files = []
25 ): array {
26 $response = parent::callApiSendingMethod(plgAcymSendinblue::SENDING_METHOD_API_URL.$url, $data, $headers, $type, $authentication, $dataDecoded, $files);
27
28 if (!empty($response['error_curl'])) {
29 acym_logError('Error calling the URL '.$url.': '.$response['error_curl'], 'sendinblue');
30 $this->plugin->errors[] = $response['error_curl'];
31 } elseif (!empty($response['message'])) {
32 acym_logError('Error calling the URL '.$url.': '.$response['message'], 'sendinblue');
33
34 if (strpos($response['message'], 'Contact already in list') === false) {
35 $this->plugin->errors[] = $response['message'];
36 }
37
38 if (strpos($response['message'], 'Your account is under validation.') !== false) {
39 $this->config->saveConfig(['sendinblue_validation' => 1]);
40 }
41 /*
42 * Any API call
43 * code: unauthorized
44 * message: Key not found
45 *
46 * User creation
47 * code: invalid_parameter
48 * message: Invalid email address
49 *
50 * User delete
51 * code: document_not_found
52 * message: Contact does not exist
53 *
54 * create attribute
55 * code: invalid_parameter
56 * message: Attribute name must be unique
57 *
58 * Add user to list
59 * code: invalid_parameter
60 * message: Contact already in list and/or does not exist
61 *
62 * Create list
63 * code: document_not_found
64 * message: Folder ID does not exist
65 *
66 * Campaign creation
67 * message: Your account is under validation. You can not create another campaign.
68 */
69 }
70
71 return $response;
72 }
73 }
74