Version Description
- Added send test email functionality in settings page.
- Fixed
Call-time pass-by-reference has been deprecated
PHP errors.
Download this release
Release Info
Developer | l3rady |
Plugin | WP Updates Notifier |
Version | 1.3 |
Comparing to | |
See all releases |
Code changes from version 1.2 to 1.3
- readme.txt +6 -2
- uninstall.php +1 -1
- wp-updates-notifier.php +43 -32
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: l3rady
|
|
3 |
Donate link: http://l3rady.com/donate
|
4 |
Tags: admin, theme, monitor, plugin, notification, upgrade, security
|
5 |
Requires at least: 3.1
|
6 |
-
Tested up to: 3.
|
7 |
-
Stable tag: 1.2
|
8 |
|
9 |
Sends email to notify you if there are any updates for your WordPress site. Can notify about core, plugin and theme updates.
|
10 |
|
@@ -48,6 +48,10 @@ This plugin is a fork of [Update Notifier](http://wordpress.org/extend/plugins/u
|
|
48 |
|
49 |
== Changelog ==
|
50 |
|
|
|
|
|
|
|
|
|
51 |
= 1.2 =
|
52 |
* Added the ability to allow multiple email address to be added to the `notify to` setting. Multiple email addresses to be comma separated.
|
53 |
* Removed code from last version that was left in from dev. Caused WP to check for update on every admin page load.
|
3 |
Donate link: http://l3rady.com/donate
|
4 |
Tags: admin, theme, monitor, plugin, notification, upgrade, security
|
5 |
Requires at least: 3.1
|
6 |
+
Tested up to: 3.3.1
|
7 |
+
Stable tag: 1.2.1
|
8 |
|
9 |
Sends email to notify you if there are any updates for your WordPress site. Can notify about core, plugin and theme updates.
|
10 |
|
48 |
|
49 |
== Changelog ==
|
50 |
|
51 |
+
= 1.3 =
|
52 |
+
* Added send test email functionality in settings page.
|
53 |
+
* Fixed `Call-time pass-by-reference has been deprecated` PHP errors.
|
54 |
+
|
55 |
= 1.2 =
|
56 |
* Added the ability to allow multiple email address to be added to the `notify to` setting. Multiple email addresses to be comma separated.
|
57 |
* Removed code from last version that was left in from dev. Caused WP to check for update on every admin page load.
|
uninstall.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<?php
|
2 |
-
/* Copyright
|
3 |
|
4 |
This program is free software; you can redistribute it and/or modify
|
5 |
it under the terms of the GNU General Public License as published by
|
1 |
<?php
|
2 |
+
/* Copyright 2012 Scott Cariss (email : scott@l3rady.com)
|
3 |
|
4 |
This program is free software; you can redistribute it and/or modify
|
5 |
it under the terms of the GNU General Public License as published by
|
wp-updates-notifier.php
CHANGED
@@ -4,13 +4,13 @@ Plugin Name: WP Updates Notifier
|
|
4 |
Plugin URI: http://l3rady.com/projects/wp-updates-notifier/
|
5 |
Description: Sends email to notify you if there are any updates for your WordPress site. Can notify about core, plugin and theme updates.
|
6 |
Author: Scott Cariss
|
7 |
-
Version: 1.
|
8 |
Author URI: http://l3rady.com/
|
9 |
Text Domain: wp-updates-notifier
|
10 |
Domain Path: /languages
|
11 |
*/
|
12 |
|
13 |
-
/* Copyright
|
14 |
|
15 |
This program is free software; you can redistribute it and/or modify
|
16 |
it under the terms of the GNU General Public License as published by
|
@@ -42,21 +42,21 @@ if (!class_exists('sc_WPUpdatesNotifier')) {
|
|
42 |
// Check settings are up to date
|
43 |
$this->settingsUpToDate();
|
44 |
// Create Activation and Deactivation Hooks
|
45 |
-
register_activation_hook(__FILE__, array(
|
46 |
-
register_deactivation_hook(__FILE__, array(
|
47 |
// Internationalization
|
48 |
load_plugin_textdomain('wp-updates-notifier', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/');
|
49 |
// Add Filters
|
50 |
-
add_filter('plugin_action_links', array(
|
51 |
-
add_filter('sc_wpun_plugins_need_update', array(
|
52 |
-
add_filter('sc_wpun_themes_need_update', array(
|
53 |
// Add Actions
|
54 |
-
add_action('admin_menu', array(
|
55 |
-
add_action('admin_init', array(
|
56 |
-
add_action('admin_init', array(
|
57 |
-
add_action('sc_wpun_enable_cron', array(
|
58 |
-
add_action('sc_wpun_disable_cron', array(
|
59 |
-
add_action(self::$cron_name, array(
|
60 |
}
|
61 |
|
62 |
|
@@ -172,14 +172,14 @@ if (!class_exists('sc_WPUpdatesNotifier')) {
|
|
172 |
public function do_update_check() {
|
173 |
$options = get_option(self::$options_field); // get settings
|
174 |
$message = ""; // start with a blank message
|
175 |
-
$core_updated = $this->core_update_check(
|
176 |
if(0 != $options['notify_plugins']) { // are we to check for plugin updates?
|
177 |
-
$plugins_updated = $this->plugins_update_check(
|
178 |
} else {
|
179 |
$plugins_updated = false; // no plugin updates
|
180 |
}
|
181 |
if(0 != $options['notify_themes']) { // are we to check for theme updates?
|
182 |
-
$themes_updated = $this->themes_update_check(
|
183 |
} else {
|
184 |
$themes_updated = false; // no theme updates
|
185 |
}
|
@@ -355,13 +355,13 @@ if (!class_exists('sc_WPUpdatesNotifier')) {
|
|
355 |
public function send_notification_email($message) {
|
356 |
$settings = get_option(self::$options_field); // get settings
|
357 |
$subject = sprintf(__("WP Updates Notifier: Updates Available @ %s", "wp-updates-notifier"), site_url());
|
358 |
-
add_filter('wp_mail_from', array(
|
359 |
-
add_filter('wp_mail_from_name', array(
|
360 |
-
add_filter('wp_mail_content_type', array(
|
361 |
wp_mail($settings['notify_to'], $subject, $message); // send email
|
362 |
-
remove_filter('wp_mail_from', array(
|
363 |
-
remove_filter('wp_mail_from_name', array(
|
364 |
-
remove_filter('wp_mail_content_type', array(
|
365 |
}
|
366 |
public function sc_wpun_wp_mail_from() { $settings = get_option(self::$options_field); return $settings['notify_from']; }
|
367 |
public function sc_wpun_wp_mail_from_name() { return __("WP Updates Notifier", "wp-updates-notifier"); }
|
@@ -391,7 +391,7 @@ if (!class_exists('sc_WPUpdatesNotifier')) {
|
|
391 |
* much straight forward use of the WordPress Settings API.
|
392 |
*/
|
393 |
public function admin_settings_menu() {
|
394 |
-
$page = add_options_page('WP Updates Notifier', 'WP Updates Notifier', 'manage_options', 'wp-updates-notifier', array(
|
395 |
}
|
396 |
public function settings_page() {
|
397 |
?>
|
@@ -403,20 +403,21 @@ if (!class_exists('sc_WPUpdatesNotifier')) {
|
|
403 |
settings_fields("sc_wpun_settings");
|
404 |
do_settings_sections("wp-updates-notifier");
|
405 |
?>
|
406 |
-
<input class="button-primary" name="Submit" type="submit" value="<?php _e("Save
|
|
|
407 |
</form>
|
408 |
</div>
|
409 |
<?php
|
410 |
}
|
411 |
public function admin_settings_init() {
|
412 |
-
register_setting(self::$options_field, self::$options_field, array(
|
413 |
-
add_settings_section("sc_wpun_settings_main", __("Settings", "wp-updates-notifier"), array(
|
414 |
-
add_settings_field("sc_wpun_settings_main_frequency", __("Frequency to check", "wp-updates-notifier"), array(
|
415 |
-
add_settings_field("sc_wpun_settings_main_notify_to", __("Notify email to", "wp-updates-notifier"), array(
|
416 |
-
add_settings_field("sc_wpun_settings_main_notify_from", __("Notify email from", "wp-updates-notifier"), array(
|
417 |
-
add_settings_field("sc_wpun_settings_main_notify_plugins", __("Notify about plugin updates?", "wp-updates-notifier"), array(
|
418 |
-
add_settings_field("sc_wpun_settings_main_notify_themes", __("Notify about theme updates?", "wp-updates-notifier"), array(
|
419 |
-
add_settings_field("sc_wpun_settings_main_hide_updates", __("Hide core WP update nag from non-admin users?", "wp-updates-notifier"), array(
|
420 |
}
|
421 |
public function sc_wpun_settings_validate($input) {
|
422 |
$valid = get_option(self::$options_field);
|
@@ -475,8 +476,18 @@ if (!class_exists('sc_WPUpdatesNotifier')) {
|
|
475 |
} else {
|
476 |
add_settings_error("sc_wpun_settings_main_hide_updates", "sc_wpun_settings_main_hide_updates_error", __("Invalid hide updates value entered", "wp-updates-notifier"), "error");
|
477 |
}
|
|
|
|
|
|
|
|
|
|
|
478 |
return $valid;
|
479 |
}
|
|
|
|
|
|
|
|
|
|
|
480 |
public function sc_wpun_settings_main_text() {}
|
481 |
public function sc_wpun_settings_main_field_frequency() {
|
482 |
$options = get_option(self::$options_field);
|
4 |
Plugin URI: http://l3rady.com/projects/wp-updates-notifier/
|
5 |
Description: Sends email to notify you if there are any updates for your WordPress site. Can notify about core, plugin and theme updates.
|
6 |
Author: Scott Cariss
|
7 |
+
Version: 1.3
|
8 |
Author URI: http://l3rady.com/
|
9 |
Text Domain: wp-updates-notifier
|
10 |
Domain Path: /languages
|
11 |
*/
|
12 |
|
13 |
+
/* Copyright 2012 Scott Cariss (email : scott@l3rady.com)
|
14 |
|
15 |
This program is free software; you can redistribute it and/or modify
|
16 |
it under the terms of the GNU General Public License as published by
|
42 |
// Check settings are up to date
|
43 |
$this->settingsUpToDate();
|
44 |
// Create Activation and Deactivation Hooks
|
45 |
+
register_activation_hook(__FILE__, array(__CLASS__, 'activate'));
|
46 |
+
register_deactivation_hook(__FILE__, array(__CLASS__, 'deactivate'));
|
47 |
// Internationalization
|
48 |
load_plugin_textdomain('wp-updates-notifier', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/');
|
49 |
// Add Filters
|
50 |
+
add_filter('plugin_action_links', array(__CLASS__, 'plugin_action_links'), 10, 2); // Add settings link to plugin in plugin list
|
51 |
+
add_filter('sc_wpun_plugins_need_update', array(__CLASS__, 'check_plugins_against_notified')); // Filter out plugins that need update if already been notified
|
52 |
+
add_filter('sc_wpun_themes_need_update', array(__CLASS__, 'check_themes_against_notified')); // Filter out themes that need update if already been notified
|
53 |
// Add Actions
|
54 |
+
add_action('admin_menu', array(__CLASS__, 'admin_settings_menu')); // Add menu to options
|
55 |
+
add_action('admin_init', array(__CLASS__, 'admin_settings_init')); // Add admin init functions
|
56 |
+
add_action('admin_init', array(__CLASS__, 'remove_update_nag_for_nonadmins')); // See if we remove update nag for non admins
|
57 |
+
add_action('sc_wpun_enable_cron', array(__CLASS__, 'enable_cron')); // action to enable cron
|
58 |
+
add_action('sc_wpun_disable_cron', array(__CLASS__, 'disable_cron')); // action to disable cron
|
59 |
+
add_action(self::$cron_name, array(__CLASS__, 'do_update_check')); // action to link cron task to actual task
|
60 |
}
|
61 |
|
62 |
|
172 |
public function do_update_check() {
|
173 |
$options = get_option(self::$options_field); // get settings
|
174 |
$message = ""; // start with a blank message
|
175 |
+
$core_updated = $this->core_update_check($message); // check the WP core for updates
|
176 |
if(0 != $options['notify_plugins']) { // are we to check for plugin updates?
|
177 |
+
$plugins_updated = $this->plugins_update_check($message, $options['notify_plugins']); // check for plugin updates
|
178 |
} else {
|
179 |
$plugins_updated = false; // no plugin updates
|
180 |
}
|
181 |
if(0 != $options['notify_themes']) { // are we to check for theme updates?
|
182 |
+
$themes_updated = $this->themes_update_check($message, $options['notify_themes']); // check for theme updates
|
183 |
} else {
|
184 |
$themes_updated = false; // no theme updates
|
185 |
}
|
355 |
public function send_notification_email($message) {
|
356 |
$settings = get_option(self::$options_field); // get settings
|
357 |
$subject = sprintf(__("WP Updates Notifier: Updates Available @ %s", "wp-updates-notifier"), site_url());
|
358 |
+
add_filter('wp_mail_from', array(__CLASS__, 'sc_wpun_wp_mail_from')); // add from filter
|
359 |
+
add_filter('wp_mail_from_name', array(__CLASS__, 'sc_wpun_wp_mail_from_name')); // add from name filter
|
360 |
+
add_filter('wp_mail_content_type', array(__CLASS__, 'sc_wpun_wp_mail_content_type')); // add content type filter
|
361 |
wp_mail($settings['notify_to'], $subject, $message); // send email
|
362 |
+
remove_filter('wp_mail_from', array(__CLASS__, 'sc_wpun_wp_mail_from')); // remove from filter
|
363 |
+
remove_filter('wp_mail_from_name', array(__CLASS__, 'sc_wpun_wp_mail_from_name')); // remove from name filter
|
364 |
+
remove_filter('wp_mail_content_type', array(__CLASS__, 'sc_wpun_wp_mail_content_type')); // remove content type filter
|
365 |
}
|
366 |
public function sc_wpun_wp_mail_from() { $settings = get_option(self::$options_field); return $settings['notify_from']; }
|
367 |
public function sc_wpun_wp_mail_from_name() { return __("WP Updates Notifier", "wp-updates-notifier"); }
|
391 |
* much straight forward use of the WordPress Settings API.
|
392 |
*/
|
393 |
public function admin_settings_menu() {
|
394 |
+
$page = add_options_page('WP Updates Notifier', 'WP Updates Notifier', 'manage_options', 'wp-updates-notifier', array(__CLASS__, 'settings_page'));
|
395 |
}
|
396 |
public function settings_page() {
|
397 |
?>
|
403 |
settings_fields("sc_wpun_settings");
|
404 |
do_settings_sections("wp-updates-notifier");
|
405 |
?>
|
406 |
+
<input class="button-primary" name="Submit" type="submit" value="<?php _e("Save settings", "wp-updates-notifier"); ?>" />
|
407 |
+
<input class="button" name="submitwithemail" type="submit" value="<?php _e("Save settings with test email", "wp-updates-notifier"); ?>" />
|
408 |
</form>
|
409 |
</div>
|
410 |
<?php
|
411 |
}
|
412 |
public function admin_settings_init() {
|
413 |
+
register_setting(self::$options_field, self::$options_field, array(__CLASS__, "sc_wpun_settings_validate")); // Register Main Settings
|
414 |
+
add_settings_section("sc_wpun_settings_main", __("Settings", "wp-updates-notifier"), array(__CLASS__, "sc_wpun_settings_main_text"), "wp-updates-notifier"); // Make settings main section
|
415 |
+
add_settings_field("sc_wpun_settings_main_frequency", __("Frequency to check", "wp-updates-notifier"), array(__CLASS__, "sc_wpun_settings_main_field_frequency"), "wp-updates-notifier", "sc_wpun_settings_main");
|
416 |
+
add_settings_field("sc_wpun_settings_main_notify_to", __("Notify email to", "wp-updates-notifier"), array(__CLASS__, "sc_wpun_settings_main_field_notify_to"), "wp-updates-notifier", "sc_wpun_settings_main");
|
417 |
+
add_settings_field("sc_wpun_settings_main_notify_from", __("Notify email from", "wp-updates-notifier"), array(__CLASS__, "sc_wpun_settings_main_field_notify_from"), "wp-updates-notifier", "sc_wpun_settings_main");
|
418 |
+
add_settings_field("sc_wpun_settings_main_notify_plugins", __("Notify about plugin updates?", "wp-updates-notifier"), array(__CLASS__, "sc_wpun_settings_main_field_notify_plugins"), "wp-updates-notifier", "sc_wpun_settings_main");
|
419 |
+
add_settings_field("sc_wpun_settings_main_notify_themes", __("Notify about theme updates?", "wp-updates-notifier"), array(__CLASS__, "sc_wpun_settings_main_field_notify_themes"), "wp-updates-notifier", "sc_wpun_settings_main");
|
420 |
+
add_settings_field("sc_wpun_settings_main_hide_updates", __("Hide core WP update nag from non-admin users?", "wp-updates-notifier"), array(__CLASS__, "sc_wpun_settings_main_field_hide_updates"), "wp-updates-notifier", "sc_wpun_settings_main");
|
421 |
}
|
422 |
public function sc_wpun_settings_validate($input) {
|
423 |
$valid = get_option(self::$options_field);
|
476 |
} else {
|
477 |
add_settings_error("sc_wpun_settings_main_hide_updates", "sc_wpun_settings_main_hide_updates_error", __("Invalid hide updates value entered", "wp-updates-notifier"), "error");
|
478 |
}
|
479 |
+
|
480 |
+
if(isset($_POST['submitwithemail'])) {
|
481 |
+
add_filter( 'pre_set_transient_settings_errors', array(__CLASS__, "send_test_email") );
|
482 |
+
}
|
483 |
+
|
484 |
return $valid;
|
485 |
}
|
486 |
+
public function send_test_email($settings_errors) {
|
487 |
+
if( isset($settings_errors[0]['type']) && $settings_errors[0]['type'] == "updated" ) {
|
488 |
+
self::send_notification_email(__("This is a test message from WP Updates Notifier.", "wp-updates-notifier"));
|
489 |
+
}
|
490 |
+
}
|
491 |
public function sc_wpun_settings_main_text() {}
|
492 |
public function sc_wpun_settings_main_field_frequency() {
|
493 |
$options = get_option(self::$options_field);
|