diff options
-rw-r--r-- | Postman/Extensions/Admin/PostmanAdminView.php | 4 | ||||
-rw-r--r-- | Postman/Extensions/Core/Notifications/PostmanPushoverNotify.php | 2 | ||||
-rw-r--r-- | Postman/Extensions/Core/Notifications/PostmanSlackNotify.php | 2 | ||||
-rw-r--r-- | Postman/Extensions/License/PostmanLicenseHandler.php | 55 | ||||
-rw-r--r-- | Postman/Extensions/License/PostmanLicenseManager.php | 4 | ||||
-rw-r--r-- | Postman/Phpmailer/PostsmtpMailer.php | 9 | ||||
-rw-r--r-- | Postman/Postman-Controller/PostmanWelcomeController.php | 5 | ||||
-rw-r--r-- | Postman/Postman-Email-Log/PostmanEmailLogController.php | 6 | ||||
-rw-r--r-- | Postman/Postman-Mail/PostmanWooCommerce.php | 118 | ||||
-rw-r--r-- | Postman/Postman-Mail/mailgun/vendor/symfony/options-resolver/OptionsResolver.php | 6 | ||||
-rw-r--r-- | Postman/PostmanInstaller.php | 3 | ||||
-rw-r--r-- | postman-smtp.php | 4 | ||||
-rw-r--r-- | readme.txt | 10 |
13 files changed, 100 insertions, 128 deletions
diff --git a/Postman/Extensions/Admin/PostmanAdminView.php b/Postman/Extensions/Admin/PostmanAdminView.php index af66fcb..428ee17 100644 --- a/Postman/Extensions/Admin/PostmanAdminView.php +++ b/Postman/Extensions/Admin/PostmanAdminView.php @@ -75,6 +75,10 @@ <button type="submit" name="post_smtp_extension[<?php echo $short_name; ?>_activate]" class="button button-primary">Activate</button> <?php endif; ?> + <?php if ( $license_data->license === 'expired' ) : ?> + <a href="<?php echo $license_data->renew_url; ?>" target="_blank" class="button button-primary">Renew License</a> + <?php endif; ?> + <button type="submit" name="post_smtp_extension[<?php echo $short_name; ?>_deactivate]" class="button button-secondary">Deactivate</button> </div> </div> diff --git a/Postman/Extensions/Core/Notifications/PostmanPushoverNotify.php b/Postman/Extensions/Core/Notifications/PostmanPushoverNotify.php index c1f2661..bc1e95d 100644 --- a/Postman/Extensions/Core/Notifications/PostmanPushoverNotify.php +++ b/Postman/Extensions/Core/Notifications/PostmanPushoverNotify.php @@ -31,4 +31,4 @@ class PostmanPushoverNotify implements Postman_Notify { error_log( __CLASS__ . ': ' . print_r( $body, true ) ); } } -} +}
\ No newline at end of file diff --git a/Postman/Extensions/Core/Notifications/PostmanSlackNotify.php b/Postman/Extensions/Core/Notifications/PostmanSlackNotify.php index 3e482a8..1da009a 100644 --- a/Postman/Extensions/Core/Notifications/PostmanSlackNotify.php +++ b/Postman/Extensions/Core/Notifications/PostmanSlackNotify.php @@ -37,4 +37,4 @@ class PostmanSlackNotify implements Postman_Notify { error_log( __CLASS__ . ': ' . $message ); } } -}
\ No newline at end of file +} diff --git a/Postman/Extensions/License/PostmanLicenseHandler.php b/Postman/Extensions/License/PostmanLicenseHandler.php index b24aa14..e144951 100644 --- a/Postman/Extensions/License/PostmanLicenseHandler.php +++ b/Postman/Extensions/License/PostmanLicenseHandler.php @@ -7,6 +7,9 @@ if ( ! class_exists( 'PostmanLicenseHandler' ) ) : class PostmanLicenseHandler { + + const DAYS_TO_ALERT = array( 30, 14, 7, 1); + private $file; private $license; private $license_data; @@ -81,7 +84,6 @@ class PostmanLicenseHandler { add_action( 'init', array( $this, 'cron' ), 20 ); - // Check that license is valid once per week add_action( 'admin_init', array( $this, 'validate_license' ) ); // Updater @@ -241,9 +243,9 @@ class PostmanLicenseHandler { set_site_transient( 'update_plugins', null ); // Decode license data - $license_data = json_decode( wp_remote_retrieve_body( $response ) ); + $this->license_data = json_decode( wp_remote_retrieve_body( $response ) ); - update_option( $this->item_shortname . '_license_active', $license_data ); + update_option( $this->item_shortname . '_license_active', $this->license_data ); update_option( $this->item_shortname . '_license_key', $license ); $slug = plugin_basename($this->file); @@ -307,7 +309,7 @@ class PostmanLicenseHandler { } // Decode the license data - $license_data = json_decode( wp_remote_retrieve_body( $response ) ); + $this->license_data = json_decode( wp_remote_retrieve_body( $response ) ); delete_option( $this->item_shortname . '_license_active' ); delete_option( $this->item_shortname . '_license_key' ); @@ -323,6 +325,39 @@ class PostmanLicenseHandler { set_transient( $this->item_shortname . '_cron', true, rand( 12, 48 ) * HOUR_IN_SECONDS ); } + + $license_data = $this->license_data; + + $datetime1 = new DateTime(); + $datetime2 = new DateTime( $license_data->expires ); + + foreach ( self::DAYS_TO_ALERT as $day_to_alert ) { + + $interval = $datetime1->diff($datetime2); + if( $interval->days == $day_to_alert ){ + add_action( 'admin_notices', function () use ( $day_to_alert, $license_data ) { + echo $this->item_name . ' is about to expire in ' . $day_to_alert . ' days: ' . $license_data->expires; + }); + + return; + } + + if ( $interval->days == 0 ) { + add_action( 'admin_notices', function () use ( $license_data ) { + echo $this->item_name . ' license expire today at: ' . $license_data->expires; + }); + + return; + } + } + + if ( $license_data->activations_left == 0 ) { + add_action( 'admin_notices', function () use ( $license_data ) { + echo $this->item_name . ' has no activations'; + }); + + return; + } } @@ -357,10 +392,18 @@ class PostmanLicenseHandler { return false; } - $license_data = json_decode( wp_remote_retrieve_body( $response ) ); + if ( wp_remote_retrieve_response_code( $response ) !== 200 ) { + return false; + } + + $this->license_data = json_decode( wp_remote_retrieve_body( $response ) ); - update_option( $this->item_shortname . '_license_active', $license_data ); + update_option( $this->item_shortname . '_license_active', $this->license_data ); + + } + private function get_license_data() { + return get_option( $this->item_shortname . '_license_active' ); } diff --git a/Postman/Extensions/License/PostmanLicenseManager.php b/Postman/Extensions/License/PostmanLicenseManager.php index cb10852..a25f092 100644 --- a/Postman/Extensions/License/PostmanLicenseManager.php +++ b/Postman/Extensions/License/PostmanLicenseManager.php @@ -3,7 +3,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; class PostmanLicenseManager { - const ENDPOINT = 'https://postmansmtp.com'; + const ENDPOINT = 'https://postmansmtpcom-staging.dxpsites.net'; const CORE_EXTENSIONS = [ 'gmail_api', 'sendgrid_api', 'mandrill_api', 'mailgun_api' ]; @@ -97,4 +97,4 @@ class PostmanLicenseManager { public function get_extensions() { return $this->extensions; } -} +}
\ No newline at end of file diff --git a/Postman/Phpmailer/PostsmtpMailer.php b/Postman/Phpmailer/PostsmtpMailer.php index c7587bb..91f5122 100644 --- a/Postman/Phpmailer/PostsmtpMailer.php +++ b/Postman/Phpmailer/PostsmtpMailer.php @@ -4,9 +4,14 @@ if ( ! defined( 'ABSPATH' ) ) { } if ( ! class_exists( 'PHPMailer', false ) ) { - require_once ABSPATH . WPINC . '/class-phpmailer.php'; + require_once ABSPATH . WPINC . '/PHPMailer/PHPMailer.php'; + require_once ABSPATH . WPINC . '/PHPMailer/SMTP.php'; + require_once ABSPATH . WPINC . '/PHPMailer/Exception.php'; } +use PHPMailer\PHPMailer\PHPMailer; +use PHPMailer\PHPMailer\Exception; + add_action('plugins_loaded', function() { global $phpmailer; @@ -120,7 +125,7 @@ class PostsmtpMailer extends PHPMailer { return $result; - } catch (phpmailerException $exc) { + } catch (Exception $exc) { $this->error = $exc; diff --git a/Postman/Postman-Controller/PostmanWelcomeController.php b/Postman/Postman-Controller/PostmanWelcomeController.php index e37d3e8..a7c62bf 100644 --- a/Postman/Postman-Controller/PostmanWelcomeController.php +++ b/Postman/Postman-Controller/PostmanWelcomeController.php @@ -189,11 +189,6 @@ class PostmanWelcomeController { <h4 class="wp-people-group"><?php esc_html_e( 'Project Leaders', 'post-smtp' ); ?></h4> <ul class="wp-people-group " id="wp-people-group-project-leaders"> - <li class="wp-person" id="wp-person-jasonhendriks"> - <a href="https://profiles.wordpress.org/jasonhendriks"><img src="https://secure.gravatar.com/avatar/8692c7b6084517a592f6cad107f7bcb0?s=60&d=mm&r=g" class="gravatar" alt="Jason Hendriks " /></a> - <a class="web" href="http://profiles.wordpress.org/matt">Jason Hendriks</a> - <span class="title"><?php esc_html_e( 'Founding Developer (abandoned)', 'post-smtp' ); ?></span> - </li> <li class="wp-person" id="wp-person-yehudah"> <a href="http://profiles.wordpress.org/yehudah"><img src="https://secure.gravatar.com/avatar/c561638d04ea8fef351f974dbb9ece39?s=60&d=mm&r=g" class="gravatar" alt="Yehuda Hassine" /></a> <a class="web" href="http://profiles.wordpress.org/yehudah">Yehuda Hassine</a> diff --git a/Postman/Postman-Email-Log/PostmanEmailLogController.php b/Postman/Postman-Email-Log/PostmanEmailLogController.php index a6e5179..e94eb43 100644 --- a/Postman/Postman-Email-Log/PostmanEmailLogController.php +++ b/Postman/Postman-Email-Log/PostmanEmailLogController.php @@ -97,14 +97,20 @@ class PostmanEmailLogController { $fp = fopen('php://output', 'wb'); $headers = array_keys( PostmanLogFields::get_instance()->get_fields() ); + $headers[] = 'delivery_time'; + fputcsv($fp, $headers); + $date_format = get_option( 'date_format' ); + $time_format = get_option( 'time_format' ); + foreach ( $logs->posts as $log ) { $meta = PostmanLogFields::get_instance()->get($log->ID); $data = []; foreach ( $meta as $header => $line ) { $data[] = $line[0]; } + $data[] = date( "$date_format $time_format", strtotime( $log->post_date ) ); fputcsv($fp, $data); } diff --git a/Postman/Postman-Mail/PostmanWooCommerce.php b/Postman/Postman-Mail/PostmanWooCommerce.php index 1768881..e53f373 100644 --- a/Postman/Postman-Mail/PostmanWooCommerce.php +++ b/Postman/Postman-Mail/PostmanWooCommerce.php @@ -29,32 +29,12 @@ if ( ! class_exists( 'PostmanWoocommerce' ) ) { public function overide_email_settings( $settings ) { - return array( + $key = $this->find_woocommerce_email_from_address( $settings ); - array( 'title' => __( 'Email notifications', 'post-smtp' ), 'desc' => __( 'Email notifications sent from WooCommerce are listed below. Click on an email to configure it.', 'post-smtp' ), 'type' => 'title', 'id' => 'email_notification_settings' ), - - array( 'type' => 'email_notification' ), - - array( 'type' => 'sectionend', 'id' => 'email_notification_settings' ), - - array( 'type' => 'sectionend', 'id' => 'email_recipient_options' ), - - array( 'title' => __( 'Email sender options', 'post-smtp' ), 'type' => 'title', 'desc' => '', 'id' => 'email_options' ), - - array( - 'title' => __( '"From" name', 'post-smtp' ), - 'desc' => __( 'How the sender name appears in outgoing WooCommerce emails.', 'post-smtp' ), - 'id' => 'woocommerce_email_from_name', - 'type' => 'text', - 'css' => 'min-width:300px;', - 'default' => esc_attr( get_bloginfo( 'name', 'display' ) ), - 'autoload' => false, - 'desc_tip' => true, - ), - - array( + if ( $key ) { + $settings[$key] = array( 'title' => __( '"From" address', 'post-smtp' ), - 'desc' => __( 'This is overided by the account configured on Post SMTP plugin configuration.', 'post-smtp' ), + 'desc' => __( 'This is override by the account configured on Post SMTP plugin configuration.', 'post-smtp' ), 'id' => 'woocommerce_email_from_address', 'type' => 'email', 'custom_attributes' => array( @@ -65,88 +45,20 @@ if ( ! class_exists( 'PostmanWoocommerce' ) ) { 'default' => $this->options->getMessageSenderEmail(), 'autoload' => false, 'desc_tip' => true, - ), - - array( 'type' => 'sectionend', 'id' => 'email_options' ), + ); + } - array( 'title' => __( 'Email template', 'post-smtp' ), 'type' => 'title', 'desc' => sprintf( __( 'This section lets you customize the WooCommerce emails. <a href="%s" target="_blank">Click here to preview your email template</a>.', 'post-smtp' ), wp_nonce_url( admin_url( '?preview_woocommerce_mail=true' ), 'preview-mail' ) ), 'id' => 'email_template_options' ), - - array( - 'title' => __( 'Header image', 'post-smtp' ), - 'desc' => __( 'URL to an image you want to show in the email header. Upload images using the media uploader (Admin > Media).', 'post-smtp' ), - 'id' => 'woocommerce_email_header_image', - 'type' => 'text', - 'css' => 'min-width:300px;', - 'placeholder' => __( 'N/A', 'post-smtp' ), - 'default' => '', - 'autoload' => false, - 'desc_tip' => true, - ), - - array( - 'title' => __( 'Footer text', 'post-smtp' ), - 'desc' => __( 'The text to appear in the footer of WooCommerce emails.', 'post-smtp' ), - 'id' => 'woocommerce_email_footer_text', - 'css' => 'width:300px; height: 75px;', - 'placeholder' => __( 'N/A', 'post-smtp' ), - 'type' => 'textarea', - /* translators: %s: site name */ - 'default' => get_bloginfo( 'name', 'display' ), - 'autoload' => false, - 'desc_tip' => true, - ), - - array( - 'title' => __( 'Base color', 'post-smtp' ), - /* translators: %s: default color */ - 'desc' => sprintf( __( 'The base color for WooCommerce email templates. Default %s.', 'post-smtp' ), '<code>#96588a</code>' ), - 'id' => 'woocommerce_email_base_color', - 'type' => 'color', - 'css' => 'width:6em;', - 'default' => '#96588a', - 'autoload' => false, - 'desc_tip' => true, - ), - - array( - 'title' => __( 'Background color', 'post-smtp' ), - /* translators: %s: default color */ - 'desc' => sprintf( __( 'The background color for WooCommerce email templates. Default %s.', 'post-smtp' ), '<code>#f7f7f7</code>' ), - 'id' => 'woocommerce_email_background_color', - 'type' => 'color', - 'css' => 'width:6em;', - 'default' => '#f7f7f7', - 'autoload' => false, - 'desc_tip' => true, - ), - - array( - 'title' => __( 'Body background color', 'post-smtp' ), - /* translators: %s: default color */ - 'desc' => sprintf( __( 'The main body background color. Default %s.', 'post-smtp' ), '<code>#ffffff</code>' ), - 'id' => 'woocommerce_email_body_background_color', - 'type' => 'color', - 'css' => 'width:6em;', - 'default' => '#ffffff', - 'autoload' => false, - 'desc_tip' => true, - ), - - array( - 'title' => __( 'Body text color', 'post-smtp' ), - /* translators: %s: default color */ - 'desc' => sprintf( __( 'The main body text color. Default %s.', 'post-smtp' ), '<code>#3c3c3c</code>' ), - 'id' => 'woocommerce_email_text_color', - 'type' => 'color', - 'css' => 'width:6em;', - 'default' => '#3c3c3c', - 'autoload' => false, - 'desc_tip' => true, - ), + return $settings; + } - array( 'type' => 'sectionend', 'id' => 'email_template_options' ), + private function find_woocommerce_email_from_address($settings) { + foreach ( $settings as $key => $data ) { + if ( isset( $data['id'] ) && $data['id'] == 'woocommerce_email_from_address' ) { + return $key; + } + } - ); + return false; } } }
\ No newline at end of file diff --git a/Postman/Postman-Mail/mailgun/vendor/symfony/options-resolver/OptionsResolver.php b/Postman/Postman-Mail/mailgun/vendor/symfony/options-resolver/OptionsResolver.php index f5b84f0..18b4488 100644 --- a/Postman/Postman-Mail/mailgun/vendor/symfony/options-resolver/OptionsResolver.php +++ b/Postman/Postman-Mail/mailgun/vendor/symfony/options-resolver/OptionsResolver.php @@ -103,7 +103,7 @@ class OptionsResolver implements Options * * The closure will be evaluated when {@link resolve()} is called. The * closure has access to the resolved values of other options through the - * passed {@link Options} instance: + * passed {@link Admin} instance: * * function (Options $options) { * if (isset($options['port'])) { @@ -120,7 +120,7 @@ class OptionsResolver implements Options * // 'Default Name' === $previousValue * }); * - * This is mostly useful if the configuration of the {@link Options} object + * This is mostly useful if the configuration of the {@link Admin} object * is spread across different locations of your code, such as base and * sub-classes. * @@ -361,7 +361,7 @@ class OptionsResolver implements Options * * The closure is invoked when {@link resolve()} is called. The closure * has access to the resolved values of other options through the passed - * {@link Options} instance. + * {@link Admin} instance. * * The second parameter passed to the closure is the value of * the option. diff --git a/Postman/PostmanInstaller.php b/Postman/PostmanInstaller.php index 01c6a07..ee36435 100644 --- a/Postman/PostmanInstaller.php +++ b/Postman/PostmanInstaller.php @@ -77,7 +77,8 @@ class PostmanInstaller { // Bail if activating from network, or bulk if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { - return; } + return; + } // Add the transient to redirect //set_transient( '_post_activation_redirect', true, 30 ); diff --git a/postman-smtp.php b/postman-smtp.php index 7502746..9868686 100644 --- a/postman-smtp.php +++ b/postman-smtp.php @@ -6,7 +6,7 @@ if ( ! defined( 'ABSPATH' ) ) { * 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.12 + * Version: 2.0.13 * Author: Yehuda Hassine * Text Domain: post-smtp * Author URI: https://postmansmtp.com @@ -35,7 +35,7 @@ if ( ! defined( 'ABSPATH' ) ) { 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.12' ); +define( 'POST_SMTP_VER', '2.0.13' ); define( 'POST_SMTP_SHOW_RELEASE_MESSAGE', true ); define( 'POST_SMTP_RELEASE_MESSAGE', "I have released a new Google Analytics AIO plugin, if you liked it please leave a review." ); define( 'POST_SMTP_RELEASE_URL', 'https://wordpress.org/plugins/metrics-query/' ); @@ -3,8 +3,8 @@ Contributors: yehudah Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=yehuda@myinbox.in&item_name=Donation+for+PostSMTP 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: 5.4.1 -Stable tag: 2.0.12 +Tested up to: 5.5 +Stable tag: 2.0.13 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -281,6 +281,12 @@ To avoid being flagged as spam, you need to prove your email isn't forged. On a == Changelog == += 2.0.13 - 2020-08-11 +* Fixed: WordPress 5.5 compatibility +* Fixed: Email log filtering +* Fixed: Pushover notifications +* New: Suggest solution for email delivery errors + = 2.0.12 - 2020-05-18 * Updated: Readme file info |