Companion Auto Update - Version 2.9

Version Description

  • Advanced Controls: You can control auto-updating per plugin via the plugin filter.
Download this release

Release Info

Developer Papin
Plugin Icon 128x128 Companion Auto Update
Version 2.9
Comparing to
See all releases

Code changes from version 2.8.1 to 2.9

Files changed (2) hide show
  1. companion-auto-update.php +19 -14
  2. readme.txt +3 -3
companion-auto-update.php CHANGED
@@ -1,11 +1,11 @@
1
  <?php
2
  /*
3
  * Plugin Name: Companion Auto Update
4
- * Plugin URI: https://qreative-web.com
5
  * Description: This plugin auto updates all plugins, all themes and the wordpress core.
6
- * Version: 2.8.1
7
  * Author: Qreative-Web
8
- * Author URI: http://papinschipper.nl
9
  * Contributors: papin
10
  * License: GPLv2 or later
11
  * License URI: https://www.gnu.org/licenses/gpl-2.0.html
@@ -290,8 +290,7 @@ function cau_frontend() { ?>
290
 
291
  } else if( $_GET['tab'] == 'pluginlist' ) {
292
 
293
- echo '<p>Coming soon.. <a href="http://papinschipper.nl/blog/new-feature-filter-plugins/" target="_blank">Read more</a></p>';
294
- // selectPlugins();
295
 
296
  } ?>
297
 
@@ -372,6 +371,7 @@ function selectPlugins() { ?>
372
  foreach ( get_plugins() as $key => $value ) {
373
 
374
  $slug = $key;
 
375
  $hash = explode( '/', $slug );
376
  $slug_hash = md5( $slug[0] );
377
 
@@ -382,7 +382,7 @@ function selectPlugins() { ?>
382
 
383
  }
384
 
385
- if( in_array( $slug, donotupdatelist() ) ) {
386
 
387
  $class = 'inactive';
388
  $checked = 'CHECKED';
@@ -400,7 +400,7 @@ function selectPlugins() { ?>
400
 
401
  <th scope="row" class="check-column">
402
  <label class="screen-reader-text" for="cb-select-'.$slug_hash.'">Select '. $name .'</label>
403
- <input id="cb-select-'.$slug_hash.'" type="checkbox" name="post[]" value="'.$slug.'" '.$checked.' ><label></label>
404
  <div class="locked-indicator"></div>
405
  </th>
406
 
@@ -452,20 +452,24 @@ require_once('companion-auto-update-check-updates.php');
452
  function cau_settings_link( $links ) {
453
 
454
  $settings_link = '<a href="tools.php?page=cau-settings">'.__('Settings', 'companion-auto-update' ).'</a>';
455
- array_unshift($links, $settings_link);
456
  return $links;
457
 
458
  }
459
  $plugin = plugin_basename(__FILE__);
460
- add_filter("plugin_action_links_$plugin", 'cau_settings_link' );
461
 
462
  // Only update plugin which are enabled
463
- function cau_dont_update ( $update, $item ) {
464
 
465
- if ( in_array( $item->slug, donotupdatelist() ) ) {
466
- return $update;
 
 
 
467
  } else {
468
- return true;
 
469
  }
470
 
471
  }
@@ -507,7 +511,7 @@ class CAU_auto_update {
507
  $configs = $wpdb->get_results( "SELECT * FROM $table_name WHERE name = 'plugins'");
508
  foreach ( $configs as $config ) {
509
 
510
- if( $config->onoroff == 'on' ) add_filter( 'auto_update_plugin', '__return_true', 1 ); // Turn on
511
  if( $config->onoroff != 'on' ) add_filter( 'auto_update_plugin', '__return_false', 1 ); // Turn off
512
 
513
  }
@@ -529,6 +533,7 @@ class CAU_auto_update {
529
  // WP Email Config
530
  $configs = $wpdb->get_results( "SELECT * FROM $table_name WHERE name = 'wpemail'");
531
  foreach ( $configs as $config ) {
 
532
  if( $config->onoroff != 'on' ) add_filter( 'auto_core_update_send_email', '__return_false' );
533
  }
534
 
1
  <?php
2
  /*
3
  * Plugin Name: Companion Auto Update
4
+ * Plugin URI: http://codeermeneer.nl/portfolio/companion-auto-update/
5
  * Description: This plugin auto updates all plugins, all themes and the wordpress core.
6
+ * Version: 2.9.0
7
  * Author: Qreative-Web
8
+ * Author URI: http://codeermeneer.nl/
9
  * Contributors: papin
10
  * License: GPLv2 or later
11
  * License URI: https://www.gnu.org/licenses/gpl-2.0.html
290
 
291
  } else if( $_GET['tab'] == 'pluginlist' ) {
292
 
293
+ selectPlugins();
 
294
 
295
  } ?>
296
 
371
  foreach ( get_plugins() as $key => $value ) {
372
 
373
  $slug = $key;
374
+ $actualSlug = array_shift( explode( '/', $slug ) );
375
  $hash = explode( '/', $slug );
376
  $slug_hash = md5( $slug[0] );
377
 
382
 
383
  }
384
 
385
+ if( in_array( $actualSlug, donotupdatelist() ) ) {
386
 
387
  $class = 'inactive';
388
  $checked = 'CHECKED';
400
 
401
  <th scope="row" class="check-column">
402
  <label class="screen-reader-text" for="cb-select-'.$slug_hash.'">Select '. $name .'</label>
403
+ <input id="cb-select-'.$slug_hash.'" type="checkbox" name="post[]" value="'.$actualSlug.'" '.$checked.' ><label></label>
404
  <div class="locked-indicator"></div>
405
  </th>
406
 
452
  function cau_settings_link( $links ) {
453
 
454
  $settings_link = '<a href="tools.php?page=cau-settings">'.__('Settings', 'companion-auto-update' ).'</a>';
455
+ array_unshift( $links, $settings_link );
456
  return $links;
457
 
458
  }
459
  $plugin = plugin_basename(__FILE__);
460
+ add_filter( "plugin_action_links_$plugin", "cau_settings_link" );
461
 
462
  // Only update plugin which are enabled
463
+ function cau_dont_update( $update, $item ) {
464
 
465
+ $plugins = donotupdatelist();
466
+
467
+ if ( in_array( $item->slug, $plugins ) ) {
468
+ // Use the normal API response to decide whether to update or not
469
+ return $update;
470
  } else {
471
+ // Always update plugins
472
+ return true;
473
  }
474
 
475
  }
511
  $configs = $wpdb->get_results( "SELECT * FROM $table_name WHERE name = 'plugins'");
512
  foreach ( $configs as $config ) {
513
 
514
+ if( $config->onoroff == 'on' ) add_filter( 'auto_update_plugin', 'cau_dont_update', 10, 2 ); // Turn on
515
  if( $config->onoroff != 'on' ) add_filter( 'auto_update_plugin', '__return_false', 1 ); // Turn off
516
 
517
  }
533
  // WP Email Config
534
  $configs = $wpdb->get_results( "SELECT * FROM $table_name WHERE name = 'wpemail'");
535
  foreach ( $configs as $config ) {
536
+ if( $config->onoroff == 'on' ) add_filter( 'auto_core_update_send_email', '__return_true' );
537
  if( $config->onoroff != 'on' ) add_filter( 'auto_core_update_send_email', '__return_false' );
538
  }
539
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.me/dakel/1
4
  Tags: auto, automatic, background, update, updates, updating, automatic updates, automatic background updates, easy update, wordpress update, theme update, plugin update, up-to-date, security, update latest version, update core, update wp, update wp core, major updates, minor updates, update to new version, update core, update plugin, update plugins, update plugins automatically, update theme, plugin, theme, advance, control, mail, notifations, enable
5
  Requires at least: 3.5.0
6
  Tested up to: 4.7
7
- Stable tag: 2.8.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -31,7 +31,7 @@ We give you full control over what is updated and what isn't, via the settings p
31
 
32
  Email notifications are send once a day in order to prevent spamming :)
33
 
34
- = Advanced Controls: Coming soon =
35
  You can control auto-updating per plugin via the plugin filter.
36
  For example: If you have Woocommerce installed but you do not wan't to have it auto-updated you can now disable auto-updating for Woocommerce only, so your other plugins will continue to be updated.
37
 
@@ -64,7 +64,7 @@ Submit your translations [Here](https://translate.wordpress.org/projects/wp-plug
64
 
65
  == Changelog ==
66
 
67
- = What to expect: 2.9 =
68
  * Advanced Controls: You can control auto-updating per plugin via the plugin filter.
69
 
70
  = 2.8.1 =
4
  Tags: auto, automatic, background, update, updates, updating, automatic updates, automatic background updates, easy update, wordpress update, theme update, plugin update, up-to-date, security, update latest version, update core, update wp, update wp core, major updates, minor updates, update to new version, update core, update plugin, update plugins, update plugins automatically, update theme, plugin, theme, advance, control, mail, notifations, enable
5
  Requires at least: 3.5.0
6
  Tested up to: 4.7
7
+ Stable tag: 2.9
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
31
 
32
  Email notifications are send once a day in order to prevent spamming :)
33
 
34
+ = Advanced Controls =
35
  You can control auto-updating per plugin via the plugin filter.
36
  For example: If you have Woocommerce installed but you do not wan't to have it auto-updated you can now disable auto-updating for Woocommerce only, so your other plugins will continue to be updated.
37
 
64
 
65
  == Changelog ==
66
 
67
+ = 2.9 =
68
  * Advanced Controls: You can control auto-updating per plugin via the plugin filter.
69
 
70
  = 2.8.1 =