Easy Updates Manager - Version 6.2.5

Version Description

Released 2016-11-14

  • Bug fix: internationalization was in the wrong place
Download this release

Release Info

Developer ronalfy
Plugin Icon 128x128 Easy Updates Manager
Version 6.2.5
Comparing to
See all releases

Code changes from version 6.2.2 to 6.2.5

Files changed (4) hide show
  1. contributing.md +12 -14
  2. easy-updates-manager.php +0 -383
  3. main.php +397 -2
  4. readme.txt +19 -122
contributing.md CHANGED
@@ -1,26 +1,24 @@
1
- # Easy Updates Manager Contributing Handbook
2
  Easy Updates Manager is a 100% volunteer run plugin. We are always happy to welcome new contributors to help make Easy Updates Manager a better plugin.
3
 
4
- ## Getting Started with Contributing
5
- There are many ways that you can contribute to Easy Updates Manager. The ones that are going to be outlines in this are:
6
  - Coding
7
  - Documentation
8
  - Support
9
  - Translations
10
- Below is a quick outline on each one and how you can contribute to them.
11
 
12
- ### Coding
13
- Coding is not easy. That is why we are always looking for some help. You can help code by creating pull requests to resolve issues.
14
 
15
- If you plan on doing this then please make sure that you do the following use the most recent branch of Easy Updates Manager to make your changes on, and most importantly use the most recent version of WordPress to test your changes on.
16
 
17
- ### Documentation
18
- Documentation can be a very tedious job. Also there can never be too much documentation in my opinion. For this reason we are more than happy for you to write up some documentation for Easy Updates Manager. This can consist of writing pages for our wiki, writing a post about how to use Easy Updates Manager, or even create a video about Easy Updates Manager. Either one of these we would very much appreciate.
19
 
20
- Note that if you want to right up stuff for the wiki then please submit an issue with your suggested wiki changes.
21
 
22
- ### Support
23
- Support is a fairly big thing to manage. We volunteers at Easy Updates Manager want to make sure that our users get the best support they can. How you can help with this is extremely simple. Head over to our WordPress Support Forum and answer some support topics.
24
 
25
- ### Translation
26
- We are always trying to expand Easy Updates Managers translations. If you are interested in translating Easy Updates Manager then go here. https://translate.wordpress.org/projects/wp-plugins/stops-core-theme-and-plugin-updates
 
1
  Easy Updates Manager is a 100% volunteer run plugin. We are always happy to welcome new contributors to help make Easy Updates Manager a better plugin.
2
 
3
+ # Getting Started with Contributing
4
+ There are many ways that you can contribute to Easy Updates Manager.
5
  - Coding
6
  - Documentation
7
  - Support
8
  - Translations
 
9
 
10
+ ## Coding
11
+ Coding is not easy. A good start to contibuting with code is to create a pull request through GitHub.
12
 
13
+ If you plan on doing this then please make sure that you use the most recent branch of Easy Updates Manager to make your changes on, and most importantly use the most recent version of WordPress to test your changes on.
14
 
15
+ ## Documentation
16
+ Documentation is always needing to be updated. Also there can never be too much documentation. For this reason we are more than happy for you to write up some documentation for Easy Updates Manager. This can consist of writing pages for our wiki, writing a post about how to use Easy Updates Manager, or even create a video about Easy Updates Manager. Either one of these we would very much appreciate.
17
 
18
+ Note that if you want to right up stuff for the wiki then please submit an issue with your suggested wiki changes so that we can have a look.
19
 
20
+ ## Support
21
+ Support is a fairly big thing to manage. We volunteers at Easy Updates Manager want to make sure that our users get the best support they can. How you can help with this is extremely simple. Head on over to our <a href="https://wordpress.org/support/plugin/stops-core-theme-and-plugin-updates">WordPress Support Forum</a> and answer some support topics.
22
 
23
+ ## Translation
24
+ We are always trying to expand Easy Updates Managers translations. If you are interested in translating Easy Updates Manager, please <a href="https://translate.wordpress.org/projects/wp-plugins/stops-core-theme-and-plugin-updates">go here</a>.
easy-updates-manager.php DELETED
@@ -1,383 +0,0 @@
1
- <?php
2
- /**
3
- * Main plugin class
4
- *
5
- * Initializes auto-loader, internationalization, and plugin dependencies.
6
- *
7
- * @since 5.0.0
8
- *
9
- * @package WordPress
10
- */
11
- class MPSUM_Updates_Manager {
12
-
13
- /**
14
- * Holds the class instance.
15
- *
16
- * @since 5.0.0
17
- * @access static
18
- * @var MPSUM_Updates_Manager $instance
19
- */
20
- private static $instance = null;
21
-
22
- /**
23
- * Stores the plugin's options
24
- *
25
- * @since 5.0.0
26
- * @access static
27
- * @var array $options
28
- */
29
- private static $options = false;
30
-
31
- /**
32
- * Retrieve a class instance.
33
- *
34
- * Retrieve a class instance.
35
- *
36
- * @since 5.0.0
37
- * @access static
38
- *
39
- * @return MPSUM_Updates_Manager Instance of the class.
40
- */
41
- public static function get_instance() {
42
- if ( null == self::$instance ) {
43
- self::$instance = new self;
44
- }
45
- return self::$instance;
46
- } //end get_instance
47
-
48
- /**
49
- * Retrieve the plugin basename.
50
- *
51
- * Retrieve the plugin basename.
52
- *
53
- * @since 5.0.0
54
- * @access static
55
- *
56
- * @return string plugin basename
57
- */
58
- public static function get_plugin_basename() {
59
- return plugin_basename( __FILE__ );
60
- }
61
-
62
- /**
63
- * Class constructor.
64
- *
65
- * Set up internationalization, auto-loader, and plugin initialization.
66
- *
67
- * @since 5.0.0
68
- * @access private
69
- *
70
- */
71
- private function __construct() {
72
- /* Localization Code */
73
- load_plugin_textdomain( 'stops-core-theme-and-plugin-updates', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
74
-
75
- spl_autoload_register( array( $this, 'loader' ) );
76
-
77
- // Logging
78
- $options = MPSUM_Updates_Manager::get_options( 'core' );
79
- if ( isset( $options[ 'logs' ] ) && 'on' == $options[ 'logs' ] ) {
80
- MPSUM_Logs::run();
81
- }
82
-
83
- add_action( 'plugins_loaded', array( $this, 'plugins_loaded' ) );
84
- } //end constructor
85
-
86
- /**
87
- * Return the absolute path to an asset.
88
- *
89
- * Return the absolute path to an asset based on a relative argument.
90
- *
91
- * @since 5.0.0
92
- * @access static
93
- *
94
- * @param string $path Relative path to the asset.
95
- * @return string Absolute path to the relative asset.
96
- */
97
- public static function get_plugin_dir( $path = '' ) {
98
- $dir = rtrim( plugin_dir_path(__FILE__), '/' );
99
- if ( !empty( $path ) && is_string( $path) )
100
- $dir .= '/' . ltrim( $path, '/' );
101
- return $dir;
102
- }
103
-
104
- /**
105
- * Return the web path to an asset.
106
- *
107
- * Return the web path to an asset based on a relative argument.
108
- *
109
- * @since 5.0.0
110
- * @access static
111
- *
112
- * @param string $path Relative path to the asset.
113
- * @return string Web path to the relative asset.
114
- */
115
- public static function get_plugin_url( $path = '' ) {
116
- $dir = rtrim( plugin_dir_url(__FILE__), '/' );
117
- if ( !empty( $path ) && is_string( $path) )
118
- $dir .= '/' . ltrim( $path, '/' );
119
- return $dir;
120
- }
121
-
122
- /**
123
- * Retrieve the plugin's options
124
- *
125
- * Retrieve the plugin's options based on context
126
- *
127
- * @since 5.0.0
128
- * @access static
129
- *
130
- * @param string $context Context to retrieve options for. This is used as an array key.
131
- * @param bool $force_reload Whether to retrieve cached options or forcefully retrieve from the database.
132
- * @return array All options if no context, or associative array if context is set. Empty array if no options.
133
- */
134
- public static function get_options( $context = '', $force_reload = false ) {
135
- //Try to get cached options
136
- $options = self::$options;
137
- if ( false === $options || true === $force_reload ) {
138
- $options = get_site_option( 'MPSUM', false, false );
139
- }
140
-
141
- if ( false === $options ) {
142
- $options = self::maybe_migrate_options();
143
- }
144
-
145
- //Store options
146
- if ( !is_array( $options ) ) {
147
- $options = array();
148
- }
149
- self::$options = $options;
150
-
151
- //Attempt to get context
152
- if ( !empty( $context ) && is_string( $context ) ) {
153
- if ( array_key_exists( $context, $options ) ) {
154
- return (array)$options[ $context ];
155
- } else {
156
- return array();
157
- }
158
- }
159
-
160
-
161
- return $options;
162
- } //get_options
163
-
164
- /**
165
- * Auto-loads classes.
166
- *
167
- * Auto-load classes that belong to this plugin.
168
- *
169
- * @since 5.0.0
170
- * @access private
171
- *
172
- * @param string $class_name The name of the class.
173
- */
174
- private function loader( $class_name ) {
175
- if ( class_exists( $class_name, false ) || false === strpos( $class_name, 'MPSUM' ) ) {
176
- return;
177
- }
178
- $file = MPSUM_Updates_Manager::get_plugin_dir( "includes/{$class_name}.php" );
179
- if ( file_exists( $file ) ) {
180
- include_once( $file );
181
- }
182
- }
183
-
184
- /**
185
- * Determine whether to migrate options from an older version of the plugin.
186
- *
187
- * Migrate old options to new plugin format.
188
- *
189
- * @since 5.0.0
190
- * @access private
191
- *
192
- * @return bool|array false if no migration, associative array of options if migration successful
193
- */
194
- public static function maybe_migrate_options() {
195
- $options = false;
196
- $original_options = get_option( '_disable_updates', false );
197
-
198
- if ( false !== $original_options && is_array( $original_options ) ) {
199
- $options = array(
200
- 'core' => array(),
201
- 'plugins' => array(),
202
- 'themes' => array()
203
- );
204
- //Global WP Updates
205
- if ( isset( $original_options[ 'all' ] ) && "1" === $original_options[ 'all' ] ) {
206
- $options[ 'core' ][ 'all_updates' ] = 'off';
207
- }
208
- //Global Plugin Updates
209
- if ( isset( $original_options[ 'plugin' ] ) && "1" === $original_options[ 'plugin' ] ) {
210
- $options[ 'core' ][ 'plugin_updates' ] = 'off';
211
- }
212
- //Global Theme Updates
213
- if ( isset( $original_options[ 'theme' ] ) && "1" === $original_options[ 'theme' ] ) {
214
- $options[ 'core' ][ 'theme_updates' ] = 'off';
215
- }
216
- //Global Core Updates
217
- if ( isset( $original_options[ 'core' ] ) && "1" === $original_options[ 'core' ] ) {
218
- $options[ 'core' ][ 'core_updates' ] = 'off';
219
- }
220
- //Global Individual Theme Updates
221
- if ( isset( $original_options[ 'it' ] ) && "1" === $original_options[ 'it' ] ) {
222
- if ( isset( $original_options[ 'themes' ] ) && is_array( $original_options[ 'themes' ] ) ) {
223
- $options[ 'themes' ] = $original_options[ 'themes' ];
224
- }
225
- }
226
- //Global Individual Plugin Updates
227
- if ( isset( $original_options[ 'ip' ] ) && "1" === $original_options[ 'ip' ] ) {
228
- if ( isset( $original_options[ 'plugins' ] ) && is_array( $original_options[ 'plugins' ] ) ) {
229
- $options[ 'plugins' ] = $original_options[ 'plugins' ];
230
- }
231
- }
232
- //Browser Nag
233
- if ( isset( $original_options[ 'bnag' ] ) && "1" === $original_options[ 'bnag' ] ) {
234
- $options[ 'core' ][ 'misc_browser_nag' ] = 'off';
235
- }
236
- //WordPress Version
237
- if ( isset( $original_options[ 'wpv' ] ) && "1" === $original_options[ 'wpv' ] ) {
238
- $options[ 'core' ][ 'misc_wp_footer' ] = 'off';
239
- }
240
- //Translation Updates
241
- if ( isset( $original_options[ 'auto-translation-updates' ] ) && "1" === $original_options[ 'auto-translation-updates' ] ) {
242
- $options[ 'core' ][ 'automatic_translation_updates' ] = 'off';
243
- }
244
- //Translation Updates
245
- if ( isset( $original_options[ 'auto-core-emails' ] ) && "1" === $original_options[ 'auto-core-emails' ] ) {
246
- $options[ 'core' ][ 'notification_core_update_emails' ] = 'off';
247
- }
248
- //Automatic Updates
249
- if ( isset( $original_options[ 'abup' ] ) && "1" === $original_options[ 'abup' ] ) {
250
- $options[ 'core' ][ 'automatic_major_updates' ] = 'off';
251
- $options[ 'core' ][ 'automatic_minor_updates' ] = 'off';
252
- $options[ 'core' ][ 'automatic_plugin_updates' ] = 'off';
253
- $options[ 'core' ][ 'automatic_theme_updates' ] = 'off';
254
- }
255
-
256
- delete_option( '_disable_updates' );
257
- delete_site_option( '_disable_updates' );
258
- update_site_option( 'MPSUM', $options );
259
-
260
- }
261
- return $options;
262
- }
263
-
264
- /**
265
- * Initialize the plugin and its dependencies.
266
- *
267
- * Initialize the plugin and its dependencies.
268
- *
269
- * @since 5.0.0
270
- * @access public
271
- * @see __construct
272
- * @internal Uses plugins_loaded action
273
- *
274
- */
275
- public function plugins_loaded() {
276
- //Skip disable updates if a user is excluded
277
- $disable_updates_skip = false;
278
- if ( current_user_can( 'install_plugins' ) ) {
279
- $current_user = wp_get_current_user();
280
- $current_user_id = $current_user->ID;
281
- $excluded_users = MPSUM_Updates_Manager::get_options( 'excluded_users' );
282
- if ( in_array( $current_user_id, $excluded_users ) ) {
283
- $disable_updates_skip = true;
284
- }
285
- }
286
- if ( false === $disable_updates_skip ) {
287
- MPSUM_Disable_Updates::run();
288
- }
289
-
290
- add_action( 'wp_ajax_mpsum_ajax_action', array( $this, 'ajax_update_option' ) );
291
-
292
-
293
- $not_doing_ajax = ( !defined( 'DOING_AJAX' ) || !DOING_AJAX );
294
- $not_admin_disabled = ( !defined( 'MPSUM_DISABLE_ADMIN' ) || !MPSUM_DISABLE_ADMIN );
295
- if ( is_admin() && $not_doing_ajax && $not_admin_disabled ) {
296
- MPSUM_Admin::run();
297
- }
298
- }
299
-
300
- public function ajax_update_option() {
301
- if ( !wp_verify_nonce( $_POST[ '_ajax_nonce' ], 'mpsum_options_save' ) ) {
302
- die( 'Cheating, huh' );
303
- }
304
- if ( !isset( $_POST[ 'context' ] ) || !isset( $_POST[ 'data_action' ] ) ) {
305
- die('');
306
- }
307
- /* Get Ajax Options */
308
- $context = sanitize_text_field( $_POST[ 'context' ] );
309
- $option = sanitize_text_field( $_POST[ 'data_action' ] );
310
- $option_value = sanitize_text_field( $_POST[ 'checked' ] );
311
- $val = sanitize_text_field( $_POST[ 'val' ] );
312
-
313
-
314
- $options = MPSUM_Updates_Manager::get_options( $context );
315
- $options = wp_parse_args( $options, MPSUM_Admin_Core::get_defaults() );
316
- if ( 'core' == $context ) {
317
- $options[ $option ] = $option_value;
318
- if ( $option == 'automatic_theme_updates' || $option == 'automatic_plugin_updates' ) {
319
- $options[ $option ] = $val;
320
- }
321
- MPSUM_Updates_Manager::update_options( $options, $context );
322
- } else if ( 'plugins' == $context || 'themes' == $context ) {
323
- $plugin_options = MPSUM_Updates_Manager::get_options( $context );
324
- if ( 'on' == $option_value ) {
325
- foreach( $plugin_options as $plugin ) {
326
- if ( ( $key = array_search( $option, $plugin_options ) ) !== false ) {
327
- unset( $plugin_options[ $key ] );
328
- }
329
- }
330
- } else {
331
- $plugin_options[] = $option;
332
- $plugin_options = array_values( array_unique( $plugin_options ) );
333
- }
334
-
335
- MPSUM_Updates_Manager::update_options( $plugin_options, $context );
336
- } elseif( 'plugins_automatic' == $context || 'themes_automatic' == $context ) {
337
- $plugin_options = MPSUM_Updates_Manager::get_options( $context );
338
- if ( 'off' == $option_value ) {
339
- foreach( $plugin_options as $plugin ) {
340
- if ( ( $key = array_search( $option, $plugin_options ) ) !== false ) {
341
- unset( $plugin_options[ $key ] );
342
- }
343
- }
344
- } else {
345
- $options = MPSUM_Updates_Manager::get_options( $context );
346
- $options[] = $option;
347
- $plugin_options = array_values( array_unique( $options ) );
348
- }
349
-
350
- MPSUM_Updates_Manager::update_options( $plugin_options, $context );
351
- }
352
-
353
- die( $context );
354
-
355
- }
356
-
357
- /**
358
- * Save plugin options.
359
- *
360
- * Saves the plugin options based on context. If no context is provided, updates all options.
361
- *
362
- * @since 5.0.0
363
- * @access static
364
- *
365
- * @param array $options Associative array of plugin options.
366
- * @param string $context Array key of which options to update
367
- */
368
- public static function update_options( $options = array(), $context = '' ) {
369
- $options_to_save = self::get_options();
370
-
371
- if ( !empty( $context ) && is_string( $context ) ) {
372
- $options_to_save[ $context ] = $options;
373
- } else {
374
- $options_to_save = $options;
375
- }
376
-
377
- self::$options = $options_to_save;
378
- update_site_option( 'MPSUM', $options_to_save );
379
- }
380
-
381
- } //end class MPSUM_Updates_Manager
382
-
383
- MPSUM_Updates_Manager::get_instance();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
main.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Easy Updates Manager
4
  Plugin URI: https://wordpress.org/plugins/stops-core-theme-and-plugin-updates/
5
  Description: Manage and disable WordPress updates, including core, plugin, theme, and automatic updates - Works with Multisite and has built-in logging features.
6
  Author: Easy Updates Manager Team
7
- Version: 6.2.2
8
  Requires at least: 4.4
9
  Author URI: https://wordpress.org/plugins/stops-core-theme-and-plugin-updates/
10
  Contributors: kidsguide, ronalfy
@@ -13,4 +13,399 @@ Domain Path: /languages
13
  Updates: true
14
  Network: true
15
  */
16
- require( 'easy-updates-manager.php' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  Plugin URI: https://wordpress.org/plugins/stops-core-theme-and-plugin-updates/
5
  Description: Manage and disable WordPress updates, including core, plugin, theme, and automatic updates - Works with Multisite and has built-in logging features.
6
  Author: Easy Updates Manager Team
7
+ Version: 6.2.5
8
  Requires at least: 4.4
9
  Author URI: https://wordpress.org/plugins/stops-core-theme-and-plugin-updates/
10
  Contributors: kidsguide, ronalfy
13
  Updates: true
14
  Network: true
15
  */
16
+
17
+ /**
18
+ * Main plugin class
19
+ *
20
+ * Initializes auto-loader, internationalization, and plugin dependencies.
21
+ *
22
+ * @since 5.0.0
23
+ *
24
+ * @package WordPress
25
+ */
26
+ class MPSUM_Updates_Manager {
27
+
28
+ /**
29
+ * Holds the class instance.
30
+ *
31
+ * @since 5.0.0
32
+ * @access static
33
+ * @var MPSUM_Updates_Manager $instance
34
+ */
35
+ private static $instance = null;
36
+
37
+ /**
38
+ * Stores the plugin's options
39
+ *
40
+ * @since 5.0.0
41
+ * @access static
42
+ * @var array $options
43
+ */
44
+ private static $options = false;
45
+
46
+ /**
47
+ * Retrieve a class instance.
48
+ *
49
+ * Retrieve a class instance.
50
+ *
51
+ * @since 5.0.0
52
+ * @access static
53
+ *
54
+ * @return MPSUM_Updates_Manager Instance of the class.
55
+ */
56
+ public static function get_instance() {
57
+ if ( null == self::$instance ) {
58
+ self::$instance = new self;
59
+ }
60
+ return self::$instance;
61
+ } //end get_instance
62
+
63
+ /**
64
+ * Retrieve the plugin basename.
65
+ *
66
+ * Retrieve the plugin basename.
67
+ *
68
+ * @since 5.0.0
69
+ * @access static
70
+ *
71
+ * @return string plugin basename
72
+ */
73
+ public static function get_plugin_basename() {
74
+ return plugin_basename( __FILE__ );
75
+ }
76
+
77
+ /**
78
+ * Class constructor.
79
+ *
80
+ * Set up internationalization, auto-loader, and plugin initialization.
81
+ *
82
+ * @since 5.0.0
83
+ * @access private
84
+ *
85
+ */
86
+ private function __construct() {
87
+
88
+ spl_autoload_register( array( $this, 'loader' ) );
89
+
90
+ // Logging
91
+ $options = MPSUM_Updates_Manager::get_options( 'core' );
92
+ if ( isset( $options[ 'logs' ] ) && 'on' == $options[ 'logs' ] ) {
93
+ MPSUM_Logs::run();
94
+ }
95
+
96
+ add_action( 'init', array( $this, 'init' ) );
97
+ add_action( 'plugins_loaded', array( $this, 'plugins_loaded' ) );
98
+ } //end constructor
99
+
100
+ /**
101
+ * Run code during the init action.
102
+ *
103
+ * Run code during the init action.
104
+ *
105
+ * @since 6.2.5
106
+ * @access public
107
+ *
108
+ */
109
+ public function init() {
110
+ /* Localization Code */
111
+ load_plugin_textdomain( 'stops-core-theme-and-plugin-updates', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
112
+ }
113
+
114
+ /**
115
+ * Return the absolute path to an asset.
116
+ *
117
+ * Return the absolute path to an asset based on a relative argument.
118
+ *
119
+ * @since 5.0.0
120
+ * @access static
121
+ *
122
+ * @param string $path Relative path to the asset.
123
+ * @return string Absolute path to the relative asset.
124
+ */
125
+ public static function get_plugin_dir( $path = '' ) {
126
+ $dir = rtrim( plugin_dir_path(__FILE__), '/' );
127
+ if ( !empty( $path ) && is_string( $path) )
128
+ $dir .= '/' . ltrim( $path, '/' );
129
+ return $dir;
130
+ }
131
+
132
+ /**
133
+ * Return the web path to an asset.
134
+ *
135
+ * Return the web path to an asset based on a relative argument.
136
+ *
137
+ * @since 5.0.0
138
+ * @access static
139
+ *
140
+ * @param string $path Relative path to the asset.
141
+ * @return string Web path to the relative asset.
142
+ */
143
+ public static function get_plugin_url( $path = '' ) {
144
+ $dir = rtrim( plugin_dir_url(__FILE__), '/' );
145
+ if ( !empty( $path ) && is_string( $path) )
146
+ $dir .= '/' . ltrim( $path, '/' );
147
+ return $dir;
148
+ }
149
+
150
+ /**
151
+ * Retrieve the plugin's options
152
+ *
153
+ * Retrieve the plugin's options based on context
154
+ *
155
+ * @since 5.0.0
156
+ * @access static
157
+ *
158
+ * @param string $context Context to retrieve options for. This is used as an array key.
159
+ * @param bool $force_reload Whether to retrieve cached options or forcefully retrieve from the database.
160
+ * @return array All options if no context, or associative array if context is set. Empty array if no options.
161
+ */
162
+ public static function get_options( $context = '', $force_reload = false ) {
163
+ //Try to get cached options
164
+ $options = self::$options;
165
+ if ( false === $options || true === $force_reload ) {
166
+ $options = get_site_option( 'MPSUM', false, false );
167
+ }
168
+
169
+ if ( false === $options ) {
170
+ $options = self::maybe_migrate_options();
171
+ }
172
+
173
+ //Store options
174
+ if ( !is_array( $options ) ) {
175
+ $options = array();
176
+ }
177
+ self::$options = $options;
178
+
179
+ //Attempt to get context
180
+ if ( !empty( $context ) && is_string( $context ) ) {
181
+ if ( array_key_exists( $context, $options ) ) {
182
+ return (array)$options[ $context ];
183
+ } else {
184
+ return array();
185
+ }
186
+ }
187
+
188
+
189
+ return $options;
190
+ } //get_options
191
+
192
+ /**
193
+ * Auto-loads classes.
194
+ *
195
+ * Auto-load classes that belong to this plugin.
196
+ *
197
+ * @since 5.0.0
198
+ * @access private
199
+ *
200
+ * @param string $class_name The name of the class.
201
+ */
202
+ private function loader( $class_name ) {
203
+ if ( class_exists( $class_name, false ) || false === strpos( $class_name, 'MPSUM' ) ) {
204
+ return;
205
+ }
206
+ $file = MPSUM_Updates_Manager::get_plugin_dir( "includes/{$class_name}.php" );
207
+ if ( file_exists( $file ) ) {
208
+ include_once( $file );
209
+ }
210
+ }
211
+
212
+ /**
213
+ * Determine whether to migrate options from an older version of the plugin.
214
+ *
215
+ * Migrate old options to new plugin format.
216
+ *
217
+ * @since 5.0.0
218
+ * @access private
219
+ *
220
+ * @return bool|array false if no migration, associative array of options if migration successful
221
+ */
222
+ public static function maybe_migrate_options() {
223
+ $options = false;
224
+ $original_options = get_option( '_disable_updates', false );
225
+
226
+ if ( false !== $original_options && is_array( $original_options ) ) {
227
+ $options = array(
228
+ 'core' => array(),
229
+ 'plugins' => array(),
230
+ 'themes' => array()
231
+ );
232
+ //Global WP Updates
233
+ if ( isset( $original_options[ 'all' ] ) && "1" === $original_options[ 'all' ] ) {
234
+ $options[ 'core' ][ 'all_updates' ] = 'off';
235
+ }
236
+ //Global Plugin Updates
237
+ if ( isset( $original_options[ 'plugin' ] ) && "1" === $original_options[ 'plugin' ] ) {
238
+ $options[ 'core' ][ 'plugin_updates' ] = 'off';
239
+ }
240
+ //Global Theme Updates
241
+ if ( isset( $original_options[ 'theme' ] ) && "1" === $original_options[ 'theme' ] ) {
242
+ $options[ 'core' ][ 'theme_updates' ] = 'off';
243
+ }
244
+ //Global Core Updates
245
+ if ( isset( $original_options[ 'core' ] ) && "1" === $original_options[ 'core' ] ) {
246
+ $options[ 'core' ][ 'core_updates' ] = 'off';
247
+ }
248
+ //Global Individual Theme Updates
249
+ if ( isset( $original_options[ 'it' ] ) && "1" === $original_options[ 'it' ] ) {
250
+ if ( isset( $original_options[ 'themes' ] ) && is_array( $original_options[ 'themes' ] ) ) {
251
+ $options[ 'themes' ] = $original_options[ 'themes' ];
252
+ }
253
+ }
254
+ //Global Individual Plugin Updates
255
+ if ( isset( $original_options[ 'ip' ] ) && "1" === $original_options[ 'ip' ] ) {
256
+ if ( isset( $original_options[ 'plugins' ] ) && is_array( $original_options[ 'plugins' ] ) ) {
257
+ $options[ 'plugins' ] = $original_options[ 'plugins' ];
258
+ }
259
+ }
260
+ //Browser Nag
261
+ if ( isset( $original_options[ 'bnag' ] ) && "1" === $original_options[ 'bnag' ] ) {
262
+ $options[ 'core' ][ 'misc_browser_nag' ] = 'off';
263
+ }
264
+ //WordPress Version
265
+ if ( isset( $original_options[ 'wpv' ] ) && "1" === $original_options[ 'wpv' ] ) {
266
+ $options[ 'core' ][ 'misc_wp_footer' ] = 'off';
267
+ }
268
+ //Translation Updates
269
+ if ( isset( $original_options[ 'auto-translation-updates' ] ) && "1" === $original_options[ 'auto-translation-updates' ] ) {
270
+ $options[ 'core' ][ 'automatic_translation_updates' ] = 'off';
271
+ }
272
+ //Translation Updates
273
+ if ( isset( $original_options[ 'auto-core-emails' ] ) && "1" === $original_options[ 'auto-core-emails' ] ) {
274
+ $options[ 'core' ][ 'notification_core_update_emails' ] = 'off';
275
+ }
276
+ //Automatic Updates
277
+ if ( isset( $original_options[ 'abup' ] ) && "1" === $original_options[ 'abup' ] ) {
278
+ $options[ 'core' ][ 'automatic_major_updates' ] = 'off';
279
+ $options[ 'core' ][ 'automatic_minor_updates' ] = 'off';
280
+ $options[ 'core' ][ 'automatic_plugin_updates' ] = 'off';
281
+ $options[ 'core' ][ 'automatic_theme_updates' ] = 'off';
282
+ }
283
+
284
+ delete_option( '_disable_updates' );
285
+ delete_site_option( '_disable_updates' );
286
+ update_site_option( 'MPSUM', $options );
287
+
288
+ }
289
+ return $options;
290
+ }
291
+
292
+ /**
293
+ * Initialize the plugin and its dependencies.
294
+ *
295
+ * Initialize the plugin and its dependencies.
296
+ *
297
+ * @since 5.0.0
298
+ * @access public
299
+ * @see __construct
300
+ * @internal Uses plugins_loaded action
301
+ *
302
+ */
303
+ public function plugins_loaded() {
304
+ //Skip disable updates if a user is excluded
305
+ $disable_updates_skip = false;
306
+ if ( current_user_can( 'install_plugins' ) ) {
307
+ $current_user = wp_get_current_user();
308
+ $current_user_id = $current_user->ID;
309
+ $excluded_users = MPSUM_Updates_Manager::get_options( 'excluded_users' );
310
+ if ( in_array( $current_user_id, $excluded_users ) ) {
311
+ $disable_updates_skip = true;
312
+ }
313
+ }
314
+ if ( false === $disable_updates_skip ) {
315
+ MPSUM_Disable_Updates::run();
316
+ }
317
+
318
+ add_action( 'wp_ajax_mpsum_ajax_action', array( $this, 'ajax_update_option' ) );
319
+
320
+
321
+ $not_doing_ajax = ( !defined( 'DOING_AJAX' ) || !DOING_AJAX );
322
+ $not_admin_disabled = ( !defined( 'MPSUM_DISABLE_ADMIN' ) || !MPSUM_DISABLE_ADMIN );
323
+ if ( is_admin() && $not_doing_ajax && $not_admin_disabled ) {
324
+ MPSUM_Admin::run();
325
+ }
326
+ }
327
+
328
+ public function ajax_update_option() {
329
+ if ( !wp_verify_nonce( $_POST[ '_ajax_nonce' ], 'mpsum_options_save' ) ) {
330
+ die( 'Cheating, huh' );
331
+ }
332
+ if ( !isset( $_POST[ 'context' ] ) || !isset( $_POST[ 'data_action' ] ) ) {
333
+ die('');
334
+ }
335
+ /* Get Ajax Options */
336
+ $context = sanitize_text_field( $_POST[ 'context' ] );
337
+ $option = sanitize_text_field( $_POST[ 'data_action' ] );
338
+ $option_value = sanitize_text_field( $_POST[ 'checked' ] );
339
+ $val = sanitize_text_field( $_POST[ 'val' ] );
340
+
341
+
342
+ $options = MPSUM_Updates_Manager::get_options( $context );
343
+ $options = wp_parse_args( $options, MPSUM_Admin_Core::get_defaults() );
344
+ if ( 'core' == $context ) {
345
+ $options[ $option ] = $option_value;
346
+ if ( $option == 'automatic_theme_updates' || $option == 'automatic_plugin_updates' ) {
347
+ $options[ $option ] = $val;
348
+ }
349
+ MPSUM_Updates_Manager::update_options( $options, $context );
350
+ } else if ( 'plugins' == $context || 'themes' == $context ) {
351
+ $plugin_options = MPSUM_Updates_Manager::get_options( $context );
352
+ if ( 'on' == $option_value ) {
353
+ foreach( $plugin_options as $plugin ) {
354
+ if ( ( $key = array_search( $option, $plugin_options ) ) !== false ) {
355
+ unset( $plugin_options[ $key ] );
356
+ }
357
+ }
358
+ } else {
359
+ $plugin_options[] = $option;
360
+ $plugin_options = array_values( array_unique( $plugin_options ) );
361
+ }
362
+
363
+ MPSUM_Updates_Manager::update_options( $plugin_options, $context );
364
+ } elseif( 'plugins_automatic' == $context || 'themes_automatic' == $context ) {
365
+ $plugin_options = MPSUM_Updates_Manager::get_options( $context );
366
+ if ( 'off' == $option_value ) {
367
+ foreach( $plugin_options as $plugin ) {
368
+ if ( ( $key = array_search( $option, $plugin_options ) ) !== false ) {
369
+ unset( $plugin_options[ $key ] );
370
+ }
371
+ }
372
+ } else {
373
+ $options = MPSUM_Updates_Manager::get_options( $context );
374
+ $options[] = $option;
375
+ $plugin_options = array_values( array_unique( $options ) );
376
+ }
377
+
378
+ MPSUM_Updates_Manager::update_options( $plugin_options, $context );
379
+ }
380
+
381
+ die( $context );
382
+
383
+ }
384
+
385
+ /**
386
+ * Save plugin options.
387
+ *
388
+ * Saves the plugin options based on context. If no context is provided, updates all options.
389
+ *
390
+ * @since 5.0.0
391
+ * @access static
392
+ *
393
+ * @param array $options Associative array of plugin options.
394
+ * @param string $context Array key of which options to update
395
+ */
396
+ public static function update_options( $options = array(), $context = '' ) {
397
+ $options_to_save = self::get_options();
398
+
399
+ if ( !empty( $context ) && is_string( $context ) ) {
400
+ $options_to_save[ $context ] = $options;
401
+ } else {
402
+ $options_to_save = $options;
403
+ }
404
+
405
+ self::$options = $options_to_save;
406
+ update_site_option( 'MPSUM', $options_to_save );
407
+ }
408
+
409
+ } //end class MPSUM_Updates_Manager
410
+
411
+ MPSUM_Updates_Manager::get_instance();
readme.txt CHANGED
@@ -2,10 +2,9 @@
2
  Contributors: kidsguide, ronalfy, roary86, bigwing
3
  Tags: updates manager, easy updates manager, disable updates manager, disable updates, update control, plugin updates, theme updates, core updates, automatic updates, multisite, logs
4
  Requires at least: 4.4
5
- Tested up to: 4.6
6
- Stable tag: 6.2.2
7
  License: GPLv2 or later
8
- Donate link: https://mediaron.com/contribute/
9
 
10
  Manage all your WordPress updates, including individual updates, automatic updates, logs, and loads more. Also works with WordPress Multisite.
11
 
@@ -104,6 +103,16 @@ For additional information and FAQs for Easy Updates Manager check out our <a hr
104
 
105
  == Changelog ==
106
 
 
 
 
 
 
 
 
 
 
 
107
  = 6.2.2 =
108
  Released 2016-08-19
109
 
@@ -125,128 +134,16 @@ Released 2016-06-27
125
 
126
  * Bug Fix: Quick links in plugin and themes tab weren't working.
127
 
128
- = 6.1.3 =
129
- Released 2016-06-21
130
-
131
- * Bug fix: email addresses for background updates were not working for non-core updates.
132
-
133
- = 6.1.1 =
134
- Released 2016-06-08
135
-
136
- * Fixed bulk action issue for bottom options in plugins and themes tab.
137
-
138
- = 6.1.0 =
139
- Released 2016-05-30
140
-
141
- * Enhancement: filters for logs.
142
- * Enhancement: can now change the email address for automatic updates.
143
- * Enhancement: warnings now show up in the Advanced tab if automatic updates are disabled by something other than this plugin.
144
-
145
- = 6.0.5 =
146
- Released 2016-05-20
147
-
148
- * Added new filter: `mpsum_default_options` to set defaults programmatically.
149
- * Bug fix: CSS styles for dashboard were applied to the list views.
150
-
151
- = 6.0.3 =
152
- Released 2016-05-17
153
-
154
- * Bug fix: Allow translations in logs (note: manual logging of translations is not currently possible).
155
- * Bug fix: Settings link causes PHP warning error in multisite.
156
-
157
- = 6.0.1 =
158
- Released 2016-05-15
159
-
160
- * Bug fix: Resetting options and enabling logs does not enable logging.
161
-
162
- = 6.0.0 =
163
- Released 2016-05-14
164
-
165
- * LOGS! A highly requested feature is now here. Please keep in mind we consider logs still in beta.
166
-
167
- = 5.4.5 =
168
- Released 2016-04-29
169
-
170
- * Bug fix: Resolving PHP error notices in dashboard
171
- * Numerous dashboard improvements and a spinner to show save progress
172
- * Fixing bug in Multisite where the same user is showing up multiple times
173
-
174
- = 5.4.3 =
175
- Released 2016-01-15
176
 
177
- * Fixed dashboard styles to be more responsive
178
- * Added dashboard JS to preserve states on the Core dashboard tab
179
 
180
- = 5.4.2 =
181
- Released 2015-11-25
182
-
183
- * Removed e-mail options that didn't make it into WordPress 4.4
184
- * Fixed GoDaddy issue where plugin wasn't showing up
185
-
186
- = 5.4.1 =
187
- Released 2015-10-31
188
-
189
- * Fixing styles being used elsewhere besides the EUM dashboard
190
-
191
- = 5.4.0 =
192
- Released 2015-10-30
193
-
194
- * Major Dashboard Update (Props roary86 and ronalfy)
195
- * List Table Changes (Props ramiy)
196
- * WordPress 4.4 preparation
197
-
198
- = 5.3.2 =
199
- Released 2015-10-13
200
-
201
- * Fixed translation errors.
202
- * Welcomed Bego Mario Garde (pixolin) as a official contributor.
203
-
204
- = 5.3.1 =
205
- Released 2015-09-27
206
-
207
- * Fixing automatic updates dashboard widget.
208
-
209
- = 5.3.0 =
210
- Released 2015-09-27
211
-
212
- * New Dashboard View
213
- * Support for WordPress 4.4 Email Notifications
214
-
215
- = 5.2.0 =
216
- Released 2015-09-19
217
-
218
- * Added Force check in the Advanced Tab.
219
- * Better support for third-party plugins.
220
- * Updating the filter priority for better update experience with third-party plugins.
221
-
222
- = 5.1.1 =
223
- Released 2015-08-24
224
-
225
- * Fixed internationalization in plugin files.
226
- * Added German translation.
227
- * Updated internal plugin documentation.
228
- * Fixing errant status messages.
229
-
230
- = 5.1.0 =
231
- Released 2015-08-13
232
-
233
- * WordPress 4.3 tested and is now the minimum supported version.
234
- * Added default option to plugin/theme automatic updates.
235
- * Updated internal HTML to be WordPress 4.3 compatible.
236
- * Updated internal list tables to be WordPress 4.3 compatible.
237
- * Moved menus in multisite to Dashboard for WordPress 4.3 compatibility.
238
-
239
- = 5.0.0 =
240
- Updated 2015-04-23 to ensure WordPress 4.2 compatibility Released 2015-03-24
241
-
242
- In version 5.0.0 we completely re-wrote the plugin to offer a faster and more secure experience. You will also notice that we added lots more settings to cover almost every aspect of managing updates.
243
 
244
- * Complete re-write of Disable Updates Manager with new user interface.
245
- * Now compatible with WordPress Multisite installations.
246
- * New name: Easy Updates Manager
247
- * New contributor: <a href="https://profiles.wordpress.org/ronalfy">ronalfy</a>
248
 
249
- == Upgrade Notice ==
 
250
 
251
  = 6.2.2 =
252
  Fixing issue with manual updates for logs. Fixing CSS issue for mobile.
@@ -261,4 +158,4 @@ Manual logs for translations now work with WordPress 4.6.
261
  Bug Fix: Quick links in plugin and themes tab weren't working.
262
 
263
  = 6.1.3 =
264
- Bug fix: email addresses for background updates were not working for non-core updates.
2
  Contributors: kidsguide, ronalfy, roary86, bigwing
3
  Tags: updates manager, easy updates manager, disable updates manager, disable updates, update control, plugin updates, theme updates, core updates, automatic updates, multisite, logs
4
  Requires at least: 4.4
5
+ Tested up to: 4.7
6
+ Stable tag: 6.2.5
7
  License: GPLv2 or later
 
8
 
9
  Manage all your WordPress updates, including individual updates, automatic updates, logs, and loads more. Also works with WordPress Multisite.
10
 
103
 
104
  == Changelog ==
105
 
106
+ = 6.2.5 =
107
+ Released 2016-11-14
108
+
109
+ * Bug fix: internationalization was in the wrong place
110
+
111
+ = 6.2.3 =
112
+ Released 2016-08-21
113
+
114
+ * Bug fix: options setting on plugins screen disappeared
115
+
116
  = 6.2.2 =
117
  Released 2016-08-19
118
 
134
 
135
  * Bug Fix: Quick links in plugin and themes tab weren't working.
136
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
137
 
138
+ For past changelogs, please visit our <a href="https://github.com/easy-updates-manager/easy-updates-manager/releases">GitHub</a>.
 
139
 
140
+ == Upgrade Notice ==
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
141
 
142
+ = 6.2.5 =
143
+ Bug fix: internationalization was in the wrong place
 
 
144
 
145
+ = 6.2.3 =
146
+ Bug fix: options setting on plugins screen disappeared
147
 
148
  = 6.2.2 =
149
  Fixing issue with manual updates for logs. Fixing CSS issue for mobile.
158
  Bug Fix: Quick links in plugin and themes tab weren't working.
159
 
160
  = 6.1.3 =
161
+ Bug fix: email addresses for background updates were not working for non-core updates.