getName(); $recommendation['logo_url'] = $this->getLogoURL(); if ($hostData->hostname == self::HOST && $hostData->port == self::PORT) { $recommendation ['priority'] = self::PRIORITY; /* translators: where variables are (1) transport name (2) host and (3) port */ $recommendation ['message'] = sprintf ( __ ( ('Postman recommends the %1$s to host %2$s on port %3$d.') ), $this->getName(), self::HOST, self::PORT ); } return $recommendation; } /** * @since 3.2.0 * @version 1.0 */ public function createMailEngine() { $api_key = $this->options->getResendApiKey(); require_once 'PostmanResendMailEngine.php'; $engine = new PostmanResendMailEngine( $api_key ); return $engine; } /** * @since 3.2.0 * @version 1.0 */ public function getDeliveryDetails() { /* translators: where (1) is the secure icon and (2) is the transport name */ return sprintf ( __ ( 'Postman will send mail via the %1$s %2$s.', 'post-smtp' ), '🔐', $this->getName () ); } /** * @param PostmanWizardSocket $socket * @param $winningRecommendation * @param $userSocketOverride * @param $userAuthOverride * @return array * @since 3.2.0 * @version 1.0 */ public function populateConfiguration( $hostname ) { $response = parent::populateConfiguration( $hostname ); $response [PostmanOptions::TRANSPORT_TYPE] = $this->getSlug(); $response [PostmanOptions::PORT] = $this->getPort(); $response [PostmanOptions::HOSTNAME] = $this->getHostname(); $response [PostmanOptions::SECURITY_TYPE] = PostmanOptions::SECURITY_TYPE_SMTPS; $response [PostmanOptions::AUTHENTICATION_TYPE] = PostmanOptions::AUTHENTICATION_TYPE_OAUTH2; return $response; } /** * @since 3.2.0 * @version 1.0 */ public function on_admin_init() { $this->addSettings(); $this->registerStylesAndScripts(); } /** * @since 3.2.0 * @version 1.0 */ public function addSettings() { add_settings_section( self::RESEND_AUTH_SECTION, __('Authentication', 'post-smtp'), array( $this, 'printResendAuthSectionInfo' ), self::RESEND_AUTH_OPTIONS ); add_settings_field( PostmanOptions::RESEND_API_KEY, __( 'API Key', 'post-smtp' ), array( $this, 'resend_api_key_callback' ), self::RESEND_AUTH_OPTIONS, self::RESEND_AUTH_SECTION ); } /** * @since 3.2.0 * @version 1.0 */ public function printResendAuthSectionInfo() { printf ( '
%s
', sprintf ( __ ( 'Create an account at %2$s and enter an API key below.', 'post-smtp' ), 'https://resend.com/', 'resend.com', 'https://resend.com/api-keys' ) ); } /** * @since 3.2.0 * @version 1.0 */ public function resend_api_key_callback() { printf( '', null !== $this->options->getResendApiKey() ? esc_attr( PostmanUtils::obfuscatePassword( $this->options->getResendApiKey() ) ) : '', __( 'Required', 'post-smtp' ) ); print ' '; } /** * @since 3.2.0 * @version 1.0 */ public function registerStylesAndScripts() { // register the stylesheet and javascript external resources $pluginData = apply_filters ( 'postman_get_plugin_metadata', null ); wp_register_script ( 'postman-resend', plugins_url ( 'Postman/Postman-Mail/postman-resend.js', $this->rootPluginFilenameAndPath ), array ( PostmanViewController::JQUERY_SCRIPT, 'jquery_validation', PostmanViewController::POSTMAN_SCRIPT ), $pluginData['version'] ); } /** * @since 3.2.0 * @version 1.0 */ public function enqueueScript() { wp_enqueue_script( 'postman-resend' ); } /** * @since 3.2.0 * @version 1.0 */ public function printWizardAuthenticationStep() { print '