diff options
author | yehudah <yehudah@b8457f37-d9ea-0310-8a92-e5e31aec5664> | 2019-05-15 12:14:32 +0000 |
---|---|---|
committer | yehudah <yehudah@b8457f37-d9ea-0310-8a92-e5e31aec5664> | 2019-05-15 12:14:32 +0000 |
commit | 38153c0f3e739f3d89a1a7734fd7d199bf457fab (patch) | |
tree | 28e19f4e091d5182a2c63bc98377e5381b0043ac /Postman/PostmanViewController.php | |
parent | 942aa536210fe204a2d097eb8878c1d690e0547b (diff) | |
download | Post-SMTP-38153c0f3e739f3d89a1a7734fd7d199bf457fab.zip |
= 2.0 - 2019-05-15
* New: Mailer Type - Added an option to send without overwrite the 'wp_mail' function, better compability to WordPress delivery. hopefully will be the default in the future.
* Updated: Sendgrid API was upgraded and rewritten to the new version.
* Fixed: Message-Id header was missing on SMTP
* Fixed: Email logger optimization - better query for large amount of records.
* Fixed: The localization was fixed to match translate.wordpress.org translation system ( Thanks to Niels de Blaauw from Level-Level ).
* Fixed: Code and optimization ( Thanks to Niels de Blaauw from Level-Level ).
Diffstat (limited to 'Postman/PostmanViewController.php')
-rw-r--r-- | Postman/PostmanViewController.php | 178 |
1 files changed, 99 insertions, 79 deletions
diff --git a/Postman/PostmanViewController.php b/Postman/PostmanViewController.php index 6fef916..8dffa31 100644 --- a/Postman/PostmanViewController.php +++ b/Postman/PostmanViewController.php @@ -38,6 +38,7 @@ if ( ! class_exists( 'PostmanViewController' ) ) { add_action( 'admin_init', array( $this, 'registerStylesAndScripts' ), 0 ); add_action( 'wp_ajax_delete_lock_file', array( $this, 'delete_lock_file' ) ); add_action( 'wp_ajax_dismiss_version_notify', array( $this, 'dismiss_version_notify' ) ); + add_action( 'wp_ajax_dismiss_donation_notify', array( $this, 'dismiss_donation_notify' ) ); //add_action( 'admin_init', array( $this, 'do_activation_redirect' ) ); @@ -47,19 +48,24 @@ if ( ! class_exists( 'PostmanViewController' ) ) { function dismiss_version_notify() { check_ajax_referer( 'postsmtp', 'security' ); - $version = sanitize_text_field($_POST['version']); - $result = update_option('postman_release_version_'. $version, true ); + $result = update_option('postman_release_version', true ); } + function dismiss_donation_notify() { + check_ajax_referer( 'postsmtp', 'security' ); + + $result = update_option('postman_dismiss_donation', true ); + } + function delete_lock_file() { check_ajax_referer( 'postman', 'security' ); if ( ! PostmanUtils::lockFileExists() ) { - echo __('No lock file found.', Postman::TEXT_DOMAIN ); + echo __('No lock file found.', 'post-smtp' ); die(); } - echo PostmanUtils::deleteLockFile() == true ? __('Success, try to send test email.', Postman::TEXT_DOMAIN ) : __('Failed, try again.', Postman::TEXT_DOMAIN ); + echo PostmanUtils::deleteLockFile() == true ? __('Success, try to send test email.', 'post-smtp' ) : __('Failed, try again.', 'post-smtp' ); die(); } @@ -96,8 +102,8 @@ if ( ! class_exists( 'PostmanViewController' ) ) { */ public function generateDefaultContent() { // This page will be under "Settings" - $pageTitle = sprintf( __( '%s Setup', Postman::TEXT_DOMAIN ), __( 'Post SMTP', Postman::TEXT_DOMAIN ) ); - $pluginName = __( 'Post SMTP', Postman::TEXT_DOMAIN ); + $pageTitle = sprintf( __( '%s Setup', 'post-smtp' ), __( 'Post SMTP', 'post-smtp' ) ); + $pluginName = __( 'Post SMTP', 'post-smtp' ); $uniqueId = self::POSTMAN_MENU_SLUG; $pageOptions = array( $this, @@ -119,7 +125,7 @@ if ( ! class_exists( 'PostmanViewController' ) ) { * Register the Email Test screen */ public function addPurgeDataSubmenu() { - $page = add_submenu_page( null, sprintf( __( '%s Setup', Postman::TEXT_DOMAIN ), __( 'Post SMTP', Postman::TEXT_DOMAIN ) ), __( 'Post SMTP', Postman::TEXT_DOMAIN ), Postman::MANAGE_POSTMAN_CAPABILITY_NAME, PostmanAdminController::MANAGE_OPTIONS_PAGE_SLUG, array( + $page = add_submenu_page( null, sprintf( __( '%s Setup', 'post-smtp' ), __( 'Post SMTP', 'post-smtp' ) ), __( 'Post SMTP', 'post-smtp' ), Postman::MANAGE_POSTMAN_CAPABILITY_NAME, PostmanAdminController::MANAGE_OPTIONS_PAGE_SLUG, array( $this, 'outputPurgeDataContent', ) ); @@ -157,15 +163,15 @@ if ( ! class_exists( 'PostmanViewController' ) ) { ), '1.13.1' ); wp_localize_script( PostmanViewController::POSTMAN_SCRIPT, 'postman_ajax_msg', array( - 'bad_response' => __( 'An unexpected error occurred', Postman::TEXT_DOMAIN ), - 'corrupt_response' => __( 'Unexpected PHP messages corrupted the Ajax response', Postman::TEXT_DOMAIN ), + 'bad_response' => __( 'An unexpected error occurred', 'post-smtp' ), + 'corrupt_response' => __( 'Unexpected PHP messages corrupted the Ajax response', 'post-smtp' ), ) ); wp_localize_script( 'jquery_steps_script', 'steps_current_step', 'steps_current_step' ); wp_localize_script( 'jquery_steps_script', 'steps_pagination', 'steps_pagination' ); - wp_localize_script( 'jquery_steps_script', 'steps_finish', _x( 'Finish', 'Press this button to Finish this task', Postman::TEXT_DOMAIN ) ); - wp_localize_script( 'jquery_steps_script', 'steps_next', _x( 'Next', 'Press this button to go to the next step', Postman::TEXT_DOMAIN ) ); - wp_localize_script( 'jquery_steps_script', 'steps_previous', _x( 'Previous', 'Press this button to go to the previous step', Postman::TEXT_DOMAIN ) ); + wp_localize_script( 'jquery_steps_script', 'steps_finish', _x( 'Finish', 'Press this button to Finish this task', 'post-smtp' ) ); + wp_localize_script( 'jquery_steps_script', 'steps_next', _x( 'Next', 'Press this button to go to the next step', 'post-smtp' ) ); + wp_localize_script( 'jquery_steps_script', 'steps_previous', _x( 'Previous', 'Press this button to go to the previous step', 'post-smtp' ) ); wp_localize_script( 'jquery_steps_script', 'steps_loading', 'steps_loading' ); } @@ -177,7 +183,7 @@ if ( ! class_exists( 'PostmanViewController' ) ) { print '<div class="wrap">'; $this->displayTopNavigation(); if ( ! PostmanPreRequisitesCheck::isReady() ) { - printf( '<p><span style="color:red; padding:2px 0; font-size:1.1em">%s</span></p>', __( 'Postman is unable to run. Email delivery is being handled by WordPress (or another plugin).', Postman::TEXT_DOMAIN ) ); + printf( '<p><span style="color:red; padding:2px 0; font-size:1.1em">%s</span></p>', __( 'Postman is unable to run. Email delivery is being handled by WordPress (or another plugin).', 'post-smtp' ) ); } else { $ready_messsage = PostmanTransportRegistry::getInstance()->getReadyMessage(); $statusMessage = $ready_messsage['message']; @@ -193,27 +199,32 @@ if ( ! class_exists( 'PostmanViewController' ) ) { $this->printDeliveryDetails(); /* translators: where %d is the number of emails delivered */ print '<p style="margin:10px 10px"><span>'; - printf( _n( 'Postman has delivered <span style="color:green">%d</span> email.', 'Postman has delivered <span style="color:green">%d</span> emails.', PostmanState::getInstance()->getSuccessfulDeliveries(), Postman::TEXT_DOMAIN ), PostmanState::getInstance()->getSuccessfulDeliveries() ); + printf( _n( 'Postman has delivered <span style="color:green">%d</span> email.', 'Postman has delivered <span style="color:green">%d</span> emails.', PostmanState::getInstance()->getSuccessfulDeliveries(), 'post-smtp' ), PostmanState::getInstance()->getSuccessfulDeliveries() ); if ( $this->options->isMailLoggingEnabled() ) { print ' '; - printf( __( 'The last %d email attempts are recorded <a href="%s">in the log</a>.', Postman::TEXT_DOMAIN ), PostmanOptions::getInstance()->getMailLoggingMaxEntries(), PostmanUtils::getEmailLogPageUrl() ); + printf( __( 'The last %d email attempts are recorded <a href="%s">in the log</a>.', 'post-smtp' ), PostmanOptions::getInstance()->getMailLoggingMaxEntries(), PostmanUtils::getEmailLogPageUrl() ); } print '</span></p>'; } if ( $this->options->isNew() ) { - printf( '<h3 style="padding-top:10px">%s</h3>', __( 'Thank-you for choosing Postman!', Postman::TEXT_DOMAIN ) ); + printf( '<h3 style="padding-top:10px">%s</h3>', __( 'Thank-you for choosing Postman!', 'post-smtp' ) ); /* translators: where %s is the URL of the Setup Wizard */ - printf( '<p><span>%s</span></p>', sprintf( __( 'Let\'s get started! All users are strongly encouraged to <a href="%s">run the Setup Wizard</a>.', Postman::TEXT_DOMAIN ), $this->getPageUrl( PostmanConfigurationController::CONFIGURATION_WIZARD_SLUG ) ) ); - printf( '<p><span>%s</span></p>', sprintf( __( 'Alternately, <a href="%s">manually configure</a> your own settings and/or modify advanced options.', Postman::TEXT_DOMAIN ), $this->getPageUrl( PostmanConfigurationController::CONFIGURATION_SLUG ) ) ); + printf( '<p><span>%s</span></p>', sprintf( __( 'Let\'s get started! All users are strongly encouraged to <a href="%s">run the Setup Wizard</a>.', 'post-smtp' ), $this->getPageUrl( PostmanConfigurationController::CONFIGURATION_WIZARD_SLUG ) ) ); + printf( '<p><span>%s</span></p>', sprintf( __( 'Alternately, <a href="%s">manually configure</a> your own settings and/or modify advanced options.', 'post-smtp' ), $this->getPageUrl( PostmanConfigurationController::CONFIGURATION_SLUG ) ) ); } else { if ( PostmanState::getInstance()->isTimeToReviewPostman() && ! PostmanOptions::getInstance()->isNew() ) { print '</br><hr width="70%"></br>'; /* translators: where %s is the URL to the WordPress.org review and ratings page */ - printf( '%s</span></p>', sprintf( __( 'Please consider <a href="%s">leaving a review</a> to help spread the word! :D', Postman::TEXT_DOMAIN ), 'https://wordpress.org/support/view/plugin-reviews/post-smtp?filter=5' ) ); + printf( '%s</span></p>', sprintf( __( 'Please consider <a href="%s">leaving a review</a> to help spread the word! :D', 'post-smtp' ), 'https://wordpress.org/support/view/plugin-reviews/post-smtp?filter=5' ) ); } - printf( '<p><span>%s :-)</span></p>', sprintf( __( 'Postman needs translators! Please take a moment to <a href="%s">translate a few sentences on-line</a>', Postman::TEXT_DOMAIN ), 'https://translate.wordpress.org/projects/wp-plugins/post-smtp/stable' ) ); + printf( '<p><span>%s :-)</span></p>', sprintf( __( 'Postman needs translators! Please take a moment to <a href="%s">translate a few sentences on-line</a>', 'post-smtp' ), 'https://translate.wordpress.org/projects/wp-plugins/post-smtp/stable' ) ); } - printf( '<p><span>%s</span></p>', __( '<b style="background-color:yellow">New for v1.7!</style></b> Send mail with the Mandrill or SendGrid APIs.', Postman::TEXT_DOMAIN ) ); + printf( + '<p><span>%s</span> <a target="_blank" href="%s">%s</a></p>', + __( '<b style="background-color:yellow">New for v1.9.8!</b> Fallback - setup a second delivery method when the first one is failing', 'post-smtp' ), + 'https://postmansmtp.com/post-smtp-1-9-7-the-smtp-fallback/', + __( 'Check the detailes here', 'post-smtp') + ); } /** @@ -226,33 +237,33 @@ if ( ! class_exists( 'PostmanViewController' ) ) { /** * - * @param unknown $title + * @param mixed $title * @param string $slug */ public static function outputChildPageHeader( $title, $slug = '' ) { - printf( '<h2>%s</h2>', sprintf( __( '%s Setup', Postman::TEXT_DOMAIN ), __( 'Post SMTP', Postman::TEXT_DOMAIN ) ) ); + printf( '<h2>%s</h2>', sprintf( __( '%s Setup', 'post-smtp' ), __( 'Post SMTP', 'post-smtp' ) ) ); printf( '<div id="postman-main-menu" class="welcome-panel %s">', $slug ); print '<div class="welcome-panel-content">'; print '<div class="welcome-panel-column-container">'; print '<div class="welcome-panel-column welcome-panel-last">'; printf( '<h4>%s</h4>', $title ); print '</div>'; - printf( '<p id="back_to_main_menu">%s <a id="back_to_menu_link" href="%s">%s</a></p>', self::BACK_ARROW_SYMBOL, PostmanUtils::getSettingsPageUrl(), _x( 'Back To Main Menu', 'Return to main menu link', Postman::TEXT_DOMAIN ) ); + printf( '<p id="back_to_main_menu">%s <a id="back_to_menu_link" href="%s">%s</a></p>', self::BACK_ARROW_SYMBOL, PostmanUtils::getSettingsPageUrl(), _x( 'Back To Main Menu', 'Return to main menu link', 'post-smtp' ) ); print '</div></div></div>'; } /** */ public function outputPurgeDataContent() { - $importTitle = __( 'Import', Postman::TEXT_DOMAIN ); - $exportTile = __( 'Export', Postman::TEXT_DOMAIN ); - $resetTitle = __( 'Reset Plugin', Postman::TEXT_DOMAIN ); + $importTitle = __( 'Import', 'post-smtp' ); + $exportTile = __( 'Export', 'post-smtp' ); + $resetTitle = __( 'Reset Plugin', 'post-smtp' ); $options = $this->options; print '<div class="wrap">'; PostmanViewController::outputChildPageHeader( sprintf( '%s/%s/%s', $importTitle, $exportTile, $resetTitle ) ); print '<section id="export_settings">'; printf( '<h3><span>%s<span></h3>', $exportTile ); - printf( '<p><span>%s</span></p>', __( 'Copy this data into another instance of Postman to duplicate the configuration.', Postman::TEXT_DOMAIN ) ); + printf( '<p><span>%s</span></p>', __( 'Copy this data into another instance of Postman to duplicate the configuration.', 'post-smtp' ) ); $data = ''; if ( ! PostmanPreRequisitesCheck::checkZlibEncode() ) { $extraDeleteButtonAttributes = sprintf( 'disabled="true"' ); @@ -271,15 +282,15 @@ if ( ! class_exists( 'PostmanViewController' ) ) { wp_nonce_field( PostmanAdminController::IMPORT_SETTINGS_SLUG ); printf( '<input type="hidden" name="action" value="%s" />', PostmanAdminController::IMPORT_SETTINGS_SLUG ); print '<p>'; - printf( '<span>%s</span>', __( 'Paste data from another instance of Postman here to duplicate the configuration.', Postman::TEXT_DOMAIN ) ); + printf( '<span>%s</span>', __( 'Paste data from another instance of Postman here to duplicate the configuration.', 'post-smtp' ) ); if ( PostmanTransportRegistry::getInstance()->getSelectedTransport()->isOAuthUsed( PostmanOptions::getInstance()->getAuthenticationType() ) ) { - $warning = __( 'Warning', Postman::TEXT_DOMAIN ); - $errorMessage = __( 'Using the same OAuth 2.0 Client ID and Client Secret from this site at the same time as another site will cause failures.', Postman::TEXT_DOMAIN ); + $warning = __( 'Warning', 'post-smtp' ); + $errorMessage = __( 'Using the same OAuth 2.0 Client ID and Client Secret from this site at the same time as another site will cause failures.', 'post-smtp' ); printf( ' <span><b>%s</b>: %s</span>', $warning, $errorMessage ); } print '</p>'; printf( '<textarea cols="80" rows="5" name="settings" %s></textarea>', $extraDeleteButtonAttributes ); - submit_button( __( 'Import', Postman::TEXT_DOMAIN ), 'primary', 'import', true, $extraDeleteButtonAttributes ); + submit_button( __( 'Import', 'post-smtp' ), 'primary', 'import', true, $extraDeleteButtonAttributes ); print '</form>'; print '</section>'; print '<section id="delete_settings">'; @@ -287,7 +298,7 @@ if ( ! class_exists( 'PostmanViewController' ) ) { print '<form method="POST" action="' . get_admin_url() . 'admin-post.php">'; wp_nonce_field( PostmanAdminController::PURGE_DATA_SLUG ); printf( '<input type="hidden" name="action" value="%s" />', PostmanAdminController::PURGE_DATA_SLUG ); - printf( '<p><span>%s</span></p><p><span>%s</span></p>', __( 'This will purge all of Postman\'s settings, including account credentials and the email log.', Postman::TEXT_DOMAIN ), __( 'Are you sure?', Postman::TEXT_DOMAIN ) ); + printf( '<p><span>%s</span></p><p><span>%s</span></p>', __( 'This will purge all of Postman\'s settings, including account credentials and the email log.', 'post-smtp' ), __( 'Are you sure?', 'post-smtp' ) ); $extraDeleteButtonAttributes = 'style="background-color:red;color:white"'; if ( $this->options->isNew() ) { $extraDeleteButtonAttributes .= ' disabled="true"'; @@ -302,14 +313,14 @@ if ( ! class_exists( 'PostmanViewController' ) ) { */ private function displayTopNavigation() { $version = PostmanState::getInstance()->getVersion(); - $show = get_option('postman_release_version_'. $version ); - printf( '<h2>%s</h2>', sprintf( __( '%s Setup', Postman::TEXT_DOMAIN ), __( 'Post SMTP', Postman::TEXT_DOMAIN ) ) ); + $show = get_option('postman_release_version' ); + printf( '<h2>%s</h2>', sprintf( __( '%s Setup', 'post-smtp' ), __( 'Post SMTP', 'post-smtp' ) ) ); if ( ! $show ) { echo ' <div class="updated settings-error notice is-dismissible"> <p> - <strong>Version ' . $version . ' The SMTP Fallback ( A backup delivery SMTP ):</strong> <a target="_blank" href="https://postmansmtp.com/post-smtp-1-9-7-the-smtp-fallback/">Read Here</a> + <strong>Version ' . $version . ' Mailer Type:</strong> <a target="_blank" href="https://postmansmtp.com/post-smtp-2-0-mailer-type-and-much-more/">Read Here</a> </p> <button style="z-index: 100;" data-version="'. $version . '" data-security="' . wp_create_nonce('postsmtp') .'" type="button" class="notice-dismiss postman-release-message"> <span class="screen-reader-text">Dismiss this notice.</span> @@ -317,49 +328,58 @@ if ( ! class_exists( 'PostmanViewController' ) ) { </div>'; } - print '<div id="postman-main-menu" class="welcome-panel">'; - print '<div class="welcome-panel-content">'; - print '<div class="welcome-panel-column-container">'; - print '<div class="welcome-panel-column">'; - printf( '<h4>%s</h4>', __( 'Configuration', Postman::TEXT_DOMAIN ) ); - printf( '<a class="button button-primary button-hero" href="%s">%s</a>', $this->getPageUrl( PostmanConfigurationController::CONFIGURATION_WIZARD_SLUG ), __( 'Start the Wizard', Postman::TEXT_DOMAIN ) ); - printf( '<p class="">%s <a href="%s" class="configure_manually">%s</a></p>', __( 'or', Postman::TEXT_DOMAIN ), $this->getPageUrl( PostmanConfigurationController::CONFIGURATION_SLUG ), __( 'Show All Settings', Postman::TEXT_DOMAIN ) ); - print '</div>'; - print '<div class="welcome-panel-column">'; - printf( '<h4>%s</h4>', _x( 'Actions', 'Main Menu', Postman::TEXT_DOMAIN ) ); - print '<ul>'; - - // Grant permission with Google - PostmanTransportRegistry::getInstance()->getSelectedTransport()->printActionMenuItem(); - - if ( PostmanWpMailBinder::getInstance()->isBound() ) { - printf( '<li><a href="%s" class="welcome-icon send_test_email">%s</a></li>', $this->getPageUrl( PostmanSendTestEmailController::EMAIL_TEST_SLUG ), __( 'Send a Test Email', Postman::TEXT_DOMAIN ) ); - } else { - printf( '<li><div class="welcome-icon send_test_email">%s</div></li>', __( 'Send a Test Email', Postman::TEXT_DOMAIN ) ); - } - - // import-export-reset menu item - if ( ! $this->options->isNew() || true ) { - $purgeLinkPattern = '<li><a href="%1$s" class="welcome-icon oauth-authorize">%2$s</a></li>'; - } else { - $purgeLinkPattern = '<li>%2$s</li>'; - } - $importTitle = __( 'Import', Postman::TEXT_DOMAIN ); - $exportTile = __( 'Export', Postman::TEXT_DOMAIN ); - $resetTitle = __( 'Reset Plugin', Postman::TEXT_DOMAIN ); - $importExportReset = sprintf( '%s/%s/%s', $importTitle, $exportTile, $resetTitle ); - printf( $purgeLinkPattern, $this->getPageUrl( PostmanAdminController::MANAGE_OPTIONS_PAGE_SLUG ), sprintf( '%s', $importExportReset ) ); - print '</ul>'; - print '</div>'; - print '<div class="welcome-panel-column welcome-panel-last">'; - printf( '<h4>%s</h4>', _x( 'Troubleshooting', 'Main Menu', Postman::TEXT_DOMAIN ) ); - print '<ul>'; - printf( '<li><a href="%s" class="welcome-icon run-port-test">%s</a></li>', $this->getPageUrl( PostmanConnectivityTestController::PORT_TEST_SLUG ), __( 'Connectivity Test', Postman::TEXT_DOMAIN ) ); - printf( '<li><a href="%s" class="welcome-icon run-port-test">%s</a></li>', $this->getPageUrl( PostmanDiagnosticTestController::DIAGNOSTICS_SLUG ), __( 'Diagnostic Test', Postman::TEXT_DOMAIN ) ); - printf( '<li><a href="%s" data-security="%s" class="welcome-icon release-lock-file">%s</a></li>', '#', wp_create_nonce( "postman" ), __( 'Release Lock File Error', Postman::TEXT_DOMAIN ) ); - printf( '<li><a href="https://postmansmtp.com/forums/" class="welcome-icon postman_support">%s</a></li>', __( 'Online Support', Postman::TEXT_DOMAIN ) ); - printf( '<li><img class="align-middle" src="' . plugins_url( 'style/images/new.gif', dirname( __DIR__ ) . '/postman-smtp.php' ) . '"><a target="blank" class="align-middle" href="https://postmansmtp.com/category/guides/" class="welcome-icon postman_guides">%s</a></li>', __( 'Guides', Postman::TEXT_DOMAIN ) ); - print '</ul></div></div></div></div>'; + include_once POST_PATH . '/Postman/extra/donation.php'; + + echo '<div class="twitter-wrap">'; + print '<div id="postman-main-menu" class="welcome-panel">'; + print '<div class="welcome-panel-content">'; + print '<div class="welcome-panel-column-container">'; + print '<div class="welcome-panel-column">'; + printf( '<h4>%s</h4>', __( 'Configuration', 'post-smtp' ) ); + printf( '<a class="button button-primary button-hero" href="%s">%s</a>', $this->getPageUrl( PostmanConfigurationController::CONFIGURATION_WIZARD_SLUG ), __( 'Start the Wizard', 'post-smtp' ) ); + printf( '<p class="">%s <a href="%s" class="configure_manually">%s</a></p>', __( 'or', 'post-smtp' ), $this->getPageUrl( PostmanConfigurationController::CONFIGURATION_SLUG ), __( 'Show All Settings', 'post-smtp' ) ); + print '</div>'; + print '<div class="welcome-panel-column">'; + printf( '<h4>%s</h4>', _x( 'Actions', 'Main Menu', 'post-smtp' ) ); + print '<ul>'; + + // Grant permission with Google + PostmanTransportRegistry::getInstance()->getSelectedTransport()->printActionMenuItem(); + + if ( PostmanWpMailBinder::getInstance()->isBound() ) { + printf( '<li><a href="%s" class="welcome-icon send_test_email">%s</a></li>', $this->getPageUrl( PostmanSendTestEmailController::EMAIL_TEST_SLUG ), __( 'Send a Test Email', 'post-smtp' ) ); + } else { + printf( '<li><div class="welcome-icon send_test_email">%s</div></li>', __( 'Send a Test Email', 'post-smtp' ) ); + } + + // import-export-reset menu item + if ( ! $this->options->isNew() || true ) { + $purgeLinkPattern = '<li><a href="%1$s" class="welcome-icon oauth-authorize">%2$s</a></li>'; + } else { + $purgeLinkPattern = '<li>%2$s</li>'; + } + $importTitle = __( 'Import', 'post-smtp' ); + $exportTile = __( 'Export', 'post-smtp' ); + $resetTitle = __( 'Reset Plugin', 'post-smtp' ); + $importExportReset = sprintf( '%s/%s/%s', $importTitle, $exportTile, $resetTitle ); + printf( $purgeLinkPattern, $this->getPageUrl( PostmanAdminController::MANAGE_OPTIONS_PAGE_SLUG ), sprintf( '%s', $importExportReset ) ); + print '</ul>'; + print '</div>'; + print '<div class="welcome-panel-column welcome-panel-last">'; + printf( '<h4>%s</h4>', _x( 'Troubleshooting', 'Main Menu', 'post-smtp' ) ); + print '<ul>'; + printf( '<li><a href="%s" class="welcome-icon run-port-test">%s</a></li>', $this->getPageUrl( PostmanConnectivityTestController::PORT_TEST_SLUG ), __( 'Connectivity Test', 'post-smtp' ) ); + printf( '<li><a href="%s" class="welcome-icon run-port-test">%s</a></li>', $this->getPageUrl( PostmanDiagnosticTestController::DIAGNOSTICS_SLUG ), __( 'Diagnostic Test', 'post-smtp' ) ); + printf( '<li><a href="%s" data-security="%s" class="welcome-icon release-lock-file">%s</a></li>', '#', wp_create_nonce( "postman" ), __( 'Release Lock File Error', 'post-smtp' ) ); + printf( '<li><a href="https://postmansmtp.com/forums/" class="welcome-icon postman_support">%s</a></li>', __( 'Online Support', 'post-smtp' ) ); + printf( '<li><img class="align-middle" src="' . plugins_url( 'style/images/new.gif', dirname( __DIR__ ) . '/postman-smtp.php' ) . '"><a target="blank" class="align-middle" href="https://postmansmtp.com/category/guides/" class="welcome-icon postman_guides">%s</a></li>', __( 'Guides', 'post-smtp' ) ); + print '</ul></div></div></div></div>'; + ?> + <div class="twitter-iframe-wrap" style="min-width: 300px;"> + <a class="twitter-timeline" data-height="304" href="https://twitter.com/PostSMTP?ref_src=twsrc%5Etfw">Tweets by PostSMTP</a> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script> + </div> + </div> + <?php } } } |