Version Description
Released 2016-08-19
- Bug fix: manual updates of plugins and themes were showing as failures
- Bug fix: radio boxes on mobile were squished
Download this release
Release Info
Developer | ronalfy |
Plugin | Easy Updates Manager |
Version | 6.2.2 |
Comparing to | |
See all releases |
Code changes from version 6.2.3 to 6.2.2
- easy-updates-manager.php +383 -0
- main.php +2 -384
- readme.txt +1 -9
easy-updates-manager.php
ADDED
@@ -0,0 +1,383 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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.
|
8 |
Requires at least: 4.4
|
9 |
Author URI: https://wordpress.org/plugins/stops-core-theme-and-plugin-updates/
|
10 |
Contributors: kidsguide, ronalfy
|
@@ -13,386 +13,4 @@ Domain Path: /languages
|
|
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 |
-
/* Localization Code */
|
88 |
-
load_plugin_textdomain( 'stops-core-theme-and-plugin-updates', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
|
89 |
-
|
90 |
-
spl_autoload_register( array( $this, 'loader' ) );
|
91 |
-
|
92 |
-
// Logging
|
93 |
-
$options = MPSUM_Updates_Manager::get_options( 'core' );
|
94 |
-
if ( isset( $options[ 'logs' ] ) && 'on' == $options[ 'logs' ] ) {
|
95 |
-
MPSUM_Logs::run();
|
96 |
-
}
|
97 |
-
|
98 |
-
add_action( 'plugins_loaded', array( $this, 'plugins_loaded' ) );
|
99 |
-
} //end constructor
|
100 |
-
|
101 |
-
/**
|
102 |
-
* Return the absolute path to an asset.
|
103 |
-
*
|
104 |
-
* Return the absolute path to an asset based on a relative argument.
|
105 |
-
*
|
106 |
-
* @since 5.0.0
|
107 |
-
* @access static
|
108 |
-
*
|
109 |
-
* @param string $path Relative path to the asset.
|
110 |
-
* @return string Absolute path to the relative asset.
|
111 |
-
*/
|
112 |
-
public static function get_plugin_dir( $path = '' ) {
|
113 |
-
$dir = rtrim( plugin_dir_path(__FILE__), '/' );
|
114 |
-
if ( !empty( $path ) && is_string( $path) )
|
115 |
-
$dir .= '/' . ltrim( $path, '/' );
|
116 |
-
return $dir;
|
117 |
-
}
|
118 |
-
|
119 |
-
/**
|
120 |
-
* Return the web path to an asset.
|
121 |
-
*
|
122 |
-
* Return the web path to an asset based on a relative argument.
|
123 |
-
*
|
124 |
-
* @since 5.0.0
|
125 |
-
* @access static
|
126 |
-
*
|
127 |
-
* @param string $path Relative path to the asset.
|
128 |
-
* @return string Web path to the relative asset.
|
129 |
-
*/
|
130 |
-
public static function get_plugin_url( $path = '' ) {
|
131 |
-
$dir = rtrim( plugin_dir_url(__FILE__), '/' );
|
132 |
-
if ( !empty( $path ) && is_string( $path) )
|
133 |
-
$dir .= '/' . ltrim( $path, '/' );
|
134 |
-
return $dir;
|
135 |
-
}
|
136 |
-
|
137 |
-
/**
|
138 |
-
* Retrieve the plugin's options
|
139 |
-
*
|
140 |
-
* Retrieve the plugin's options based on context
|
141 |
-
*
|
142 |
-
* @since 5.0.0
|
143 |
-
* @access static
|
144 |
-
*
|
145 |
-
* @param string $context Context to retrieve options for. This is used as an array key.
|
146 |
-
* @param bool $force_reload Whether to retrieve cached options or forcefully retrieve from the database.
|
147 |
-
* @return array All options if no context, or associative array if context is set. Empty array if no options.
|
148 |
-
*/
|
149 |
-
public static function get_options( $context = '', $force_reload = false ) {
|
150 |
-
//Try to get cached options
|
151 |
-
$options = self::$options;
|
152 |
-
if ( false === $options || true === $force_reload ) {
|
153 |
-
$options = get_site_option( 'MPSUM', false, false );
|
154 |
-
}
|
155 |
-
|
156 |
-
if ( false === $options ) {
|
157 |
-
$options = self::maybe_migrate_options();
|
158 |
-
}
|
159 |
-
|
160 |
-
//Store options
|
161 |
-
if ( !is_array( $options ) ) {
|
162 |
-
$options = array();
|
163 |
-
}
|
164 |
-
self::$options = $options;
|
165 |
-
|
166 |
-
//Attempt to get context
|
167 |
-
if ( !empty( $context ) && is_string( $context ) ) {
|
168 |
-
if ( array_key_exists( $context, $options ) ) {
|
169 |
-
return (array)$options[ $context ];
|
170 |
-
} else {
|
171 |
-
return array();
|
172 |
-
}
|
173 |
-
}
|
174 |
-
|
175 |
-
|
176 |
-
return $options;
|
177 |
-
} //get_options
|
178 |
-
|
179 |
-
/**
|
180 |
-
* Auto-loads classes.
|
181 |
-
*
|
182 |
-
* Auto-load classes that belong to this plugin.
|
183 |
-
*
|
184 |
-
* @since 5.0.0
|
185 |
-
* @access private
|
186 |
-
*
|
187 |
-
* @param string $class_name The name of the class.
|
188 |
-
*/
|
189 |
-
private function loader( $class_name ) {
|
190 |
-
if ( class_exists( $class_name, false ) || false === strpos( $class_name, 'MPSUM' ) ) {
|
191 |
-
return;
|
192 |
-
}
|
193 |
-
$file = MPSUM_Updates_Manager::get_plugin_dir( "includes/{$class_name}.php" );
|
194 |
-
if ( file_exists( $file ) ) {
|
195 |
-
include_once( $file );
|
196 |
-
}
|
197 |
-
}
|
198 |
-
|
199 |
-
/**
|
200 |
-
* Determine whether to migrate options from an older version of the plugin.
|
201 |
-
*
|
202 |
-
* Migrate old options to new plugin format.
|
203 |
-
*
|
204 |
-
* @since 5.0.0
|
205 |
-
* @access private
|
206 |
-
*
|
207 |
-
* @return bool|array false if no migration, associative array of options if migration successful
|
208 |
-
*/
|
209 |
-
public static function maybe_migrate_options() {
|
210 |
-
$options = false;
|
211 |
-
$original_options = get_option( '_disable_updates', false );
|
212 |
-
|
213 |
-
if ( false !== $original_options && is_array( $original_options ) ) {
|
214 |
-
$options = array(
|
215 |
-
'core' => array(),
|
216 |
-
'plugins' => array(),
|
217 |
-
'themes' => array()
|
218 |
-
);
|
219 |
-
//Global WP Updates
|
220 |
-
if ( isset( $original_options[ 'all' ] ) && "1" === $original_options[ 'all' ] ) {
|
221 |
-
$options[ 'core' ][ 'all_updates' ] = 'off';
|
222 |
-
}
|
223 |
-
//Global Plugin Updates
|
224 |
-
if ( isset( $original_options[ 'plugin' ] ) && "1" === $original_options[ 'plugin' ] ) {
|
225 |
-
$options[ 'core' ][ 'plugin_updates' ] = 'off';
|
226 |
-
}
|
227 |
-
//Global Theme Updates
|
228 |
-
if ( isset( $original_options[ 'theme' ] ) && "1" === $original_options[ 'theme' ] ) {
|
229 |
-
$options[ 'core' ][ 'theme_updates' ] = 'off';
|
230 |
-
}
|
231 |
-
//Global Core Updates
|
232 |
-
if ( isset( $original_options[ 'core' ] ) && "1" === $original_options[ 'core' ] ) {
|
233 |
-
$options[ 'core' ][ 'core_updates' ] = 'off';
|
234 |
-
}
|
235 |
-
//Global Individual Theme Updates
|
236 |
-
if ( isset( $original_options[ 'it' ] ) && "1" === $original_options[ 'it' ] ) {
|
237 |
-
if ( isset( $original_options[ 'themes' ] ) && is_array( $original_options[ 'themes' ] ) ) {
|
238 |
-
$options[ 'themes' ] = $original_options[ 'themes' ];
|
239 |
-
}
|
240 |
-
}
|
241 |
-
//Global Individual Plugin Updates
|
242 |
-
if ( isset( $original_options[ 'ip' ] ) && "1" === $original_options[ 'ip' ] ) {
|
243 |
-
if ( isset( $original_options[ 'plugins' ] ) && is_array( $original_options[ 'plugins' ] ) ) {
|
244 |
-
$options[ 'plugins' ] = $original_options[ 'plugins' ];
|
245 |
-
}
|
246 |
-
}
|
247 |
-
//Browser Nag
|
248 |
-
if ( isset( $original_options[ 'bnag' ] ) && "1" === $original_options[ 'bnag' ] ) {
|
249 |
-
$options[ 'core' ][ 'misc_browser_nag' ] = 'off';
|
250 |
-
}
|
251 |
-
//WordPress Version
|
252 |
-
if ( isset( $original_options[ 'wpv' ] ) && "1" === $original_options[ 'wpv' ] ) {
|
253 |
-
$options[ 'core' ][ 'misc_wp_footer' ] = 'off';
|
254 |
-
}
|
255 |
-
//Translation Updates
|
256 |
-
if ( isset( $original_options[ 'auto-translation-updates' ] ) && "1" === $original_options[ 'auto-translation-updates' ] ) {
|
257 |
-
$options[ 'core' ][ 'automatic_translation_updates' ] = 'off';
|
258 |
-
}
|
259 |
-
//Translation Updates
|
260 |
-
if ( isset( $original_options[ 'auto-core-emails' ] ) && "1" === $original_options[ 'auto-core-emails' ] ) {
|
261 |
-
$options[ 'core' ][ 'notification_core_update_emails' ] = 'off';
|
262 |
-
}
|
263 |
-
//Automatic Updates
|
264 |
-
if ( isset( $original_options[ 'abup' ] ) && "1" === $original_options[ 'abup' ] ) {
|
265 |
-
$options[ 'core' ][ 'automatic_major_updates' ] = 'off';
|
266 |
-
$options[ 'core' ][ 'automatic_minor_updates' ] = 'off';
|
267 |
-
$options[ 'core' ][ 'automatic_plugin_updates' ] = 'off';
|
268 |
-
$options[ 'core' ][ 'automatic_theme_updates' ] = 'off';
|
269 |
-
}
|
270 |
-
|
271 |
-
delete_option( '_disable_updates' );
|
272 |
-
delete_site_option( '_disable_updates' );
|
273 |
-
update_site_option( 'MPSUM', $options );
|
274 |
-
|
275 |
-
}
|
276 |
-
return $options;
|
277 |
-
}
|
278 |
-
|
279 |
-
/**
|
280 |
-
* Initialize the plugin and its dependencies.
|
281 |
-
*
|
282 |
-
* Initialize the plugin and its dependencies.
|
283 |
-
*
|
284 |
-
* @since 5.0.0
|
285 |
-
* @access public
|
286 |
-
* @see __construct
|
287 |
-
* @internal Uses plugins_loaded action
|
288 |
-
*
|
289 |
-
*/
|
290 |
-
public function plugins_loaded() {
|
291 |
-
//Skip disable updates if a user is excluded
|
292 |
-
$disable_updates_skip = false;
|
293 |
-
if ( current_user_can( 'install_plugins' ) ) {
|
294 |
-
$current_user = wp_get_current_user();
|
295 |
-
$current_user_id = $current_user->ID;
|
296 |
-
$excluded_users = MPSUM_Updates_Manager::get_options( 'excluded_users' );
|
297 |
-
if ( in_array( $current_user_id, $excluded_users ) ) {
|
298 |
-
$disable_updates_skip = true;
|
299 |
-
}
|
300 |
-
}
|
301 |
-
if ( false === $disable_updates_skip ) {
|
302 |
-
MPSUM_Disable_Updates::run();
|
303 |
-
}
|
304 |
-
|
305 |
-
add_action( 'wp_ajax_mpsum_ajax_action', array( $this, 'ajax_update_option' ) );
|
306 |
-
|
307 |
-
|
308 |
-
$not_doing_ajax = ( !defined( 'DOING_AJAX' ) || !DOING_AJAX );
|
309 |
-
$not_admin_disabled = ( !defined( 'MPSUM_DISABLE_ADMIN' ) || !MPSUM_DISABLE_ADMIN );
|
310 |
-
if ( is_admin() && $not_doing_ajax && $not_admin_disabled ) {
|
311 |
-
MPSUM_Admin::run();
|
312 |
-
}
|
313 |
-
}
|
314 |
-
|
315 |
-
public function ajax_update_option() {
|
316 |
-
if ( !wp_verify_nonce( $_POST[ '_ajax_nonce' ], 'mpsum_options_save' ) ) {
|
317 |
-
die( 'Cheating, huh' );
|
318 |
-
}
|
319 |
-
if ( !isset( $_POST[ 'context' ] ) || !isset( $_POST[ 'data_action' ] ) ) {
|
320 |
-
die('');
|
321 |
-
}
|
322 |
-
/* Get Ajax Options */
|
323 |
-
$context = sanitize_text_field( $_POST[ 'context' ] );
|
324 |
-
$option = sanitize_text_field( $_POST[ 'data_action' ] );
|
325 |
-
$option_value = sanitize_text_field( $_POST[ 'checked' ] );
|
326 |
-
$val = sanitize_text_field( $_POST[ 'val' ] );
|
327 |
-
|
328 |
-
|
329 |
-
$options = MPSUM_Updates_Manager::get_options( $context );
|
330 |
-
$options = wp_parse_args( $options, MPSUM_Admin_Core::get_defaults() );
|
331 |
-
if ( 'core' == $context ) {
|
332 |
-
$options[ $option ] = $option_value;
|
333 |
-
if ( $option == 'automatic_theme_updates' || $option == 'automatic_plugin_updates' ) {
|
334 |
-
$options[ $option ] = $val;
|
335 |
-
}
|
336 |
-
MPSUM_Updates_Manager::update_options( $options, $context );
|
337 |
-
} else if ( 'plugins' == $context || 'themes' == $context ) {
|
338 |
-
$plugin_options = MPSUM_Updates_Manager::get_options( $context );
|
339 |
-
if ( 'on' == $option_value ) {
|
340 |
-
foreach( $plugin_options as $plugin ) {
|
341 |
-
if ( ( $key = array_search( $option, $plugin_options ) ) !== false ) {
|
342 |
-
unset( $plugin_options[ $key ] );
|
343 |
-
}
|
344 |
-
}
|
345 |
-
} else {
|
346 |
-
$plugin_options[] = $option;
|
347 |
-
$plugin_options = array_values( array_unique( $plugin_options ) );
|
348 |
-
}
|
349 |
-
|
350 |
-
MPSUM_Updates_Manager::update_options( $plugin_options, $context );
|
351 |
-
} elseif( 'plugins_automatic' == $context || 'themes_automatic' == $context ) {
|
352 |
-
$plugin_options = MPSUM_Updates_Manager::get_options( $context );
|
353 |
-
if ( 'off' == $option_value ) {
|
354 |
-
foreach( $plugin_options as $plugin ) {
|
355 |
-
if ( ( $key = array_search( $option, $plugin_options ) ) !== false ) {
|
356 |
-
unset( $plugin_options[ $key ] );
|
357 |
-
}
|
358 |
-
}
|
359 |
-
} else {
|
360 |
-
$options = MPSUM_Updates_Manager::get_options( $context );
|
361 |
-
$options[] = $option;
|
362 |
-
$plugin_options = array_values( array_unique( $options ) );
|
363 |
-
}
|
364 |
-
|
365 |
-
MPSUM_Updates_Manager::update_options( $plugin_options, $context );
|
366 |
-
}
|
367 |
-
|
368 |
-
die( $context );
|
369 |
-
|
370 |
-
}
|
371 |
-
|
372 |
-
/**
|
373 |
-
* Save plugin options.
|
374 |
-
*
|
375 |
-
* Saves the plugin options based on context. If no context is provided, updates all options.
|
376 |
-
*
|
377 |
-
* @since 5.0.0
|
378 |
-
* @access static
|
379 |
-
*
|
380 |
-
* @param array $options Associative array of plugin options.
|
381 |
-
* @param string $context Array key of which options to update
|
382 |
-
*/
|
383 |
-
public static function update_options( $options = array(), $context = '' ) {
|
384 |
-
$options_to_save = self::get_options();
|
385 |
-
|
386 |
-
if ( !empty( $context ) && is_string( $context ) ) {
|
387 |
-
$options_to_save[ $context ] = $options;
|
388 |
-
} else {
|
389 |
-
$options_to_save = $options;
|
390 |
-
}
|
391 |
-
|
392 |
-
self::$options = $options_to_save;
|
393 |
-
update_site_option( 'MPSUM', $options_to_save );
|
394 |
-
}
|
395 |
-
|
396 |
-
} //end class MPSUM_Updates_Manager
|
397 |
-
|
398 |
-
MPSUM_Updates_Manager::get_instance();
|
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 |
Updates: true
|
14 |
Network: true
|
15 |
*/
|
16 |
+
require( 'easy-updates-manager.php' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ 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.
|
7 |
License: GPLv2 or later
|
8 |
Donate link: https://mediaron.com/contribute/
|
9 |
|
@@ -104,11 +104,6 @@ For additional information and FAQs for Easy Updates Manager check out our <a hr
|
|
104 |
|
105 |
== Changelog ==
|
106 |
|
107 |
-
= 6.2.3 =
|
108 |
-
Released 2016-08-21
|
109 |
-
|
110 |
-
* Bug fix: options setting on plugins screen disappeared
|
111 |
-
|
112 |
= 6.2.2 =
|
113 |
Released 2016-08-19
|
114 |
|
@@ -253,9 +248,6 @@ In version 5.0.0 we completely re-wrote the plugin to offer a faster and more se
|
|
253 |
|
254 |
== Upgrade Notice ==
|
255 |
|
256 |
-
= 6.2.3 =
|
257 |
-
Bug fix: options setting on plugins screen disappeared
|
258 |
-
|
259 |
= 6.2.2 =
|
260 |
Fixing issue with manual updates for logs. Fixing CSS issue for mobile.
|
261 |
|
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 |
|
104 |
|
105 |
== Changelog ==
|
106 |
|
|
|
|
|
|
|
|
|
|
|
107 |
= 6.2.2 =
|
108 |
Released 2016-08-19
|
109 |
|
248 |
|
249 |
== Upgrade Notice ==
|
250 |
|
|
|
|
|
|
|
251 |
= 6.2.2 =
|
252 |
Fixing issue with manual updates for logs. Fixing CSS issue for mobile.
|
253 |
|