| @@ -25,30 +25,30 @@ | ||
| 25 | 25 | public function onAcymGetSendingMethodsHtmlSetting(&$data) |
| 26 | 26 | { |
| 27 | 27 | $config = empty($data['tab']) ? $this->config : $data['tab']->config; |
| 28 | 28 | $defaultApiKey = $config->get(self::SENDING_METHOD_ID.'_api_key'); |
| 29 | - ob_start(); | |
| 30 | 29 | ?> |
| 31 | - <div class="send_settings cell grid-x acym_vcenter" id="<?php echo self::SENDING_METHOD_ID; ?>_settings"> | |
| 30 | + <div class="send_settings cell grid-x acym_vcenter" id="<?php echo esc_attr(self::SENDING_METHOD_ID); ?>_settings"> | |
| 32 | 31 | <div class="cell grid-x acym_vcenter acym__sending__methods__one__settings"> |
| 33 | - <label class="cell shrink margin-right-1" for="<?php echo self::SENDING_METHOD_ID; ?>_settings_api-key"> | |
| 34 | - <?php echo acym_translationSprintf( | |
| 35 | - 'ACYM_SENDING_METHOD_API_KEY', | |
| 36 | - self::SENDING_METHOD_NAME | |
| 32 | + <label class="cell shrink margin-right-1" for="<?php echo esc_attr(self::SENDING_METHOD_ID); ?>_settings_api-key"> | |
| 33 | + <?php echo esc_html( | |
| 34 | + acym_translationSprintf( | |
| 35 | + 'ACYM_SENDING_METHOD_API_KEY', | |
| 36 | + self::SENDING_METHOD_NAME | |
| 37 | + ) | |
| 37 | 38 | ); ?> |
| 38 | 39 | </label> |
| 39 | - <?php echo $this->getLinks('https://signup.sendgrid.com/', 'https://sendgrid.com/pricing/'); ?> | |
| 40 | + <?php $this->getLinks('https://signup.sendgrid.com/', 'https://sendgrid.com/pricing/'); ?> | |
| 40 | 41 | <input type="text" |
| 41 | - id="<?php echo self::SENDING_METHOD_ID; ?>_settings_api-key" | |
| 42 | - value="<?php echo empty($defaultApiKey) ? $this->config->get(self::SENDING_METHOD_ID.'_api_key') : $defaultApiKey; ?>" | |
| 43 | - name="config[<?php echo self::SENDING_METHOD_ID; ?>_api_key]" | |
| 44 | - class="cell margin-next-1 acym__configuration__mail__settings__text"> | |
| 45 | - <?php echo $this->getTestCredentialsSendingMethodButton(self::SENDING_METHOD_ID); ?> | |
| 46 | - <?php echo $this->getCopySettingsButton($data, self::SENDING_METHOD_ID, 'wp_mail_smtp'); ?> | |
| 42 | + id="<?php echo esc_attr(self::SENDING_METHOD_ID); ?>_settings_api-key" | |
| 43 | + value="<?php echo esc_attr(empty($defaultApiKey) ? $this->config->get(self::SENDING_METHOD_ID.'_api_key') : $defaultApiKey); ?>" | |
| 44 | + name="config[<?php echo esc_attr(self::SENDING_METHOD_ID); ?>_api_key]" | |
| 45 | + class="cell margin-next-1 acym__configuration__mail__settings__text"> | |
| 46 | + <?php $this->getTestCredentialsSendingMethodButton(self::SENDING_METHOD_ID); ?> | |
| 47 | + <?php $this->getCopySettingsButton($data, self::SENDING_METHOD_ID, 'wp_mail_smtp'); ?> | |
| 47 | 48 | </div> |
| 48 | 49 | </div> |
| 49 | 50 | <?php |
| 50 | - $data['sendingMethodsHtmlSettings'][self::SENDING_METHOD_ID] = ob_get_clean(); | |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | public function onAcymTestCredentialSendingMethod($sendingMethod, $credentials) |
| 54 | 54 | { |
| @@ -72,8 +72,9 @@ | ||
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | public function onAcymSendEmail(&$response, $mailerHelper, $to, $from, $reply_to, $bcc = [], $attachments = [], $sendingMethodListParams = []) |
| 75 | 75 | { |
| 76 | + //https://sendgrid.com/docs/API_Reference/Web_API_v3/Mail/index.html | |
| 76 | 77 | if ($mailerHelper->externalMailer !== self::SENDING_METHOD_ID) return; |
| 77 | 78 | $headers = $this->getHeadersSendingMethod(self::SENDING_METHOD_ID, [], $sendingMethodListParams); |
| 78 | 79 | $headers[] = 'Content-Type: application/json'; |
| 79 | 80 | |
| @@ -133,8 +134,15 @@ | ||
| 133 | 134 | $response['message'] = $responseMailer['errors'][0]['message']; |
| 134 | 135 | } |
| 135 | 136 | } |
| 136 | 137 | |
| 138 | + /** | |
| 139 | + * @param array $credentials | |
| 140 | + * @param string $sendingMethod | |
| 141 | + * @param array $sendingMethodListParams this parameter is only used for the plugin sending method list | |
| 142 | + * | |
| 143 | + * @return void | |
| 144 | + */ | |
| 137 | 145 | public function onAcymGetCredentialsSendingMethod(array &$credentials, string $sendingMethod, array $sendingMethodListParams = []) |
| 138 | 146 | { |
| 139 | 147 | if ($sendingMethod !== self::SENDING_METHOD_ID) return; |
| 140 | 148 | |