Easy Updates Manager - Version 4.1.0

Version Description

  • BIG: code clean-up (moved code, fixed code, etc.). - Thanks GitHub Pull Request and other help!!!
  • Added: version 4.1.0 on GitHub (including the lang file).
  • Added: website! http://webguywp.wordpress.com/
  • New Contributor: shazahm1!
  • New: video tutroial.
  • New: disable themes individually.
  • New: wp-cli compatiblity. - Thanks GitHub Issue!
  • Fixed: changelog footnote star error.
  • Updated: disable plugin updates.
  • Updated: installation section.
  • Updated: screenshots.
  • Renamed: files. - Thanks GitHub Issue!
Download this release

Release Info

Developer kidsguide
Plugin Icon 128x128 Easy Updates Manager
Version 4.1.0
Comparing to
See all releases

Code changes from version 4.0.3 to 4.1.0

Files changed (4) hide show
  1. Function.php +689 -506
  2. License.txt +1 -1
  3. readme.txt +25 -23
  4. uninstall.php +1 -3
Function.php CHANGED
@@ -2,27 +2,26 @@
2
  /**
3
  * @package Disable Updates Manager
4
  * @author Websiteguy
5
- * @version 4.0.3
6
- */
 
7
  /*
8
  Plugin Name: Disable Updates Manager
9
  Plugin URI: http://wordpress.org/plugins/stops-core-theme-and-plugin-updates/
10
- Version: 4.0.3
11
- Description: A configurable plugin that disables updates for you. Easy, clean and helpful.
12
  Author: Websiteguy
13
- Author URI: http://profiles.wordpress.org/kidsguide/
 
14
  License: GPL2
15
- Text Domain: stops-core-theme-and-plugin-updates
16
- Domain Path: /lang
17
  Tested up to WordPress: 3.9.1
18
- */
19
- /*
20
- License:
21
 
22
- @Copyright 2013 - 2014 Websiteguy (email: mpsparrow@cogeco.ca)
23
 
24
  This program is free software; you can redistribute it and/or modify
25
- it under the terms of the GNU General Public License, version 2, as
26
  published by the Free Software Foundation.
27
 
28
  This program is distributed in the hope that it will be useful,
@@ -37,587 +36,771 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
37
  Go to the license.txt in the trunk for more information.
38
  */
39
 
40
- // Define version.
41
-
42
- define("DISABLEUPDATESMANAGERVERSION", "4.0.3");
43
-
44
- class Disable_Updates {
45
- // Set status in array
46
- private $status = array();
47
-
48
- // Set checkboxes in array
49
- private $checkboxes = array();
50
-
51
- function Disable_Updates() {
52
-
53
- // Add menu page.
54
- add_action('admin_menu', array(&$this, 'add_submenu'));
55
-
56
- // Settings API.
57
- add_action('admin_init', array(&$this, 'register_setting'));
58
-
59
-
60
- // load the values recorded.
61
- $this->load_disable_updates();
62
- }
63
-
64
- // Register settings.
65
- function register_setting() {
66
- register_setting('_disable_updates', '_disable_updates', array(&$this, 'validate_settings'));
67
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
 
69
- function validate_settings( $input ) {
70
  $options = get_option( '_disable_updates' );
71
-
72
- foreach ( $this->checkboxes as $id ) {
73
- if ( isset( $options[$id] ) && !isset( $input[$id] ) )
74
- unset( $options[$id] );
75
  }
76
-
77
- return $input;
78
- }
79
 
80
- function add_submenu() {
81
- // Add submenu to "Dashboard" menu.
82
- add_submenu_page( 'options-general.php', 'Disable Updates Manager', __('Disable Updates Manager','disable-updates-manager'), 'administrator', __FILE__, array(&$this, 'display_page') );
 
 
 
 
83
  }
84
 
85
- // Functions for plugin (Change in settings)
86
- function load_disable_updates() {
87
- $this->status = get_option('_disable_updates');
88
-
89
- if( !$this->status ) return;
90
 
91
- foreach( $this->status as $id => $value ) {
 
92
 
93
- switch( $id ) {
94
 
95
- // Disable Plugin Updates
96
- case 'plugin' :
97
-
98
- // Disable Plugin Updates Code
99
- remove_action( 'load-update-core.php', 'wp_update_plugins' );
100
- add_filter( 'pre_site_transient_update_plugins', create_function( '$a', "return null;" ) );
101
-
102
- // Disable Plugin Update E-mails (only works for some plugins)
103
- apply_filters( 'auto_plugin_update_send_email', false, $type, $plugin_update, $result );
104
-
105
- apply_filters('automatic_plugin_updates_send_debug_email', true, $type, $plugin_update, $result );
106
-
107
- break;
108
-
109
- // Disable Theme Updates
110
- case 'theme' :
111
-
112
- // Disable Theme Updates Code
113
- remove_action( 'load-update-core.php', 'wp_update_themes' );
114
- add_filter( 'pre_site_transient_update_themes', create_function( '$a', "return null;" ) );
115
-
116
- // Disable Theme Update E-mails (only works for some plugins)
117
- apply_filters( 'auto_theme_update_send_email', false, $type, $theme_update, $result );
118
-
119
- apply_filters('automatic_theme_updates_send_debug_email', true, $type, $theme_update, $result );
120
-
121
- break;
122
-
123
- // Disable WordPress Core Updates
124
- case 'core' :
125
-
126
- // Disable WordPress Core Updates Code
127
- remove_action( 'load-update-core.php', 'wp_update_core' );
128
- add_filter( 'pre_site_transient_update_core', create_function( '$a', "return null;" ) );
129
-
130
- // Disable WordPress Core Update E-mails (only works for some plugins)
131
- apply_filters( 'auto_core_update_send_email', false, $type, $core_update, $result );
132
-
133
- apply_filters('automatic_core_updates_send_debug_email', true, $type, $core_update, $result );
134
-
135
- break;
136
-
137
- // Remove the Dashboard Updates Menu
138
- case 'page' :
139
-
140
- // Remove the Dashboard Updates Menu Code
141
- add_action( 'admin_init', 'wpse_38111' );
142
- function wpse_38111() {
143
- remove_submenu_page( 'index.php', 'update-core.php' );
144
  }
145
-
146
- break;
147
 
148
- // Disable All Updates
149
- case 'all' :
150
 
151
- // Disable All Updates
152
 
153
- // Disable Plugin Updates Only
 
 
 
154
 
155
- remove_action( 'load-update-core.php', 'wp_update_plugins' );
156
- add_filter( 'pre_site_transient_update_plugins', create_function( '$a', "return null;" ) );
157
 
158
- // Disable Theme Updates Only
 
159
 
160
- remove_action( 'load-update-core.php', 'wp_update_themes' );
161
- add_filter( 'pre_site_transient_update_themes', create_function( '$a', "return null;" ) );
 
 
 
 
162
 
163
- // Disable Core Updates Only
 
164
 
 
 
 
 
 
 
 
 
 
 
165
  remove_action( 'load-update-core.php', 'wp_update_core' );
166
- add_filter( 'pre_site_transient_update_core', create_function( '$a', "return null;" ) );
167
 
168
- // Hide Update Notices in Admin Dashboard
 
169
 
170
- add_action('admin_menu','hide_admin_notices');
171
- function hide_admin_notices() {
172
- remove_action( 'admin_notices', 'update_nag', 3 );
173
- }
174
 
175
- // Remove Files From WordPress
 
 
176
 
177
- function admin_init() {
178
- if ( !function_exists("remove_action") ) return;
179
 
180
- // Disable Plugin Updates Only
 
 
 
 
181
 
 
182
  remove_action( 'load-plugins.php', 'wp_update_plugins' );
183
  remove_action( 'load-update.php', 'wp_update_plugins' );
184
  remove_action( 'admin_init', '_maybe_update_plugins' );
185
  remove_action( 'wp_update_plugins', 'wp_update_plugins' );
186
- wp_clear_scheduled_hook( 'wp_update_plugins' );
187
-
 
188
  remove_action( 'load-update-core.php', 'wp_update_plugins' );
189
- wp_clear_scheduled_hook( 'wp_update_plugins' );
 
 
190
 
191
- // Disable Theme Updates Only
 
 
192
 
 
 
 
 
 
 
 
 
193
  remove_action( 'load-themes.php', 'wp_update_themes' );
194
  remove_action( 'load-update.php', 'wp_update_themes' );
195
  remove_action( 'admin_init', '_maybe_update_themes' );
196
  remove_action( 'wp_update_themes', 'wp_update_themes' );
197
- wp_clear_scheduled_hook( 'wp_update_themes' );
198
-
 
199
  remove_action( 'load-update-core.php', 'wp_update_themes' );
 
 
200
  wp_clear_scheduled_hook( 'wp_update_themes' );
201
 
202
- // Disable Core Updates Only
 
 
203
 
204
- remove_action( 'wp_version_check', 'wp_version_check' );
205
- remove_action( 'admin_init', '_maybe_update_core' );
206
- wp_clear_scheduled_hook( 'wp_version_check' );
207
-
208
- wp_clear_scheduled_hook( 'wp_version_check' );
 
 
 
209
  }
210
 
211
- // Remove Updates Again (different method)
 
212
 
213
- add_filter( 'pre_site_transient_update_plugins', create_function( '$a', "return null;" ) );
214
 
215
- add_action( 'init', create_function( '$a', "remove_action( 'init', 'wp_version_check' );" ), 2 );
216
- add_filter( 'pre_option_update_core', create_function( '$a', "return null;" ) );
217
 
218
- remove_action( 'wp_version_check', 'wp_version_check' );
219
- remove_action( 'admin_init', '_maybe_update_core' );
220
- add_filter( 'pre_transient_update_core', create_function( '$a', "return null;" ) );
 
221
 
222
- add_filter( 'pre_site_transient_update_core', create_function( '$a', "return null;" ) );
223
 
224
- remove_action( 'load-themes.php', 'wp_update_themes' );
225
- remove_action( 'load-update.php', 'wp_update_themes' );
226
- remove_action( 'admin_init', '_maybe_update_themes' );
227
- remove_action( 'wp_update_themes', 'wp_update_themes' );
228
- add_filter( 'pre_transient_update_themes', create_function( '$a', "return null;" ) );
229
 
230
- remove_action( 'load-update-core.php', 'wp_update_themes' );
231
- add_filter( 'pre_site_transient_update_themes', create_function( '$a', "return null;" ) );
 
 
 
232
 
233
- add_action( 'admin_menu', create_function( '$a', "remove_action( 'load-plugins.php', 'wp_update_plugins' );") );
234
-
235
- add_action( 'admin_init', create_function( '$a', "remove_action( 'admin_init', 'wp_update_plugins' );"), 2 );
236
- add_action( 'init', create_function( '$a', "remove_action( 'init', 'wp_update_plugins' );"), 2 );
237
- add_filter( 'pre_option_update_plugins', create_function( '$a', "return null;" ) );
238
 
239
- remove_action( 'load-plugins.php', 'wp_update_plugins' );
240
- remove_action( 'load-update.php', 'wp_update_plugins' );
241
- remove_action( 'admin_init', '_maybe_update_plugins' );
242
- remove_action( 'wp_update_plugins', 'wp_update_plugins' );
243
- add_filter( 'pre_transient_update_plugins', create_function( '$a', "return null;" ) );
244
 
245
- remove_action( 'load-update-core.php', 'wp_update_plugins' );
246
- add_filter( 'pre_site_transient_update_plugins', create_function( '$a', "return null;" ) );
247
-
248
-
249
- // Disable Debug E-mails
250
- add_filter( 'automatic_updates_send_debug_email ', '__return_true', 1 );
251
-
252
- // Disable WordPress Automatic Updates
253
- define( 'Automatic_Updater_Disabled', true );
254
- define('WP_AUTO_UPDATE_CORE', false);
255
-
256
- // Disable Updates E-mails
257
-
258
- // Core E-mails Only
259
- apply_filters( 'auto_core_update_send_email', false, $type, $core_update, $result );
260
-
261
- apply_filters('automatic_core_updates_send_debug_email', true, $type, $core_update, $result );
262
-
263
- // Plugin E-mails Only
264
- apply_filters( 'auto_plugin_update_send_email', false, $type, $plugin_update, $result );
265
-
266
- apply_filters('automatic_plugin_updates_send_debug_email', true, $type, $plugin_update, $result );
267
-
268
- // Theme E-mails Only
269
- apply_filters( 'auto_theme_update_send_email', false, $type, $theme_update, $result );
270
-
271
- apply_filters('automatic_theme_updates_send_debug_email', true, $type, $theme_update, $result );
272
-
273
- break;
274
-
275
- // Remove WordPress Version Number
276
- case 'wpv' :
277
-
278
- add_filter( 'update_footer', 'my_footer_version', 11 );
279
-
280
- function my_footer_version() {
281
- return '';
282
- }
283
 
284
- break;
285
 
286
- case 'ip' :
287
- if(defined('disable_updates_loaded')) {
288
- return;
289
- }
290
- define('disable_updates_loaded', 1);
291
-
292
- add_action('init','disable_updates_get');
293
- add_action('init','disable_updates_addFilters');
294
-
295
- add_filter("plugin_row_meta", 'disable_updates_pluginLinks', 10, 2);
296
- add_filter('site_transient_update_plugins', 'disable_updates_blockUpdateNotifications');
297
-
298
- function disable_updates_addFilters() {
299
- if(!current_user_can('update_plugins')) {
300
- return;
301
- }
302
-
303
- $plugins = get_site_transient('update_plugins');
304
- $to_block = get_option('disable_updates_blocked');
305
-
306
- if(isset($plugins->response)) {
307
- // loop through all of the plugins with updates available and attach the appropriate filter
308
- foreach($plugins->response as $filename => $plugin) {
309
- // check that the version is the version we want to block updates to
310
- $s = 'after_plugin_row_' . $filename;
311
- //in_plugin_update_message-
312
- add_action($s, 'disable_updates_blockLink', -1, 1);
313
- }
314
- }
315
- if(isset($plugins->disable_updates)) {
316
- foreach($plugins->disable_updates as $filename => $plugin) {
317
- // check that the version is the version we want to block updates to
318
- $s = 'after_plugin_row_' . $filename;
319
- add_action($s, 'disable_updates_unblockLink', 2, 1);
320
  }
321
- }
322
- }
323
 
324
- function disable_updates_get() {
 
 
 
325
 
326
- if(!current_user_can('update_plugins')) {
327
- return;
328
- }
329
 
330
- // see if there are actions to process
331
- if(!isset($_GET['disable_updates']) || !isset($_GET['_wpnonce'])) {
332
- return;
333
- }
334
 
335
- if(!wp_verify_nonce($_GET['_wpnonce'], 'disable_updates')) {
336
- return;
337
- }
338
 
339
- $blocked = get_option('disable_updates_blocked');
340
- $plugins = get_site_transient('update_plugins');
341
 
342
- // block action
343
- if(isset($_GET['block']) && isset($plugins->response) && isset($plugins->response[$_GET['block']])) {
344
- $p = $plugins->response[$_GET['block']];
345
- $blocked[$_GET['block']] = array('slug' => $p->slug, 'new_version' => $p->new_version);
346
- }
347
 
348
- if(isset($_GET['unblock'])) {
349
- unset($blocked[$_GET['unblock']]);
350
 
351
- }
 
352
 
353
- update_option('disable_updates_blocked', $blocked);
354
 
355
- }
356
 
357
- function disable_updates_blockUpdateNotifications($plugins) {
 
 
358
 
359
- if(!isset($plugins->response) || count($plugins->response) == 0) {
360
- return $plugins;
 
361
  }
362
 
363
- $to_block = (array)get_option('disable_updates_blocked');
364
 
365
- foreach($to_block as $filename => $plugin) {
366
 
367
- if(isset($plugins->response[$filename])
368
- && $plugins->response[$filename]->new_version == $plugin['new_version']) {
369
 
370
- $plugins->disable_updates[$filename] = $plugins->response[$filename];
371
- unset($plugins->response[$filename]);
372
- }
373
- }
374
- return $plugins;
375
- }
376
 
377
- function disable_updates_unblockLink($filename) {
378
- disable_updates_linkStart();
379
- echo 'Updates for this plugin are blocked. <a href="plugins.php?_wpnonce=' . wp_create_nonce('disable_updates') . '&disable_updates&unblock=' . $filename . '">Unblock updates</a>.</div></td></tr>';
380
- }
381
 
382
- function disable_updates_blockLink($filename) {
383
- disable_updates_linkStart();
384
- echo ' <a href="plugins.php?_wpnonce=' . wp_create_nonce('disable_updates') . '&disable_updates&block=' . $filename . '">Block updates for this plugin</a>.</div></td></tr>';
385
- }
386
 
387
- function disable_updates_linkStart() {
388
 
389
- // wp_plugin_update_row
390
- // wp-admin/includes/update.php
391
 
392
- $wp_list_table = _get_list_table('WP_Plugins_List_Table');
393
- echo '<tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange"><div class="update-message">';
394
- }
395
 
396
- function disable_updates_pluginLinks( $links, $file ) {
397
- $plugin = plugin_basename(__FILE__);
398
- if($file == $plugin) {
399
- $links[] = '<a target="_BLANK" href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=LC5UR6667DLXU"></a>';
400
- }
401
- return $links;
402
- }
403
 
404
- if(!function_exists('printr')) {
405
- function printr($txt) {
406
- echo '<pre>'; print_r($txt); echo '</pre>';
407
- }
408
- }
409
- break;
410
-
411
- // Disable automatic background updates.
412
- case 'abup' :
413
- wp_clear_scheduled_hook( 'wp_maybe_auto_update' );
414
- break;
415
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
416
  }
417
- }
418
- }
419
-
420
  // Settings page (under dashboard).
421
- function display_page() {
422
-
423
- // Don't Allow Users to View Settings
424
- if (!current_user_can('update_core'))
425
- wp_die( __('You do not have permissions to access this page.') );
426
-
 
 
427
  ?>
428
 
429
- <div class="wrap">
430
- <span style="display:block; padding-left: 5px; padding-bottom: 5px">
431
- <h2><?php _e('Disable Updates Manager Settings','disable-updates-manager'); ?></h2>
432
- </span>
433
-
 
 
 
 
 
 
434
  <form method="post" action="options.php">
435
-
436
- <?php settings_fields('_disable_updates'); ?>
437
-
438
- <table class="form-table">
439
- <tr>
440
-
441
- </table>
442
- <table class="wp-list-table widefat fixed bookmarks" style="width: 590px; border-radius: 4px;">
443
- <thead>
444
- <tr>
445
- <th>Disable Updates</th>
446
- </tr>
447
- </thead>
448
- <tbody>
449
- <tr>
450
- <td>
451
-
452
- <div class="showonhover">
453
- <label for="all_notify">
454
- <input type="checkbox" <?php checked(1, (int)$this->status['all'], true); ?> value="1" id="all_notify" name="_disable_updates[all]"> <?php _e('Disable All Updates', 'disable-updates-manager') ?>
455
- </label>
456
- <span>
457
- <a href="#" class="viewdescription">?</a>
458
- <span class="hovertext">Just disables core, theme, and plugin updates.</span>
459
- </span>
460
- </div>
461
- </span>
462
- <span style="padding-left: 12px; display:block">
463
- <label for="plugins_notify">
464
- <input type="checkbox" <?php checked(1, (int)$this->status['plugin'], true); ?> value="1" id="plugins_notify" name="_disable_updates[plugin]"> <?php _e('Disable Plugin Updates', 'disable-updates-manager') ?>
465
- </label>
466
- <br>
467
- <label for="themes_notify">
468
- <input type="checkbox" <?php checked(1, (int)$this->status['theme'], true); ?> value="1" id="themes_notify" name="_disable_updates[theme]"> <?php _e('Disable Theme Updates', 'disable-updates-manager') ?>
469
- </label>
470
- <br>
471
- <label for="core_notify">
472
- <input type="checkbox" <?php checked(1, (int)$this->status['core'], true); ?> value="1" id="core_notify" name="_disable_updates[core]"> <?php _e('Disable WordPress Core Update', 'disable-updates-manager') ?>
473
- </label>
474
- </span>
475
- </td>
476
- </tr>
477
- </tbody>
478
- </table>
479
- <br>
480
-
481
- <table class="wp-list-table widefat fixed bookmarks" style="width: 590px; border-radius: 4px;">
482
- <thead>
483
- <tr>
484
- <th>Disable Plugins Individually</th>
485
- </tr>
486
- </thead>
487
- <tbody>
488
- <tr>
489
- <td>
490
- <div class="showonhover">
491
- <label for="ip_notify">
492
- <input type="checkbox" <?php checked(1, (int)$this->status['ip'], true); ?> value="1" id="ip_notify" name="_disable_updates[ip]"> <?php _e('Disable Plugins Individually', 'disable-updates-manager') ?>
493
- </label>
494
-
495
- <span>
496
- <a href="#" class="viewdescription">?</a>
497
- <span class="hovertext">Go to the "Plugins" section in your dashboard to disable.</span>
498
- </span>
499
- </div>
500
- </span>
501
- </td>
502
- </tr>
503
- </tbody>
504
- </table>
505
- <br>
506
- <table class="wp-list-table widefat fixed bookmarks" style="width: 590px; border-radius: 4px;">
507
- <thead>
508
- <tr>
509
- <th>Other Settings</th>
510
- </tr>
511
- </thead>
512
- <tbody>
513
- <tr>
514
- <td>
515
- <div class="showonhover">
516
- <label for="page_notify">
517
- <input type="checkbox" <?php checked(1, (int)$this->status['page'], true); ?> value="1" id="page_notify" name="_disable_updates[page]"> <?php _e('Remove Updates Page', 'disable-updates-manager') ?>
518
- </label>
519
- <span>
520
- <a href="#" class="viewdescription">?</a>
521
- <span class="hovertext">The one in the dashboard tab.</span>
522
- </span>
523
- </div>
524
- </span>
525
- <div class="showonhover">
526
- <label for="wpv_notify">
527
- <input type="checkbox" <?php checked(1, (int)$this->status['wpv'], true); ?> value="1" id="wpv_notify" name="_disable_updates[wpv]"> <?php _e('Remove WordPress Core Version from Footer', 'disable-updates-manager') ?>
528
- </label>
529
- <span>
530
- <a href="#" class="viewdescription">?</a>
531
- <span class="hovertext">Removes it for all users.</span>
532
- </span>
533
- </div>
534
- </span>
535
- <label for="abup_notify">
536
- <input type="checkbox" <?php checked(1, (int)$this->status['abup'], true); ?> value="1" id="abup_notify" name="_disable_updates[abup]"> <?php _e('Disable Automatic Background Updates', 'disable-updates-manager') ?>
537
- </label>
538
- <br>
539
- </td>
540
- </tr>
541
- </tbody>
542
- </table>
543
- <p class="submit">
544
- <input type="submit" class="button-primary" value="<?php _e('Update Settings') ?>" />
545
- </p>
546
-
547
- <table class="wp-list-table widefat fixed bookmarks" style="width: auto; padding: 5px; border-radius: 4px;">
548
- <tbody>
549
- <tr>
550
- <td>
551
- <p align="center">
552
- <a href="http://wordpress.org/support/plugin/stops-core-theme-and-plugin-updates">Support</a> | <a href="http://www.youtube.com/watch?v=7sMEBGNxhwA">Tutorial</a> | <a href="http://wordpress.org/plugins/stops-core-theme-and-plugin-updates/faq/">FAQ</a> | <a href="https://github.com/Websiteguy/disable-updates-manager">GitHub</a>
553
- </p>
554
- </td>
555
- </tr>
556
- </tbody>
557
- </table>
558
- <div class="error" style="width: 780px;">
559
- <p>
560
- <strong>Please Note! - </strong>If either your WordPress core, theme, or plugins get too out of date, you may run into compatibility problems.
561
- </p>
562
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
563
  </form>
564
  </div>
565
-
566
- <?php
567
- }
568
- }
569
 
570
- // Start Disable Updates Manager once all other plugins are fully loaded.
571
- global $Disable_Updates; $Disable_Updates = new Disable_Updates();
572
-
573
- // Plugin page link.
574
- add_filter( 'plugin_row_meta', 'thsp_plugin_meta_links', 10, 2 );
575
-
576
- function thsp_plugin_meta_links( $links, $file ) {
577
- $plugin = plugin_basename(__FILE__);
578
-
579
- // Create links.
580
- if ( $file == $plugin ) {
581
- return array_merge(
582
- $links,
583
- array( '<a href="http://www.wordpress.org/support/plugin/stops-core-theme-and-plugin-updates">Support</a>' ),
584
- array( '<a href="http://www.wordpress.org/plugins/stops-core-theme-and-plugin-updates/faq/">FAQ</a>' ),
585
- array( '<a href="http://www.youtube.com/watch?v=7sMEBGNxhwA">Tutorial</a>' ),
586
- array( '<a href="https://github.com/Websiteguy/disable-updates-manager">GitHub</a>' )
587
- );
588
- }
589
- return $links;
590
  }
 
591
 
592
- // Add links.
593
- add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), 'thsp_plugin_action_links' );
594
-
595
- function thsp_plugin_action_links( $links ) {
596
 
597
- return array_merge(
598
- array('settings' => '<a href="' . admin_url( 'options-general.php?page=stops-core-theme-and-plugin-updates/Function.php' ) . '">' . __( 'Configure', 'ts-fab' ) . '</a>'),
599
- $links);
600
- }
601
-
602
- // Add Files
603
-
604
- // Style.css
605
- function css() {
606
- wp_register_style('css', plugins_url('style.css',__FILE__ ));
607
- wp_enqueue_style('css');
608
- }
609
- add_action( 'admin_init','css');
610
-
611
- // uninstall.php
612
- function php() {
613
- wp_register_style('php', plugins_url('uninstall.php',__FILE__ ));
614
- wp_enqueue_style('php');
615
- }
616
- add_action( 'admin_init','php');
617
-
618
- // lang folder
619
- function action_init() {
620
- // Load our textdomain
621
- load_plugin_textdomain('stops-core-theme-and-plugin-updates', false , basename(dirname(__FILE__)).'/lang');
622
- }
623
- ?>
2
  /**
3
  * @package Disable Updates Manager
4
  * @author Websiteguy
5
+ * @email webguywp@gmail.com
6
+ * @version 4.1.0
7
+ */
8
  /*
9
  Plugin Name: Disable Updates Manager
10
  Plugin URI: http://wordpress.org/plugins/stops-core-theme-and-plugin-updates/
11
+ Version: 4.1.0
12
+ Description: A configurable plugin that disables updates for you. Easy, clean and helpful.
13
  Author: Websiteguy
14
+ Author URI: http://www.webguywp.wordpress.com
15
+ Author Email: webguywp@gmail.com
16
  License: GPL2
17
+ Text Domain: disable-updates-manager
18
+ Domain Path: lang
19
  Tested up to WordPress: 3.9.1
 
 
 
20
 
21
+ @Copyright 2013 - 2014 Websiteguy (email: webguywp@gmail.com)
22
 
23
  This program is free software; you can redistribute it and/or modify
24
+ it under the terms of the GNU General Public License, version 2, as
25
  published by the Free Software Foundation.
26
 
27
  This program is distributed in the hope that it will be useful,
36
  Go to the license.txt in the trunk for more information.
37
  */
38
 
39
+ class Disable_Updates {
40
+
41
+ // Define version.
42
+ const VERSION = '4.1.0';
43
+
44
+ function __construct() {
45
+
46
+ // Load our textdomain
47
+ add_action( 'init', array( __CLASS__ , 'load_textdomain' ) );
48
+
49
+ // Add menu page.
50
+ add_action( 'admin_menu', array( __CLASS__, 'add_submenu' ) );
51
+
52
+ // Settings API.
53
+ add_action( 'admin_init', array( __CLASS__, 'register_setting' ) );
54
+
55
+ // Add action links.
56
+ add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( __CLASS__, 'action_links' ) );
57
+
58
+ // Add meta links.
59
+ add_filter( 'plugin_row_meta', array( __CLASS__, 'meta_links' ), 10, 2 );
60
+
61
+ // load the values recorded.
62
+ $this->load_disable_updates();
63
+ }
64
+
65
+ static function load_textdomain() {
66
+
67
+ load_plugin_textdomain( 'disable-updates-manager', FALSE, basename( dirname( __FILE__ ) ) . '/lang' );
68
+ }
69
+
70
+ static function enqueue_css() {
71
+
72
+ wp_enqueue_style( 'disable-updates-manager-css', plugins_url( 'style.css', __FILE__ ), array(), self::VERSION );
73
+ }
74
+
75
+ // Register settings.
76
+ static function register_setting() {
77
+
78
+ register_setting( '_disable_updates', '_disable_updates', array( __CLASS__, 'validate_settings' ) );
79
+ }
80
+
81
+ static function validate_settings( $value ) {
82
+
83
+ return $value;
84
+ }
85
+
86
+ static function add_submenu() {
87
+
88
+ $page_hook = add_submenu_page( 'options-general.php', 'Disable Updates Manager', __( 'Disable Updates Manager', 'disable-updates-manager' ), 'manage_options', 'disable-updates-manager', array( __CLASS__, 'display_page' ) );
89
+
90
+ // Enqueue the admin CSS.
91
+ add_action( "load-$page_hook", array( __CLASS__, 'enqueue_css' ) );
92
+ }
93
+
94
+ static function action_links( $links ) {
95
+
96
+ return array_merge(
97
+ array(
98
+ 'settings' => '<a href="' . add_query_arg( array( 'page' => 'disable-updates-manager' ), admin_url( 'options-general.php' ) ) . '">' . __( 'Configure', 'disable-updates-manager' ) . '</a>',
99
+ ),
100
+ $links
101
+ );
102
+
103
+ }
104
+
105
+ static function meta_links( $links, $file ) {
106
+
107
+ $plugin = plugin_basename( __FILE__ );
108
+
109
+ if ( $file == $plugin ) {
110
+
111
+ return array_merge(
112
+ $links,
113
+ array( '<a target="_BLANK" href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=LC5UR6667DLXU">Donate</a>' ),
114
+ array( '<a href="http://www.wordpress.org/support/plugin/stops-core-theme-and-plugin-updates">Support</a>' ),
115
+ array( '<a href="http://www.wordpress.org/plugins/stops-core-theme-and-plugin-updates/faq/">FAQ</a>' ),
116
+ array( '<a href="https://www.youtube.com/watch?v=ppCxjREhF9g">Tutorial</a>' ),
117
+ array( '<a href="https://github.com/Websiteguy/disable-updates-manager">GitHub</a>' )
118
+ );
119
+ }
120
+
121
+ return $links;
122
+ }
123
+
124
+ // Functions for plugin (Change in settings)
125
+ static function load_disable_updates() {
126
+
127
+ $status = get_option( '_disable_updates' );
128
+
129
+ if ( ! $status ) {
130
+ return;
131
+ }
132
+
133
+ foreach ( $status as $id => $value ) {
134
+
135
+ switch ( $id ) {
136
+
137
+ // Disable Plugin Updates
138
+ case 'plugin' :
139
+
140
+ self::disable_plugin_updates();
141
+ break;
142
+
143
+ // Disable Theme Updates
144
+ case 'theme' :
145
+
146
+ self::disable_theme_updates();
147
+
148
+ break;
149
+
150
+ // Disable WordPress Core Updates
151
+ case 'core' :
152
+
153
+ self::disable_core_updates();
154
+
155
+ break;
156
+
157
+ // Remove the Dashboard Updates Menu
158
+ case 'page' :
159
+
160
+ // Remove the Dashboard Updates Menu Code
161
+ add_action( 'admin_init', create_function( '', 'remove_submenu_page( \'index.php\', \'update-core.php\' );' ) );
162
+
163
+ break;
164
+
165
+ // Disable All Updates
166
+ case 'all' :
167
+
168
+ // Disable Plugin Updates Only
169
+ self::disable_plugin_updates();
170
+
171
+ // Disable Theme Updates Only
172
+ self::disable_theme_updates();
173
+
174
+ // Disable Core Updates Only
175
+ self::disable_core_updates();
176
+
177
+ // Disable Debug E-mails
178
+ add_filter( 'automatic_updates_send_debug_email ', '__return_false', 1 );
179
+
180
+ // Disable WordPress Automatic Updates
181
+ define( 'AUTOMATIC_UPDATER_DISABLED', TRUE );
182
+ define( 'WP_AUTO_UPDATE_CORE', FALSE );
183
+
184
+ break;
185
+
186
+ // Remove WordPress Version Number
187
+ case 'wpv' :
188
+
189
+ add_filter( 'update_footer', '__return_empty_string', 11 );
190
+
191
+ break;
192
+
193
+ case 'ip' :
194
+
195
+ if ( defined( 'disable_updates_loaded' ) ) {
196
+ return;
197
+ }
198
+
199
+ define( 'disable_updates_loaded', 1 );
200
+
201
+ add_action( 'init', array( __CLASS__, 'update_plugin_block_status' ) );
202
+ add_action( 'init', array( __CLASS__, 'plugin_action_links' ) );
203
+ add_filter( 'site_transient_update_plugins', array( __CLASS__, 'remove_plugin_update_notification' ) );
204
+ add_filter( 'plugin_action_links', array( __CLASS__, 'plugin_block_action_link' ), 10, 4 );
205
+
206
+ // remove blocked plugins from being checked for updates at wordpress.org
207
+ add_filter( 'http_request_args', array( __CLASS__, 'http_request_args_plugins_filter' ), 5, 2 );
208
+
209
+ break;
210
+
211
+ case 'it':
212
+
213
+ add_filter( 'site_transient_update_themes', array( __CLASS__, 'remove_theme_update_notification' ) );
214
+
215
+ // remove blocked themes from being checked for updates at wordpress.org
216
+ add_filter( 'http_request_args', array( __CLASS__, 'http_request_args_themes_filter' ), 5, 2 );
217
+
218
+ break;
219
+
220
+ // Disable automatic background updates.
221
+ case 'abup' :
222
+
223
+ wp_clear_scheduled_hook( 'wp_maybe_auto_update' );
224
+ break;
225
+
226
+ }
227
+ }
228
+ }
229
+
230
+ static function update_plugin_block_status() {
231
+
232
+ if ( ! current_user_can( 'update_plugins' ) ) {
233
+ return;
234
+ }
235
+
236
+ // see if there are actions to process
237
+ if ( ! isset( $_GET[ 'disable_updates' ] ) || ! isset( $_GET[ '_wpnonce' ] ) ) {
238
+ return;
239
+ }
240
+
241
+ if ( ! wp_verify_nonce( $_GET[ '_wpnonce' ], 'disable_updates' ) ) {
242
+ return;
243
+ }
244
+
245
+ $blocked = get_option( 'disable_updates_blocked' );
246
+ // $plugins = get_site_transient( 'update_plugins' );
247
+
248
+ // block action
249
+ // if ( isset( $_GET[ 'block' ] ) && isset( $plugins->response ) && isset( $plugins->response[ $_GET[ 'block' ] ] ) ) {
250
+ // $p = $plugins->response[ $_GET[ 'block' ] ];
251
+ // $blocked[ $_GET[ 'block' ] ] = array( 'slug' => $p->slug, 'new_version' => $p->new_version );
252
+ // }
253
+ if ( isset( $_GET[ 'block' ] ) ) {
254
+
255
+ $blocked[ $_GET[ 'block' ] ] = TRUE;
256
+ }
257
+
258
+ if ( isset( $_GET[ 'unblock' ] ) ) {
259
+
260
+ unset( $blocked[ $_GET[ 'unblock' ] ] );
261
+ }
262
+
263
+ update_option( 'disable_updates_blocked', $blocked );
264
+ }
265
+
266
+ static function remove_plugin_update_notification( $plugins ) {
267
+
268
+ if ( ! isset( $plugins->response ) || count( $plugins->response ) == 0 ) {
269
+
270
+ return $plugins;
271
+ }
272
+
273
+ $blocked = (array) get_option( 'disable_updates_blocked' );
274
+
275
+ // foreach ( $blocked as $filename => $plugin ) {
276
+
277
+ // if ( isset( $plugins->response[ $filename ] )
278
+ // && $plugins->response[ $filename ]->new_version == $plugin[ 'new_version' ]
279
+ // ) {
280
+
281
+ // $plugins->disable_updates[ $filename ] = $plugins->response[ $filename ];
282
+ // unset( $plugins->response[ $filename ] );
283
+ // }
284
+ // }
285
+ foreach ( $blocked as $filename => $plugin ) {
286
+
287
+ if ( isset( $plugins->response[ $filename ] ) && $plugin == TRUE ) {
288
+
289
+ $plugins->disable_updates[ $filename ] = $plugins->response[ $filename ];
290
+ unset( $plugins->response[ $filename ] );
291
+ }
292
+ }
293
+
294
+ return $plugins;
295
+ }
296
+
297
+ static function remove_theme_update_notification( $themes ) {
298
 
 
299
  $options = get_option( '_disable_updates' );
300
+
301
+ if ( FALSE === $options ) {
302
+
303
+ return $themes;
304
  }
 
 
 
305
 
306
+ if ( isset( $options['themes'] ) ) {
307
+
308
+ $blocked = $options['themes'];
309
+
310
+ } else {
311
+
312
+ return $themes;
313
  }
314
 
315
+ if ( 0 === (int) count( $blocked ) ) {
 
 
 
 
316
 
317
+ return $themes;
318
+ }
319
 
320
+ if ( ! isset( $themes->response ) || count( $themes->response ) == 0 ) {
321
 
322
+ return $themes;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
323
  }
 
 
324
 
325
+ foreach ( $blocked as $theme ) {
 
326
 
327
+ if ( isset( $themes->response[ $theme ] ) ) {
328
 
329
+ $themes->disable_updates[ $theme ] = $themes->response[ $theme ];
330
+ unset( $themes->response[ $theme ] );
331
+ }
332
+ }
333
 
334
+ return $themes;
335
+ }
336
 
337
+ static function last_checked() {
338
+ global $wp_version;
339
 
340
+ return (object) array(
341
+ 'last_checked' => time(),
342
+ 'updates' => array(),
343
+ 'version_checked' => $wp_version,
344
+ );
345
+ }
346
 
347
+ // Disable Core Updates
348
+ static function disable_core_updates() {
349
 
350
+ # 2.3 to 2.7:
351
+ add_action( 'init', create_function( '', 'remove_action( \'init\', \'wp_version_check\' );' ), 2 );
352
+ add_filter( 'pre_option_update_core', '__return_null' );
353
+
354
+ # 2.8 to 3.0:
355
+ remove_action( 'wp_version_check', 'wp_version_check' );
356
+ remove_action( 'admin_init', '_maybe_update_core' );
357
+ add_filter( 'pre_transient_update_core', array( __CLASS__,'last_checked' ) );
358
+
359
+ # >3.0:
360
  remove_action( 'load-update-core.php', 'wp_update_core' );
361
+ add_filter( 'pre_site_transient_update_core', array( __CLASS__,'last_checked' ) );
362
 
363
+ // Hide Update Notices in Admin Dashboard
364
+ add_action( 'admin_menu', create_function( '', 'remove_action( \'admin_notices\', \'update_nag\', 3 );' ) );
365
 
366
+ wp_clear_scheduled_hook( 'wp_version_check' );
367
+
368
+ // Disable email.
369
+ add_filter( 'auto_core_update_send_email', '__return_false' );
370
 
371
+ // This doesn't make sense. Purpose?
372
+ // apply_filters( 'automatic_core_updates_send_debug_email', TRUE, $type, $core_update, $result );
373
+ }
374
 
375
+ // Disable Plugin Updates
376
+ static function disable_plugin_updates() {
377
 
378
+ # 2.3 to 2.7:
379
+ // add_action( 'admin_menu', create_function( '$a', "remove_action( 'load-plugins.php', 'wp_update_plugins' );") );
380
+ // add_action( 'admin_init', create_function( '$a', "remove_action( 'admin_init', 'wp_update_plugins' );"), 2 );
381
+ // add_action( 'init', create_function( '$a', "remove_action( 'init', 'wp_update_plugins' );"), 2 );
382
+ add_filter( 'pre_option_update_plugins', '__return_null' );
383
 
384
+ # 2.8 to 3.0:
385
  remove_action( 'load-plugins.php', 'wp_update_plugins' );
386
  remove_action( 'load-update.php', 'wp_update_plugins' );
387
  remove_action( 'admin_init', '_maybe_update_plugins' );
388
  remove_action( 'wp_update_plugins', 'wp_update_plugins' );
389
+ add_filter( 'pre_transient_update_plugins', array( __CLASS__,'last_checked' ) );
390
+
391
+ # >3.0:
392
  remove_action( 'load-update-core.php', 'wp_update_plugins' );
393
+ add_filter( 'pre_site_transient_update_plugins', array( __CLASS__,'last_checked' ) );
394
+
395
+ wp_clear_scheduled_hook( 'wp_update_plugins' );
396
 
397
+ // Disable Plugin Update E-mails (only works for some plugins)
398
+ // This doesn't make sense. Purpose?
399
+ // apply_filters( 'auto_plugin_update_send_email', FALSE, $type, $plugin_update, $result );
400
 
401
+ // This doesn't make sense. Purpose?
402
+ // apply_filters( 'automatic_plugin_updates_send_debug_email', TRUE, $type, $plugin_update, $result );
403
+ }
404
+
405
+ // Disable Theme Updates
406
+ static function disable_theme_updates() {
407
+
408
+ # 2.8 to 3.0:
409
  remove_action( 'load-themes.php', 'wp_update_themes' );
410
  remove_action( 'load-update.php', 'wp_update_themes' );
411
  remove_action( 'admin_init', '_maybe_update_themes' );
412
  remove_action( 'wp_update_themes', 'wp_update_themes' );
413
+ add_filter( 'pre_transient_update_themes', array( __CLASS__,'last_checked' ) );
414
+
415
+ # >3.0:
416
  remove_action( 'load-update-core.php', 'wp_update_themes' );
417
+ add_filter( 'pre_site_transient_update_themes', array( __CLASS__,'last_checked' ) );
418
+
419
  wp_clear_scheduled_hook( 'wp_update_themes' );
420
 
421
+ // Disable Theme Update E-mails (only works for some plugins)
422
+ // This doesn't make sense. Purpose?
423
+ // apply_filters( 'auto_theme_update_send_email', FALSE, $type, $theme_update, $result );
424
 
425
+ // This doesn't make sense. Purpose?
426
+ // apply_filters( 'automatic_theme_updates_send_debug_email', TRUE, $type, $theme_update, $result );
427
+ }
428
+
429
+ static function plugin_action_links() {
430
+
431
+ if ( ! current_user_can( 'update_plugins' ) ) {
432
+ return;
433
  }
434
 
435
+ $plugins = get_site_transient( 'update_plugins' );
436
+ // $to_block = get_option( 'disable_updates_blocked' );
437
 
438
+ if ( isset( $plugins->response ) ) {
439
 
440
+ // loop through all of the plugins with updates available and attach the appropriate filter
441
+ foreach ( $plugins->response as $filename => $plugin ) {
442
 
443
+ // check that the version is the version we want to block updates to
444
+ add_action( "in_plugin_update_message-$filename", array( __CLASS__, 'plugin_block_link' ), 99, 2 );
445
+ }
446
+ }
447
 
448
+ if ( isset( $plugins->disable_updates ) ) {
449
 
450
+ foreach ( $plugins->disable_updates as $filename => $plugin ) {
 
 
 
 
451
 
452
+ // check that the version is the version we want to block updates to
453
+ add_action( "after_plugin_row_$filename", array( __CLASS__, 'plugin_unblock_link'), -1, 1 );
454
+ }
455
+ }
456
+ }
457
 
458
+ static function plugin_block_action_link( $actions, $plugin_file, $plugin_data, $context ) {
 
 
 
 
459
 
460
+ $blocked = get_option( 'disable_updates_blocked' );
 
 
 
 
461
 
462
+ if ( array_key_exists( $plugin_file, $blocked ) ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
463
 
464
+ $actions[] = '<a class="delete" href="plugins.php?_wpnonce=' . wp_create_nonce( 'disable_updates' ) . '&disable_updates&unblock=' . $plugin_file . '">Unblock Updates</a>';
465
 
466
+ } else {
467
+
468
+ $actions[] = '<a class="delete" href="plugins.php?_wpnonce=' . wp_create_nonce( 'disable_updates' ) . '&disable_updates&block=' . $plugin_file . '">Block Updates</a>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
469
  }
 
 
470
 
471
+ return $actions;
472
+ }
473
+
474
+ static function http_request_args_plugins_filter( $r, $url ) {
475
 
476
+ if ( 0 !== strpos( $url, 'https://api.wordpress.org/plugins/update-check/1.1/' ) ) {
 
 
477
 
478
+ return $r;
479
+ }
 
 
480
 
481
+ $blocked = get_option( 'disable_updates_blocked' );
482
+ $blocked = (array) array_keys( $blocked );
 
483
 
484
+ if ( 0 === (int) count( $blocked ) ) {
 
485
 
486
+ return $r;
487
+ }
 
 
 
488
 
489
+ if ( ! isset( $r['body']['plugins'] ) ) {
 
490
 
491
+ return $r;
492
+ }
493
 
494
+ $plugins = json_decode( $r['body']['plugins'], TRUE );
495
 
496
+ foreach ( $blocked as $p ) {
497
 
498
+ if ( isset( $plugins['plugins'][ $p ] ) ) unset( $plugins['plugins'][ $p ] );
499
+ if ( FALSE !== $key = array_search( $p, $plugins['active'] ) ) unset( $plugins['active'][ $key ] );
500
+ }
501
 
502
+ $r['body']['plugins'] = json_encode( $plugins );
503
+
504
+ return $r;
505
  }
506
 
507
+ static function http_request_args_themes_filter( $r, $url ) {
508
 
509
+ if ( 0 !== strpos( $url, 'https://api.wordpress.org/themes/update-check/1.1/' ) ) {
510
 
511
+ return $r;
512
+ }
513
 
514
+ $options = get_option( '_disable_updates' );
 
 
 
 
 
515
 
516
+ if ( FALSE === $options ) {
 
 
 
517
 
518
+ return $r;
519
+ }
 
 
520
 
521
+ if ( isset( $options['themes'] ) ) {
522
 
523
+ $blocked = $options['themes'];
 
524
 
525
+ } else {
 
 
526
 
527
+ return $r;
528
+ }
 
 
 
 
 
529
 
530
+ if ( 0 === (int) count( $blocked ) ) {
 
 
 
 
 
 
 
 
 
 
531
 
532
+ return $r;
533
+ }
534
+
535
+ if ( ! isset( $r['body']['themes'] ) ) {
536
+
537
+ return $r;
538
+ }
539
+
540
+ $themes = json_decode( $r['body']['themes'], TRUE );
541
+
542
+ foreach ( $blocked as $t ) {
543
+
544
+ if ( isset( $themes['themes'][ $t ] ) ) unset( $themes['themes'][ $t ] );
545
+ }
546
+
547
+ $r['body']['themes'] = json_encode( $themes );
548
+
549
+ return $r;
550
  }
551
+
 
 
552
  // Settings page (under dashboard).
553
+ static function display_page() {
554
+
555
+ $status = get_option( '_disable_updates' );
556
+
557
+ // Don't Allow Users to View Settings
558
+ if ( ! current_user_can( 'update_core' ) ) {
559
+ wp_die( __( 'You do not have permissions to access this page.' ) );
560
+ }
561
  ?>
562
 
563
+ <div class="wrap">
564
+
565
+ <h2><?php _e( 'Disable Updates Manager Settings', 'disable-updates-manager' ); ?></h2>
566
+
567
+ <div class="error" style="width: 780px;">
568
+ <p>
569
+ <strong>Please Note! - </strong>If either your WordPress core, theme, or plugins get too out
570
+ of date, you may run into compatibility problems.
571
+ </p>
572
+ </div>
573
+
574
  <form method="post" action="options.php">
575
+
576
+ <?php settings_fields( '_disable_updates' ); ?>
577
+
578
+ <table class="wp-list-table widefat fixed bookmarks" style="width: 590px; border-radius: 4px;">
579
+ <thead>
580
+ <tr>
581
+ <th>Disable Updates</th>
582
+ </tr>
583
+ </thead>
584
+ <tbody>
585
+ <tr>
586
+ <td>
587
+
588
+ <div class="showonhover">
589
+ <label for="all_notify">
590
+ <input
591
+ type="checkbox" <?php checked( 1, ( isset( $status['all'] ) ? (int) $status['all'] : 0 ), TRUE ); ?>
592
+ value="1" id="all_notify"
593
+ name="_disable_updates[all]"> <?php _e( 'Disable All Updates', 'disable-updates-manager' ) ?>
594
+ </label>
595
+ <span>
596
+ <a href="#" class="viewdescription">?</a>
597
+ <span class="hovertext">Just disables core, theme, and plugin updates.</span>
598
+ </span>
599
+ </div>
600
+
601
+ <span style="padding-left: 12px; display:block">
602
+ <label for="plugins_notify">
603
+ <input type="checkbox" <?php checked( 1, ( isset( $status['plugin'] ) ? (int) $status['plugin'] : 0 ), TRUE ); ?>
604
+ value="1" id="plugins_notify"
605
+ name="_disable_updates[plugin]"> <?php _e( 'Disable Plugin Updates', 'disable-updates-manager' ) ?>
606
+ </label>
607
+ <br>
608
+ <label for="themes_notify">
609
+ <input type="checkbox" <?php checked( 1, ( isset( $status['theme'] ) ? (int) $status['theme'] : 0 ), TRUE ); ?>
610
+ value="1" id="themes_notify"
611
+ name="_disable_updates[theme]"> <?php _e( 'Disable Theme Updates', 'disable-updates-manager' ) ?>
612
+ </label>
613
+ <br>
614
+ <label for="core_notify">
615
+ <input type="checkbox" <?php checked( 1, ( isset( $status['core'] ) ? (int) $status['core'] : 0 ), TRUE ); ?>
616
+ value="1" id="core_notify"
617
+ name="_disable_updates[core]"> <?php _e( 'Disable WordPress Core Update', 'disable-updates-manager' ) ?>
618
+ </label>
619
+ </span>
620
+ </td>
621
+ </tr>
622
+ </tbody>
623
+ </table>
624
+ <br>
625
+
626
+ <table class="wp-list-table widefat fixed bookmarks" style="width: 590px; border-radius: 4px;">
627
+ <thead>
628
+ <tr>
629
+ <th>Disable Plugins Individually</th>
630
+ </tr>
631
+ </thead>
632
+ <tbody>
633
+ <tr>
634
+ <td>
635
+ <div class="showonhover">
636
+ <label for="ip_notify">
637
+ <input type="checkbox" <?php checked( 1, ( isset( $status['ip'] ) ? (int) $status['ip'] : 0 ), TRUE ); ?>
638
+ value="1" id="ip_notify"
639
+ name="_disable_updates[ip]"> <?php _e( 'Disable Plugins Individually', 'disable-updates-manager' ) ?>
640
+ </label>
641
+
642
+ <span>
643
+ <a href="#" class="viewdescription">?</a>
644
+ <span class="hovertext">Go to the "Plugins" section in your dashboard to disable.</span>
645
+ </span>
646
+ </div>
647
+
648
+ </td>
649
+ </tr>
650
+ </tbody>
651
+ </table>
652
+ <br>
653
+
654
+ <table class="wp-list-table widefat fixed bookmarks" style="width: 590px; border-radius: 4px;">
655
+ <thead>
656
+ <tr>
657
+ <th>Disable Themes Individually</th>
658
+ </tr>
659
+ </thead>
660
+ <tbody>
661
+ <tr>
662
+ <td>
663
+ <div class="showonhover">
664
+ <label for="it_notify">
665
+ <input type="checkbox" <?php checked( 1, ( isset( $status['it'] ) ? (int) $status['it'] : 0 ), TRUE ); ?>
666
+ value="1" id="it_notify"
667
+ name="_disable_updates[it]"> <?php _e( 'Disable Themes Individually', 'disable-updates-manager' ) ?>
668
+ </label>
669
+
670
+ <span>
671
+ <a href="#" class="viewdescription">?</a>
672
+ <span class="hovertext">Enabling this option will show the list of themes to block updates.</span>
673
+ </span>
674
+ </div>
675
+ </td>
676
+ </tr>
677
+
678
+ <?php
679
+
680
+ if ( isset( $status['it'] ) ) {
681
+
682
+ ?>
683
+
684
+ <tr>
685
+ <th>Select themes to disable:</th>
686
+ </tr>
687
+
688
+ <?php
689
+
690
+ $themes = wp_get_themes( array( 'allowed' => TRUE ) );
691
+
692
+ foreach ( $themes as $slug => $theme ) {
693
+
694
+ $key = sanitize_key( $slug );
695
+
696
+ ?>
697
+
698
+ <tr>
699
+ <td>
700
+
701
+ <?php
702
+
703
+ printf( '<label for="%1$s"><input type="checkbox" value="%3$s" id="%1$s" name="_disable_updates[themes][%1$s]"%2$s> %4$s</label>',
704
+ $key,
705
+ ( isset( $status['themes'][ $key ] ) && $status['themes'][ $key ] === $slug ) ? ' checked="checked"' : '',
706
+ $slug,
707
+ esc_html( $theme->name )
708
+ );
709
+
710
+ ?>
711
+
712
+ </td>
713
+ </tr>
714
+
715
+ <?php
716
+ }
717
+
718
+ }
719
+ ?>
720
+
721
+ </tbody>
722
+ </table>
723
+ <br>
724
+
725
+ <table class="wp-list-table widefat fixed bookmarks" style="width: 590px; border-radius: 4px;">
726
+ <thead>
727
+ <tr>
728
+ <th>Other Settings</th>
729
+ </tr>
730
+ </thead>
731
+ <tbody>
732
+ <tr>
733
+ <td>
734
+ <div class="showonhover">
735
+ <label for="page_notify">
736
+ <input
737
+ type="checkbox" <?php checked( 1, ( isset( $status['page'] ) ? (int) $status['page'] : 0 ), TRUE ); ?>
738
+ value="1" id="page_notify"
739
+ name="_disable_updates[page]"> <?php _e( 'Remove Updates Page', 'disable-updates-manager' ) ?>
740
+ </label>
741
+ <span>
742
+ <a href="#" class="viewdescription">?</a>
743
+ <span class="hovertext">The one in the dashboard tab.</span>
744
+ </span>
745
+ </div>
746
+
747
+ <div class="showonhover">
748
+ <label for="wpv_notify">
749
+ <input
750
+ type="checkbox" <?php checked( 1, ( isset( $status['wpv'] ) ? (int) $status['wpv'] : 0 ), TRUE ); ?>
751
+ value="1" id="wpv_notify"
752
+ name="_disable_updates[wpv]"> <?php _e( 'Remove WordPress Core Version from Footer', 'disable-updates-manager' ) ?>
753
+ </label>
754
+ <span>
755
+ <a href="#" class="viewdescription">?</a>
756
+ <span class="hovertext">Removes it for all users.</span>
757
+ </span>
758
+ </div>
759
+
760
+ <label for="abup_notify">
761
+ <input type="checkbox" <?php checked( 1, ( isset( $status['abup'] ) ? (int) $status['abup'] : 0 ), TRUE ); ?>
762
+ value="1" id="abup_notify"
763
+ name="_disable_updates[abup]"> <?php _e( 'Disable Automatic Background Updates', 'disable-updates-manager' ) ?>
764
+ </label>
765
+ <br>
766
+ </td>
767
+ </tr>
768
+ </tbody>
769
+ </table>
770
+ <p class="submit">
771
+ <input type="submit" class="button-primary" value="<?php _e( 'Update Settings' ) ?>"/>
772
+ </p>
773
+
774
+ <table class="wp-list-table widefat fixed bookmarks"
775
+ style="width: auto; padding: 5px; border-radius: 4px;">
776
+ <tbody>
777
+ <tr>
778
+ <td>
779
+ <p align="center">
780
+ <a href="http://wordpress.org/support/plugin/stops-core-theme-and-plugin-updates">Support</a> |
781
+ <a href="https://www.youtube.com/watch?v=ppCxjREhF9g">Tutorial</a> |
782
+ <a href="http://wordpress.org/plugins/stops-core-theme-and-plugin-updates/faq/">FAQ</a> |
783
+ <a href="https://github.com/Websiteguy/disable-updates-manager">GitHub</a>
784
+ </p>
785
+ </td>
786
+ </tr>
787
+ </tbody>
788
+ </table>
789
+
790
  </form>
791
  </div>
 
 
 
 
792
 
793
+ <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
794
  }
795
+ }
796
 
797
+ global $Disable_Updates;
798
+ $Disable_Updates = new Disable_Updates();
 
 
799
 
800
+ if ( ! function_exists( 'printr' ) ) {
801
+ function printr( $txt ) {
802
+ echo '<pre>';
803
+ print_r( $txt );
804
+ echo '</pre>';
805
+ }
806
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
License.txt CHANGED
@@ -204,4 +204,4 @@
204
  EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
205
  SUCH DAMAGES.
206
 
207
- Matthew Sparrow (Websiteguy)
204
  EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
205
  SUCH DAMAGES.
206
 
207
+ Matthew Sparrow (Websiteguy) webguywp@gmail.com
readme.txt CHANGED
@@ -14,7 +14,7 @@ This plugin is configurable! Check the updates you would like to disable in the
14
 
15
  = Features =
16
  <ol>
17
- <li>Disables plugins individually.</li>
18
  <li>Disables plugin updates.</li>
19
  <li>Disables theme updates.</li>
20
  <li>Disable WordPress core updates.</li>
@@ -29,7 +29,7 @@ To see more features view the <a href="http://wordpress.org/plugins/stops-core-t
29
  = Video Tutorials =
30
  [youtube http://www.youtube.com/watch?v=ppCxjREhF9g]
31
 
32
- [youtube http://www.youtube.com/watch?v=TbqYfkDlhCg]
33
 
34
 
35
  == Frequently Asked Questions ==
@@ -39,16 +39,16 @@ A: Their are a couple of differences.
39
  <li>They do not disable WordPress automatic updates.</li>
40
  <li>They do not have video tutorials and screenshots.</li>
41
  <li>They do not have settings to make it configurable.</li>
42
- <li>They do not disable plugins individually.</li>
43
  </ol>
44
 
45
  = Q: If I remove this plugin from my website will I be able to update my plugins, themes, and WordPress core again? =
46
  A: Yes, this plugin just disables the update. We has also recently made an uninstall.php for this plugin.
47
 
48
- = Q: Is it possible to disable one plugin? =
49
- A: This plugin can disable plugins individually. Watch the tutorial below for help on how to do it.
50
 
51
- [youtube http://www.youtube.com/watch?v=TbqYfkDlhCg]
52
 
53
  = Q: Does this plugin work with WordPress Multisite? =
54
  A: This plugin doesn't yet, but we are working on this.
@@ -59,25 +59,27 @@ A: This plugin doesn't yet, but we are working on this.
59
  3. Disable Plugins Individually
60
 
61
  == Installation ==
62
- Their are two way to install Disable Updates Manager.
63
 
64
- <strong>1)</strong>
65
- <ol>
66
- <li>Push the button above to download the latest version of Disable Updates Manager.</li>
67
- <li>Go in your websites admin to the Plugins> Add New> page and push Upload.</li>
68
-
69
- <li>Upload the zip file and push install.</li>
70
- <li>Go to the Plugins section in your admin dashboard and activate.</li>
71
- </ol>
72
-
73
- <strong>2)</strong> <u><strong>Recommended</strong></u>
74
- <ol>
75
- <li>Go in your websites admin to the Plugins> Add New> page and push on the search bar.</li>
76
- <li>Search Disable Updates Manager and push install.</li>
77
- <li>Go to the Plugins section in your admin dashboard and activate.</li>
78
- </ol>
79
 
80
  == Changelog ==
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
  = 4.0.3 =
82
  * Fixed: FAQ spelling mistakes.
83
  * Fixed: changelog star error.
@@ -327,4 +329,4 @@ Their are two way to install Disable Updates Manager.
327
  = Note =
328
  Versions 0.2 to 0.9 are not listed in this changelog.
329
 
330
- = * = versions not available for download.
14
 
15
  = Features =
16
  <ol>
17
+ <li>Disables plugins and themes individually.</li>
18
  <li>Disables plugin updates.</li>
19
  <li>Disables theme updates.</li>
20
  <li>Disable WordPress core updates.</li>
29
  = Video Tutorials =
30
  [youtube http://www.youtube.com/watch?v=ppCxjREhF9g]
31
 
32
+ [youtube http://www.youtube.com/watch?v=jPHyG2YYeo4]
33
 
34
 
35
  == Frequently Asked Questions ==
39
  <li>They do not disable WordPress automatic updates.</li>
40
  <li>They do not have video tutorials and screenshots.</li>
41
  <li>They do not have settings to make it configurable.</li>
42
+ <li>They do not disable plugins and themes individually.</li>
43
  </ol>
44
 
45
  = Q: If I remove this plugin from my website will I be able to update my plugins, themes, and WordPress core again? =
46
  A: Yes, this plugin just disables the update. We has also recently made an uninstall.php for this plugin.
47
 
48
+ = Q: Is it possible to disable one plugin or theme? =
49
+ A: This plugin can disable plugins and themes individually. Watch the tutorial below for help on how to do it.
50
 
51
+ [youtube http://www.youtube.com/watch?v=jPHyG2YYeo4]
52
 
53
  = Q: Does this plugin work with WordPress Multisite? =
54
  A: This plugin doesn't yet, but we are working on this.
59
  3. Disable Plugins Individually
60
 
61
  == Installation ==
62
+ Installing Disable Updates Manager.
63
 
64
+ 1.Install Disable Updates Manager either via the WordPress.org plugin directory, or by uploading the files to your server
65
+ 2.After activating Disable Updates Manager by Websiteguy, you will be able to go to the Disable Updates Manager page under the settings.
66
+ 3.That's it. You're ready to go!
 
 
 
 
 
 
 
 
 
 
 
 
67
 
68
  == Changelog ==
69
+ = 4.1.0 =
70
+ * <strong>BIG:</strong> code clean-up (moved code, fixed code, etc.). - Thanks <a href="https://github.com/Websiteguy/disable-updates-manager/pull/4">GitHub Pull Request</a> and other help!!!
71
+ * Added: version 4.1.0 on GitHub (including the lang file).
72
+ * Added: website! http://webguywp.wordpress.com/
73
+ * New Contributor: shazahm1!
74
+ * New: video tutroial.
75
+ * New: disable themes individually.
76
+ * New: wp-cli compatiblity. - Thanks <a href="https://github.com/Websiteguy/disable-updates-manager/issues/2">GitHub Issue</a>!
77
+ * Fixed: changelog footnote star error.
78
+ * Updated: disable plugin updates.
79
+ * Updated: installation section.
80
+ * Updated: screenshots.
81
+ * Renamed: files. - Thanks <a href="https://github.com/Websiteguy/disable-updates-manager/issues/11">GitHub Issue</a>!
82
+
83
  = 4.0.3 =
84
  * Fixed: FAQ spelling mistakes.
85
  * Fixed: changelog star error.
329
  = Note =
330
  Versions 0.2 to 0.9 are not listed in this changelog.
331
 
332
+ = * versions not available for download. =
uninstall.php CHANGED
@@ -6,6 +6,4 @@ if ( !defined( 'WP_UNINSTALL_PLUGIN' ) ) {
6
  }
7
 
8
  // it was defined, now delete
9
- delete_option('_disable_updates');
10
-
11
- ?>
6
  }
7
 
8
  // it was defined, now delete
9
+ delete_option('_disable_updates');