Version Description
Released 2016-08-17
- Added screen options for items per page and disabling the dashboard.
Download this release
Release Info
Developer | ronalfy |
Plugin | Easy Updates Manager |
Version | 6.2.0 |
Comparing to | |
See all releases |
Code changes from version 6.1.8 to 6.2.0
- easy-updates-manager.php +383 -0
- includes/MPSUM_Admin.php +60 -9
- includes/MPSUM_Admin_Help.php +0 -1
- includes/MPSUM_Admin_Screen_Options.php +112 -0
- includes/MPSUM_Logs_List_Table.php +8 -1
- includes/MPSUM_Plugins_List_Table.php +7 -2
- includes/MPSUM_Themes_List_Table.php +7 -1
- js/admin.js +14 -1
- main.php +2 -383
- readme.txt +9 -1
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 |
+
add_action( 'plugins_loaded', array( $this, 'plugins_loaded' ) );
|
78 |
+
} //end constructor
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Return the absolute path to an asset.
|
82 |
+
*
|
83 |
+
* Return the absolute path to an asset based on a relative argument.
|
84 |
+
*
|
85 |
+
* @since 5.0.0
|
86 |
+
* @access static
|
87 |
+
*
|
88 |
+
* @param string $path Relative path to the asset.
|
89 |
+
* @return string Absolute path to the relative asset.
|
90 |
+
*/
|
91 |
+
public static function get_plugin_dir( $path = '' ) {
|
92 |
+
$dir = rtrim( plugin_dir_path(__FILE__), '/' );
|
93 |
+
if ( !empty( $path ) && is_string( $path) )
|
94 |
+
$dir .= '/' . ltrim( $path, '/' );
|
95 |
+
return $dir;
|
96 |
+
}
|
97 |
+
|
98 |
+
/**
|
99 |
+
* Return the web path to an asset.
|
100 |
+
*
|
101 |
+
* Return the web path to an asset based on a relative argument.
|
102 |
+
*
|
103 |
+
* @since 5.0.0
|
104 |
+
* @access static
|
105 |
+
*
|
106 |
+
* @param string $path Relative path to the asset.
|
107 |
+
* @return string Web path to the relative asset.
|
108 |
+
*/
|
109 |
+
public static function get_plugin_url( $path = '' ) {
|
110 |
+
$dir = rtrim( plugin_dir_url(__FILE__), '/' );
|
111 |
+
if ( !empty( $path ) && is_string( $path) )
|
112 |
+
$dir .= '/' . ltrim( $path, '/' );
|
113 |
+
return $dir;
|
114 |
+
}
|
115 |
+
|
116 |
+
/**
|
117 |
+
* Retrieve the plugin's options
|
118 |
+
*
|
119 |
+
* Retrieve the plugin's options based on context
|
120 |
+
*
|
121 |
+
* @since 5.0.0
|
122 |
+
* @access static
|
123 |
+
*
|
124 |
+
* @param string $context Context to retrieve options for. This is used as an array key.
|
125 |
+
* @param bool $force_reload Whether to retrieve cached options or forcefully retrieve from the database.
|
126 |
+
* @return array All options if no context, or associative array if context is set. Empty array if no options.
|
127 |
+
*/
|
128 |
+
public static function get_options( $context = '', $force_reload = false ) {
|
129 |
+
//Try to get cached options
|
130 |
+
$options = self::$options;
|
131 |
+
if ( false === $options || true === $force_reload ) {
|
132 |
+
$options = get_site_option( 'MPSUM', false, false );
|
133 |
+
}
|
134 |
+
|
135 |
+
if ( false === $options ) {
|
136 |
+
$options = self::maybe_migrate_options();
|
137 |
+
}
|
138 |
+
|
139 |
+
//Store options
|
140 |
+
if ( !is_array( $options ) ) {
|
141 |
+
$options = array();
|
142 |
+
}
|
143 |
+
self::$options = $options;
|
144 |
+
|
145 |
+
//Attempt to get context
|
146 |
+
if ( !empty( $context ) && is_string( $context ) ) {
|
147 |
+
if ( array_key_exists( $context, $options ) ) {
|
148 |
+
return (array)$options[ $context ];
|
149 |
+
} else {
|
150 |
+
return array();
|
151 |
+
}
|
152 |
+
}
|
153 |
+
|
154 |
+
|
155 |
+
return $options;
|
156 |
+
} //get_options
|
157 |
+
|
158 |
+
/**
|
159 |
+
* Auto-loads classes.
|
160 |
+
*
|
161 |
+
* Auto-load classes that belong to this plugin.
|
162 |
+
*
|
163 |
+
* @since 5.0.0
|
164 |
+
* @access private
|
165 |
+
*
|
166 |
+
* @param string $class_name The name of the class.
|
167 |
+
*/
|
168 |
+
private function loader( $class_name ) {
|
169 |
+
if ( class_exists( $class_name, false ) || false === strpos( $class_name, 'MPSUM' ) ) {
|
170 |
+
return;
|
171 |
+
}
|
172 |
+
$file = MPSUM_Updates_Manager::get_plugin_dir( "includes/{$class_name}.php" );
|
173 |
+
if ( file_exists( $file ) ) {
|
174 |
+
include_once( $file );
|
175 |
+
}
|
176 |
+
}
|
177 |
+
|
178 |
+
/**
|
179 |
+
* Determine whether to migrate options from an older version of the plugin.
|
180 |
+
*
|
181 |
+
* Migrate old options to new plugin format.
|
182 |
+
*
|
183 |
+
* @since 5.0.0
|
184 |
+
* @access private
|
185 |
+
*
|
186 |
+
* @return bool|array false if no migration, associative array of options if migration successful
|
187 |
+
*/
|
188 |
+
public static function maybe_migrate_options() {
|
189 |
+
$options = false;
|
190 |
+
$original_options = get_option( '_disable_updates', false );
|
191 |
+
|
192 |
+
if ( false !== $original_options && is_array( $original_options ) ) {
|
193 |
+
$options = array(
|
194 |
+
'core' => array(),
|
195 |
+
'plugins' => array(),
|
196 |
+
'themes' => array()
|
197 |
+
);
|
198 |
+
//Global WP Updates
|
199 |
+
if ( isset( $original_options[ 'all' ] ) && "1" === $original_options[ 'all' ] ) {
|
200 |
+
$options[ 'core' ][ 'all_updates' ] = 'off';
|
201 |
+
}
|
202 |
+
//Global Plugin Updates
|
203 |
+
if ( isset( $original_options[ 'plugin' ] ) && "1" === $original_options[ 'plugin' ] ) {
|
204 |
+
$options[ 'core' ][ 'plugin_updates' ] = 'off';
|
205 |
+
}
|
206 |
+
//Global Theme Updates
|
207 |
+
if ( isset( $original_options[ 'theme' ] ) && "1" === $original_options[ 'theme' ] ) {
|
208 |
+
$options[ 'core' ][ 'theme_updates' ] = 'off';
|
209 |
+
}
|
210 |
+
//Global Core Updates
|
211 |
+
if ( isset( $original_options[ 'core' ] ) && "1" === $original_options[ 'core' ] ) {
|
212 |
+
$options[ 'core' ][ 'core_updates' ] = 'off';
|
213 |
+
}
|
214 |
+
//Global Individual Theme Updates
|
215 |
+
if ( isset( $original_options[ 'it' ] ) && "1" === $original_options[ 'it' ] ) {
|
216 |
+
if ( isset( $original_options[ 'themes' ] ) && is_array( $original_options[ 'themes' ] ) ) {
|
217 |
+
$options[ 'themes' ] = $original_options[ 'themes' ];
|
218 |
+
}
|
219 |
+
}
|
220 |
+
//Global Individual Plugin Updates
|
221 |
+
if ( isset( $original_options[ 'ip' ] ) && "1" === $original_options[ 'ip' ] ) {
|
222 |
+
if ( isset( $original_options[ 'plugins' ] ) && is_array( $original_options[ 'plugins' ] ) ) {
|
223 |
+
$options[ 'plugins' ] = $original_options[ 'plugins' ];
|
224 |
+
}
|
225 |
+
}
|
226 |
+
//Browser Nag
|
227 |
+
if ( isset( $original_options[ 'bnag' ] ) && "1" === $original_options[ 'bnag' ] ) {
|
228 |
+
$options[ 'core' ][ 'misc_browser_nag' ] = 'off';
|
229 |
+
}
|
230 |
+
//WordPress Version
|
231 |
+
if ( isset( $original_options[ 'wpv' ] ) && "1" === $original_options[ 'wpv' ] ) {
|
232 |
+
$options[ 'core' ][ 'misc_wp_footer' ] = 'off';
|
233 |
+
}
|
234 |
+
//Translation Updates
|
235 |
+
if ( isset( $original_options[ 'auto-translation-updates' ] ) && "1" === $original_options[ 'auto-translation-updates' ] ) {
|
236 |
+
$options[ 'core' ][ 'automatic_translation_updates' ] = 'off';
|
237 |
+
}
|
238 |
+
//Translation Updates
|
239 |
+
if ( isset( $original_options[ 'auto-core-emails' ] ) && "1" === $original_options[ 'auto-core-emails' ] ) {
|
240 |
+
$options[ 'core' ][ 'notification_core_update_emails' ] = 'off';
|
241 |
+
}
|
242 |
+
//Automatic Updates
|
243 |
+
if ( isset( $original_options[ 'abup' ] ) && "1" === $original_options[ 'abup' ] ) {
|
244 |
+
$options[ 'core' ][ 'automatic_major_updates' ] = 'off';
|
245 |
+
$options[ 'core' ][ 'automatic_minor_updates' ] = 'off';
|
246 |
+
$options[ 'core' ][ 'automatic_plugin_updates' ] = 'off';
|
247 |
+
$options[ 'core' ][ 'automatic_theme_updates' ] = 'off';
|
248 |
+
}
|
249 |
+
|
250 |
+
delete_option( '_disable_updates' );
|
251 |
+
delete_site_option( '_disable_updates' );
|
252 |
+
update_site_option( 'MPSUM', $options );
|
253 |
+
|
254 |
+
}
|
255 |
+
return $options;
|
256 |
+
}
|
257 |
+
|
258 |
+
/**
|
259 |
+
* Initialize the plugin and its dependencies.
|
260 |
+
*
|
261 |
+
* Initialize the plugin and its dependencies.
|
262 |
+
*
|
263 |
+
* @since 5.0.0
|
264 |
+
* @access public
|
265 |
+
* @see __construct
|
266 |
+
* @internal Uses plugins_loaded action
|
267 |
+
*
|
268 |
+
*/
|
269 |
+
public function plugins_loaded() {
|
270 |
+
//Skip disable updates if a user is excluded
|
271 |
+
$disable_updates_skip = false;
|
272 |
+
if ( current_user_can( 'install_plugins' ) ) {
|
273 |
+
$current_user = wp_get_current_user();
|
274 |
+
$current_user_id = $current_user->ID;
|
275 |
+
$excluded_users = MPSUM_Updates_Manager::get_options( 'excluded_users' );
|
276 |
+
if ( in_array( $current_user_id, $excluded_users ) ) {
|
277 |
+
$disable_updates_skip = true;
|
278 |
+
}
|
279 |
+
}
|
280 |
+
if ( false === $disable_updates_skip ) {
|
281 |
+
MPSUM_Disable_Updates::run();
|
282 |
+
}
|
283 |
+
|
284 |
+
// Logging
|
285 |
+
$options = MPSUM_Updates_Manager::get_options( 'core' );
|
286 |
+
if ( isset( $options[ 'logs' ] ) && 'on' == $options[ 'logs' ] ) {
|
287 |
+
MPSUM_Logs::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();
|
includes/MPSUM_Admin.php
CHANGED
@@ -63,8 +63,23 @@ class MPSUM_Admin {
|
|
63 |
*/
|
64 |
private function __construct() {
|
65 |
add_action( 'init', array( $this, 'init' ), 9 );
|
|
|
66 |
} //end constructor
|
67 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
/**
|
69 |
* Return the URL to the admin panel page.
|
70 |
*
|
@@ -137,7 +152,7 @@ class MPSUM_Admin {
|
|
137 |
new MPSUM_Admin_Core( self::get_slug() );
|
138 |
new MPSUM_Admin_Advanced( self::get_slug() );
|
139 |
|
140 |
-
|
141 |
|
142 |
}
|
143 |
|
@@ -156,6 +171,21 @@ class MPSUM_Admin {
|
|
156 |
new MPSUM_Admin_Help();
|
157 |
}
|
158 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
159 |
public function enqueue_scripts() {
|
160 |
$pagenow = isset( $_GET[ 'page' ] ) ? $_GET[ 'page' ] : false;
|
161 |
$is_active_tab = isset( $_GET[ 'tab' ] ) ? $_GET[ 'tab' ] : false;
|
@@ -165,8 +195,19 @@ class MPSUM_Admin {
|
|
165 |
return;
|
166 |
}
|
167 |
|
168 |
-
wp_enqueue_script( 'mpsum_dashboard', MPSUM_Updates_Manager::get_plugin_url( '/js/admin.js' ), array( 'jquery' ), '
|
169 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
170 |
wp_enqueue_style( 'mpsum_dashboard', MPSUM_Updates_Manager::get_plugin_url( '/css/style.css' ), array(), '20160502' );
|
171 |
}
|
172 |
|
@@ -185,6 +226,7 @@ class MPSUM_Admin {
|
|
185 |
$hook = add_dashboard_page( __( 'Updates Options', 'stops-core-theme-and-plugin-updates' ) , __( 'Updates Options', 'stops-core-theme-and-plugin-updates' ), 'install_plugins', self::get_slug(), array( $this, 'output_admin_interface' ) );
|
186 |
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
|
187 |
add_action( "load-$hook", array( $this, 'init_help_screen' ) );
|
|
|
188 |
}
|
189 |
|
190 |
/**
|
@@ -202,6 +244,7 @@ class MPSUM_Admin {
|
|
202 |
$hook = add_dashboard_page( __( 'Updates Options', 'stops-core-theme-and-plugin-updates' ) , __( 'Updates Options', 'stops-core-theme-and-plugin-updates' ), 'install_plugins', self::get_slug(), array( $this, 'output_admin_interface' ) );
|
203 |
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
|
204 |
add_action( "load-$hook", array( $this, 'init_help_screen' ) );
|
|
|
205 |
}
|
206 |
|
207 |
/**
|
@@ -223,12 +266,16 @@ class MPSUM_Admin {
|
|
223 |
<?php
|
224 |
$core_options = MPSUM_Updates_Manager::get_options( 'core' );
|
225 |
$tabs = array();
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
|
|
|
|
|
|
|
|
232 |
$tabs[] = array(
|
233 |
'url' => add_query_arg( array( 'tab' => 'main' ), self::get_url() ), /* URL to the tab */
|
234 |
'label' => esc_html__( 'General', 'stops-core-theme-and-plugin-updates' ),
|
@@ -265,6 +312,9 @@ class MPSUM_Admin {
|
|
265 |
if ( $tabs && !empty( $tabs ) ) {
|
266 |
$tab_html = '<h2 class="nav-tab-wrapper">';
|
267 |
$active_tab = isset( $_GET[ 'tab' ] ) ? sanitize_text_field( $_GET[ 'tab' ] ) : 'dashboard';
|
|
|
|
|
|
|
268 |
$do_action = false;
|
269 |
foreach( $tabs as $tab ) {
|
270 |
$classes = array( 'nav-tab' );
|
@@ -282,6 +332,7 @@ class MPSUM_Admin {
|
|
282 |
echo $tab_html;
|
283 |
}
|
284 |
if ( $do_action ) {
|
|
|
285 |
/**
|
286 |
* Perform a tab action.
|
287 |
*
|
63 |
*/
|
64 |
private function __construct() {
|
65 |
add_action( 'init', array( $this, 'init' ), 9 );
|
66 |
+
add_filter( 'set-screen-option', array( $this, 'add_screen_option_save' ), 10, 3 );
|
67 |
} //end constructor
|
68 |
|
69 |
+
/**
|
70 |
+
* Save the screen options.
|
71 |
+
*
|
72 |
+
* Save the screen options.
|
73 |
+
*
|
74 |
+
* @since 6.2.0
|
75 |
+
* @access static
|
76 |
+
*
|
77 |
+
* @return string URL to the admin panel page.
|
78 |
+
*/
|
79 |
+
public function add_screen_option_save( $status, $option, $value ) {
|
80 |
+
return MPSUM_Admin_Screen_Options::save_options( $status, $option, $value );
|
81 |
+
}
|
82 |
+
|
83 |
/**
|
84 |
* Return the URL to the admin panel page.
|
85 |
*
|
152 |
new MPSUM_Admin_Core( self::get_slug() );
|
153 |
new MPSUM_Admin_Advanced( self::get_slug() );
|
154 |
|
155 |
+
MPSUM_Admin_Screen_Options::maybe_save_dashboard_screen_option();
|
156 |
|
157 |
}
|
158 |
|
171 |
new MPSUM_Admin_Help();
|
172 |
}
|
173 |
|
174 |
+
/**
|
175 |
+
* Initializes the screen options.
|
176 |
+
*
|
177 |
+
* Initializes the screen options.
|
178 |
+
*
|
179 |
+
* @since 6.2
|
180 |
+
* @access public
|
181 |
+
* @see init
|
182 |
+
* @internal Uses load_{$hook} action
|
183 |
+
*
|
184 |
+
*/
|
185 |
+
public function init_screen_options() {
|
186 |
+
MPSUM_Admin_Screen_Options::run();
|
187 |
+
}
|
188 |
+
|
189 |
public function enqueue_scripts() {
|
190 |
$pagenow = isset( $_GET[ 'page' ] ) ? $_GET[ 'page' ] : false;
|
191 |
$is_active_tab = isset( $_GET[ 'tab' ] ) ? $_GET[ 'tab' ] : false;
|
195 |
return;
|
196 |
}
|
197 |
|
198 |
+
wp_enqueue_script( 'mpsum_dashboard', MPSUM_Updates_Manager::get_plugin_url( '/js/admin.js' ), array( 'jquery' ), '20160817', true );
|
199 |
+
|
200 |
+
$user_id = get_current_user_id();
|
201 |
+
$dashboard_showing = get_user_meta( $user_id, 'mpsum_dashboard', true );
|
202 |
+
if ( ! $dashboard_showing ) {
|
203 |
+
$dashboard_showing = 'on';
|
204 |
+
}
|
205 |
+
wp_localize_script( 'mpsum_dashboard', 'mpsum', array(
|
206 |
+
'spinner' => MPSUM_Updates_Manager::get_plugin_url( '/images/spinner.gif' ),
|
207 |
+
'tabs' => _x( 'Tabs', 'Show or hide admin tabs', 'stops-core-theme-and-plugin-updates' ),
|
208 |
+
'dashboard' => _x( 'Show Dashboard', 'Show or hide the dashboard', 'stops-core-theme-and-plugin-updates' ),
|
209 |
+
'dashboard_showing' => $dashboard_showing,
|
210 |
+
) );
|
211 |
wp_enqueue_style( 'mpsum_dashboard', MPSUM_Updates_Manager::get_plugin_url( '/css/style.css' ), array(), '20160502' );
|
212 |
}
|
213 |
|
226 |
$hook = add_dashboard_page( __( 'Updates Options', 'stops-core-theme-and-plugin-updates' ) , __( 'Updates Options', 'stops-core-theme-and-plugin-updates' ), 'install_plugins', self::get_slug(), array( $this, 'output_admin_interface' ) );
|
227 |
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
|
228 |
add_action( "load-$hook", array( $this, 'init_help_screen' ) );
|
229 |
+
add_action( "load-$hook", array( $this, 'init_screen_options' ) );
|
230 |
}
|
231 |
|
232 |
/**
|
244 |
$hook = add_dashboard_page( __( 'Updates Options', 'stops-core-theme-and-plugin-updates' ) , __( 'Updates Options', 'stops-core-theme-and-plugin-updates' ), 'install_plugins', self::get_slug(), array( $this, 'output_admin_interface' ) );
|
245 |
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
|
246 |
add_action( "load-$hook", array( $this, 'init_help_screen' ) );
|
247 |
+
add_action( "load-$hook", array( $this, 'init_screen_options' ) );
|
248 |
}
|
249 |
|
250 |
/**
|
266 |
<?php
|
267 |
$core_options = MPSUM_Updates_Manager::get_options( 'core' );
|
268 |
$tabs = array();
|
269 |
+
|
270 |
+
if ( 'off' !== get_user_meta( get_current_user_id(), 'mpsum_dashboard', true ) ) {
|
271 |
+
$tabs[] = array(
|
272 |
+
'url' => add_query_arg( array( 'tab' => 'dashboard' ), self::get_url() ), /* URL to the tab */
|
273 |
+
'label' => esc_html__( 'Dashboard', 'stops-core-theme-and-plugin-updates' ),
|
274 |
+
'get' => 'dashboard' /*$_GET variable*/,
|
275 |
+
'action' => 'mpsum_admin_tab_dashboard' /* action variable in do_action */
|
276 |
+
);
|
277 |
+
}
|
278 |
+
|
279 |
$tabs[] = array(
|
280 |
'url' => add_query_arg( array( 'tab' => 'main' ), self::get_url() ), /* URL to the tab */
|
281 |
'label' => esc_html__( 'General', 'stops-core-theme-and-plugin-updates' ),
|
312 |
if ( $tabs && !empty( $tabs ) ) {
|
313 |
$tab_html = '<h2 class="nav-tab-wrapper">';
|
314 |
$active_tab = isset( $_GET[ 'tab' ] ) ? sanitize_text_field( $_GET[ 'tab' ] ) : 'dashboard';
|
315 |
+
if ( 'off' === get_user_meta( get_current_user_id(), 'mpsum_dashboard', true ) && 'dashboard' == $active_tab ) {
|
316 |
+
$active_tab = 'main';
|
317 |
+
}
|
318 |
$do_action = false;
|
319 |
foreach( $tabs as $tab ) {
|
320 |
$classes = array( 'nav-tab' );
|
332 |
echo $tab_html;
|
333 |
}
|
334 |
if ( $do_action ) {
|
335 |
+
|
336 |
/**
|
337 |
* Perform a tab action.
|
338 |
*
|
includes/MPSUM_Admin_Help.php
CHANGED
@@ -86,7 +86,6 @@ CONTENT4;
|
|
86 |
<ul>
|
87 |
<li><a href="http://profiles.wordpress.org/kidsguide/">Matthew (kidsguide)</a></li>
|
88 |
<li><a href="http://profiles.wordpress.org/ronalfy/">Ronald Huereca (ronalfy)</a></li>
|
89 |
-
<li><a href="http://profiles.wordpress.org/pixolin/">Bego Mario Garde (pixolin)</a></li>
|
90 |
<li><a href="http://profiles.wordpress.org/roary86/">Roary Tubbs</a></li>
|
91 |
<li><a href="http://profiles.wordpress.org/bigwing">BigWing Interactive</a></li>
|
92 |
</ul>
|
86 |
<ul>
|
87 |
<li><a href="http://profiles.wordpress.org/kidsguide/">Matthew (kidsguide)</a></li>
|
88 |
<li><a href="http://profiles.wordpress.org/ronalfy/">Ronald Huereca (ronalfy)</a></li>
|
|
|
89 |
<li><a href="http://profiles.wordpress.org/roary86/">Roary Tubbs</a></li>
|
90 |
<li><a href="http://profiles.wordpress.org/bigwing">BigWing Interactive</a></li>
|
91 |
</ul>
|
includes/MPSUM_Admin_Screen_Options.php
ADDED
@@ -0,0 +1,112 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Screen options screen for Easy Updates Manager
|
4 |
+
*
|
5 |
+
* Initializes and outputs the screen options screen for the plugin.
|
6 |
+
*
|
7 |
+
* @since 6.2.0
|
8 |
+
*
|
9 |
+
* @package WordPress
|
10 |
+
*/
|
11 |
+
class MPSUM_Admin_Screen_Options {
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Holds the class instance.
|
15 |
+
*
|
16 |
+
* @since 6.2.0
|
17 |
+
* @access static
|
18 |
+
* @var MPSUM_Admin $instance
|
19 |
+
*/
|
20 |
+
|
21 |
+
private static $instance = null;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Class constructor.
|
25 |
+
*
|
26 |
+
* Initialize the class
|
27 |
+
*
|
28 |
+
* @since 6.2.0
|
29 |
+
* @access public
|
30 |
+
*
|
31 |
+
*/
|
32 |
+
private function __construct() {
|
33 |
+
$this->set_screen_options();
|
34 |
+
} //end constructor
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Save screen option.
|
38 |
+
*
|
39 |
+
* Save screen option.
|
40 |
+
*
|
41 |
+
* @since 6.2.0
|
42 |
+
* @access static
|
43 |
+
*
|
44 |
+
* @param string status
|
45 |
+
* @param string option Option name
|
46 |
+
* @param string option Option value
|
47 |
+
*/
|
48 |
+
public static function save_options( $status, $option, $value ) {
|
49 |
+
if ( 'mpsum_items_per_page' == $option ) {
|
50 |
+
return $value;
|
51 |
+
}
|
52 |
+
return $status;
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Set a class instance.
|
57 |
+
*
|
58 |
+
* Set a class instance.
|
59 |
+
*
|
60 |
+
* @since 6.2.0
|
61 |
+
* @access static
|
62 |
+
*
|
63 |
+
*/
|
64 |
+
public static function run() {
|
65 |
+
if ( null == self::$instance ) {
|
66 |
+
self::$instance = new self;
|
67 |
+
}
|
68 |
+
} //end get_instance
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Set screen options for items per page.
|
72 |
+
*
|
73 |
+
* Set screen options for items per page.
|
74 |
+
*
|
75 |
+
* @since 6.2.0
|
76 |
+
* @access private
|
77 |
+
*
|
78 |
+
*/
|
79 |
+
private function set_screen_options() {
|
80 |
+
$args = array(
|
81 |
+
'label' => __( 'Items Per Page', 'stops-core-theme-and-plugin-updates' ),
|
82 |
+
'default' => 100,
|
83 |
+
'option' => 'mpsum_items_per_page'
|
84 |
+
);
|
85 |
+
|
86 |
+
add_screen_option( 'per_page', $args );
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Save dashboard screen options.
|
91 |
+
*
|
92 |
+
* Save dashboard screen options.
|
93 |
+
*
|
94 |
+
* @since 6.2.0
|
95 |
+
* @access static
|
96 |
+
*
|
97 |
+
*/
|
98 |
+
public static function maybe_save_dashboard_screen_option() {
|
99 |
+
if ( isset( $_REQUEST[ 'mpsum_dashboard' ] ) && isset( $_REQUEST[ 'screenoptionnonce' ] ) ) {
|
100 |
+
if ( ! wp_verify_nonce( $_REQUEST[ 'screenoptionnonce' ], 'screen-options-nonce' ) ) {
|
101 |
+
return;
|
102 |
+
}
|
103 |
+
$user_id = get_current_user_id();
|
104 |
+
$dashboard = sanitize_text_field( $_REQUEST[ 'mpsum_dashboard' ] );
|
105 |
+
if ( 'on' !== $dashboard ) {
|
106 |
+
$dashboard = 'off';
|
107 |
+
}
|
108 |
+
update_user_meta( $user_id, 'mpsum_dashboard', $dashboard );
|
109 |
+
}
|
110 |
+
}
|
111 |
+
|
112 |
+
}
|
includes/MPSUM_Logs_List_Table.php
CHANGED
@@ -38,7 +38,14 @@ class MPSUM_Logs_List_Table extends MPSUM_List_Table {
|
|
38 |
global $wpdb, $_wp_column_headers;
|
39 |
$screen = get_current_screen();
|
40 |
$tablename = $wpdb->base_prefix . 'eum_logs';
|
41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
$log_count = $wpdb->get_var( "select count( * ) from $tablename" );
|
43 |
|
44 |
$paged = isset( $_GET[ 'paged' ] ) ? absint( $_GET[ 'paged' ] ) : 0;
|
38 |
global $wpdb, $_wp_column_headers;
|
39 |
$screen = get_current_screen();
|
40 |
$tablename = $wpdb->base_prefix . 'eum_logs';
|
41 |
+
|
42 |
+
// Get logs per page
|
43 |
+
$user_id = get_current_user_id();
|
44 |
+
$per_page = get_user_meta( $user_id, 'mpsum_items_per_page', true );
|
45 |
+
if ( ! is_numeric( $per_page ) ) {
|
46 |
+
$per_page = 100;
|
47 |
+
}
|
48 |
+
|
49 |
$log_count = $wpdb->get_var( "select count( * ) from $tablename" );
|
50 |
|
51 |
$paged = isset( $_GET[ 'paged' ] ) ? absint( $_GET[ 'paged' ] ) : 0;
|
includes/MPSUM_Plugins_List_Table.php
CHANGED
@@ -122,8 +122,13 @@ class MPSUM_Plugins_List_Table extends MPSUM_List_Table {
|
|
122 |
}
|
123 |
|
124 |
$total_this_page = $totals[ $status ];
|
125 |
-
|
126 |
-
|
|
|
|
|
|
|
|
|
|
|
127 |
|
128 |
$start = ( $page - 1 ) * $plugins_per_page;
|
129 |
|
122 |
}
|
123 |
|
124 |
$total_this_page = $totals[ $status ];
|
125 |
+
|
126 |
+
// Get plugins per page
|
127 |
+
$user_id = get_current_user_id();
|
128 |
+
$plugins_per_page = get_user_meta( $user_id, 'mpsum_items_per_page', true );
|
129 |
+
if ( ! is_numeric( $plugins_per_page ) ) {
|
130 |
+
$plugins_per_page = 100;
|
131 |
+
}
|
132 |
|
133 |
$start = ( $page - 1 ) * $plugins_per_page;
|
134 |
|
includes/MPSUM_Themes_List_Table.php
CHANGED
@@ -127,7 +127,13 @@ class MPSUM_Themes_List_Table extends MPSUM_List_Table {
|
|
127 |
}
|
128 |
}
|
129 |
$total_this_page = count( $themes[ 'all' ] );
|
130 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
131 |
|
132 |
$start = ( $page - 1 ) * $themes_per_page;
|
133 |
|
127 |
}
|
128 |
}
|
129 |
$total_this_page = count( $themes[ 'all' ] );
|
130 |
+
|
131 |
+
// Get themes per page
|
132 |
+
$user_id = get_current_user_id();
|
133 |
+
$themes_per_page = get_user_meta( $user_id, 'mpsum_items_per_page', true );
|
134 |
+
if ( ! is_numeric( $themes_per_page ) ) {
|
135 |
+
$themes_per_page = 100;
|
136 |
+
}
|
137 |
|
138 |
$start = ( $page - 1 ) * $themes_per_page;
|
139 |
|
js/admin.js
CHANGED
@@ -116,6 +116,19 @@ jQuery( document ).ready( function( $ ) {
|
|
116 |
$( '.dashboard-plugin-theme-auto-updates .dashboard-tab-plugins' ).toggleClass( 'active' );
|
117 |
$( '.dashboard-plugin-theme-auto-updates .dashboard-tab-header-plugin' ).toggleClass( 'active' );
|
118 |
$( '.dashboard-plugin-theme-auto-updates .dashboard-tab-header-theme' ).toggleClass( 'active' );
|
119 |
-
} );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
120 |
|
121 |
} );
|
116 |
$( '.dashboard-plugin-theme-auto-updates .dashboard-tab-plugins' ).toggleClass( 'active' );
|
117 |
$( '.dashboard-plugin-theme-auto-updates .dashboard-tab-header-plugin' ).toggleClass( 'active' );
|
118 |
$( '.dashboard-plugin-theme-auto-updates .dashboard-tab-header-theme' ).toggleClass( 'active' );
|
119 |
+
} );
|
120 |
+
|
121 |
+
/* Screen Options */
|
122 |
+
var dashboard_checked = '';
|
123 |
+
if ( 'on' == mpsum.dashboard_showing ) {
|
124 |
+
dashboard_checked = ' checked="checked"';
|
125 |
+
}
|
126 |
+
var screen_options_html = '<fieldset class="screen-options">';
|
127 |
+
screen_options_html += '<legend>' + mpsum.tabs + '</legend>';
|
128 |
+
screen_options_html += '<input type="hidden" value="off" name="mpsum_dashboard" />';
|
129 |
+
screen_options_html += '<input type="checkbox" id="mpsum_dashboard" value="on" name="mpsum_dashboard"' + dashboard_checked + '/>';
|
130 |
+
screen_options_html += ' <label for="mpsum_dashboard">' + mpsum.dashboard + '</label>';
|
131 |
+
screen_options_html += '</fieldset>';
|
132 |
+
$( '#screen-options-wrap #adv-settings' ).prepend( screen_options_html );
|
133 |
|
134 |
} );
|
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.
|
8 |
Requires at least: 4.4
|
9 |
Author URI: https://wordpress.org/plugins/stops-core-theme-and-plugin-updates/
|
10 |
Contributors: kidsguide, ronalfy
|
@@ -13,385 +13,4 @@ Domain Path: /languages
|
|
13 |
Updates: true
|
14 |
Network: true
|
15 |
*/
|
16 |
-
|
17 |
-
* Main plugin class
|
18 |
-
*
|
19 |
-
* Initializes auto-loader, internationalization, and plugin dependencies.
|
20 |
-
*
|
21 |
-
* @since 5.0.0
|
22 |
-
*
|
23 |
-
* @package WordPress
|
24 |
-
*/
|
25 |
-
class MPSUM_Updates_Manager {
|
26 |
-
|
27 |
-
/**
|
28 |
-
* Holds the class instance.
|
29 |
-
*
|
30 |
-
* @since 5.0.0
|
31 |
-
* @access static
|
32 |
-
* @var MPSUM_Updates_Manager $instance
|
33 |
-
*/
|
34 |
-
private static $instance = null;
|
35 |
-
|
36 |
-
/**
|
37 |
-
* Stores the plugin's options
|
38 |
-
*
|
39 |
-
* @since 5.0.0
|
40 |
-
* @access static
|
41 |
-
* @var array $options
|
42 |
-
*/
|
43 |
-
private static $options = false;
|
44 |
-
|
45 |
-
/**
|
46 |
-
* Retrieve a class instance.
|
47 |
-
*
|
48 |
-
* Retrieve a class instance.
|
49 |
-
*
|
50 |
-
* @since 5.0.0
|
51 |
-
* @access static
|
52 |
-
*
|
53 |
-
* @return MPSUM_Updates_Manager Instance of the class.
|
54 |
-
*/
|
55 |
-
public static function get_instance() {
|
56 |
-
if ( null == self::$instance ) {
|
57 |
-
self::$instance = new self;
|
58 |
-
}
|
59 |
-
return self::$instance;
|
60 |
-
} //end get_instance
|
61 |
-
|
62 |
-
/**
|
63 |
-
* Retrieve the plugin basename.
|
64 |
-
*
|
65 |
-
* Retrieve the plugin basename.
|
66 |
-
*
|
67 |
-
* @since 5.0.0
|
68 |
-
* @access static
|
69 |
-
*
|
70 |
-
* @return string plugin basename
|
71 |
-
*/
|
72 |
-
public static function get_plugin_basename() {
|
73 |
-
return plugin_basename( __FILE__ );
|
74 |
-
}
|
75 |
-
|
76 |
-
/**
|
77 |
-
* Class constructor.
|
78 |
-
*
|
79 |
-
* Set up internationalization, auto-loader, and plugin initialization.
|
80 |
-
*
|
81 |
-
* @since 5.0.0
|
82 |
-
* @access private
|
83 |
-
*
|
84 |
-
*/
|
85 |
-
private function __construct() {
|
86 |
-
/* Localization Code */
|
87 |
-
load_plugin_textdomain( 'stops-core-theme-and-plugin-updates', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
|
88 |
-
|
89 |
-
spl_autoload_register( array( $this, 'loader' ) );
|
90 |
-
|
91 |
-
add_action( 'plugins_loaded', array( $this, 'plugins_loaded' ) );
|
92 |
-
} //end constructor
|
93 |
-
|
94 |
-
/**
|
95 |
-
* Return the absolute path to an asset.
|
96 |
-
*
|
97 |
-
* Return the absolute path to an asset based on a relative argument.
|
98 |
-
*
|
99 |
-
* @since 5.0.0
|
100 |
-
* @access static
|
101 |
-
*
|
102 |
-
* @param string $path Relative path to the asset.
|
103 |
-
* @return string Absolute path to the relative asset.
|
104 |
-
*/
|
105 |
-
public static function get_plugin_dir( $path = '' ) {
|
106 |
-
$dir = rtrim( plugin_dir_path(__FILE__), '/' );
|
107 |
-
if ( !empty( $path ) && is_string( $path) )
|
108 |
-
$dir .= '/' . ltrim( $path, '/' );
|
109 |
-
return $dir;
|
110 |
-
}
|
111 |
-
|
112 |
-
/**
|
113 |
-
* Return the web path to an asset.
|
114 |
-
*
|
115 |
-
* Return the web path to an asset based on a relative argument.
|
116 |
-
*
|
117 |
-
* @since 5.0.0
|
118 |
-
* @access static
|
119 |
-
*
|
120 |
-
* @param string $path Relative path to the asset.
|
121 |
-
* @return string Web path to the relative asset.
|
122 |
-
*/
|
123 |
-
public static function get_plugin_url( $path = '' ) {
|
124 |
-
$dir = rtrim( plugin_dir_url(__FILE__), '/' );
|
125 |
-
if ( !empty( $path ) && is_string( $path) )
|
126 |
-
$dir .= '/' . ltrim( $path, '/' );
|
127 |
-
return $dir;
|
128 |
-
}
|
129 |
-
|
130 |
-
/**
|
131 |
-
* Retrieve the plugin's options
|
132 |
-
*
|
133 |
-
* Retrieve the plugin's options based on context
|
134 |
-
*
|
135 |
-
* @since 5.0.0
|
136 |
-
* @access static
|
137 |
-
*
|
138 |
-
* @param string $context Context to retrieve options for. This is used as an array key.
|
139 |
-
* @param bool $force_reload Whether to retrieve cached options or forcefully retrieve from the database.
|
140 |
-
* @return array All options if no context, or associative array if context is set. Empty array if no options.
|
141 |
-
*/
|
142 |
-
public static function get_options( $context = '', $force_reload = false ) {
|
143 |
-
//Try to get cached options
|
144 |
-
$options = self::$options;
|
145 |
-
if ( false === $options || true === $force_reload ) {
|
146 |
-
$options = get_site_option( 'MPSUM', false, false );
|
147 |
-
}
|
148 |
-
|
149 |
-
if ( false === $options ) {
|
150 |
-
$options = self::maybe_migrate_options();
|
151 |
-
}
|
152 |
-
|
153 |
-
//Store options
|
154 |
-
if ( !is_array( $options ) ) {
|
155 |
-
$options = array();
|
156 |
-
}
|
157 |
-
self::$options = $options;
|
158 |
-
|
159 |
-
//Attempt to get context
|
160 |
-
if ( !empty( $context ) && is_string( $context ) ) {
|
161 |
-
if ( array_key_exists( $context, $options ) ) {
|
162 |
-
return (array)$options[ $context ];
|
163 |
-
} else {
|
164 |
-
return array();
|
165 |
-
}
|
166 |
-
}
|
167 |
-
|
168 |
-
|
169 |
-
return $options;
|
170 |
-
} //get_options
|
171 |
-
|
172 |
-
/**
|
173 |
-
* Auto-loads classes.
|
174 |
-
*
|
175 |
-
* Auto-load classes that belong to this plugin.
|
176 |
-
*
|
177 |
-
* @since 5.0.0
|
178 |
-
* @access private
|
179 |
-
*
|
180 |
-
* @param string $class_name The name of the class.
|
181 |
-
*/
|
182 |
-
private function loader( $class_name ) {
|
183 |
-
if ( class_exists( $class_name, false ) || false === strpos( $class_name, 'MPSUM' ) ) {
|
184 |
-
return;
|
185 |
-
}
|
186 |
-
$file = MPSUM_Updates_Manager::get_plugin_dir( "includes/{$class_name}.php" );
|
187 |
-
if ( file_exists( $file ) ) {
|
188 |
-
include_once( $file );
|
189 |
-
}
|
190 |
-
}
|
191 |
-
|
192 |
-
/**
|
193 |
-
* Determine whether to migrate options from an older version of the plugin.
|
194 |
-
*
|
195 |
-
* Migrate old options to new plugin format.
|
196 |
-
*
|
197 |
-
* @since 5.0.0
|
198 |
-
* @access private
|
199 |
-
*
|
200 |
-
* @return bool|array false if no migration, associative array of options if migration successful
|
201 |
-
*/
|
202 |
-
public static function maybe_migrate_options() {
|
203 |
-
$options = false;
|
204 |
-
$original_options = get_option( '_disable_updates', false );
|
205 |
-
|
206 |
-
if ( false !== $original_options && is_array( $original_options ) ) {
|
207 |
-
$options = array(
|
208 |
-
'core' => array(),
|
209 |
-
'plugins' => array(),
|
210 |
-
'themes' => array()
|
211 |
-
);
|
212 |
-
//Global WP Updates
|
213 |
-
if ( isset( $original_options[ 'all' ] ) && "1" === $original_options[ 'all' ] ) {
|
214 |
-
$options[ 'core' ][ 'all_updates' ] = 'off';
|
215 |
-
}
|
216 |
-
//Global Plugin Updates
|
217 |
-
if ( isset( $original_options[ 'plugin' ] ) && "1" === $original_options[ 'plugin' ] ) {
|
218 |
-
$options[ 'core' ][ 'plugin_updates' ] = 'off';
|
219 |
-
}
|
220 |
-
//Global Theme Updates
|
221 |
-
if ( isset( $original_options[ 'theme' ] ) && "1" === $original_options[ 'theme' ] ) {
|
222 |
-
$options[ 'core' ][ 'theme_updates' ] = 'off';
|
223 |
-
}
|
224 |
-
//Global Core Updates
|
225 |
-
if ( isset( $original_options[ 'core' ] ) && "1" === $original_options[ 'core' ] ) {
|
226 |
-
$options[ 'core' ][ 'core_updates' ] = 'off';
|
227 |
-
}
|
228 |
-
//Global Individual Theme Updates
|
229 |
-
if ( isset( $original_options[ 'it' ] ) && "1" === $original_options[ 'it' ] ) {
|
230 |
-
if ( isset( $original_options[ 'themes' ] ) && is_array( $original_options[ 'themes' ] ) ) {
|
231 |
-
$options[ 'themes' ] = $original_options[ 'themes' ];
|
232 |
-
}
|
233 |
-
}
|
234 |
-
//Global Individual Plugin Updates
|
235 |
-
if ( isset( $original_options[ 'ip' ] ) && "1" === $original_options[ 'ip' ] ) {
|
236 |
-
if ( isset( $original_options[ 'plugins' ] ) && is_array( $original_options[ 'plugins' ] ) ) {
|
237 |
-
$options[ 'plugins' ] = $original_options[ 'plugins' ];
|
238 |
-
}
|
239 |
-
}
|
240 |
-
//Browser Nag
|
241 |
-
if ( isset( $original_options[ 'bnag' ] ) && "1" === $original_options[ 'bnag' ] ) {
|
242 |
-
$options[ 'core' ][ 'misc_browser_nag' ] = 'off';
|
243 |
-
}
|
244 |
-
//WordPress Version
|
245 |
-
if ( isset( $original_options[ 'wpv' ] ) && "1" === $original_options[ 'wpv' ] ) {
|
246 |
-
$options[ 'core' ][ 'misc_wp_footer' ] = 'off';
|
247 |
-
}
|
248 |
-
//Translation Updates
|
249 |
-
if ( isset( $original_options[ 'auto-translation-updates' ] ) && "1" === $original_options[ 'auto-translation-updates' ] ) {
|
250 |
-
$options[ 'core' ][ 'automatic_translation_updates' ] = 'off';
|
251 |
-
}
|
252 |
-
//Translation Updates
|
253 |
-
if ( isset( $original_options[ 'auto-core-emails' ] ) && "1" === $original_options[ 'auto-core-emails' ] ) {
|
254 |
-
$options[ 'core' ][ 'notification_core_update_emails' ] = 'off';
|
255 |
-
}
|
256 |
-
//Automatic Updates
|
257 |
-
if ( isset( $original_options[ 'abup' ] ) && "1" === $original_options[ 'abup' ] ) {
|
258 |
-
$options[ 'core' ][ 'automatic_major_updates' ] = 'off';
|
259 |
-
$options[ 'core' ][ 'automatic_minor_updates' ] = 'off';
|
260 |
-
$options[ 'core' ][ 'automatic_plugin_updates' ] = 'off';
|
261 |
-
$options[ 'core' ][ 'automatic_theme_updates' ] = 'off';
|
262 |
-
}
|
263 |
-
|
264 |
-
delete_option( '_disable_updates' );
|
265 |
-
delete_site_option( '_disable_updates' );
|
266 |
-
update_site_option( 'MPSUM', $options );
|
267 |
-
|
268 |
-
}
|
269 |
-
return $options;
|
270 |
-
}
|
271 |
-
|
272 |
-
/**
|
273 |
-
* Initialize the plugin and its dependencies.
|
274 |
-
*
|
275 |
-
* Initialize the plugin and its dependencies.
|
276 |
-
*
|
277 |
-
* @since 5.0.0
|
278 |
-
* @access public
|
279 |
-
* @see __construct
|
280 |
-
* @internal Uses plugins_loaded action
|
281 |
-
*
|
282 |
-
*/
|
283 |
-
public function plugins_loaded() {
|
284 |
-
//Skip disable updates if a user is excluded
|
285 |
-
$disable_updates_skip = false;
|
286 |
-
if ( current_user_can( 'install_plugins' ) ) {
|
287 |
-
$current_user = wp_get_current_user();
|
288 |
-
$current_user_id = $current_user->ID;
|
289 |
-
$excluded_users = MPSUM_Updates_Manager::get_options( 'excluded_users' );
|
290 |
-
if ( in_array( $current_user_id, $excluded_users ) ) {
|
291 |
-
$disable_updates_skip = true;
|
292 |
-
}
|
293 |
-
}
|
294 |
-
if ( false === $disable_updates_skip ) {
|
295 |
-
MPSUM_Disable_Updates::run();
|
296 |
-
}
|
297 |
-
|
298 |
-
// Logging
|
299 |
-
$options = MPSUM_Updates_Manager::get_options( 'core' );
|
300 |
-
if ( isset( $options[ 'logs' ] ) && 'on' == $options[ 'logs' ] ) {
|
301 |
-
MPSUM_Logs::run();
|
302 |
-
}
|
303 |
-
|
304 |
-
add_action( 'wp_ajax_mpsum_ajax_action', array( $this, 'ajax_update_option' ) );
|
305 |
-
|
306 |
-
|
307 |
-
$not_doing_ajax = ( !defined( 'DOING_AJAX' ) || !DOING_AJAX );
|
308 |
-
$not_admin_disabled = ( !defined( 'MPSUM_DISABLE_ADMIN' ) || !MPSUM_DISABLE_ADMIN );
|
309 |
-
if ( is_admin() && $not_doing_ajax && $not_admin_disabled ) {
|
310 |
-
MPSUM_Admin::run();
|
311 |
-
}
|
312 |
-
}
|
313 |
-
|
314 |
-
public function ajax_update_option() {
|
315 |
-
if ( !wp_verify_nonce( $_POST[ '_ajax_nonce' ], 'mpsum_options_save' ) ) {
|
316 |
-
die( 'Cheating, huh' );
|
317 |
-
}
|
318 |
-
if ( !isset( $_POST[ 'context' ] ) || !isset( $_POST[ 'data_action' ] ) ) {
|
319 |
-
die('');
|
320 |
-
}
|
321 |
-
/* Get Ajax Options */
|
322 |
-
$context = sanitize_text_field( $_POST[ 'context' ] );
|
323 |
-
$option = sanitize_text_field( $_POST[ 'data_action' ] );
|
324 |
-
$option_value = sanitize_text_field( $_POST[ 'checked' ] );
|
325 |
-
$val = sanitize_text_field( $_POST[ 'val' ] );
|
326 |
-
|
327 |
-
|
328 |
-
$options = MPSUM_Updates_Manager::get_options( $context );
|
329 |
-
$options = wp_parse_args( $options, MPSUM_Admin_Core::get_defaults() );
|
330 |
-
if ( 'core' == $context ) {
|
331 |
-
$options[ $option ] = $option_value;
|
332 |
-
if ( $option == 'automatic_theme_updates' || $option == 'automatic_plugin_updates' ) {
|
333 |
-
$options[ $option ] = $val;
|
334 |
-
}
|
335 |
-
MPSUM_Updates_Manager::update_options( $options, $context );
|
336 |
-
} else if ( 'plugins' == $context || 'themes' == $context ) {
|
337 |
-
$plugin_options = MPSUM_Updates_Manager::get_options( $context );
|
338 |
-
if ( 'on' == $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 |
-
$plugin_options[] = $option;
|
346 |
-
$plugin_options = array_values( array_unique( $plugin_options ) );
|
347 |
-
}
|
348 |
-
|
349 |
-
MPSUM_Updates_Manager::update_options( $plugin_options, $context );
|
350 |
-
} elseif( 'plugins_automatic' == $context || 'themes_automatic' == $context ) {
|
351 |
-
$plugin_options = MPSUM_Updates_Manager::get_options( $context );
|
352 |
-
if ( 'off' == $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 |
-
$options = MPSUM_Updates_Manager::get_options( $context );
|
360 |
-
$options[] = $option;
|
361 |
-
$plugin_options = array_values( array_unique( $options ) );
|
362 |
-
}
|
363 |
-
|
364 |
-
MPSUM_Updates_Manager::update_options( $plugin_options, $context );
|
365 |
-
}
|
366 |
-
|
367 |
-
die( $context );
|
368 |
-
|
369 |
-
}
|
370 |
-
|
371 |
-
/**
|
372 |
-
* Save plugin options.
|
373 |
-
*
|
374 |
-
* Saves the plugin options based on context. If no context is provided, updates all options.
|
375 |
-
*
|
376 |
-
* @since 5.0.0
|
377 |
-
* @access static
|
378 |
-
*
|
379 |
-
* @param array $options Associative array of plugin options.
|
380 |
-
* @param string $context Array key of which options to update
|
381 |
-
*/
|
382 |
-
public static function update_options( $options = array(), $context = '' ) {
|
383 |
-
$options_to_save = self::get_options();
|
384 |
-
|
385 |
-
if ( !empty( $context ) && is_string( $context ) ) {
|
386 |
-
$options_to_save[ $context ] = $options;
|
387 |
-
} else {
|
388 |
-
$options_to_save = $options;
|
389 |
-
}
|
390 |
-
|
391 |
-
self::$options = $options_to_save;
|
392 |
-
update_site_option( 'MPSUM', $options_to_save );
|
393 |
-
}
|
394 |
-
|
395 |
-
} //end class MPSUM_Updates_Manager
|
396 |
-
|
397 |
-
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.0
|
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.
|
7 |
License: GPLv2 or later
|
8 |
Donate link: https://mediaron.com/contribute/
|
9 |
|
@@ -103,6 +103,11 @@ For additional information and FAQs for Easy Updates Manager check out our <a hr
|
|
103 |
|
104 |
== Changelog ==
|
105 |
|
|
|
|
|
|
|
|
|
|
|
106 |
= 6.1.8 =
|
107 |
Released 2016-07-07
|
108 |
|
@@ -236,6 +241,9 @@ In version 5.0.0 we completely re-wrote the plugin to offer a faster and more se
|
|
236 |
|
237 |
== Upgrade Notice ==
|
238 |
|
|
|
|
|
|
|
239 |
= 6.1.8 =
|
240 |
Manual logs for translations now work with WordPress 4.6.
|
241 |
|
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.0
|
7 |
License: GPLv2 or later
|
8 |
Donate link: https://mediaron.com/contribute/
|
9 |
|
103 |
|
104 |
== Changelog ==
|
105 |
|
106 |
+
= 6.2.0 =
|
107 |
+
Released 2016-08-17
|
108 |
+
|
109 |
+
* Added screen options for items per page and disabling the dashboard.
|
110 |
+
|
111 |
= 6.1.8 =
|
112 |
Released 2016-07-07
|
113 |
|
241 |
|
242 |
== Upgrade Notice ==
|
243 |
|
244 |
+
= 6.2.0 =
|
245 |
+
Added screen options for items per page and disabling the dashboard.
|
246 |
+
|
247 |
= 6.1.8 =
|
248 |
Manual logs for translations now work with WordPress 4.6.
|
249 |
|