Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix warnings due to defualt property not set on save #172

Merged
merged 1 commit into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
Changelog
=========
= 1.9.7 (2024-01-03): =
- Ensure defaults are always set to remove warnings in PHP 8.1+

1.9.6 (2023-09-10)
- Added typehints to methods
- Added code for making plugin WP VIP GO compatible for the `From mail`
Expand Down
25 changes: 19 additions & 6 deletions includes/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,13 @@ public function __construct()
{
parent::__construct();

$this->init();

// Load localizations if available
load_plugin_textdomain('mailgun', false, 'mailgun/languages');

// Activation hook
register_activation_hook($this->plugin_file, [&$this, 'init']);
register_activation_hook($this->plugin_file, [&$this, 'activation']);

// Hook into admin_init and register settings and potentially register an admin_notice
add_action('admin_init', [&$this, 'admin_init']);
Expand All @@ -59,8 +61,22 @@ public function __construct()
add_action('wp_ajax_mailgun-test', [&$this, 'ajax_send_test']);
}

/**
* Adds the default options during plugin activation.
*
* @return void
*
*/
public function activation() {
if (!$this->options) {
$this->options = $this->defaults;
add_option('mailgun', $this->options);
}
}


/**
* Initialize the default options during plugin activation.
* Initialize the default property.
*
* @return void
*
Expand Down Expand Up @@ -90,10 +106,7 @@ public function init()
'override-from' => '0',
'tag' => $sitename,
);
if (!$this->options) {
$this->options = $this->defaults;
add_option('mailgun', $this->options);
}

}

/**
Expand Down
5 changes: 3 additions & 2 deletions mailgun.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
* Plugin Name: Mailgun
* Plugin URI: http://wordpress.org/extend/plugins/mailgun/
* Description: Mailgun integration for WordPress
* Version: 1.9.6
* Tested up to: 6.3.1
* Version: 1.9.7
* Requires PHP: 7.4
* Requires at least: 4.4
* Author: Mailgun
* Author URI: http://www.mailgun.com/
* License: GPLv2 or later
Expand Down
10 changes: 5 additions & 5 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
Mailgun for WordPress
=====================

Contributors: mailgun, sivel, lookahead.io, m35dev
Contributors: mailgun, sivel, lookahead.io, m35dev, alanfuller
Tags: mailgun, smtp, http, api, mail, email
Requires at least: 3.3
Tested up to: 6.3.1
Stable tag: 1.9.6
Requires PHP: 7.4
Tested up to: 6.4
Stable tag: 1.9.7
License: GPLv2 or later

Easily send email from your WordPress site through Mailgun using the HTTP API or SMTP.
Expand Down Expand Up @@ -132,6 +130,8 @@ MAILGUN_TRACK_OPENS Type: string Choices: 'yes' or 'no'


== Changelog ==
= 1.9.7 (2024-01-03): =
- Ensure defaults are always set to remove warnings in PHP 8.1+

= 1.9.6 (2023-09-10): =
- Added typehints to methods
Expand Down
10 changes: 5 additions & 5 deletions readme.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
Mailgun for WordPress
=====================

Contributors: mailgun, sivel, lookahead.io, m35dev
Contributors: mailgun, sivel, lookahead.io, m35dev, alanfuller
Tags: mailgun, smtp, http, api, mail, email
Requires at least: 4.4
Tested up to: 6.3.1
Stable tag: 1.9.6
Requires PHP: 7.4
Tested up to: 6.4
Stable tag: 1.9.7
License: GPLv2 or later

Easily send email from your WordPress site through Mailgun using the HTTP API or SMTP.
Expand Down Expand Up @@ -130,6 +128,8 @@ MAILGUN_TRACK_OPENS Type: string Choices: 'yes' or 'no'


== Changelog ==
= 1.9.7 (2024-01-03): =
- Ensure defaults are always set to remove warnings in PHP 8.1+

= 1.9.6 (2023-09-10): =
- Added typehints to methods
Expand Down