diff options
author | yehudah <yehudah@b8457f37-d9ea-0310-8a92-e5e31aec5664> | 2018-04-23 21:12:54 +0000 |
---|---|---|
committer | yehudah <yehudah@b8457f37-d9ea-0310-8a92-e5e31aec5664> | 2018-04-23 21:12:54 +0000 |
commit | ab8b46da49e1b2da2710b5c69c7b411d30138ead (patch) | |
tree | 0fb99285d3a2d39783b28509eccb2a25fdbfbd04 | |
parent | ad292885dc7b4c9a070a1c49d8b8e50c741a19db (diff) | |
download | Post-SMTP-ab8b46da49e1b2da2710b5c69c7b411d30138ead.zip |
* Fix lockfile erros
* Contact form 7 integration
* PHP 5.6 requirement
git-svn-id: https://plugins.svn.wordpress.org/post-smtp/trunk@1863201 b8457f37-d9ea-0310-8a92-e5e31aec5664
-rw-r--r-- | Postman/Postman-Mail/PostmanMailgunMailEngine.php | 6 | ||||
-rw-r--r-- | Postman/Postman-Mail/PostmanSendGridMailEngine.php | 8 | ||||
-rw-r--r-- | Postman/Postman.php | 7 | ||||
-rw-r--r-- | Postman/PostmanUtils.php | 3 | ||||
-rw-r--r-- | Postman/PostmanViewController.php | 4 | ||||
-rw-r--r-- | postman-smtp.php | 33 | ||||
-rw-r--r-- | readme.txt | 13 | ||||
-rw-r--r-- | style/testEmail.html | 2 |
8 files changed, 58 insertions, 18 deletions
diff --git a/Postman/Postman-Mail/PostmanMailgunMailEngine.php b/Postman/Postman-Mail/PostmanMailgunMailEngine.php index 58def41..8258022 100644 --- a/Postman/Postman-Mail/PostmanMailgunMailEngine.php +++ b/Postman/Postman-Mail/PostmanMailgunMailEngine.php @@ -20,7 +20,7 @@ if ( ! class_exists( 'PostmanMailgunMailEngine' ) ) { private $apiKey; private $domainName; - private $mandrillMessage; + private $mailgunMessage; /** * @@ -153,7 +153,7 @@ if ( ! class_exists( 'PostmanMailgunMailEngine' ) ) { $result = array(); try { if ( $this->logger->isDebug() ) { - $this->logger->debug( 'Creating Mandrill service with apiKey=' . $this->apiKey ); + $this->logger->debug( 'Creating Mailgun service with apiKey=' . $this->apiKey ); } // send the message @@ -184,7 +184,7 @@ if ( ! class_exists( 'PostmanMailgunMailEngine' ) ) { private function processSend( $mg ) { - if ( count( $this->mailgunMessage['to'] ) == 1 ) { + if ( count( $this->mailgunMessage['to'] ) <= 1 ) { return $mg->messages()->send( $this->domainName, array_filter( $this->mailgunMessage ) ); } else { diff --git a/Postman/Postman-Mail/PostmanSendGridMailEngine.php b/Postman/Postman-Mail/PostmanSendGridMailEngine.php index 28e3c83..eaa5b69 100644 --- a/Postman/Postman-Mail/PostmanSendGridMailEngine.php +++ b/Postman/Postman-Mail/PostmanSendGridMailEngine.php @@ -188,14 +188,16 @@ if ( ! class_exists( 'PostmanSendGridMailEngine' ) ) { $response_body = json_decode( $response->body() ); - if ( isset( $response_body->errors[0]->message ) ) { - $this->transcript = $response_body->errors[0]->message; + if ( isset( $response_body->errors[0]->message ) || $response->statusCode() != 200 ) { + + $e = $response->statusCode() != 200 ? sprintf( __( 'ERROR: Status code is %1$s', Postman::TEXT_DOMAIN ), $response->statusCode() ) : $response_body->errors[0]->message; + $this->transcript = $e; $this->transcript .= PostmanModuleTransport::RAW_MESSAGE_FOLLOWS; $this->transcript .= print_r( $mail, true ); $this->logger->debug( 'Transcript=' . $this->transcript ); - throw new Exception( $response_body->errors[0]->message ); + throw new Exception( $e ); } $this->transcript = print_r( $response->body(), true ); $this->transcript .= PostmanModuleTransport::RAW_MESSAGE_FOLLOWS; diff --git a/Postman/Postman.php b/Postman/Postman.php index 7df883a..ba639e3 100644 --- a/Postman/Postman.php +++ b/Postman/Postman.php @@ -54,6 +54,7 @@ class Postman { require_once 'PostmanConfigTextHelper.php'; require_once 'Postman-Email-Log/PostmanEmailLogPostType.php'; require_once 'Postman-Mail/PostmanMyMailConnector.php'; + require_once 'Postman-Mail/PostmanContactForm7.php'; //require_once 'Postman-Mail/PostmanWooCommerce.php'; // get plugin metadata - alternative to get_plugin_data @@ -106,6 +107,9 @@ class Postman { // MyMail integration new PostmanMyMailConnector( $rootPluginFilenameAndPath ); + // Contact form 7 + new Postsmtp_ContactForm7; + // WooCommerce Integration //new PostmanWoocommerce(); @@ -153,6 +157,7 @@ class Postman { $this, 'on_deactivation', ) ); + } public function post_smtp_wpml_admin_notice() { @@ -426,7 +431,7 @@ class Postman { // because __FILE__ returns the wrong path if the plugin is installed as a symlink $shortLocale = substr( get_locale(), 0, 2 ); if ( $shortLocale != 'en' ) { - $langDir = 'postman-smtp/Postman/languages'; + $langDir = 'post-smtp/Postman/languages'; $success = load_plugin_textdomain( Postman::TEXT_DOMAIN, false, $langDir ); if ( $this->logger->isDebug() ) { if ( $success ) { diff --git a/Postman/PostmanUtils.php b/Postman/PostmanUtils.php index b70b2b8..7eaebe5 100644 --- a/Postman/PostmanUtils.php +++ b/Postman/PostmanUtils.php @@ -243,6 +243,9 @@ class PostmanUtils { return $success; } static function createLockFile( $tempDirectory = null ) { + if ( self::lockFileExists() ) { + self::deleteLockFile(); + } $path = PostmanUtils::calculateTemporaryLockPath( $tempDirectory ); $success = @fopen( $path, 'xb' ); if ( PostmanUtils::$logger->isTrace() ) { diff --git a/Postman/PostmanViewController.php b/Postman/PostmanViewController.php index 49388f3..5fb8cb1 100644 --- a/Postman/PostmanViewController.php +++ b/Postman/PostmanViewController.php @@ -57,7 +57,7 @@ if ( ! class_exists( 'PostmanViewController' ) ) { die(); } - echo PostmanUtils::deleteLockFile() == true ? __('Success', Postman::TEXT_DOMAIN ) : __('Failed, try again.', Postman::TEXT_DOMAIN ); + echo PostmanUtils::deleteLockFile() == true ? __('Success, try to send test email.', Postman::TEXT_DOMAIN ) : __('Failed, try again.', Postman::TEXT_DOMAIN ); die(); } @@ -307,7 +307,7 @@ if ( ! class_exists( 'PostmanViewController' ) ) { echo ' <div class="updated settings-error notice is-dismissible"> <p> - <strong>Version ' . $version . ' released with Gmail upgrade and notifications:</strong> <a target="_blank" href="https://postmansmtp.com/post-smtp-1-8-4-best-wordpress-gmail-client">Read Here</a> + <strong>Version ' . $version . ' released with lockfile fix and new PHP requirement:</strong> <a target="_blank" href="https://postmansmtp.com/post-smtp-v1-8-6-lockfile-and-raise-the-php-version">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> diff --git a/postman-smtp.php b/postman-smtp.php index 29ea419..dba2fe8 100644 --- a/postman-smtp.php +++ b/postman-smtp.php @@ -4,7 +4,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: 1.8.5 + * Version: 1.8.6 * Author: Jason Hendriks, Yehuda Hassine * Text Domain: post-smtp * Author URI: https://postmansmtp.com @@ -38,9 +38,20 @@ define( 'POST_BASE', __FILE__ ); define( 'POST_PATH', __DIR__ ); -if ( in_array( 'postman-smtp/postman-smtp.php', (array) get_option( 'active_plugins', array() ) ) ) { +$postman_smtp_exist = in_array( 'postman-smtp/postman-smtp.php', (array) get_option( 'active_plugins', array() ) ); +$required_php_version = version_compare(PHP_VERSION, '5.6.0', '<'); + +if ( $postman_smtp_exist || $required_php_version ) { add_action( 'admin_init', 'post_smtp_plugin_deactivate' ); - add_action( 'admin_notices', 'post_smtp_plugin_admin_notice' ); + + if ( $postman_smtp_exist ) { + add_action( 'admin_notices', 'post_smtp_plugin_admin_notice' ); + } + + if ( $required_php_version ) { + add_action( 'admin_notices', 'post_smtp_plugin_admin_notice_version' ); + } + } else { post_start( memory_get_usage() ); } @@ -50,6 +61,20 @@ function post_smtp_plugin_deactivate() { deactivate_plugins( plugin_basename( __FILE__ ) ); } +function post_smtp_plugin_admin_notice_version() { + echo '<div class="error"> + <p> + <strong>Post SMTP</strong> plugin require at least PHP version 5.6, contact to your web hostig support to upgrade. + </p> + <p> + <a href="https://secure.php.net/supported-versions.php">See supported versions on PHP.net</a> + </p> + </div>'; + + if ( isset( $_GET['activate'] ) ) { + unset( $_GET['activate'] ); } +} + function post_smtp_plugin_admin_notice() { echo '<div class="error"><p><strong>Post SMTP</strong> plugin is a fork (twin brother) of the original Postman SMTP, you must disable Postman SMTP to use this plugin.</p></div>'; @@ -99,5 +124,5 @@ function post_start( $startingMemory ) { */ function post_setupPostman() { require_once 'Postman/Postman.php'; - $kevinCostner = new Postman( __FILE__, '1.8.5' ); + $kevinCostner = new Postman( __FILE__, '1.8.6' ); } @@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=yehuda@m Tags: postman smtp, postman, smtp, email, mail, mailer, email log, oauth2, gmail, google apps, hotmail, yahoo, mandrill api, sendgrid api, elastic email, office365, mailgun Requires at least: 3.9 Tested up to: 4.9.5 -Stable tag: 1.8.5 +Stable tag: 1.8.6 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -12,8 +12,8 @@ Send, log and troubleshoot your Outgoing Email easily. Supports everything: SMTP == Description == -= Version 1.8.5 released = -Making Post SMTP the best Gmail client for WordPress, and a notification feature for failed emails. [Read the detailes here](https://postmansmtp.com/post-smtp-1-8-4-best-wordpress-gmail-client/) += Version 1.8.6 released = +Lockfile, Contact form 7 and raise the PHP version. [Read the detailes here](https://postmansmtp.com/post-smtp-v1-8-6-lockfile-and-raise-the-php-version/) = WordPress Mail SMTP Plugin = @@ -81,7 +81,7 @@ SendGrid has a free SMTP plan that you can use to send up to 100 emails per day. * .. and every other plugin that uses the WordPress API [wp_mail](https://codex.wordpress.org/Function_Reference/wp_mail) to send mail! = Requirements = -* WordPress 3.9 and PHP 5.2 with SPL and iconv +* WordPress 3.9 and PHP 5.6 with SPL and iconv * Memory: 750KiB per process at idle * Reliable mail delivery with custom email domains requires an SPF record * Reliable SMTP delivery requires credentials with an email service provider @@ -297,6 +297,11 @@ To avoid being flagged as spam, you need to prove your email isn't forged. On a == Changelog == += 1.8.6 - 2018-04-24 +* Fix lockfile erros +* Contact form 7 integration +* PHP 5.6 requirement + = 1.8.5 - 2018-04-19 * Remove Beta Woocommerce integration * Better check for WPML less then version 3.9 diff --git a/style/testEmail.html b/style/testEmail.html index 3f41ea9..544b0e6 100644 --- a/style/testEmail.html +++ b/style/testEmail.html @@ -25,7 +25,7 @@ <div style="max-width: 600px; height: 400px; margin: 0 auto; overflow: hidden;background-image:url('http://plugins.svn.wordpress.org/postman-smtp/assets/email/poofytoo.png');background-repeat: no-repeat;"> <div style="margin:50px 0 0 300px; width:300px; font-size:2em;">Hello! - 你好 - Bonjour! - नमस्ते - ¡Hola! - Olá - Привет! - 今日は</div> - <div style="text-align:right;font-size: 1.4em; color:black;margin:150px 0 0 200px;">Sent by <em>Postman</em> v1.5.6<br/><span style="font-size: 0.8em"><a style="color:#3f73b9" href="https://wordpress.org/plugins/postman-smtp/">https://wordpress.org/plugins/postman-smtp/</a></span></div> + <div style="text-align:right;font-size: 1.4em; color:black;margin:150px 0 0 200px;">Sent by <em>Postman</em> v1.5.6<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></div> </div> </td> </tr> |