Plugin Directory

Changeset 1381607


Ignore:
Timestamp:
03/30/2016 02:25:11 AM (10 years ago)
Author:
jeffreysmattson
Message:

Update trunk.

Location:
l7-automatic-updates/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • l7-automatic-updates/trunk/l7-automatic-updates.php

    r1268310 r1381607  
    55 * Description: Options for setting Wordpress's Automatic updates.
    66 * Author: Jeffrey S. Mattson
    7  * Version: 1.0.3
     7 * Version: 1.0.4
    88 * Author URI: http://layer7web.com
    99 * License: GPL2+
     
    1111
    1212/*
    13 Copyright 2015 Jeffrey S. Mattson (email : plugins@layer7web.com)
     13Copyright 2016 Jeffrey S. Mattson (email : plugins@layer7web.com)
    1414This program is free software; you can redistribute it and/ or modify
    1515it under the terms of the GNU General Public License as published by
     
    3939                add_action( 'admin_menu', array( $this, 'l7wau_add_settings_menu' ) );
    4040                add_action( 'admin_init', array( $this, 'l7wau_register_settings' ) );
    41             } else {
    42                 // do nothing
    4341            }
    4442
     
    5149            // Error notices
    5250            add_action( 'admin_notices', array( $this, 'l7wau_error_notice' ) );
     51
     52            // Filter the background update notification email.
     53            add_filter( 'auto_core_update_email', array( $this, 'l7w_filter_auto_core_update_email' ), 1 );
    5354        }
    5455
     
    142143            add_settings_field( 'l7wau_version', 'Update When Version Control is Detected?', array( $this, 'l7wau_version' ), 'l7-automatic-updates', 'l7wau_top_section', array( 'label_for' => 'l7wau_version' ) );
    143144
     145            // Email setting
     146            add_settings_field( 'l7wau_notification_email', 'Send Notification Email To', array( $this, 'l7wau_notification_email' ), 'l7-automatic-updates', 'l7wau_top_section', array( 'label_for' => 'l7wau_version' ) );
     147
    144148            /**
    145149             * Add the plugin checkboxes
     
    157161            echo 'Settings';
    158162        }
     163
    159164        /**
    160165         * Plugins Description
     
    222227            $output = '<input type="checkbox" value="1" id="l7wau_version" name="l7wau_settings_group[version]"' . $checked . ' >';
    223228            echo $output;
     229        }
     230
     231        /**
     232         * Enter email address field
     233         */
     234        function l7wau_notification_email(){
     235            $text_string = $this->l7wau_default_settings( 'l7wau_notification_email' );
     236            $content = "<div class='input-group'><span class='input-group-addon'><i></i></span><input id='l7wau_notification_email' name='l7wau_settings_group[l7wau_notification_email]' type='text' value='" . esc_attr( $text_string ) . "' class='form-control' style='width:40%;' /></div><i>Leave blank to send to admin's email. Set in settings -> general.</i>";
     237            echo $content;
    224238        }
    225239
     
    228242         * is not set then it returns the default value. If the default key is not
    229243         * in the array it returns false.
     244         *
    230245         * @param  string $key the key value of the setting
    231246         * @return string/boolean     
     
    397412        /**
    398413         * Used to set the 'checked' value to the checkboxes.
     414         *
    399415         * @param  string $name
    400416         */
     
    424440        /**
    425441         * Returns an array with the plugin names to update.
     442         *
    426443         * @return array names of plugins to update.
    427444         */
     
    447464            return $return_array;
    448465        }
     466
     467        /**
     468         * Filter the background update notification email
     469         *
     470         * @since 1.0.2
     471         *
     472         * @param array $email Array of email arguments that will be passed to wp_mail().
     473         * @return array Modified array containing the new email address.
     474         */
     475        public function l7w_filter_auto_core_update_email( $email ) {
     476
     477            // Get plugin settings.
     478            $options = get_option( 'l7wau_settings_group' );
     479
     480            // If an email address has been set, override the WordPress default.
     481            if ( isset( $options['l7wau_notification_email'] ) && ! empty( $options['l7wau_notification_email'] ) ) {
     482                $email['to'] = $options['l7wau_notification_email'];
     483            }
     484
     485            return $email;
     486        }
    449487    }
    450488}
  • l7-automatic-updates/trunk/readme.txt

    r1268298 r1381607  
    44Tags: automatic, updates, plugins, themes, core, minor, individual
    55Requires at least: 3.8.2
    6 Tested up to: 4.3
    7 Stable tag:1.0.3
     6Tested up to: 4.4.2
     7Stable tag:1.0.4
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    5757= 1.0.3 =
    5858
    59 *  Corrected Display Error
    60 *  JS in now more efficient.
     59*  Added the ability to change the notification email recipient.
    6160
    6261= 1.0.2 =
Note: See TracChangeset for help on using the changeset viewer.