Mailgun for WordPress - Version 1.7

Version Description

(2019-01-21): = - Remove settings page for multisites. - Simplify admin notifications. - Test plugin with PHP 7.2. - Test plugin up to WordPress 5.0.3.

Download this release

Release Info

Developer Mailgun
Plugin Icon 128x128 Mailgun for WordPress
Version 1.7
Comparing to
See all releases

Code changes from version 1.6.1 to 1.7

Files changed (5) hide show
  1. CHANGELOG.md +6 -0
  2. includes/admin.php +36 -23
  3. includes/mg-filter.php +1 -0
  4. mailgun.php +1 -1
  5. readme.txt +8 -2
CHANGELOG.md CHANGED
@@ -1,6 +1,12 @@
1
  Changelog
2
  =========
3
 
 
 
 
 
 
 
4
  1.6.1 (2018-10-08)
5
  - Restore Settings page form for all install types.
6
 
1
  Changelog
2
  =========
3
 
4
+ 1.7 (2019-01-21)
5
+ - Remove settings page for multisites.
6
+ - Simplify admin notifications.
7
+ - Test plugin with PHP 7.2.
8
+ - Test plugin up to WordPress 5.0.3.
9
+
10
  1.6.1 (2018-10-08)
11
  - Restore Settings page form for all install types.
12
 
includes/admin.php CHANGED
@@ -43,14 +43,16 @@
43
  // Activation hook
44
  register_activation_hook($this->plugin_file, array(&$this, 'init'));
45
 
46
- // Hook into admin_init and register settings and potentially register an admin_notice
47
- add_action('admin_init', array(&$this, 'admin_init'));
 
48
 
49
- // Activate the options page
50
- add_action('admin_menu', array(&$this, 'admin_menu'));
51
 
52
- // Register an AJAX action for testing mail sending capabilities
53
- add_action('wp_ajax_mailgun-test', array(&$this, 'ajax_send_test'));
 
54
  }
55
 
56
  /**
@@ -130,7 +132,7 @@
130
  */
131
  public function admin_footer_js()
132
  {
133
- ?>
134
  <script type="text/javascript">
135
  /* <![CDATA[ */
136
  var mailgunApiOrNot = function () {
@@ -186,8 +188,7 @@
186
  })
187
  /* ]]> */
188
  </script>
189
- <?php
190
-
191
  }
192
 
193
  /**
@@ -320,26 +321,38 @@
320
  return;
321
  endif;
322
 
323
- if ((!$this->get_option('apiKey') && $this->get_option('useAPI') === '1')
324
- || (!$this->get_option('password') && $this->get_option('useAPI') === '0')
325
- || (!$this->get_option('region') && $this->get_option('useAPI') === '1')
326
- ):
327
- ?>
 
 
 
328
  <div id='mailgun-warning' class='notice notice-warning is-dismissible'>
329
  <p>
330
- <strong>
331
- <?php _e('Mailgun is almost ready. ', 'mailgun'); ?>
332
- </strong>
333
  <?php
334
  printf(
335
- __('With the latest update, Mailgun now supports multiple regions! By default, we will use the U.S. region, but we now have an EU region available. You can configure your Mailgun settings <a href="%1$s">here</a> or in your wp-config.php.',
336
- 'mailgun'),
337
- menu_page_url('mailgun', false)
338
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
339
  ?>
340
  </p>
341
  </div>
342
- <?php
343
  endif;
344
 
345
  if ($this->get_option('override-from') === '1' &&
@@ -357,10 +370,10 @@
357
  'mailgun'),
358
  menu_page_url('mailgun', false)
359
  );
360
- ?>
361
  </p>
362
  </div>
363
- <?php
364
  endif;
365
  }
366
 
43
  // Activation hook
44
  register_activation_hook($this->plugin_file, array(&$this, 'init'));
45
 
46
+ if( (!defined('MULTISITE') || !MULTISITE) && (!defined('MAILGUN_USEAPI') || !MAILGUN_USEAPI) ):
47
+ // Hook into admin_init and register settings and potentially register an admin_notice
48
+ add_action('admin_init', array(&$this, 'admin_init'));
49
 
50
+ // Activate the options page
51
+ add_action('admin_menu', array(&$this, 'admin_menu'));
52
 
53
+ // Register an AJAX action for testing mail sending capabilities
54
+ add_action('wp_ajax_mailgun-test', array(&$this, 'ajax_send_test'));
55
+ endif;
56
  }
57
 
58
  /**
132
  */
133
  public function admin_footer_js()
134
  {
135
+ ?>
136
  <script type="text/javascript">
137
  /* <![CDATA[ */
138
  var mailgunApiOrNot = function () {
188
  })
189
  /* ]]> */
190
  </script>
191
+ <?php
 
192
  }
193
 
194
  /**
321
  return;
322
  endif;
323
 
324
+ $smtpPasswordUndefined = ( !$this->get_option('password') && ( !defined('MAILGUN_PASSWORD') || !MAILGUN_PASSWORD ) );
325
+ $smtpActiveNotConfigured = ( $this->get_option('useAPI') === '0' && $smtpPasswordUndefined );
326
+ $apiRegionUndefined = ( !$this->get_option('region') && ( !defined('MAILGUN_REGION') || !MAILGUN_REGION ) );
327
+ $apiKeyUndefined = ( !$this->get_option('apiKey') && ( !defined('MAILGUN_APIKEY') || !MAILGUN_APIKEY ));
328
+ $apiActiveNotConfigured = ( $this->get_option('useAPI') === '1' && ( $apiRegionUndefined || $apiKeyUndefined ) );
329
+
330
+ if ( $apiActiveNotConfigured || $smtpActiveNotConfigured ):
331
+ ?>
332
  <div id='mailgun-warning' class='notice notice-warning is-dismissible'>
333
  <p>
 
 
 
334
  <?php
335
  printf(
336
+ _e('Mailgun now supports multiple regions! The U.S. region will be used by default, but you can choose the EU region.',
337
+ 'mailgun')
 
338
  );
339
+
340
+ if ( (defined('MULTISITE') || MULTISITE) && (!defined('MAILGUN_REGION') || !MAILGUN_REGION) ):
341
+ printf(
342
+ __('You can configure your Mailgun settings in your wp-config.php.', 'mailgun')
343
+ );
344
+ endif;
345
+
346
+ if( (!defined('MULTISITE') || !MULTISITE) && !$this->get_option('domain')):
347
+ printf(
348
+ __('You can configure your Mailgun settings in <a href="%1$s">here</a>', 'mailgun'),
349
+ menu_page_url('mailgun', false)
350
+ );
351
+ endif;
352
  ?>
353
  </p>
354
  </div>
355
+ <?php
356
  endif;
357
 
358
  if ($this->get_option('override-from') === '1' &&
370
  'mailgun'),
371
  menu_page_url('mailgun', false)
372
  );
373
+ ?>
374
  </p>
375
  </div>
376
+ <?php
377
  endif;
378
  }
379
 
includes/mg-filter.php CHANGED
@@ -19,6 +19,7 @@
19
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20
  */
21
 
 
22
  /**
23
  * Tries several methods to get the MIME Content-Type of a file.
24
  *
19
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20
  */
21
 
22
+
23
  /**
24
  * Tries several methods to get the MIME Content-Type of a file.
25
  *
mailgun.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: Mailgun
5
  * Plugin URI: http://wordpress.org/extend/plugins/mailgun/
6
  * Description: Mailgun integration for WordPress
7
- * Version: 1.6.1
8
  * Author: Mailgun
9
  * Author URI: http://www.mailgun.com/
10
  * License: GPLv2 or later
4
  * Plugin Name: Mailgun
5
  * Plugin URI: http://wordpress.org/extend/plugins/mailgun/
6
  * Description: Mailgun integration for WordPress
7
+ * Version: 1.7
8
  * Author: Mailgun
9
  * Author URI: http://www.mailgun.com/
10
  * License: GPLv2 or later
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: 4.9.8
8
- Stable tag: 1.6.1
9
  License: GPLv2 or later
10
 
11
 
@@ -129,6 +129,12 @@ MAILGUN_FROM_ADDRESS Type: string
129
 
130
  == Changelog ==
131
 
 
 
 
 
 
 
132
  = 1.6.1 (2018-10-08): =
133
  - Restore Settings page form for all install types.
134
 
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: 5.0.2
8
+ Stable tag: 1.7
9
  License: GPLv2 or later
10
 
11
 
129
 
130
  == Changelog ==
131
 
132
+ = 1.7 (2019-01-21): =
133
+ - Remove settings page for multisites.
134
+ - Simplify admin notifications.
135
+ - Test plugin with PHP 7.2.
136
+ - Test plugin up to WordPress 5.0.3.
137
+
138
  = 1.6.1 (2018-10-08): =
139
  - Restore Settings page form for all install types.
140