| @@ -1,85 +1,0 @@ | ||
| 1 | -<?php | |
| 2 | - | |
| 3 | -use AcyMailing\Core\AcymPlugin; | |
| 4 | - | |
| 5 | -class plgAcymAmazon extends AcymPlugin | |
| 6 | -{ | |
| 7 | - const SENDING_METHOD_ID = 'amazon'; | |
| 8 | - const SENDING_METHOD_NAME = 'Amazon SES'; | |
| 9 | - const SENDING_METHOD_HOST = 'email-smtp.us-east-2.amazonaws.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/amazon.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="amazon_host" class="cell shrink"> | |
| 34 | - <?php | |
| 35 | - echo acym_translation('ACYM_AMAZON_SES_SERVER'); | |
| 36 | - echo acym_info( | |
| 37 | - [ | |
| 38 | - 'textShownInTooltip' => acym_translation('ACYM_AMAZON_SES_SERVER_DESC'), | |
| 39 | - ] | |
| 40 | - ); | |
| 41 | - ?> | |
| 42 | - </label> | |
| 43 | - <?php echo $this->getLinks( | |
| 44 | - 'https://signin.aws.amazon.com/signin?redirect_uri=https%3A%2F%2Fportal.aws.amazon.com%2Fbilling%2Fsignup%2Fresume&client_id=signup', | |
| 45 | - 'https://aws.amazon.com/en/ses/pricing/' | |
| 46 | - ); ?> | |
| 47 | - <input id="amazon_host" | |
| 48 | - class="cell" | |
| 49 | - type="text" | |
| 50 | - name="config[amazon_host]" | |
| 51 | - value="<?php echo acym_escape($this->config->get('amazon_host', self::SENDING_METHOD_HOST)); ?>"> | |
| 52 | - </div> | |
| 53 | - <div class="cell grid-x acym_vcenter acym__sending__methods__one__settings"> | |
| 54 | - <label for="amazon_username" class="cell"><?php echo acym_translation('ACYM_AMAZON_SES_USERNAME'); ?></label> | |
| 55 | - <input id="amazon_username" | |
| 56 | - class="cell" | |
| 57 | - type="text" | |
| 58 | - name="config[amazon_username]" | |
| 59 | - value="<?php echo acym_escape($this->config->get('amazon_username')); ?>"> | |
| 60 | - </div> | |
| 61 | - <div class="cell grid-x acym_vcenter acym__sending__methods__one__settings"> | |
| 62 | - <label for="amazon_password" class="cell"><?php echo acym_translation('ACYM_AMAZON_SES_PASSWORD'); ?></label> | |
| 63 | - <input id="amazon_password" | |
| 64 | - class="cell" | |
| 65 | - type="text" | |
| 66 | - name="config[amazon_password]" | |
| 67 | - value="<?php echo str_repeat('*', strlen($this->config->get('amazon_password'))); ?>"> | |
| 68 | - </div> | |
| 69 | - </div> | |
| 70 | - </div> | |
| 71 | - <?php | |
| 72 | - $data['sendingMethodsHtmlSettings'][self::SENDING_METHOD_ID] = ob_get_clean(); | |
| 73 | - } | |
| 74 | - | |
| 75 | - public function onAcymGetCredentialsSendingMethod(array &$credentials, string $sendingMethod, array $sendingMethodListParams = []) | |
| 76 | - { | |
| 77 | - if ($sendingMethod != self::SENDING_METHOD_ID) return; | |
| 78 | - | |
| 79 | - $credentials = [ | |
| 80 | - self::SENDING_METHOD_ID.'_host' => $sendingMethodListParams[self::SENDING_METHOD_ID.'_host'] ?? $this->config->get(self::SENDING_METHOD_ID.'_host', ''), | |
| 81 | - self::SENDING_METHOD_ID.'_username' => $sendingMethodListParams[self::SENDING_METHOD_ID.'_username'] ?? $this->config->get(self::SENDING_METHOD_ID.'_username', ''), | |
| 82 | - self::SENDING_METHOD_ID.'_password' => $sendingMethodListParams[self::SENDING_METHOD_ID.'_password'] ?? $this->config->get(self::SENDING_METHOD_ID.'_password', ''), | |
| 83 | - ]; | |
| 84 | - } | |
| 85 | -} | |