PluginProbe
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress / 10.11.1
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress v10.11.1
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 / brevo / plugin.php

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

74 lines 3.0 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 plgAcymBrevo extends AcymPlugin
6 {
7 const SENDING_METHOD_ID = 'brevo-smtp';
8 const SENDING_METHOD_NAME = 'Brevo';
9 const SENDING_METHOD_HOST = 'smtp-relay.brevo.com';
10
11 public function __construct()
12 {
13 parent::__construct();
14 $this->pluginDescription->name = self::SENDING_METHOD_NAME;
15 }
16
17 public function onAcymGetSendingMethods(&$data, $isMailer = false)
18 {
19 $data['sendingMethods'][self::SENDING_METHOD_ID] = [
20 'name' => $this->pluginDescription->name,
21 'image' => ACYM_IMAGES.'mailers/brevo.png',
22 'image_class' => '',
23 ];
24 }
25
26 public function onAcymGetSendingMethodsHtmlSetting(&$data)
27 {
28 ob_start();
29 ?>
30 <div class="send_settings cell grid-x acym_vcenter" id="<?php echo self::SENDING_METHOD_ID; ?>_settings">
31 <div class="cell grid-x acym_vcenter acym__sending__methods__one__settings">
32 <div class="cell grid-x acym_vcenter acym__sending__methods__one__settings">
33 <label for="brevo_identifier" class="cell shrink margin-right-1">
34 <?php echo acym_translation('ACYM_BREVO_LOGIN'); ?>
35 </label>
36 <?php echo $this->getLinks(
37 'https://get.brevo.com/hbvmwg6onvve'
38 ); ?>
39 <div class="margin-left-1 cell grid-x acym-grid-margin-x shrink acym_vcenter">
40 <p class="cell shrink"><?php echo acym_translation('ACYM_ALREADY_HAVE_AN_ACCOUNT'); ?></p>
41 <a target="_blank" class="cell shrink" href="https://app.brevo.com/settings/keys/smtp"><?php echo strtolower(acym_translation('ACYM_HERE')); ?></a>
42 </div>
43 <input id="brevo_identifier"
44 class="cell"
45 type="text"
46 name="config[brevo_identifier]"
47 value="<?php echo acym_escape($this->config->get('brevo_identifier', '')); ?>">
48 </div>
49 <div class="cell grid-x acym_vcenter acym__sending__methods__one__settings">
50 <label for="brevo_smtp_key" class="cell"><?php echo acym_translation('ACYM_BREVO_SMTP_KEY'); ?></label>
51 <input id="brevo_smtp_key"
52 class="cell"
53 type="text"
54 name="config[brevo_smtp_key]"
55 value="<?php echo acym_escape($this->config->get('brevo_smtp_key')); ?>">
56 </div>
57 </div>
58 </div>
59 <?php
60 $data['sendingMethodsHtmlSettings'][self::SENDING_METHOD_ID] = ob_get_clean();
61 }
62
63 public function onAcymGetCredentialsSendingMethod(array &$credentials, string $sendingMethod, array $sendingMethodListParams = [])
64 {
65 if ($sendingMethod != self::SENDING_METHOD_ID) return;
66
67 $credentials = [
68 self::SENDING_METHOD_ID.'_host' => self::SENDING_METHOD_HOST,
69 self::SENDING_METHOD_ID.'_username' => $sendingMethodListParams['brevo_identifier'] ?? $this->config->get('brevo_identifier', ''),
70 self::SENDING_METHOD_ID.'_password' => $sendingMethodListParams['brevo_smtp_key'] ?? $this->config->get('brevo_smtp_key', ''),
71 ];
72 }
73 }
74