| @@ -3,8 +3,15 @@ | ||
| 3 | 3 | use AcyMailing\Types\DelayType; |
| 4 | 4 | |
| 5 | 5 | class SendinblueCredentials extends SendinblueClass |
| 6 | 6 | { |
| 7 | + /** | |
| 8 | + * @param array $credentials | |
| 9 | + * @param string $sendingMethod | |
| 10 | + * @param array $sendingMethodListParams this parameter is only used for the plugin sending method list | |
| 11 | + * | |
| 12 | + * @return void | |
| 13 | + */ | |
| 7 | 14 | public function onAcymGetCredentialsSendingMethod(array &$credentials, string $sendingMethod, array $sendingMethodListParams = []) |
| 8 | 15 | { |
| 9 | 16 | if ($sendingMethod != plgAcymSendinblue::SENDING_METHOD_ID) return; |
| 10 | 17 | |
| @@ -41,34 +48,46 @@ | ||
| 41 | 48 | $message .= ' <a href="#" class="acym__do__not__remindme acym__do__not__remindme__info" title="sendinblue_validation">'; |
| 42 | 49 | $message .= acym_translation('ACYM_DO_NOT_REMIND_ME'); |
| 43 | 50 | $message .= '</a>'; |
| 44 | 51 | |
| 45 | - acym_enqueueMessage($message, 'info'); | |
| 52 | + $notification = [ | |
| 53 | + 'name' => 'sendinblue_validation', | |
| 54 | + 'removable' => 0, | |
| 55 | + ]; | |
| 56 | + acym_enqueueMessage($message, 'info', true, [$notification]); | |
| 57 | + } else { | |
| 58 | + acym_removeDashboardNotification('sendinblue_validation'); | |
| 46 | 59 | } |
| 47 | 60 | |
| 48 | 61 | $delayType = new DelayType(); |
| 62 | + ob_start(); | |
| 63 | + $delayType->display( | |
| 64 | + 'config['.plgAcymSendinblue::SENDING_METHOD_ID.'_clean_frequency]', | |
| 65 | + $this->config->get(plgAcymSendinblue::SENDING_METHOD_ID.'_clean_frequency', 604800), | |
| 66 | + DelayType::TYPE_WEEKS_MONTHS | |
| 67 | + ); | |
| 68 | + $delay = ob_get_clean(); | |
| 49 | 69 | $config = empty($data['tab']) ? $this->config : $data['tab']->config; |
| 50 | 70 | $defaultApiKey = $config->get(plgAcymSendinblue::SENDING_METHOD_ID.'_api_key'); |
| 51 | - ob_start(); | |
| 52 | 71 | ?> |
| 53 | - <div class="send_settings cell grid-x acym_vcenter" id="<?php echo plgAcymSendinblue::SENDING_METHOD_ID; ?>_settings"> | |
| 72 | + <div class="send_settings cell grid-x acym_vcenter" id="<?php echo esc_attr(plgAcymSendinblue::SENDING_METHOD_ID); ?>_settings"> | |
| 54 | 73 | <div class="cell grid-x acym_vcenter acym__sending__methods__one__settings"> |
| 55 | - <label class="cell shrink margin-right-1" for="<?php echo plgAcymSendinblue::SENDING_METHOD_ID; ?>_settings_api-key"> | |
| 56 | - <?php echo acym_translationSprintf('ACYM_SENDING_METHOD_API_KEY', plgAcymSendinblue::SENDING_METHOD_NAME); ?> | |
| 74 | + <label class="cell shrink margin-right-1" for="<?php echo esc_attr(plgAcymSendinblue::SENDING_METHOD_ID); ?>_settings_api-key"> | |
| 75 | + <?php echo esc_html(acym_translationSprintf('ACYM_SENDING_METHOD_API_KEY', plgAcymSendinblue::SENDING_METHOD_NAME)); ?> | |
| 57 | 76 | </label> |
| 58 | - <?php echo $this->getLinks('https://get.brevo.com/hbvmwg6onvve'); ?> | |
| 77 | + <?php $this->getLinks('https://get.brevo.com/hbvmwg6onvve'); ?> | |
| 59 | 78 | <input type="text" |
| 60 | - id="<?php echo plgAcymSendinblue::SENDING_METHOD_ID; ?>_settings_api-key" | |
| 61 | - value="<?php echo empty($defaultApiKey) ? $this->config->get(plgAcymSendinblue::SENDING_METHOD_ID.'_api_key') : $defaultApiKey; ?>" | |
| 62 | - name="config[<?php echo plgAcymSendinblue::SENDING_METHOD_ID; ?>_api_key]" | |
| 63 | - class="cell margin-right-1 acym__configuration__mail__settings__text"> | |
| 64 | - <?php echo $this->getTestCredentialsSendingMethodButton(plgAcymSendinblue::SENDING_METHOD_ID); ?> | |
| 65 | - <?php echo $this->getCopySettingsButton($data, plgAcymSendinblue::SENDING_METHOD_ID, 'wp_mail_smtp'); ?> | |
| 79 | + id="<?php echo esc_attr(plgAcymSendinblue::SENDING_METHOD_ID); ?>_settings_api-key" | |
| 80 | + value="<?php echo esc_attr(empty($defaultApiKey) ? $this->config->get(plgAcymSendinblue::SENDING_METHOD_ID.'_api_key') : $defaultApiKey); ?>" | |
| 81 | + name="config[<?php echo esc_attr(plgAcymSendinblue::SENDING_METHOD_ID); ?>_api_key]" | |
| 82 | + class="cell margin-next-1 acym__configuration__mail__settings__text"> | |
| 83 | + <?php $this->getTestCredentialsSendingMethodButton(plgAcymSendinblue::SENDING_METHOD_ID); ?> | |
| 84 | + <?php $this->getCopySettingsButton($data, plgAcymSendinblue::SENDING_METHOD_ID, 'wp_mail_smtp'); ?> | |
| 66 | 85 | <div class="cell grid-x margin-top-1 acym__sending__methods__synch"> |
| 67 | 86 | <button type="button" |
| 68 | - sending-method-id="<?php echo plgAcymSendinblue::SENDING_METHOD_ID; ?>" | |
| 69 | - class="acym__configuration__sending__synch__users cell shrink button button-secondary"> | |
| 70 | - <?php echo acym_translation('ACYM_SYNCHRO_EXISTING_USERS'); ?> | |
| 87 | + sending-method-id="<?php echo esc_attr(plgAcymSendinblue::SENDING_METHOD_ID); ?>" | |
| 88 | + class="acym__configuration__sending__synch__users cell shrink button button-secondary"> | |
| 89 | + <?php echo esc_html(acym_translation('ACYM_SYNCHRO_EXISTING_USERS')); ?> | |
| 71 | 90 | </button> |
| 72 | 91 | <span class="acym__configuration__sending__method-icon cell shrink margin-left-1 acym_vcenter"></span> |
| 73 | 92 | <span class="acym__configuration__sending__method-synch__message cell shrink margin-left-1 acym_vcenter"></span> |
| 74 | 93 | </div> |
| @@ -74,13 +93,13 @@ | ||
| 74 | 93 | </div> |
| 75 | 94 | <?php if (!$this->plugin->isLogFileEmpty()) { ?> |
| 76 | 95 | <div class="cell grid-x margin-top-1 acym__sending__methods__log"> |
| 77 | 96 | <?php |
| 78 | - echo acym_modal( | |
| 97 | + acym_modal( | |
| 79 | 98 | acym_translation('ACYM_REPORT_SEE'), |
| 80 | 99 | '', |
| 81 | 100 | null, |
| 82 | - '', | |
| 101 | + [], | |
| 83 | 102 | [ |
| 84 | 103 | 'class' => 'button', |
| 85 | 104 | 'data-ajax' => 'true', |
| 86 | 105 | 'data-iframe' => '&ctrl=configuration&task=seeLogs&filename='.$this->plugin->logFilename, |
| @@ -89,22 +108,35 @@ | ||
| 89 | 108 | ?> |
| 90 | 109 | </div> |
| 91 | 110 | <?php } ?> |
| 92 | 111 | <div class="cell grid-x margin-top-1 acym_vcenter acym__sending__methods__clean__data"> |
| 93 | - <?php echo acym_translationSprintf( | |
| 94 | - 'ACYM_CLEAN_DATA_ON_X_X', | |
| 95 | - plgAcymSendinblue::SENDING_METHOD_NAME, | |
| 96 | - $delayType->display( | |
| 97 | - 'config['.plgAcymSendinblue::SENDING_METHOD_ID.'_clean_frequency]', | |
| 98 | - $this->config->get(plgAcymSendinblue::SENDING_METHOD_ID.'_clean_frequency', 604800), // one week | |
| 99 | - 4 | |
| 100 | - ) | |
| 112 | + <?php echo wp_kses( | |
| 113 | + acym_translationSprintf('ACYM_CLEAN_DATA_ON_X_X', plgAcymSendinblue::SENDING_METHOD_NAME, $delay), | |
| 114 | + [ | |
| 115 | + 'input' => [ | |
| 116 | + 'class' => true, | |
| 117 | + 'type' => true, | |
| 118 | + 'id' => true, | |
| 119 | + 'value' => true, | |
| 120 | + 'onchange' => true, | |
| 121 | + 'min' => true, | |
| 122 | + ], | |
| 123 | + 'select' => [ | |
| 124 | + 'name' => true, | |
| 125 | + 'id' => true, | |
| 126 | + 'class' => true, | |
| 127 | + 'onchange' => true, | |
| 128 | + ], | |
| 129 | + 'option' => [ | |
| 130 | + 'value' => true, | |
| 131 | + 'selected' => true, | |
| 132 | + ], | |
| 133 | + ] | |
| 101 | 134 | ); ?> |
| 102 | 135 | </div> |
| 103 | 136 | </div> |
| 104 | 137 | </div> |
| 105 | 138 | <?php |
| 106 | - $data['sendingMethodsHtmlSettings'][plgAcymSendinblue::SENDING_METHOD_ID] = ob_get_clean(); | |
| 107 | 139 | } |
| 108 | 140 | |
| 109 | 141 | public function testCredentialSendingMethod($sendingMethod, $credentials) |
| 110 | 142 | { |