| @@ -26,38 +26,39 @@ | ||
| 26 | 26 | public function onAcymGetSendingMethodsHtmlSetting(&$data) |
| 27 | 27 | { |
| 28 | 28 | $config = empty($data['tab']) ? $this->config : $data['tab']->config; |
| 29 | 29 | $defaultApiKey = $config->get(self::SENDING_METHOD_ID.'_api_key'); |
| 30 | - ob_start(); | |
| 31 | 30 | ?> |
| 32 | - <div class="send_settings cell grid-x acym_vcenter" id="<?php echo self::SENDING_METHOD_ID; ?>_settings"> | |
| 31 | + <div class="send_settings cell grid-x acym_vcenter" id="<?php echo esc_attr(self::SENDING_METHOD_ID); ?>_settings"> | |
| 33 | 32 | <div class="cell grid-x acym_vcenter acym__sending__methods__one__settings"> |
| 34 | - <label class="cell shrink margin-right-1" for="<?php echo self::SENDING_METHOD_ID; ?>_settings_api-key"> | |
| 35 | - <?php echo acym_translationSprintf( | |
| 36 | - 'ACYM_SENDING_METHOD_API_KEY', | |
| 37 | - self::SENDING_METHOD_NAME | |
| 33 | + <label class="cell shrink margin-right-1" for="<?php echo esc_attr(self::SENDING_METHOD_ID); ?>_settings_api-key"> | |
| 34 | + <?php echo esc_html( | |
| 35 | + acym_translationSprintf( | |
| 36 | + 'ACYM_SENDING_METHOD_API_KEY', | |
| 37 | + self::SENDING_METHOD_NAME | |
| 38 | + ) | |
| 38 | 39 | ); ?> |
| 39 | 40 | </label> |
| 40 | - <?php echo $this->getLinks('https://account.postmarkapp.com/sign_up', 'https://postmarkapp.com/pricing'); ?> | |
| 41 | + <?php $this->getLinks('https://account.postmarkapp.com/sign_up', 'https://postmarkapp.com/pricing'); ?> | |
| 41 | 42 | <input type="text" |
| 42 | - id="<?php echo self::SENDING_METHOD_ID; ?>_settings_api-key" | |
| 43 | - value="<?php echo empty($defaultApiKey) ? $this->config->get(self::SENDING_METHOD_ID.'_api_key') : $defaultApiKey; ?>" | |
| 44 | - name="config[<?php echo self::SENDING_METHOD_ID; ?>_api_key]" | |
| 45 | - class="cell margin-next-1 acym__configuration__mail__settings__text"> | |
| 46 | - <?php echo $this->getTestCredentialsSendingMethodButton(self::SENDING_METHOD_ID); ?> | |
| 43 | + id="<?php echo esc_attr(self::SENDING_METHOD_ID); ?>_settings_api-key" | |
| 44 | + value="<?php echo esc_attr(empty($defaultApiKey) ? $this->config->get(self::SENDING_METHOD_ID.'_api_key') : $defaultApiKey); ?>" | |
| 45 | + name="config[<?php echo esc_attr(self::SENDING_METHOD_ID); ?>_api_key]" | |
| 46 | + class="cell margin-next-1 acym__configuration__mail__settings__text"> | |
| 47 | + <?php $this->getTestCredentialsSendingMethodButton(self::SENDING_METHOD_ID); ?> | |
| 47 | 48 | </div> |
| 48 | 49 | <div class="cell grid-x acym_vcenter acym__sending__methods__one__settings"> |
| 49 | 50 | <label class="cell medium-6"> |
| 50 | - <?php echo acym_translation('ACYM_POSTMARK_STREAM_ID').acym_info(['textShownInTooltip' => 'ACYM_STREAM_ID_INFO']); ?> | |
| 51 | + <?php echo esc_html(acym_translation('ACYM_POSTMARK_STREAM_ID')); | |
| 52 | + acym_info(['textShownInTooltip' => 'ACYM_STREAM_ID_INFO']); ?> | |
| 51 | 53 | <input type="text" |
| 52 | - class="cell auto" | |
| 53 | - name="config[postmark_stream_id]" | |
| 54 | - value="<?php echo acym_escape(empty($this->config->get('postmark_stream_id')) ? '' : $this->config->get('postmark_stream_id')); ?>"> | |
| 54 | + class="cell auto" | |
| 55 | + name="config[postmark_stream_id]" | |
| 56 | + value="<?php echo esc_attr(empty($this->config->get('postmark_stream_id')) ? '' : $this->config->get('postmark_stream_id')); ?>"> | |
| 55 | 57 | </label> |
| 56 | 58 | </div> |
| 57 | 59 | </div> |
| 58 | 60 | <?php |
| 59 | - $data['sendingMethodsHtmlSettings'][self::SENDING_METHOD_ID] = ob_get_clean(); | |
| 60 | 61 | } |
| 61 | 62 | |
| 62 | 63 | public function getHeadersSendingMethod($sendingMethod, $credentials = [], $sendingMethodListParams = []) |
| 63 | 64 | { |
| @@ -69,8 +70,15 @@ | ||
| 69 | 70 | 'Content-type: application/json', |
| 70 | 71 | ]; |
| 71 | 72 | } |
| 72 | 73 | |
| 74 | + /** | |
| 75 | + * @param array $credentials | |
| 76 | + * @param string $sendingMethod | |
| 77 | + * @param array $sendingMethodListParams this parameter is only used for the plugin sending method list | |
| 78 | + * | |
| 79 | + * @return void | |
| 80 | + */ | |
| 73 | 81 | public function onAcymGetCredentialsSendingMethod(array &$credentials, string $sendingMethod, array $sendingMethodListParams = []) |
| 74 | 82 | { |
| 75 | 83 | if ($sendingMethod != self::SENDING_METHOD_ID) return; |
| 76 | 84 | |
| @@ -101,8 +109,9 @@ | ||
| 101 | 109 | } |
| 102 | 110 | |
| 103 | 111 | public function onAcymSendEmail(&$response, $mailerHelper, $to, $from, $reply_to, $bcc = [], $attachments = [], $sendingMethodListParams = []) |
| 104 | 112 | { |
| 113 | + //https://postmarkapp.com/developer/api/email-api | |
| 105 | 114 | if ($mailerHelper->externalMailer !== self::SENDING_METHOD_ID) return; |
| 106 | 115 | |
| 107 | 116 | $data = [ |
| 108 | 117 | 'From' => $from['email'], |
| @@ -125,8 +134,9 @@ | ||
| 125 | 134 | } |
| 126 | 135 | $data['Attachments'] = $attachFormated; |
| 127 | 136 | } |
| 128 | 137 | |
| 138 | + // Handle the Stream ID | |
| 129 | 139 | if (!empty($mailerHelper->mailId)) { |
| 130 | 140 | $mailId = $mailerHelper->mailId; |
| 131 | 141 | if (acym_isMultilingual()) { |
| 132 | 142 | $parentId = acym_loadResult('SELECT parent_id FROM `#__acym_mail` WHERE id = '.intval($mailId)); |