Skip to content

Commit

Permalink
2.0.25
Browse files Browse the repository at this point in the history
Bug Fixes
WP 5.9 Compatibility Ballon UI issue.
Uncaught Error: Class ‘PostmanAdminController’ not found.
Ajax error appearing due to Google API depreciated function.

Improvements

Code Optimization.
MIME version added to test mails to prevent emails from spam.
NEW Filter postman_test_email_args added to modify test email arguments.
NEW Action wp_mail_succeeded added to exectue on every success email delivery.
  • Loading branch information
smusman98 committed Jul 18, 2022
1 parent 44181d4 commit 0d0f410
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 30 deletions.
17 changes: 1 addition & 16 deletions Postman/Postman-Email-Log/PostmanEmailLogView.php
Original file line number Diff line number Diff line change
Expand Up @@ -390,22 +390,7 @@ function prepare_items() {
);
array_push( $data, $flattenedPost );
}

/**
* This checks for sorting input and sorts the data in our array accordingly.
*
* In a real-world situation involving a database, you would probably want
* to handle sorting by passing the 'orderby' and 'order' values directly
* to a custom query. The returned data will be pre-sorted, and this array
* sorting technique would be unnecessary.
*/
function usort_reorder( $a, $b ) {
$orderby = ( ! empty( $_REQUEST ['orderby'] )) ? sanitize_text_field($_REQUEST ['orderby']) : 'title'; // If no sort, default to title
$order = ( ! empty( $_REQUEST ['order'] )) ? sanitize_text_field($_REQUEST ['order']) : 'asc'; // If no order, default to asc
$result = strcmp( $a [ $orderby ], $b [ $orderby ] ); // Determine sort order
return ($order === 'asc') ? $result : - $result; // Send final sort direction to usort
}
// usort($data, 'usort_reorder');

/**
* *********************************************************************
* ---------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ public function createRequestUri($restPath, $params)
}

if (count($queryVars)) {
$requestUrl .= '?' . implode($queryVars, '&');
$requestUrl .= '?' . implode( '&', $queryVars );
}

return $requestUrl;
Expand Down
16 changes: 12 additions & 4 deletions Postman/Postman-Send-Test-Email/PostmanSendTestEmailController.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,10 @@ function test_mode() {

/**
* This Ajax sends a test email
*
* @since 1.0
* @since 2.0.25 @filter `postman_test_email_args`
* @version 1.0
*/
function sendTestEmailViaAjax() {

Expand All @@ -225,11 +229,15 @@ function sendTestEmailViaAjax() {
) );

// this header specifies that there are many parts (one text part, one html part)
$header = 'Content-Type: multipart/alternative;';
$header = 'Content-Type: multipart/alternative; \r\n';
$header .= 'MIME-Version: 1.0 \r\n';

// createt the message content
$message = $this->createMessageContent();


$email_args = apply_filters( 'postman_test_email_args', compact( 'email', 'subject', 'message', 'header' ) );
extract( $email_args );

// send the message
$success = wp_mail( $email, $subject, $message, $header );

Expand Down Expand Up @@ -339,7 +347,7 @@ private function createMessageContent() {
' <div style="max-width: 600px; height: 400px; margin: 0 auto; overflow: hidden;background-image:url(\'https://ps.w.org/postman-smtp/assets/email/poofytoo.png\');background-repeat: no-repeat;">',
sprintf( ' <div style="margin:50px 0 0 300px; width:300px; font-size:2em;">%s</div>', $greeting ),
sprintf( ' <div style="text-align:right;font-size: 1.4em; color:black;margin:150px 0 0 200px;">%s', $sentBy ),
' <br/><span style="font-size: 0.8em"><a style="color:#3f73b9" href="https://wordpress.org/plugins/post-smtp/">https://wordpress.org/plugins/post-smtp/</a></span>',
' <br/>',
' </div>',
' </div>',
' </td>',
Expand All @@ -356,4 +364,4 @@ private function createMessageContent() {
);
return implode( PostmanMessage::EOL, $messageArray );
}
}
}
8 changes: 7 additions & 1 deletion Postman/Postman.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ public function on_plugins_loaded() {
if ( PostmanUtils::isAdmin() && is_admin() ) {
$this->setup_admin();
}

}

/**
Expand Down Expand Up @@ -425,10 +426,15 @@ public function display_configuration_required_warning() {
*
* The Gmail API used to be a separate plugin which was registered when that plugin
* was loaded. But now both the SMTP, Gmail API and other transports are registered here.
*
* @since 2.0.25 require `PostmanAdminController.php` if not exists.
* @param mixed $pluginData
*/
private function registerTransports( $rootPluginFilenameAndPath ) {

if( !class_exists( 'PostmanAdminController' ) ) {
require_once 'PostmanAdminController.php';
}

$postman_transport_registry = PostmanTransportRegistry::getInstance();

$postman_transport_registry->registerTransport( new PostmanDefaultModuleTransport( $rootPluginFilenameAndPath ) );
Expand Down
8 changes: 4 additions & 4 deletions Postman/PostmanViewController.php
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,8 @@ private function printDeliveryDetails() {
*/
public static function outputChildPageHeader( $title, $slug = '' ) {
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">';
printf( '<div id="postman-main-menu" class="post-smtp-welcome-panel %s">', $slug );
print '<div class="post-smtp-welcome-panel-content">';
print '<div class="welcome-panel-column-container">';
print '<div class="welcome-panel-column welcome-panel-last">';
printf( '<h4>%s</h4>', $title );
Expand Down Expand Up @@ -328,8 +328,8 @@ private function displayTopNavigation() {
//include_once POST_SMTP_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 id="postman-main-menu" class="post-smtp-welcome-panel">';
print '<div class="post-smtp-welcome-panel-content">';
print '<div class="welcome-panel-column-container" style="display: flex; flex-wrap: wrap; justify-content: space-around; align-items: flex-start;">';
print '<div class="ps-welcome-panel-column">';
printf( '<h4>%s</h4>', __( 'Configuration', 'post-smtp' ) );
Expand Down
9 changes: 9 additions & 0 deletions Postman/PostmanWpMailBinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,22 @@ private function replacePluggableFunctionWpMail() {
* Optional. Additional headers.
* @param string|array $attachments
* Optional. Files to attach.
* @since 2.0.25 @action `wp_mail_succeeded` added.
* @return bool Whether the email contents were sent successfully.
*/
function wp_mail($to, $subject, $message, $headers = '', $attachments = array()) {
// create an instance of PostmanWpMail to send the message
$postmanWpMail = new PostmanWpMail ();
// send the mail

$mail_data = compact( 'to', 'subject', 'message', 'headers', 'attachments' );

$result = $postmanWpMail->send ( $to, $subject, $message, $headers, $attachments );

if( $result ) {
do_action( 'wp_mail_succeeded', $mail_data );
}

// return the result
return $result;
}
Expand Down
4 changes: 2 additions & 2 deletions postman-smtp.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Plugin Name: Post SMTP
* Plugin URI: https://wordpress.org/plugins/post-smtp/
* Description: Email not reliable? Post SMTP is the first and only WordPress SMTP plugin to implement OAuth 2.0 for Gmail, Hotmail and Yahoo Mail. Setup is a breeze with the Configuration Wizard and integrated Port Tester. Enjoy worry-free delivery even if your password changes!
* Version: 2.0.24
* Version: 2.0.25
* Author: Post SMTP
* Text Domain: post-smtp
* Author URI: https://postmansmtp.com
Expand Down Expand Up @@ -35,7 +35,7 @@
define( 'POST_SMTP_BASE', __FILE__ );
define( 'POST_SMTP_PATH', __DIR__ );
define( 'POST_SMTP_URL', plugins_url('', POST_SMTP_BASE ) );
define( 'POST_SMTP_VER', '2.0.24' );
define( 'POST_SMTP_VER', '2.0.25' );
define( 'POST_SMTP_SHOW_RELEASE_MESSAGE', true );
define( 'POST_SMTP_RELEASE_MESSAGE', "THE FUTURE OF Post SMTP - PLEASE READ!" );
define( 'POST_SMTP_RELEASE_URL', 'https://postmansmtp.com/the-future-of-post-smtp/' );
Expand Down
12 changes: 12 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,18 @@ To avoid being flagged as spam, you need to prove your email isn't forged. On a

== Changelog ==

= 2.0.25 =
* **Bug Fixes**
* WP 5.9 Compatibility Ballon UI issue.
* Uncaught Error: Class ‘PostmanAdminController’ not found.
* Ajax error appearing due to Google API depreciated function.

* **Improvements**
* Code Optimization.
* MIME version added to test mails to prevent emails from spam.
* NEW Filter `postman_test_email_args` added to modify test email arguments.
* NEW Action `wp_mail_succeeded` added to exectue on every success email delivery.

= 2.0.24 - 2022-02-13
* Update: THE FUTURE OF Post SMTP - https://postmansmtp.com/the-future-of-post-smtp/

Expand Down
9 changes: 7 additions & 2 deletions style/postman.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
border-radius: 5px;
}

.welcome-panel-content {
width: 100%;
.post-smtp-welcome-panel-content {
width: 100%;
padding: 10px 0;
}

#postman-main-menu.welcome-panel {
Expand Down Expand Up @@ -135,6 +136,10 @@ p#back_to_main_menu {
background: url(images/badge.png) no-repeat;
}

.post-smtp-welcome-panel {
background: #fff;
}


@keyframes pulse {
0% {
Expand Down

0 comments on commit 0d0f410

Please sign in to comment.