Skip to content
Open
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
5 changes: 3 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Donate link: http://l3rady.com/donate
Tags: admin, theme, monitor, plugin, notification, upgrade, security
Requires at least: 3.1
Tested up to: 3.8.1
Stable tag: 1.4.1
Stable tag: 1.4.2

Sends email to notify you if there are any updates for your WordPress site. Can notify about core, plugin and theme updates.

Expand Down Expand Up @@ -53,8 +53,9 @@ This plugin is a fork of [Update Notifier](http://wordpress.org/extend/plugins/u

== Changelog ==

= 1.4.1 =
= 1.4.2 =
* Switch from using site_url() to home_url() in email subject line so not to link to a 404 page.
* Add new setting to deal with resending update notifications.

= 1.4 =
* Added external cron method allowing users check for updates as often or as little as they want
Expand Down
34 changes: 28 additions & 6 deletions wp-updates-notifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Plugin URI: https://github.com/l3rady/wp-updates-notifier
Description: Sends email to notify you if there are any updates for your WordPress site. Can notify about core, plugin and theme updates.
Author: Scott Cariss
Version: 1.4.1
Version: 1.4.2
Author URI: http://l3rady.com/
Text Domain: wp-updates-notifier
Domain Path: /languages
Expand Down Expand Up @@ -34,7 +34,7 @@
class sc_WPUpdatesNotifier {
const OPT_FIELD = "sc_wpun_settings";
const OPT_VERSION_FIELD = "sc_wpun_settings_ver";
const OPT_VERSION = "5.0";
const OPT_VERSION = "6.0";
const CRON_NAME = "sc_wpun_update_check";

public static function init() {
Expand Down Expand Up @@ -76,6 +76,7 @@ private function settingsUpToDate() {
$defaults = array( // Here are our default values for this plugin
'cron_method' => 'wordpress', // Cron method to be used for scheduling scans
'frequency' => 'hourly',
'resend' => 0,
'notify_to' => get_option( 'admin_email' ),
'notify_from' => get_option( 'admin_email' ),
'notify_plugins' => 1,
Expand Down Expand Up @@ -562,6 +563,7 @@ public function admin_settings_init() {
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
add_settings_field( "sc_wpun_settings_main_cron_method", __( "Cron Method", "wp-updates-notifier" ), array( __CLASS__, "sc_wpun_settings_main_field_cron_method" ), "wp-updates-notifier", "sc_wpun_settings_main" );
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" );
add_settings_field( "sc_wpun_settings_main_resend", __( "Resend notifications", "wp-updates-notifier" ), array( __CLASS__, "sc_wpun_settings_main_field_resend" ), "wp-updates-notifier", "sc_wpun_settings_main" );
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" );
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" );
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" );
Expand Down Expand Up @@ -591,6 +593,14 @@ public function sc_wpun_settings_validate( $input ) {
add_settings_error( "sc_wpun_settings_main_frequency", "sc_wpun_settings_main_frequency_error", __( "Invalid frequency entered", "wp-updates-notifier" ), "error" );
}

$sanitized_resend = absint( isset( $input['resend'] ) ? $input['resend'] : 0 );
if ( $sanitized_resend >= 0 && $sanitized_resend <= 2 ) {
$valid['resend'] = $sanitized_resend;
}
else {
add_settings_error( "sc_wpun_settings_main_resend", "sc_wpun_settings_main_resend_error", __( "Invalid resend notifications value entered", "wp-updates-notifier" ), "error" );
}

$emails_to = explode( ",", $input['notify_to'] );
if ( $emails_to ) {
$sanitized_emails = array();
Expand Down Expand Up @@ -679,10 +689,22 @@ public function sc_wpun_settings_main_field_frequency() {
$options = self::getSetOptions( self::OPT_FIELD );
?>
<select id="sc_wpun_settings_main_frequency" name="<?php echo self::OPT_FIELD; ?>[frequency]">
<?php foreach ( self::get_schedules() as $k => $v ): ?>
<option value="<?php echo $k; ?>" <?php selected( $options['frequency'], $k ); ?>><?php echo $v['display']; ?></option>
<?php endforeach; ?>
<select>
<?php foreach ( self::get_schedules() as $k => $v ): ?>
<option value="<?php echo $k; ?>" <?php selected( $options['frequency'], $k ); ?>><?php echo $v['display']; ?></option>
<?php endforeach; ?>
</select>
<?php
}

public function sc_wpun_settings_main_field_resend() {
$options = self::getSetOptions( self::OPT_FIELD );
?>
<label><input name="<?php echo self::OPT_FIELD; ?>[resend]" type="radio" value="0" <?php checked( $options['resend'], 0 ); ?> /> <?php esc_html_e( 'Never resend update notifications.', 'wp-updates-notifier' ); ?>
</label><br />
<label><input name="<?php echo self::OPT_FIELD; ?>[resend]" type="radio" value="1" <?php checked( $options['resend'], 1 ); ?> /> <?php esc_html_e( 'Only resend update notifications when new ones become available.', 'wp-updates-notifier' ); ?>
</label><br />
<label><input name="<?php echo self::OPT_FIELD; ?>[resend]" type="radio" value="2" <?php checked( $options['resend'], 2 ); ?> /> <?php esc_html_e( 'Always resend update notifications while there are updates available.', 'wp-updates-notifier' ); ?>
</label>
<?php
}

Expand Down