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 2.7 * @version 1.0 */ public function createMailEngine() { $api_key = $this->options->getMailjetApiKey(); $secret_key = $this->options->getMailjetSecretKey(); require_once 'PostmanMailjetMailEngine.php'; $engine = new PostmanMailjetMailEngine( $api_key,$secret_key ); return $engine; } /** * @since 2.7 * @version 1.0 */ public function getName() { return __( 'Mailjet', 'post-smtp' ); } /** * @since 2.7 * @version 1.0 */ public function getDeliveryDetails() { } /** * @param PostmanWizardSocket $socket * @param $winningRecommendation * @param $userSocketOverride * @param $userAuthOverride * @return array * @since 2.7 * @version 1.0 */ public function createOverrideMenu( PostmanWizardSocket $socket, $winningRecommendation, $userSocketOverride, $userAuthOverride ) { $overrideItem = parent::createOverrideMenu ( $socket, $winningRecommendation, $userSocketOverride, $userAuthOverride ); // push the authentication options into the $overrideItem structure $overrideItem ['auth_items'] = array ( array ( 'selected' => true, 'name' => __ ( 'API Key', 'post-smtp' ), 'value' => 'api_key' ) ); return $overrideItem; } /** * @since 2.7 * @version 1.0 */ public function on_admin_init() { if( PostmanUtils::isAdmin() ) { $this->addSettings(); $this->registerStylesAndScripts(); } } /** * @since 2.7 * @version 1.0 */ public function addSettings() { add_settings_section( self::MAILJET_AUTH_SECTION, __('Authentication', 'post-smtp'), array( $this, 'printMailjetAuthSectionInfo' ), self::MAILJET_AUTH_OPTIONS ); add_settings_field( PostmanOptions::MAILJET_API_KEY, __( 'API Key', 'post-smtp' ), array( $this, 'mailjet_api_key_callback' ), self::MAILJET_AUTH_OPTIONS, self::MAILJET_AUTH_SECTION ); add_settings_field( PostmanOptions::MAILJET_SECRET_KEY, __( 'Secret Key', 'post-smtp' ), array( $this, 'mailjet_secret_key_callback' ), self::MAILJET_AUTH_OPTIONS, self::MAILJET_AUTH_SECTION ); } /** * @since 2.7 * @version 1.0 */ public function printMailjetAuthSectionInfo() { printf ( '
%s
', sprintf ( __ ( 'Create an account at %2$s and enter an API key and Secret Key below.', 'post-smtp' ), 'https://app.mailjet.com', 'mailjet.com', 'https://app.mailjet.com/account/apikeys' ) ); } /** * @since 2.7 * @version 1.0 */ public function mailjet_api_key_callback() { printf ( '', null !== $this->options->getMailjetApiKey() ? esc_attr ( PostmanUtils::obfuscatePassword ( $this->options->getMailjetApiKey()) ) : '', __ ( 'Required', 'post-smtp' ) ); print ' '; } /** * @since 2.7 * @version 1.0 */ public function mailjet_secret_key_callback(){ printf ( '', null !== $this->options->getMailjetSecretKey() ? esc_attr ( PostmanUtils::obfuscatePassword ( $this->options->getMailjetSecretKey()) ) : '', __ ( 'Required', 'post-smtp' ) ); print ' '; } /** * @since 2.7 * @version 1.0 */ public function registerStylesAndScripts() { $pluginData = apply_filters( 'postman_get_plugin_metadata', null ); wp_register_script ( 'postman-mailjet', plugins_url ( 'Postman/Postman-Mail/postman-mailjet.js', $this->rootPluginFilenameAndPath ), array ( PostmanViewController::JQUERY_SCRIPT, 'jquery_validation', PostmanViewController::POSTMAN_SCRIPT ), $pluginData['version'] ); } /** * @since 2.7 * @version 1.0 */ public function enqueueScript() { wp_enqueue_script( 'postman-mailjet' ); } /** * @since 2.7 * @version 1.0 */ public function printWizardAuthenticationStep() { print '