options->getSweegoApiKey(); require_once 'PostmanSweegoMailEngine.php'; $engine = new PostmanSweegoMailEngine($apiKey); return $engine; } public function getDeliveryDetails() { return sprintf(__('Postman will send mail via the %1$s %2$s.', 'post-smtp'), '🔐', $this->getName()); } protected function validateTransportConfiguration() { $messages = parent::validateTransportConfiguration(); $apiKey = $this->options->getSweegoApiKey(); if (empty($apiKey)) { array_push($messages, __('API Key can not be empty', 'post-smtp') . '.'); $this->setNotConfiguredAndReady(); } if (!$this->isSenderConfigured()) { array_push($messages, __('Message From Address can not be empty', 'post-smtp') . '.'); $this->setNotConfiguredAndReady(); } return $messages; } public function getConfigurationBid(PostmanWizardSocket $hostData, $userAuthOverride, $originalSmtpServer) { $recommendation = array(); $recommendation['priority'] = 0; $recommendation['transport'] = self::SLUG; $recommendation['hostname'] = null; $recommendation['label'] = $this->getName(); $recommendation['logo_url'] = $this->getLogoURL(); if ($hostData->hostname == self::HOST && $hostData->port == self::PORT) { $recommendation['priority'] = self::PRIORITY; $recommendation['message'] = sprintf(__('Postman recommends the %1$s to host %2$s on port %3$d.'), $this->getName(), self::HOST, self::PORT); } return $recommendation; } public function on_admin_init() { if (PostmanUtils::isAdmin()) { $this->addSettings(); $this->registerStylesAndScripts(); } } public function addSettings() { add_settings_section(self::SWEEGO_AUTH_SECTION, __('Authentication', 'post-smtp'), array($this, 'printSweegoAuthSectionInfo'), self::SWEEGO_AUTH_OPTIONS); add_settings_field('sweego_api_key', __('API Key', 'post-smtp'), array($this, 'sweego_api_key_callback'), self::SWEEGO_AUTH_OPTIONS, self::SWEEGO_AUTH_SECTION); } public function printSweegoAuthSectionInfo() { printf('
%s
', sprintf(__('Enter your Sweego API key and endpoint below.', 'post-smtp'))); } public function sweego_api_key_callback() { printf('', null !== $this->options->getSweegoApiKey() ? esc_attr(PostmanUtils::obfuscatePassword($this->options->getSweegoApiKey())) : '', __('Required', 'post-smtp')); print ' '; } public function registerStylesAndScripts() { // register the stylesheet and javascript external resources $pluginData = apply_filters( 'postman_get_plugin_metadata', null ); wp_register_script( 'postman-sweego', plugins_url( 'Postman/Postman-Mail/postman-sweego.js', $this->rootPluginFilenameAndPath ), array( PostmanViewController::JQUERY_SCRIPT, 'jquery_validation', PostmanViewController::POSTMAN_SCRIPT ), $pluginData['version'] ); } public function enqueueScript() { wp_enqueue_script( 'postman-sweego' ); } public function printWizardAuthenticationStep() { print '