Mailgun for WordPress - Version v1.8.6

Version Description

Download this release

Release Info

Developer omykhailenko
Plugin Icon 128x128 Mailgun for WordPress
Version v1.8.6
Comparing to
See all releases

Code changes from version 1.8.4 to v1.8.6

CHANGELOG.md CHANGED
@@ -1,6 +1,9 @@
1
  Changelog
2
  =========
3
- = 1.8.3 (2022-08-30): =
 
 
 
4
  - Plugin refactoring. Widget fixes for working with Legacy Widget Block. PHP8.0 support check
5
 
6
  1.7.9 (2021-05-24)
1
  Changelog
2
  =========
3
+ 1.8.5 (2022-09-21)
4
+ - Make code changes to have more optimized way to use Mailgun object in the code
5
+
6
+ 1.8.3 (2022-08-30)
7
  - Plugin refactoring. Widget fixes for working with Legacy Widget Block. PHP8.0 support check
8
 
9
  1.7.9 (2021-05-24)
includes/admin.php CHANGED
@@ -465,7 +465,7 @@ class MailgunAdmin extends Mailgun
465
  }
466
 
467
  // Error message will always be returned in case of failure, if not - connection wasn't successful
468
- $error_msg = $error_msg ? $error_msg : "Can't connect to Mailgun";
469
  die(
470
  json_encode(array(
471
  'message' => __('Failure', 'mailgun'),
465
  }
466
 
467
  // Error message will always be returned in case of failure, if not - connection wasn't successful
468
+ $error_msg = $error_msg ?: "Can't connect to Mailgun";
469
  die(
470
  json_encode(array(
471
  'message' => __('Failure', 'mailgun'),
includes/lists-page.php CHANGED
@@ -19,7 +19,7 @@
19
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20
  */
21
 
22
- global $mailgun;
23
 
24
  // check mailgun domain & api key
25
  $missing_error = '';
19
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20
  */
21
 
22
+ $mailgun = Mailgun::getInstance();
23
 
24
  // check mailgun domain & api key
25
  $missing_error = '';
includes/options-page.php CHANGED
@@ -19,7 +19,7 @@
19
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20
  */
21
 
22
- global $mailgun;
23
 
24
  $mailgun_domain_const = ((defined('MAILGUN_DOMAIN') && MAILGUN_DOMAIN) ? MAILGUN_DOMAIN : null);
25
  $mailgun_domain = $mailgun_domain_const ?: $this->get_option('domain');
19
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20
  */
21
 
22
+ $mailgun = Mailgun::getInstance();
23
 
24
  $mailgun_domain_const = ((defined('MAILGUN_DOMAIN') && MAILGUN_DOMAIN) ? MAILGUN_DOMAIN : null);
25
  $mailgun_domain = $mailgun_domain_const ?: $this->get_option('domain');
includes/widget.php CHANGED
@@ -37,7 +37,7 @@ class list_widget extends \WP_Widget
37
  // This is where the action happens
38
  public function widget($args, $instance)
39
  {
40
- global $mailgun;
41
 
42
  if (!isset($instance['list_address']) || !$instance['list_address']) {
43
  return;
@@ -63,8 +63,6 @@ class list_widget extends \WP_Widget
63
  // Widget Backend
64
  public function form($instance)
65
  {
66
- global $mailgun;
67
-
68
  if (isset($instance['list_address'])) {
69
  $list_address = $instance['list_address'];
70
  } else {
@@ -77,8 +75,8 @@ class list_widget extends \WP_Widget
77
  $collect_name = '';
78
  }
79
 
80
- $list_title = isset($instance['list_title']) ? $instance['list_title'] : null;
81
- $list_description = isset($instance['list_description']) ? $instance['list_description'] : null;
82
 
83
  // Widget admin form
84
  ?>
37
  // This is where the action happens
38
  public function widget($args, $instance)
39
  {
40
+ $mailgun = Mailgun::getInstance();
41
 
42
  if (!isset($instance['list_address']) || !$instance['list_address']) {
43
  return;
63
  // Widget Backend
64
  public function form($instance)
65
  {
 
 
66
  if (isset($instance['list_address'])) {
67
  $list_address = $instance['list_address'];
68
  } else {
75
  $collect_name = '';
76
  }
77
 
78
+ $list_title = $instance['list_title'] ?? null;
79
+ $list_description = $instance['list_description'] ?? null;
80
 
81
  // Widget admin form
82
  ?>
mailgun.php CHANGED
@@ -3,7 +3,8 @@
3
  * Plugin Name: Mailgun
4
  * Plugin URI: http://wordpress.org/extend/plugins/mailgun/
5
  * Description: Mailgun integration for WordPress
6
- * Version: 1.8.3
 
7
  * Author: Mailgun
8
  * Author URI: http://www.mailgun.com/
9
  * License: GPLv2 or later
@@ -39,6 +40,11 @@
39
  */
40
  class Mailgun
41
  {
 
 
 
 
 
42
  /**
43
  * @var false|mixed|null
44
  */
@@ -93,6 +99,18 @@ class Mailgun
93
  }
94
  }
95
 
 
 
 
 
 
 
 
 
 
 
 
 
96
  /**
97
  * Get specific option from the options table.
98
  *
@@ -506,7 +524,7 @@ class Mailgun
506
  }
507
  }
508
 
509
- $mailgun = new Mailgun();
510
 
511
  if (@include __DIR__ . '/includes/widget.php') {
512
  add_action('widgets_init', [&$mailgun, 'load_list_widget']);
3
  * Plugin Name: Mailgun
4
  * Plugin URI: http://wordpress.org/extend/plugins/mailgun/
5
  * Description: Mailgun integration for WordPress
6
+ * Version: 1.8.5
7
+ * Tested up to: 6.1
8
  * Author: Mailgun
9
  * Author URI: http://www.mailgun.com/
10
  * License: GPLv2 or later
40
  */
41
  class Mailgun
42
  {
43
+ /**
44
+ * @var Mailgun $instance
45
+ */
46
+ private static $instance;
47
+
48
  /**
49
  * @var false|mixed|null
50
  */
99
  }
100
  }
101
 
102
+ /**
103
+ * @return static
104
+ */
105
+ public static function getInstance()
106
+ {
107
+ if (!isset(self::$instance)) {
108
+ self::$instance = new self();
109
+ }
110
+
111
+ return self::$instance;
112
+ }
113
+
114
  /**
115
  * Get specific option from the options table.
116
  *
524
  }
525
  }
526
 
527
+ $mailgun = Mailgun::getInstance();
528
 
529
  if (@include __DIR__ . '/includes/widget.php') {
530
  add_action('widgets_init', [&$mailgun, 'load_list_widget']);
readme.md CHANGED
@@ -4,8 +4,8 @@ Mailgun for WordPress
4
  Contributors: mailgun, sivel, lookahead.io, m35dev
5
  Tags: mailgun, smtp, http, api, mail, email
6
  Requires at least: 3.3
7
- Tested up to: 6.0.1
8
- Stable tag: 1.8.3
9
  License: GPLv2 or later
10
 
11
 
4
  Contributors: mailgun, sivel, lookahead.io, m35dev
5
  Tags: mailgun, smtp, http, api, mail, email
6
  Requires at least: 3.3
7
+ Tested up to: 6.1
8
+ Stable tag: 1.8.5
9
  License: GPLv2 or later
10
 
11
 
readme.txt CHANGED
@@ -4,8 +4,8 @@ Mailgun for WordPress
4
  Contributors: mailgun, sivel, lookahead.io, m35dev
5
  Tags: mailgun, smtp, http, api, mail, email
6
  Requires at least: 3.3
7
- Tested up to: 6.0.1
8
- Stable tag: 1.8.3
9
  License: GPLv2 or later
10
 
11
 
4
  Contributors: mailgun, sivel, lookahead.io, m35dev
5
  Tags: mailgun, smtp, http, api, mail, email
6
  Requires at least: 3.3
7
+ Tested up to: 6.1
8
+ Stable tag: 1.8.5
9
  License: GPLv2 or later
10
 
11