WP Mail SMTP by WPForms - Version 1.2.3

Version Description

  • 2018-01-22 =
  • Fixed: Gmail tokens were reset after clicking Save Settings.
  • Fixed: Slight typo in Gmail success message.
Download this release

Release Info

Developer slaFFik
Plugin Icon 128x128 WP Mail SMTP by WPForms
Version 1.2.3
Comparing to
See all releases

Code changes from version 1.2.2 to 1.2.3

languages/wp-mail-smtp.pot CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2017 WP Mail SMTP
2
  # This file is distributed under the same license as the WP Mail SMTP package.
3
  msgid ""
4
  msgstr ""
@@ -215,7 +215,7 @@ msgid "There was an error while processing the authentication request. Please ma
215
  msgstr ""
216
 
217
  #: src/Admin/Area.php:111
218
- msgid "You have successfully linked the current site with you Google API project. Now you can start sending emails through Google."
219
  msgstr ""
220
 
221
  #: src/Admin/Area.php:126
1
+ # Copyright (C) 2018 WP Mail SMTP
2
  # This file is distributed under the same license as the WP Mail SMTP package.
3
  msgid ""
4
  msgstr ""
215
  msgstr ""
216
 
217
  #: src/Admin/Area.php:111
218
+ msgid "You have successfully linked the current site with your Google API project. Now you can start sending emails through Google."
219
  msgstr ""
220
 
221
  #: src/Admin/Area.php:126
readme.txt CHANGED
@@ -146,6 +146,10 @@ By all means please contact us to discuss features or options you'd like to see
146
 
147
  == Changelog ==
148
 
 
 
 
 
149
  = 1.2.2 - 2017-12-27 =
150
  * Fixed: Correctly handle Mailgun debug message for an incorrect api key.
151
  * Fixed: Fatal error for Gmail and SMTP mailers with Nginx web-server (without Apache at all).
146
 
147
  == Changelog ==
148
 
149
+ = 1.2.3 - 2018-01-22 =
150
+ * Fixed: Gmail tokens were reset after clicking Save Settings.
151
+ * Fixed: Slight typo in Gmail success message.
152
+
153
  = 1.2.2 - 2017-12-27 =
154
  * Fixed: Correctly handle Mailgun debug message for an incorrect api key.
155
  * Fixed: Fatal error for Gmail and SMTP mailers with Nginx web-server (without Apache at all).
src/Admin/Area.php CHANGED
@@ -108,7 +108,7 @@ class Area {
108
  switch ( $success ) {
109
  case 'google_site_linked':
110
  WP::add_admin_notice(
111
- esc_html__( 'You have successfully linked the current site with you Google API project. Now you can start sending emails through Google.', 'wp-mail-smtp' ),
112
  WP::ADMIN_NOTICE_SUCCESS
113
  );
114
  break;
108
  switch ( $success ) {
109
  case 'google_site_linked':
110
  WP::add_admin_notice(
111
+ esc_html__( 'You have successfully linked the current site with your Google API project. Now you can start sending emails through Google.', 'wp-mail-smtp' ),
112
  WP::ADMIN_NOTICE_SUCCESS
113
  );
114
  break;
src/Admin/Pages/Settings.php CHANGED
@@ -231,8 +231,8 @@ class Settings extends PageAbstract {
231
  }
232
  }
233
 
234
- // New gmail clients data will be added from new $data, except the old access/refresh_token.
235
- $to_save = array_merge( $old_opt, $data );
236
 
237
  // All the sanitization is done in Options class.
238
  $options->set( $to_save );
231
  }
232
  }
233
 
234
+ // New gmail clients data will be added from new $data.
235
+ $to_save = Options::array_merge_recursive( $old_opt, $data );
236
 
237
  // All the sanitization is done in Options class.
238
  $options->set( $to_save );
src/MailCatcher.php CHANGED
@@ -28,17 +28,17 @@ class MailCatcher extends \PHPMailer {
28
  */
29
  public function send() {
30
 
31
- $options = new Options();
32
- $mailer = $options->get( 'mail', 'mailer' );
33
 
34
  // Define a custom header, that will be used in Gmail/SMTP mailers.
35
- $this->XMailer = 'WPMailSMTP/Mailer/' . $mailer . ' ' . WPMS_PLUGIN_VER;
36
 
37
  // Use the default PHPMailer, as we inject our settings there for certain providers.
38
  if (
39
- $mailer === 'mail' ||
40
- $mailer === 'smtp' ||
41
- $mailer === 'pepipost'
42
  ) {
43
  return parent::send();
44
  }
@@ -48,7 +48,7 @@ class MailCatcher extends \PHPMailer {
48
  return false;
49
  }
50
 
51
- $mailer = wp_mail_smtp()->get_providers()->get_mailer( $mailer, $this );
52
 
53
  if ( ! $mailer ) {
54
  return false;
28
  */
29
  public function send() {
30
 
31
+ $options = new Options();
32
+ $mail_mailer = $options->get( 'mail', 'mailer' );
33
 
34
  // Define a custom header, that will be used in Gmail/SMTP mailers.
35
+ $this->XMailer = 'WPMailSMTP/Mailer/' . $mail_mailer . ' ' . WPMS_PLUGIN_VER;
36
 
37
  // Use the default PHPMailer, as we inject our settings there for certain providers.
38
  if (
39
+ $mail_mailer === 'mail' ||
40
+ $mail_mailer === 'smtp' ||
41
+ $mail_mailer === 'pepipost'
42
  ) {
43
  return parent::send();
44
  }
48
  return false;
49
  }
50
 
51
+ $mailer = wp_mail_smtp()->get_providers()->get_mailer( $mail_mailer, $this );
52
 
53
  if ( ! $mailer ) {
54
  return false;
src/Options.php CHANGED
@@ -523,6 +523,55 @@ class Options {
523
  $this->populate_options();
524
  }
525
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
526
  /**
527
  * Check whether the site is using Pepipost or not.
528
  *
523
  $this->populate_options();
524
  }
525
 
526
+ /**
527
+ * Merge recursively, including a proper substitution of values in sub-arrays when keys are the same.
528
+ * It's more like array_merge() and array_merge_recursive() combined.
529
+ *
530
+ * @since 1.0.0
531
+ *
532
+ * @return array
533
+ */
534
+ public static function array_merge_recursive() {
535
+
536
+ $arrays = func_get_args();
537
+
538
+ if ( count( $arrays ) < 2 ) {
539
+ return isset( $arrays[0] ) ? $arrays[0] : array();
540
+ }
541
+
542
+ $merged = array();
543
+
544
+ while ( $arrays ) {
545
+ $array = array_shift( $arrays );
546
+
547
+ if ( ! is_array( $array ) ) {
548
+ return array();
549
+ }
550
+
551
+ if ( empty( $array ) ) {
552
+ continue;
553
+ }
554
+
555
+ foreach ( $array as $key => $value ) {
556
+ if ( is_string( $key ) ) {
557
+ if (
558
+ is_array( $value ) &&
559
+ array_key_exists( $key, $merged ) &&
560
+ is_array( $merged[ $key ] )
561
+ ) {
562
+ $merged[ $key ] = call_user_func( __METHOD__, $merged[ $key ], $value );
563
+ } else {
564
+ $merged[ $key ] = $value;
565
+ }
566
+ } else {
567
+ $merged[] = $value;
568
+ }
569
+ }
570
+ }
571
+
572
+ return $merged;
573
+ }
574
+
575
  /**
576
  * Check whether the site is using Pepipost or not.
577
  *
src/Providers/Gmail/Mailer.php CHANGED
@@ -82,7 +82,7 @@ class Mailer extends MailerAbstract {
82
  */
83
  public function send() {
84
 
85
- // Get the raw MIME email using \PHPMailer data.
86
  $base64 = base64_encode( $this->phpmailer->getSentMIMEMessage() );
87
  $base64 = str_replace( array( '+', '/', '=' ), array( '-', '_', '' ), $base64 ); // url safe.
88
  $this->message->setRaw( $base64 );
82
  */
83
  public function send() {
84
 
85
+ // Get the raw MIME email using \MailCatcher data.
86
  $base64 = base64_encode( $this->phpmailer->getSentMIMEMessage() );
87
  $base64 = str_replace( array( '+', '/', '=' ), array( '-', '_', '' ), $base64 ); // url safe.
88
  $this->message->setRaw( $base64 );
src/Providers/MailerAbstract.php CHANGED
@@ -144,7 +144,7 @@ abstract class MailerAbstract implements MailerInterface {
144
  * @internal param array $params
145
  */
146
  protected function set_body_param( $param ) {
147
- $this->body = $this->array_merge_recursive( $this->body, $param );
148
  }
149
 
150
  /**
@@ -221,7 +221,7 @@ abstract class MailerAbstract implements MailerInterface {
221
  */
222
  public function send() {
223
 
224
- $params = $this->array_merge_recursive( $this->get_default_params(), array(
225
  'headers' => $this->get_headers(),
226
  'body' => $this->get_body(),
227
  ) );
@@ -328,55 +328,6 @@ abstract class MailerAbstract implements MailerInterface {
328
  return is_string( $string ) && is_array( json_decode( $string, true ) ) && ( json_last_error() === JSON_ERROR_NONE ) ? true : false;
329
  }
330
 
331
- /**
332
- * Merge recursively, including a proper substitution of values in sub-arrays when keys are the same.
333
- * It's more like array_merge() and array_merge_recursive() combined.
334
- *
335
- * @since 1.0.0
336
- *
337
- * @return array
338
- */
339
- protected function array_merge_recursive() {
340
-
341
- $arrays = func_get_args();
342
-
343
- if ( count( $arrays ) < 2 ) {
344
- return isset( $arrays[0] ) ? $arrays[0] : array();
345
- }
346
-
347
- $merged = array();
348
-
349
- while ( $arrays ) {
350
- $array = array_shift( $arrays );
351
-
352
- if ( ! is_array( $array ) ) {
353
- return array();
354
- }
355
-
356
- if ( empty( $array ) ) {
357
- continue;
358
- }
359
-
360
- foreach ( $array as $key => $value ) {
361
- if ( is_string( $key ) ) {
362
- if (
363
- is_array( $value ) &&
364
- array_key_exists( $key, $merged ) &&
365
- is_array( $merged[ $key ] )
366
- ) {
367
- $merged[ $key ] = call_user_func( __FUNCTION__, $merged[ $key ], $value );
368
- } else {
369
- $merged[ $key ] = $value;
370
- }
371
- } else {
372
- $merged[] = $value;
373
- }
374
- }
375
- }
376
-
377
- return $merged;
378
- }
379
-
380
  /**
381
  * This method is relevant to SMTP, Pepipost and Mail.
382
  * All other custom mailers should override it with own information.
144
  * @internal param array $params
145
  */
146
  protected function set_body_param( $param ) {
147
+ $this->body = Options::array_merge_recursive( $this->body, $param );
148
  }
149
 
150
  /**
221
  */
222
  public function send() {
223
 
224
+ $params = Options::array_merge_recursive( $this->get_default_params(), array(
225
  'headers' => $this->get_headers(),
226
  'body' => $this->get_body(),
227
  ) );
328
  return is_string( $string ) && is_array( json_decode( $string, true ) ) && ( json_last_error() === JSON_ERROR_NONE ) ? true : false;
329
  }
330
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
331
  /**
332
  * This method is relevant to SMTP, Pepipost and Mail.
333
  * All other custom mailers should override it with own information.
wp_mail_smtp.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /**
3
  * Plugin Name: WP Mail SMTP
4
- * Version: 1.2.2
5
  * Plugin URI: https://wpforms.com/
6
  * Description: Reconfigures the wp_mail() function to use SMTP instead of mail() and creates an options page to manage the settings.
7
  * Author: WPForms
@@ -17,7 +17,7 @@
17
  * http://www.gnu.org/licenses/gpl.txt
18
  */
19
 
20
- define( 'WPMS_PLUGIN_VER', '1.2.2' );
21
  define( 'WPMS_PHP_VER', '5.3' );
22
 
23
  /**
1
  <?php
2
  /**
3
  * Plugin Name: WP Mail SMTP
4
+ * Version: 1.2.3
5
  * Plugin URI: https://wpforms.com/
6
  * Description: Reconfigures the wp_mail() function to use SMTP instead of mail() and creates an options page to manage the settings.
7
  * Author: WPForms
17
  * http://www.gnu.org/licenses/gpl.txt
18
  */
19
 
20
+ define( 'WPMS_PLUGIN_VER', '1.2.3' );
21
  define( 'WPMS_PHP_VER', '5.3' );
22
 
23
  /**