$sendingMethodListParams[$key] ?? $this->config->get($key, ''), ]; } public function getHeadersSendingMethod($sendingMethod, $credentials = []): array { if (empty($credentials)) { $this->onAcymGetCredentialsSendingMethod($credentials, $sendingMethod); } return [ 'api-key:'.$credentials[plgAcymSendinblue::SENDING_METHOD_ID.'_api_key'], 'accept: application/json', 'content-type: application/json', ]; } public function getSendingMethodsHtmlSetting(&$data) { $needValidation = $this->config->get('sendinblue_validation', 0); $remindMe = json_decode($this->config->get('remindme', '[]'), true); if (intval($needValidation) === 1 && !in_array('sendinblue_validation', $remindMe)) { $docUrl = ACYM_DOCUMENTATION.'external-sending-method/sendinblue#my-account-needs-validation'; $message = acym_translation('ACYM_SENDINBLUE_VALIDATION_NEEDED'); $message .= '
'.$docUrl.''; $message .= ' '; $message .= acym_translation('ACYM_DO_NOT_REMIND_ME'); $message .= ''; $notification = [ 'name' => 'sendinblue_validation', 'removable' => 0, ]; acym_enqueueMessage($message, 'info', true, [$notification]); } else { acym_removeDashboardNotification('sendinblue_validation'); } $delayType = new DelayType(); ob_start(); $delayType->display( 'config['.plgAcymSendinblue::SENDING_METHOD_ID.'_clean_frequency]', $this->config->get(plgAcymSendinblue::SENDING_METHOD_ID.'_clean_frequency', 604800), DelayType::TYPE_WEEKS_MONTHS ); $delay = ob_get_clean(); $config = empty($data['tab']) ? $this->config : $data['tab']->config; $defaultApiKey = $config->get(plgAcymSendinblue::SENDING_METHOD_ID.'_api_key'); ob_start(); ?>
getLinks('https://get.brevo.com/hbvmwg6onvve'); ?> getTestCredentialsSendingMethodButton(plgAcymSendinblue::SENDING_METHOD_ID); ?> getCopySettingsButton($data, plgAcymSendinblue::SENDING_METHOD_ID, 'wp_mail_smtp'); ?>
plugin->isLogFileEmpty()) { ?>
'button', 'data-ajax' => 'true', 'data-iframe' => '&ctrl=configuration&task=seeLogs&filename='.$this->plugin->logFilename, ] ); ?>
[ 'class' => true, 'type' => true, 'id' => true, 'value' => true, 'onchange' => true, 'min' => true, ], 'select' => [ 'name' => true, 'id' => true, 'class' => true, 'onchange' => true, ], 'option' => [ 'value' => true, 'selected' => true, ], ] ); ?>
getHeadersSendingMethod(plgAcymSendinblue::SENDING_METHOD_ID, $credentials); $response = $this->callApiSendingMethod('account', [], $headers); if (!empty($response['error_curl'])) { acym_sendAjaxResponse(acym_translationSprintf('ACYM_ERROR_OCCURRED_WHILE_CALLING_API', $response['error_curl']), [], false); } elseif (!empty($response['code'])) { $message = $response['code'] == 'unauthorized' ? acym_translation('ACYM_AUTHENTICATION_FAILS_WITH_API_KEY') : acym_translationSprintf( 'ACYM_API_RETURN_THIS_ERROR', $response['message'] ); acym_sendAjaxResponse($message, [], false); } else { acym_sendAjaxResponse(acym_translation('ACYM_API_KEY_CORRECT')); } } } public function getCreditRemainingSendingMethod(&$html) { $sendingMethod = $this->config->get('mailer_method', ''); if (empty($sendingMethod) || $sendingMethod != plgAcymSendinblue::SENDING_METHOD_ID) return; $apiKey = $this->config->get(plgAcymSendinblue::SENDING_METHOD_ID.'_api_key', ''); if (empty($apiKey)) return; $headers = $this->getHeadersSendingMethod(plgAcymSendinblue::SENDING_METHOD_ID); $response = $this->callApiSendingMethod('account', [], $headers); if (!empty($response['code']) || empty($response['plan'])) { $html = acym_translationSprintf( 'ACYM_SENDING_METHOD_ERROR_WHILE_ACTION', plgAcymSendinblue::SENDING_METHOD_NAME, acym_translation('ACYM_GETTING_REMAINING_CREDITS'), $response['message'] ); return; } $html = acym_translationSprintf( 'ACYM_SENDING_METHOD_X_UNITY', plgAcymSendinblue::SENDING_METHOD_NAME, $response['plan'][0]['credits'], ''.acym_translation('ACYM_CREDITS_REMAINING').'' ); } }