summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Postman/PostmanViewController.php98
-rw-r--r--Postman/PostmanWpMail.php32
-rw-r--r--style/postman.css17
3 files changed, 101 insertions, 46 deletions
diff --git a/Postman/PostmanViewController.php b/Postman/PostmanViewController.php
index e170987..0aa4370 100644
--- a/Postman/PostmanViewController.php
+++ b/Postman/PostmanViewController.php
@@ -48,7 +48,7 @@ if ( ! class_exists( 'PostmanViewController' ) ) {
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 delete_lock_file() {
@@ -302,7 +302,7 @@ if ( ! class_exists( 'PostmanViewController' ) ) {
*/
private function displayTopNavigation() {
$version = PostmanState::getInstance()->getVersion();
- $show = get_option('postman_release_version_'. $version );
+ $show = get_option('postman_release_version' );
printf( '<h2>%s</h2>', sprintf( __( '%s Setup', 'post-smtp' ), __( 'Post SMTP', 'post-smtp' ) ) );
if ( ! $show ) {
@@ -316,50 +316,56 @@ if ( ! class_exists( 'PostmanViewController' ) ) {
</button>
</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', '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>';
+ 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">
+ <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
}
}
}
diff --git a/Postman/PostmanWpMail.php b/Postman/PostmanWpMail.php
index ab766f0..5228fdd 100644
--- a/Postman/PostmanWpMail.php
+++ b/Postman/PostmanWpMail.php
@@ -41,6 +41,9 @@ if ( ! class_exists( 'PostmanWpMail' ) ) {
// initialize for sending
$this->init();
+ // Apply critical headers
+ $headers = $this->apply_default_headers( (array)$headers );
+
// build the message
$postmanMessage = $this->processWpMailCall( $to, $subject, $message, $headers, $attachments );
@@ -55,6 +58,35 @@ if ( ! class_exists( 'PostmanWpMail' ) ) {
return $this->sendMessage( $postmanMessage, $log );
}
+ /**
+ * @param array $headers
+ * @return array $headers
+ */
+ private function apply_default_headers( $headers ) {
+
+ $headers[] = 'Message-ID: ' . $this->createMessageId();
+
+ return $headers;
+ }
+
+ /**
+ * Creates the Message-ID
+ *
+ * @return string
+ */
+ public function createMessageId() {
+
+ $id = md5(uniqid(time()));
+
+ if (isset($_SERVER["SERVER_NAME"])) {
+ $hostName = $_SERVER["SERVER_NAME"];
+ } else {
+ $hostName = php_uname('n');
+ }
+
+ return $id . '@' . $hostName;
+ }
+
/**
* Builds a PostmanMessage based on the WordPress wp_mail parameters
*
diff --git a/style/postman.css b/style/postman.css
index 3e6358c..2366e10 100644
--- a/style/postman.css
+++ b/style/postman.css
@@ -1,5 +1,22 @@
@CHARSET "UTF-8";
+.twitter-wrap {
+ display: flex;
+}
+
+.twitter-wrap #postman-main-menu {
+ flex: 1;
+ margin: 0;
+ margin-right: 10px;
+ overflow: hidden;
+ max-height: 300px;
+ border-radius: 5px;
+}
+
+.welcome-panel-content {
+ width: 100%;
+}
+
#postman-main-menu.welcome-panel {
padding: 0px 10px 5px;
}