Companion Auto Update - Version 3.4.6

Version Description

(December 31, 2019) = * New: Filter themes, just like you do with plugins * New: Link to the release notes of the plugin in the email * Fixed: Sometimes the pluginfilter wouldn't save when using a lot of plugins * Fixed: A few errors regarding emails * Fixed: Errors regarding the set timezone * Tweak: Changing settings no longer requires page reload to see the changes * Few tweaks in code for better performance

Download this release

Release Info

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

Code changes from version 3.4.5 to 3.4.6

admin/dashboard.php CHANGED
@@ -1,13 +1,13 @@
1
  <?php
2
 
3
  if ( !wp_next_scheduled ( 'cau_set_schedule_mail' ) ) {
4
- echo '<div id="message" class="error"><p><b>'.__('Companion Auto Update was not able to set the event for sending you emails, please re-activate the plugin in order to set the event', 'companion-auto-update').'.</b></p></div>';
5
  }
6
 
7
- if ( get_site_option( 'cau_db_version' ) != cau_db_version() ) {
8
- echo '<div id="message" class="error"><p><b>'.__( 'Companion Auto Update Database Update', 'companion-auto-update' ).' &ndash;</b>
9
- '.__( 'We need you to update to the latest database version', 'companion-auto-update' ).'. <a href="'.cau_url( 'status' ).'&run=db_update" class="button button-alt" style="background: #FFF;">'.__( 'Run updater now', 'companion-auto-update' ).'</a></p></div>';
10
- }
11
 
12
  if( isset( $_POST['submit'] ) ) {
13
 
@@ -94,12 +94,12 @@
94
 
95
  echo '<p><input id="'.$cau_configs[2]->name.'" name="'.$cau_configs[2]->name.'" type="checkbox"';
96
  if( $cau_configs[2]->onoroff == 'on' ) echo 'checked';
97
- echo '/> <label for="'.$cau_configs[2]->name.'">'.__('Auto update minor core updates?', 'companion-auto-update').' <code class="majorMinorExplain">4.0.0 > 4.0.1</code></label></p>';
98
 
99
 
100
  echo '<p><input id="'.$cau_configs[3]->name.'" name="'.$cau_configs[3]->name.'" type="checkbox"';
101
  if( $cau_configs[3]->onoroff == 'on' ) echo 'checked';
102
- echo '/> <label for="'.$cau_configs[3]->name.'">'.__('Auto update major core updates?', 'companion-auto-update').' <code class="majorMinorExplain">4.0.0 > 4.1.0</code></label></p>';
103
 
104
  echo '<p><input id="'.$cau_configs[8]->name.'" name="'.$cau_configs[8]->name.'" type="checkbox"';
105
  if( $cau_configs[8]->onoroff == 'on' ) echo 'checked';
1
  <?php
2
 
3
  if ( !wp_next_scheduled ( 'cau_set_schedule_mail' ) ) {
4
+ echo '<div id="message" class="error"><p><b>'.__( 'Companion Auto Update was not able to set the event for sending you emails, please re-activate the plugin in order to set the event', 'companion-auto-update' ).'.</b></p></div>';
5
  }
6
 
7
+ if ( cau_incorrectDatabaseVersion() ) {
8
+ echo '<div id="message" class="error"><p><b>'.__( 'Companion Auto Update Database Update', 'companion-auto-update' ).' &ndash;</b>
9
+ '.__( 'We need you to update to the latest database version', 'companion-auto-update' ).'. <a href="'.cau_url( 'status' ).'&run=db_update" class="button button-alt" style="background: #FFF;">'.__( 'Run updater now', 'companion-auto-update' ).'</a></p></div>';
10
+ }
11
 
12
  if( isset( $_POST['submit'] ) ) {
13
 
94
 
95
  echo '<p><input id="'.$cau_configs[2]->name.'" name="'.$cau_configs[2]->name.'" type="checkbox"';
96
  if( $cau_configs[2]->onoroff == 'on' ) echo 'checked';
97
+ echo '/> <label for="'.$cau_configs[2]->name.'">'.__('Auto update minor core updates?', 'companion-auto-update').' <code class="majorMinorExplain">5.3.0 > 5.3.1</code></label></p>';
98
 
99
 
100
  echo '<p><input id="'.$cau_configs[3]->name.'" name="'.$cau_configs[3]->name.'" type="checkbox"';
101
  if( $cau_configs[3]->onoroff == 'on' ) echo 'checked';
102
+ echo '/> <label for="'.$cau_configs[3]->name.'">'.__('Auto update major core updates?', 'companion-auto-update').' <code class="majorMinorExplain">5.3.0 > 5.4.0</code></label></p>';
103
 
104
  echo '<p><input id="'.$cau_configs[8]->name.'" name="'.$cau_configs[8]->name.'" type="checkbox"';
105
  if( $cau_configs[8]->onoroff == 'on' ) echo 'checked';
admin/log.php CHANGED
@@ -16,4 +16,6 @@ if( isset( $_GET['filter'] ) ) {
16
 
17
  <div class='cau_spacing'></div>
18
 
19
- <?php cau_fetch_log( 'all', 'table' ); ?>
 
 
16
 
17
  <div class='cau_spacing'></div>
18
 
19
+ <?php
20
+
21
+ cau_fetch_log( 'all', 'table' );
admin/pluginlist.php CHANGED
@@ -1,36 +1,80 @@
1
- <p><?php _e('Here you can select plugins that you do not wish to automatically update', 'companion-auto-update'); ?>.</p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
  <?php
4
 
5
  global $wpdb;
6
- $table_name = $wpdb->prefix . "auto_updates";
7
-
8
- $configs = $wpdb->get_results( "SELECT * FROM $table_name WHERE name = 'plugins'");
9
- foreach ( $configs as $config ) if( $config->onoroff != 'on' ) echo '<div id="message" class="error"><p><b>'.__('Auto updating disabled', 'companion-auto-update').' &ndash;</b> '.__('You have <strong>disabled</strong> auto updating, these settings do not work unless you <strong>enable</strong> it', 'companion-auto-update').'.</p></div>';
10
 
 
11
  if( isset( $_POST['submit'] ) ) {
12
 
13
- check_admin_referer( 'cau_save_pluginlis' );
14
 
15
  $noUpdateList = '';
 
16
  $noUpdateCount = 0;
17
 
18
- foreach ( $_POST['post'] as $key ) {
19
- $noUpdateList .= sanitize_text_field( $key ).', ';
20
- $noUpdateCount++;
21
  }
22
 
23
- $wpdb->query( $wpdb->prepare( "UPDATE $table_name SET onoroff = %s WHERE name = 'notUpdateList'", $noUpdateList ) );
 
 
 
 
 
 
24
 
25
- echo '<div id="message" class="updated"><p><b>'.__('Succes', 'companion-auto-update').' &ndash;</b> '.sprintf( esc_html__( '%1$s plugins have been added to the no-update-list', 'companion-auto-update' ), $noUpdateCount ).'.</p></div>';
 
26
  }
27
 
 
 
28
  if( isset( $_POST['reset'] ) ) {
29
 
30
- check_admin_referer( 'cau_save_pluginlis' );
31
 
32
- $wpdb->query( " UPDATE $table_name SET onoroff = '' WHERE name = 'notUpdateList' " );
33
- echo '<div id="message" class="updated"><p><b>'.__('Succes', 'companion-auto-update').' &ndash;</b> '.__( 'The no-update-list has been reset, all plugins will be auto-updated from now on', 'companion-auto-update' ).'.</p></div>';
34
  }
35
 
36
  ?>
@@ -46,9 +90,9 @@ if( isset( $_POST['reset'] ) ) {
46
  <thead>
47
  <tr>
48
  <td>&nbsp;</td>
49
- <th class="head-plugin"><strong><?php _e('Plugin', 'companion-auto-update'); ?></strong></th>
50
- <th class="head-status"><strong><?php _e('Status', 'companion-auto-update'); ?></strong></th>
51
- <th class="head-description"><strong><?php _e('Description'); ?></strong></th>
52
  </tr>
53
  </thead>
54
 
@@ -56,21 +100,31 @@ if( isset( $_POST['reset'] ) ) {
56
 
57
  <?php
58
 
59
- foreach ( get_plugins() as $key => $value ) {
60
 
61
  $slug = $key;
62
  $explosion = explode( '/', $slug );
63
  $actualSlug = array_shift( $explosion );
64
  $slug_hash = md5( $slug[0] );
65
 
66
- foreach ( $value as $k => $v ) {
 
 
 
 
 
 
 
 
 
 
 
67
 
68
- if( $k == "Name" ) $name = $v;
69
- if( $k == "Description" ) $description = $v;
70
 
71
  }
72
 
73
- if( in_array( $actualSlug, donotupdatelist() ) ) {
74
 
75
  $class = 'inactive';
76
  $checked = 'CHECKED';
@@ -94,7 +148,8 @@ if( isset( $_POST['reset'] ) ) {
94
  </th>
95
 
96
  <td class="column-name">
97
- <p><strong>'. $name .'</strong></p>
 
98
  </td>
99
 
100
  <td class="cau_hide_on_mobile column-status">
@@ -113,7 +168,7 @@ if( isset( $_POST['reset'] ) ) {
113
  </tbody>
114
  </table>
115
 
116
- <?php wp_nonce_field( 'cau_save_pluginlis' ); ?>
117
 
118
  <div class='pluginListButtons'>
119
  <?php submit_button(); ?>
1
+ <?php
2
+
3
+ // Get selected filter type
4
+ if( isset( $_GET['filter'] ) ) {
5
+ $filter = $_GET['filter'];
6
+ } else {
7
+ $filter = 'plugins';
8
+ }
9
+
10
+ // Select correct database row
11
+ switch ( $filter ) {
12
+ case 'themes':
13
+ $db_table = 'notUpdateListTh';
14
+ $filter_name = __( 'Themes', 'companion-auto-update' );
15
+ $filterFunction = wp_get_themes();
16
+ break;
17
+ case 'plugins':
18
+ $db_table = 'notUpdateList';
19
+ $filter_name = __( 'Plugins', 'companion-auto-update' );
20
+ $filterFunction = get_plugins();
21
+ break;
22
+ default:
23
+ $db_table = 'notUpdateList';
24
+ $filter_name = __( 'Plugins', 'companion-auto-update' );
25
+ $filterFunction = get_plugins();
26
+ break;
27
+ }
28
+
29
+ ?>
30
+
31
+ <ul class="subsubsub">
32
+ <li><a <?php if( $filter == 'plugins' ) { echo "class='current'"; } ?> href='<?php echo cau_url( 'pluginlist&filter=plugins' ); ?>'><?php _e( 'Plugins', 'companion-auto-update' ); ?></a></li> |
33
+ <li><a <?php if( $filter == 'themes' ) { echo "class='current'"; } ?> href='<?php echo cau_url( 'pluginlist&filter=themes' ); ?>'><?php _e( 'Themes', 'companion-auto-update' ); ?></a></li>
34
+ </ul>
35
+
36
+ <div style='clear: both;'></div>
37
+
38
+ <p><?php echo sprintf( esc_html__( 'Prevent certain %s from updating automatically. %s that you select here will be skipped by Companion Auto Update and will require manual updating.', 'companion-auto-update' ), strtolower( $filter_name ), $filter_name ); ?></p>
39
 
40
  <?php
41
 
42
  global $wpdb;
43
+ $table_name = $wpdb->prefix."auto_updates";
 
 
 
44
 
45
+ // Save list
46
  if( isset( $_POST['submit'] ) ) {
47
 
48
+ check_admin_referer( 'cau_save_pluginlist' );
49
 
50
  $noUpdateList = '';
51
+ $i = 0;
52
  $noUpdateCount = 0;
53
 
54
+ if( isset( $_POST['post'] ) ) {
55
+ $noUpdateCount = count( $_POST['post'] );
 
56
  }
57
 
58
+ if( $noUpdateCount > 0 ) {
59
+ foreach ( $_POST['post'] as $key ) {
60
+ $noUpdateList .= sanitize_text_field( $key );
61
+ $i++;
62
+ if( $i != $noUpdateCount ) $noUpdateList .= ', ';
63
+ }
64
+ }
65
 
66
+ $wpdb->query( $wpdb->prepare( "UPDATE $table_name SET onoroff = '%s' WHERE name = '%s'", $noUpdateList, $db_table ) );
67
+ echo '<div id="message" class="updated"><p><b>'.__( 'Succes', 'companion-auto-update' ).' &ndash;</b> '.sprintf( esc_html__( '%1$s %2$s have been added to the no-update-list', 'companion-auto-update' ), $noUpdateCount, strtolower( $filter_name ) ).'.</p></div>';
68
  }
69
 
70
+
71
+ // Reset list
72
  if( isset( $_POST['reset'] ) ) {
73
 
74
+ check_admin_referer( 'cau_save_pluginlist' );
75
 
76
+ $wpdb->query( $wpdb->prepare( "UPDATE $table_name SET onoroff = '%s' WHERE name = %s", "", $db_table ) );
77
+ echo '<div id="message" class="updated"><p><b>'.__( 'Succes', 'companion-auto-update' ).' &ndash;</b> '.sprintf( esc_html__( 'The no-update-list has been reset, all %s will be auto-updated from now on', 'companion-auto-update' ), strtolower( $filter_name ) ).'.</p></div>';
78
  }
79
 
80
  ?>
90
  <thead>
91
  <tr>
92
  <td>&nbsp;</td>
93
+ <th class="head-plugin"><strong><?php _e( 'Name', 'companion-auto-update' ); ?></strong></th>
94
+ <th class="head-status"><strong><?php _e( 'Status', 'companion-auto-update' ); ?></strong></th>
95
+ <th class="head-description"><strong><?php _e( 'Description' ); ?></strong></th>
96
  </tr>
97
  </thead>
98
 
100
 
101
  <?php
102
 
103
+ foreach ( $filterFunction as $key => $value ) {
104
 
105
  $slug = $key;
106
  $explosion = explode( '/', $slug );
107
  $actualSlug = array_shift( $explosion );
108
  $slug_hash = md5( $slug[0] );
109
 
110
+ if( $filter == 'themes' ) {
111
+
112
+ $theme = wp_get_theme( $actualSlug );
113
+ $name = $theme->get( 'Name' );
114
+ $description = $theme->get( 'Description' );
115
+
116
+ } else {
117
+
118
+ foreach ( $value as $k => $v ) {
119
+
120
+ if( $k == "Name" ) $name = $v;
121
+ if( $k == "Description" ) $description = $v;
122
 
123
+ }
 
124
 
125
  }
126
 
127
+ if( in_array( $actualSlug, donotupdatelist( $filter ) ) ) {
128
 
129
  $class = 'inactive';
130
  $checked = 'CHECKED';
148
  </th>
149
 
150
  <td class="column-name">
151
+ <p style="margin-bottom: 0px;"><strong>'. $name .'</strong></p>
152
+ <small class="description" style="opacity: 0.5; margin-bottom: 3px;">'.$actualSlug.'</small>
153
  </td>
154
 
155
  <td class="cau_hide_on_mobile column-status">
168
  </tbody>
169
  </table>
170
 
171
+ <?php wp_nonce_field( 'cau_save_pluginlist' ); ?>
172
 
173
  <div class='pluginListButtons'>
174
  <?php submit_button(); ?>
admin/rollback.php CHANGED
@@ -1,3 +1,2 @@
1
  <?php
2
  // Currently working on this
3
- ?>
1
  <?php
2
  // Currently working on this
 
admin/schedule.php CHANGED
@@ -1,12 +1,5 @@
1
  <?php
2
 
3
- $plugin_schedule = wp_get_schedule( 'wp_update_plugins' );
4
- $theme_schedule = wp_get_schedule( 'wp_update_themes' );
5
- $core_schedule = wp_get_schedule( 'wp_version_check' );
6
- $mail_sc = wp_get_schedule( 'cau_set_schedule_mail' );
7
- $cs_hooks_p = wp_get_schedule( 'cau_custom_hooks_plugins' );
8
- $cs_hooks_t = wp_get_schedule( 'cau_custom_hooks_themes' );
9
-
10
  if( isset( $_POST['submit'] ) ) {
11
 
12
  check_admin_referer( 'cau_save_schedule' );
@@ -107,6 +100,12 @@ if( isset( $_POST['submit'] ) ) {
107
 
108
  }
109
 
 
 
 
 
 
 
110
  $availableIntervals = wp_get_schedules();
111
 
112
  ?>
@@ -124,7 +123,7 @@ $availableIntervals = wp_get_schedules();
124
  <th scope="row"><?php _e( 'Plugin update interval', 'companion-auto-update' );?></th>
125
  <td>
126
  <p>
127
- <select name='plugin_schedule' id='plugin_schedule'>
128
  <?php foreach ( $availableIntervals as $key => $value ) {
129
  foreach ( $value as $display => $interval ) {
130
  if( $display == 'display' ) {
@@ -145,11 +144,11 @@ $availableIntervals = wp_get_schedules();
145
  ?>
146
 
147
  <div class='cau_schedule_input'>
148
- <input type='text' name='pluginScheduleTimeH' value='<?php echo $setTimePluginsHour; ?>' maxlength='2' >
149
  </div><div class='cau_schedule_input_div'>
150
  :
151
  </div><div class='cau_schedule_input'>
152
- <input type='text' name='pluginScheduleTimeM' value='<?php echo $setTimePluginsMin; ?>' maxlength='2' >
153
  </div><div class='cau_shedule_notation'>
154
  <b><?php _e('Time notation: 24H', 'companion-auto-update'); ?></b>
155
  </div>
@@ -164,7 +163,7 @@ $availableIntervals = wp_get_schedules();
164
  <td>
165
  <p>
166
 
167
- <select name='theme_schedule' id='theme_schedule'>
168
  <?php foreach ( $availableIntervals as $key => $value ) {
169
  foreach ( $value as $display => $interval ) {
170
  if( $display == 'display' ) {
@@ -185,11 +184,11 @@ $availableIntervals = wp_get_schedules();
185
  ?>
186
 
187
  <div class='cau_schedule_input'>
188
- <input type='text' name='ThemeScheduleTimeH' value='<?php echo $setTimeThemesHour; ?>' maxlength='2' >
189
  </div><div class='cau_schedule_input_div'>
190
  :
191
  </div><div class='cau_schedule_input'>
192
- <input type='text' name='ThemeScheduleTimeM' value='<?php echo $setTimeThemesMins; ?>' maxlength='2' >
193
  </div><div class='cau_shedule_notation'>
194
  <b><?php _e('Time notation: 24H', 'companion-auto-update'); ?></b>
195
  </div>
@@ -202,7 +201,7 @@ $availableIntervals = wp_get_schedules();
202
  <th scope="row"><?php _e( 'Core update interval', 'companion-auto-update' );?></th>
203
  <td>
204
  <p>
205
- <select name='core_schedule' id='core_schedule'>
206
  <?php foreach ( $availableIntervals as $key => $value ) {
207
  foreach ( $value as $display => $interval ) {
208
  if( $display == 'display' ) {
@@ -223,11 +222,11 @@ $availableIntervals = wp_get_schedules();
223
  ?>
224
 
225
  <div class='cau_schedule_input'>
226
- <input type='text' name='CoreScheduleTimeH' value='<?php echo $setTimeCoreHour; ?>' maxlength='2' >
227
  </div><div class='cau_schedule_input_div'>
228
  :
229
  </div><div class='cau_schedule_input'>
230
- <input type='text' name='CoreScheduleTimeM' value='<?php echo $setTimeCoreMins; ?>' maxlength='2' >
231
  </div><div class='cau_shedule_notation'>
232
  <b><?php _e('Time notation: 24H', 'companion-auto-update'); ?></b>
233
  </div>
@@ -251,13 +250,13 @@ $availableIntervals = wp_get_schedules();
251
  <?php foreach ( $availableIntervals as $key => $value ) {
252
  foreach ( $value as $display => $interval ) {
253
  if( $display == 'display' ) {
254
- echo "<option "; if( $mail_sc == $key ) { echo "selected "; } echo "value='".$key."'>".$interval."</option>";
255
  }
256
  }
257
  } ?>
258
  </select>
259
  </p>
260
- <div class='timeScheduleEmail' <?php if( $mail_sc != 'daily' ) { echo "style='display: none;'"; } ?> >
261
 
262
  <?php
263
 
@@ -268,11 +267,11 @@ $availableIntervals = wp_get_schedules();
268
  ?>
269
 
270
  <div class='cau_schedule_input'>
271
- <input type='text' name='timeScheduleEmailTimeH' value='<?php echo $setTimeEmailHour; ?>' maxlength='2' >
272
  </div><div class='cau_schedule_input_div'>
273
  :
274
  </div><div class='cau_schedule_input'>
275
- <input type='text' name='timeScheduleEmailTimeM' value='<?php echo $setTimeEmailMins; ?>' maxlength='2' >
276
  </div><div class='cau_shedule_notation'>
277
  <b><?php _e('Time notation: 24H', 'companion-auto-update'); ?></b>
278
  </div>
1
  <?php
2
 
 
 
 
 
 
 
 
3
  if( isset( $_POST['submit'] ) ) {
4
 
5
  check_admin_referer( 'cau_save_schedule' );
100
 
101
  }
102
 
103
+ $plugin_schedule = wp_get_schedule( 'wp_update_plugins' );
104
+ $theme_schedule = wp_get_schedule( 'wp_update_themes' );
105
+ $core_schedule = wp_get_schedule( 'wp_version_check' );
106
+ $schedule_mail = wp_get_schedule( 'cau_set_schedule_mail' );
107
+ $cs_hooks_p = wp_get_schedule( 'cau_custom_hooks_plugins' );
108
+ $cs_hooks_t = wp_get_schedule( 'cau_custom_hooks_themes' );
109
  $availableIntervals = wp_get_schedules();
110
 
111
  ?>
123
  <th scope="row"><?php _e( 'Plugin update interval', 'companion-auto-update' );?></th>
124
  <td>
125
  <p>
126
+ <select name='plugin_schedule' id='plugin_schedule' class='schedule_interval'>
127
  <?php foreach ( $availableIntervals as $key => $value ) {
128
  foreach ( $value as $display => $interval ) {
129
  if( $display == 'display' ) {
144
  ?>
145
 
146
  <div class='cau_schedule_input'>
147
+ <input type='number' max='23' name='pluginScheduleTimeH' value='<?php echo $setTimePluginsHour; ?>' maxlength='2' >
148
  </div><div class='cau_schedule_input_div'>
149
  :
150
  </div><div class='cau_schedule_input'>
151
+ <input type='number' max='59' name='pluginScheduleTimeM' value='<?php echo $setTimePluginsMin; ?>' maxlength='2' >
152
  </div><div class='cau_shedule_notation'>
153
  <b><?php _e('Time notation: 24H', 'companion-auto-update'); ?></b>
154
  </div>
163
  <td>
164
  <p>
165
 
166
+ <select name='theme_schedule' id='theme_schedule' class='schedule_interval'>
167
  <?php foreach ( $availableIntervals as $key => $value ) {
168
  foreach ( $value as $display => $interval ) {
169
  if( $display == 'display' ) {
184
  ?>
185
 
186
  <div class='cau_schedule_input'>
187
+ <input type='number' max='23' name='ThemeScheduleTimeH' value='<?php echo $setTimeThemesHour; ?>' maxlength='2' >
188
  </div><div class='cau_schedule_input_div'>
189
  :
190
  </div><div class='cau_schedule_input'>
191
+ <input type='number' max='59' name='ThemeScheduleTimeM' value='<?php echo $setTimeThemesMins; ?>' maxlength='2' >
192
  </div><div class='cau_shedule_notation'>
193
  <b><?php _e('Time notation: 24H', 'companion-auto-update'); ?></b>
194
  </div>
201
  <th scope="row"><?php _e( 'Core update interval', 'companion-auto-update' );?></th>
202
  <td>
203
  <p>
204
+ <select name='core_schedule' id='core_schedule' class='schedule_interval'>
205
  <?php foreach ( $availableIntervals as $key => $value ) {
206
  foreach ( $value as $display => $interval ) {
207
  if( $display == 'display' ) {
222
  ?>
223
 
224
  <div class='cau_schedule_input'>
225
+ <input type='number' max='23' name='CoreScheduleTimeH' value='<?php echo $setTimeCoreHour; ?>' maxlength='2' >
226
  </div><div class='cau_schedule_input_div'>
227
  :
228
  </div><div class='cau_schedule_input'>
229
+ <input type='number' max='59' name='CoreScheduleTimeM' value='<?php echo $setTimeCoreMins; ?>' maxlength='2' >
230
  </div><div class='cau_shedule_notation'>
231
  <b><?php _e('Time notation: 24H', 'companion-auto-update'); ?></b>
232
  </div>
250
  <?php foreach ( $availableIntervals as $key => $value ) {
251
  foreach ( $value as $display => $interval ) {
252
  if( $display == 'display' ) {
253
+ echo "<option "; if( $schedule_mail == $key ) { echo "selected "; } echo "value='".$key."'>".$interval."</option>";
254
  }
255
  }
256
  } ?>
257
  </select>
258
  </p>
259
+ <div class='timeScheduleEmail' <?php if( $schedule_mail != 'daily' ) { echo "style='display: none;'"; } ?> >
260
 
261
  <?php
262
 
267
  ?>
268
 
269
  <div class='cau_schedule_input'>
270
+ <input type='number' max='23' name='timeScheduleEmailTimeH' value='<?php echo $setTimeEmailHour; ?>' maxlength='2' >
271
  </div><div class='cau_schedule_input_div'>
272
  :
273
  </div><div class='cau_schedule_input'>
274
+ <input type='number' max='59' name='timeScheduleEmailTimeM' value='<?php echo $setTimeEmailMins; ?>' maxlength='2' >
275
  </div><div class='cau_shedule_notation'>
276
  <b><?php _e('Time notation: 24H', 'companion-auto-update'); ?></b>
277
  </div>
admin/status.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  if( isset( $_GET['run'] ) && $_GET['run'] == 'db_update' ) {
4
  cau_manual_update();
5
- echo '<div id="message" class="updated"><p><b>'.__( 'Datbase update completed' ).'</b></p></div>';
6
  }
7
 
8
  // Date format
@@ -396,7 +396,7 @@ if( cau_incompatiblePlugins() ) { ?>
396
 
397
  <?php } ?>
398
 
399
- <table class="cau_status_list widefat striped cau_status_warnings">
400
 
401
  <thead>
402
  <tr>
@@ -413,13 +413,13 @@ if( cau_incompatiblePlugins() ) { ?>
413
  <td>PHP</td>
414
  <td><?php echo phpversion(); ?></td>
415
  </tr>
416
- <tr>
417
  <td>Database</td>
418
  <td><?php echo get_option( "cau_db_version" ); ?> <code>(Latest: <?php echo cau_db_version(); ?>)</code></td>
419
  </tr>
420
  <tr>
421
  <td class="cau_status_name"><?php _e( 'Timezone' ); ?></td>
422
- <td class="cau_status_active_state"><?php echo get_option('timezone_string'); ?> (GMT <?php echo get_option('gmt_offset'); ?>) - <?php echo date_default_timezone_get(); ?></td>
423
  </tr>
424
  </tbody>
425
 
2
 
3
  if( isset( $_GET['run'] ) && $_GET['run'] == 'db_update' ) {
4
  cau_manual_update();
5
+ echo '<div id="message" class="updated"><p><b>'.__( 'Database update completed' ).'</b></p></div>';
6
  }
7
 
8
  // Date format
396
 
397
  <?php } ?>
398
 
399
+ <table class="autoupdate cau_status_list widefat striped cau_status_warnings">
400
 
401
  <thead>
402
  <tr>
413
  <td>PHP</td>
414
  <td><?php echo phpversion(); ?></td>
415
  </tr>
416
+ <tr <?php if( cau_incorrectDatabaseVersion() ) { echo "class='inactive'"; } ?>>
417
  <td>Database</td>
418
  <td><?php echo get_option( "cau_db_version" ); ?> <code>(Latest: <?php echo cau_db_version(); ?>)</code></td>
419
  </tr>
420
  <tr>
421
  <td class="cau_status_name"><?php _e( 'Timezone' ); ?></td>
422
+ <td class="cau_status_active_state"><?php echo cau_get_proper_timezone(); ?> (GMT <?php echo get_option('gmt_offset'); ?>) - <?php echo date_default_timezone_get(); ?></td>
423
  </tr>
424
  </tbody>
425
 
backend/style.css CHANGED
@@ -247,7 +247,8 @@ table.rollbacklist td a.versionselectbutton {
247
  .cau_schedule_input {
248
  display: inline-block;
249
  vertical-align: middle;
250
- width: 40px;
 
251
  }
252
  .cau_schedule_input input {
253
  max-width: 100%;
247
  .cau_schedule_input {
248
  display: inline-block;
249
  vertical-align: middle;
250
+ width: 50px;
251
+ padding-top: 5px;
252
  }
253
  .cau_schedule_input input {
254
  max-width: 100%;
cau_emails.php CHANGED
@@ -12,7 +12,7 @@ function cau_check_updates_mail() {
12
  cau_list_plugin_updates(); // Check for plugin updates
13
  }
14
 
15
- if( $cau_configs[6]->onoroff == 'on' ) if( $cau_configs[0]->onoroff == 'on' ) cau_plugin_updated(); // Check for updated plugins
16
  }
17
 
18
  // Ge the emailadresses it should be send to
@@ -51,13 +51,18 @@ function cau_updated_message( $type, $updatedList ) {
51
 
52
  $text = sprintf( esc_html__(
53
  'One or more %1$s on your WordPress site at %2$s have been updated by Companion Auto Update. No further action is needed on your part.
54
- For more info on what is new visit your dashboard and check the changelog.
55
-
56
- The following %1$s have been updated:', 'companion-auto-update'
57
  ), $type, get_site_url() );
58
 
 
 
 
 
 
 
59
  $text .= $updatedList;
60
 
 
61
  $text .= __( "(You'll also recieve this email if you manually updated a plugin or theme)", "companion-auto-update" );
62
 
63
  return $text;
@@ -140,11 +145,13 @@ function cau_plugin_updated() {
140
  $pluginNames = array();
141
  $pluginDates = array();
142
  $pluginVersion = array();
 
143
  $themeNames = array();
144
  $themeDates = array();
145
 
146
  // Where to look for plugins
147
  $plugdir = plugin_dir_path( __DIR__ );
 
148
  $allPlugins = get_plugins();
149
 
150
  // Where to look for themes
@@ -152,7 +159,7 @@ function cau_plugin_updated() {
152
  $allThemes = wp_get_themes();
153
 
154
  // Mail schedule
155
- $mailSched = wp_get_schedule( 'cau_set_schedule_mail' );
156
 
157
  // Loop trough all plugins
158
  foreach ( $allPlugins as $key => $value ) {
@@ -162,14 +169,18 @@ function cau_plugin_updated() {
162
  $getFile = $path_parts = pathinfo( $fullPath );
163
  $pluginData = get_plugin_data( $fullPath );
164
 
 
 
 
 
165
  // Get last update date
166
  $fileDate = date ( 'YmdHi', filemtime( $fullPath ) );
167
 
168
- if( $mailSched == 'hourly' ) {
169
  $lastday = date( 'YmdHi', strtotime( '-1 hour' ) );
170
- } elseif( $mailSched == 'twicedaily' ) {
171
  $lastday = date( 'YmdHi', strtotime( '-12 hours' ) );
172
- } elseif( $mailSched == 'daily' ) {
173
  $lastday = date( 'YmdHi', strtotime( '-1 day' ) );
174
  }
175
 
@@ -186,6 +197,7 @@ function cau_plugin_updated() {
186
  }
187
 
188
  array_push( $pluginDates, $fileDate );
 
189
  }
190
 
191
  }
@@ -222,25 +234,35 @@ function cau_plugin_updated() {
222
 
223
  $totalNumP = 0;
224
  $totalNumT = 0;
225
- $updatedListP = '';
226
- $updatedListT = '';
227
 
228
  foreach ( $pluginDates as $key => $value ) {
229
- $updatedListP .= "- ".$pluginNames[$key]." to version ".$pluginVersion[$key]."\n";
 
230
  $totalNumP++;
231
  }
232
  foreach ( $themeNames as $key => $value ) {
233
- $updatedListT .= "- ".$themeNames[$key]."\n";
234
  $totalNumT++;
235
  }
236
 
 
 
 
 
 
 
 
 
 
237
  // If plugins have been updated, send email
238
  if( $totalNumP > 0 ) {
239
 
240
  // E-mail content
241
  $subject = '[' . get_bloginfo( 'name' ) . '] ' . __('One or more plugins have been updated.', 'companion-auto-update');
242
  $type = __('plugins', 'companion-auto-update');
243
- $message = cau_updated_message( $type, "\n".$updatedListP );
244
 
245
  // Send to all addresses
246
  foreach ( cau_set_email() as $key => $value) {
@@ -258,7 +280,7 @@ function cau_plugin_updated() {
258
  // E-mail content
259
  $subject = '[' . get_bloginfo( 'name' ) . '] ' . __('One or more themes have been updated.', 'companion-auto-update');
260
  $type = __('themes', 'companion-auto-update');
261
- $message = cau_updated_message( $type, "\n".$updatedListT );
262
 
263
  // Send to all addresses
264
  foreach ( cau_set_email() as $key => $value) {
@@ -269,15 +291,15 @@ function cau_plugin_updated() {
269
  }
270
 
271
  }
 
 
272
 
273
  // Prevent duplicate emails by setting the event again
274
  if( $totalNumT > 0 OR $totalNumP > 0 ) {
275
- if( $mailSched == 'hourly' ) {
276
  wp_clear_scheduled_hook('cau_set_schedule_mail');
277
  wp_schedule_event( strtotime( '+1 hour', time() ) , 'hourly', 'cau_set_schedule_mail' );
278
  }
279
  }
280
 
281
  }
282
-
283
- ?>
12
  cau_list_plugin_updates(); // Check for plugin updates
13
  }
14
 
15
+ if( $cau_configs[6]->onoroff == 'on' && $cau_configs[0]->onoroff == 'on' ) cau_plugin_updated(); // Check for updated plugins
16
  }
17
 
18
  // Ge the emailadresses it should be send to
51
 
52
  $text = sprintf( esc_html__(
53
  'One or more %1$s on your WordPress site at %2$s have been updated by Companion Auto Update. No further action is needed on your part.
54
+ For more info on what is new visit your dashboard and check the changelog.', 'companion-auto-update'
 
 
55
  ), $type, get_site_url() );
56
 
57
+ $text .= '<br /><br />';
58
+ $text .= sprintf( esc_html__(
59
+ 'The following %1$s have been updated:', 'companion-auto-update'
60
+ ), $type );
61
+
62
+ $text .= '<br />';
63
  $text .= $updatedList;
64
 
65
+ $text .= '<br />';
66
  $text .= __( "(You'll also recieve this email if you manually updated a plugin or theme)", "companion-auto-update" );
67
 
68
  return $text;
145
  $pluginNames = array();
146
  $pluginDates = array();
147
  $pluginVersion = array();
148
+ $pluginSlug = array();
149
  $themeNames = array();
150
  $themeDates = array();
151
 
152
  // Where to look for plugins
153
  $plugdir = plugin_dir_path( __DIR__ );
154
+ if ( !function_exists( 'get_plugins' ) ) require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); // Check if get_plugins() function exists.
155
  $allPlugins = get_plugins();
156
 
157
  // Where to look for themes
159
  $allThemes = wp_get_themes();
160
 
161
  // Mail schedule
162
+ $schedule_mail = wp_get_schedule( 'cau_set_schedule_mail' );
163
 
164
  // Loop trough all plugins
165
  foreach ( $allPlugins as $key => $value ) {
169
  $getFile = $path_parts = pathinfo( $fullPath );
170
  $pluginData = get_plugin_data( $fullPath );
171
 
172
+ // Get the slug
173
+ $explosion = explode( '/', $key );
174
+ $actualSlug = array_shift( $explosion );
175
+
176
  // Get last update date
177
  $fileDate = date ( 'YmdHi', filemtime( $fullPath ) );
178
 
179
+ if( $schedule_mail == 'hourly' ) {
180
  $lastday = date( 'YmdHi', strtotime( '-1 hour' ) );
181
+ } elseif( $schedule_mail == 'twicedaily' ) {
182
  $lastday = date( 'YmdHi', strtotime( '-12 hours' ) );
183
+ } elseif( $schedule_mail == 'daily' ) {
184
  $lastday = date( 'YmdHi', strtotime( '-1 day' ) );
185
  }
186
 
197
  }
198
 
199
  array_push( $pluginDates, $fileDate );
200
+ array_push( $pluginSlug, $actualSlug );
201
  }
202
 
203
  }
234
 
235
  $totalNumP = 0;
236
  $totalNumT = 0;
237
+ $updatedListP = '<ol>';
238
+ $updatedListT = '<ol>';
239
 
240
  foreach ( $pluginDates as $key => $value ) {
241
+ $updatedListP .= "<li><strong>".$pluginNames[$key]."</strong><br />
242
+ to version ".$pluginVersion[$key]." <a href='https://wordpress.org/plugins/".$pluginSlug[$key]."/#developers'>".__( "Release notes", "companion-auto-update" )."</a></li>";
243
  $totalNumP++;
244
  }
245
  foreach ( $themeNames as $key => $value ) {
246
+ $updatedListT .= "<li>".$themeNames[$key]."</li>";
247
  $totalNumT++;
248
  }
249
 
250
+ $updatedListP .= '</ol>';
251
+ $updatedListT .= '</ol>';
252
+
253
+ // Set the email content type
254
+ function cau_mail_content_type() {
255
+ return 'text/html';
256
+ }
257
+ add_filter( 'wp_mail_content_type', 'cau_mail_content_type' );
258
+
259
  // If plugins have been updated, send email
260
  if( $totalNumP > 0 ) {
261
 
262
  // E-mail content
263
  $subject = '[' . get_bloginfo( 'name' ) . '] ' . __('One or more plugins have been updated.', 'companion-auto-update');
264
  $type = __('plugins', 'companion-auto-update');
265
+ $message = cau_updated_message( $type, $updatedListP );
266
 
267
  // Send to all addresses
268
  foreach ( cau_set_email() as $key => $value) {
280
  // E-mail content
281
  $subject = '[' . get_bloginfo( 'name' ) . '] ' . __('One or more themes have been updated.', 'companion-auto-update');
282
  $type = __('themes', 'companion-auto-update');
283
+ $message = cau_updated_message( $type, $updatedListT );
284
 
285
  // Send to all addresses
286
  foreach ( cau_set_email() as $key => $value) {
291
  }
292
 
293
  }
294
+
295
+ remove_filter( 'wp_mail_content_type', 'cau_mail_content_type' );
296
 
297
  // Prevent duplicate emails by setting the event again
298
  if( $totalNumT > 0 OR $totalNumP > 0 ) {
299
+ if( $schedule_mail == 'hourly' ) {
300
  wp_clear_scheduled_hook('cau_set_schedule_mail');
301
  wp_schedule_event( strtotime( '+1 hour', time() ) , 'hourly', 'cau_set_schedule_mail' );
302
  }
303
  }
304
 
305
  }
 
 
cau_functions.php CHANGED
@@ -1,5 +1,40 @@
1
  <?php
2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  // List of incompatible plugins
4
  function cau_incompatiblePluginlist() {
5
 
@@ -43,16 +78,18 @@ function cau_pluginHasIssues() {
43
  $return = true;
44
  }
45
 
 
 
 
 
46
  return $return;
47
  }
48
  function cau_pluginIssueLevels() {
49
 
50
- if( cau_incompatiblePlugins() OR get_option( 'blog_public' ) == 0 OR checkCronjobsDisabled() ) {
51
- $level = 'low';
52
- }
53
-
54
  if( checkAutomaticUpdaterDisabled() ) {
55
- $level = 'high';
 
 
56
  }
57
 
58
  return $level;
@@ -80,6 +117,13 @@ function cau_pluginIssueCount() {
80
 
81
  return $count;
82
  }
 
 
 
 
 
 
 
83
 
84
  // Run custom hooks on plugin update
85
  function cau_run_custom_hooks_p() {
@@ -273,11 +317,25 @@ function active_subtab( $page, $identifier = 'tab' ) {
273
  }
274
 
275
  // List of plugins that should not be updated
276
- function donotupdatelist() {
277
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
278
  global $wpdb;
279
- $table_name = $wpdb->prefix . "auto_updates";
280
- $config = $wpdb->get_results( "SELECT * FROM {$table_name} WHERE name = 'notUpdateList'");
281
 
282
  $list = $config[0]->onoroff;
283
  $list = explode( ", ", $list );
@@ -288,6 +346,12 @@ function donotupdatelist() {
288
  return $returnList;
289
 
290
  }
 
 
 
 
 
 
291
 
292
  // Show the update log
293
  function cau_fetch_log( $limit, $format = 'simple' ) {
@@ -576,9 +640,9 @@ function cau_getChangelogUrl( $type, $name, $plugslug ) {
576
  }
577
 
578
  // Only update plugins which are enabled
579
- function cau_dont_update( $update, $item ) {
580
 
581
- $plugins = donotupdatelist();
582
 
583
  if ( in_array( $item->slug, $plugins ) ) {
584
  return false; // Don't update these plugins
@@ -587,6 +651,18 @@ function cau_dont_update( $update, $item ) {
587
  }
588
 
589
 
 
 
 
 
 
 
 
 
 
 
 
 
590
  }
591
 
592
  // Get plugin information of repository
@@ -721,5 +797,3 @@ function manual_update_check_init() {
721
 
722
  }
723
  add_action( 'admin_footer', 'manual_update_check_init', 1000 );
724
-
725
- ?>
1
  <?php
2
 
3
+ // Get the set timezone
4
+ function cau_get_proper_timezone() {
5
+
6
+ // WP 5.3 adds the wp_timezone_string function
7
+ if ( !function_exists( 'wp_timezone_string' ) ) {
8
+ return get_option( 'timezone_string' );
9
+ } else {
10
+ return wp_timezone_string();
11
+ }
12
+
13
+
14
+ }
15
+
16
+ // Copy of the wp_timezone_string for < 5.3 compat
17
+ if ( !function_exists( 'wp_timezone_string' ) ) {
18
+ function wp_timezone_string() {
19
+ $timezone_string = get_option( 'timezone_string' );
20
+
21
+ if ( $timezone_string ) {
22
+ return $timezone_string;
23
+ }
24
+
25
+ $offset = (float) get_option( 'gmt_offset' );
26
+ $hours = (int) $offset;
27
+ $minutes = ( $offset - $hours );
28
+
29
+ $sign = ( $offset < 0 ) ? '-' : '+';
30
+ $abs_hour = abs( $hours );
31
+ $abs_mins = abs( $minutes * 60 );
32
+ $tz_offset = sprintf( '%s%02d:%02d', $sign, $abs_hour, $abs_mins );
33
+
34
+ return $tz_offset;
35
+ }
36
+ }
37
+
38
  // List of incompatible plugins
39
  function cau_incompatiblePluginlist() {
40
 
78
  $return = true;
79
  }
80
 
81
+ if( cau_incorrectDatabaseVersion() ) {
82
+ $return = true;
83
+ }
84
+
85
  return $return;
86
  }
87
  function cau_pluginIssueLevels() {
88
 
 
 
 
 
89
  if( checkAutomaticUpdaterDisabled() ) {
90
+ $level = 'high';
91
+ } else {
92
+ $level = 'low';
93
  }
94
 
95
  return $level;
117
 
118
  return $count;
119
  }
120
+ function cau_incorrectDatabaseVersion() {
121
+ if( get_option( "cau_db_version" ) != cau_db_version() ) {
122
+ return true;
123
+ } else {
124
+ return false;
125
+ }
126
+ }
127
 
128
  // Run custom hooks on plugin update
129
  function cau_run_custom_hooks_p() {
317
  }
318
 
319
  // List of plugins that should not be updated
320
+ function donotupdatelist( $filter = 'plugins' ) {
321
 
322
+ // Select correct database row
323
+ switch ( $filter ) {
324
+ case 'themes':
325
+ $db_table = 'notUpdateListTh';
326
+ break;
327
+ case 'plugins':
328
+ $db_table = 'notUpdateList';
329
+ break;
330
+ default:
331
+ $db_table = 'notUpdateList';
332
+ break;
333
+ }
334
+
335
+ // Create list
336
  global $wpdb;
337
+ $table_name = $wpdb->prefix."auto_updates";
338
+ $config = $wpdb->get_results( "SELECT * FROM {$table_name} WHERE name = '{$db_table}'");
339
 
340
  $list = $config[0]->onoroff;
341
  $list = explode( ", ", $list );
346
  return $returnList;
347
 
348
  }
349
+ function plugins_donotupdatelist() {
350
+ return donotupdatelist( 'plugins' );
351
+ }
352
+ function themes_donotupdatelist() {
353
+ return donotupdatelist( 'themes' );
354
+ }
355
 
356
  // Show the update log
357
  function cau_fetch_log( $limit, $format = 'simple' ) {
640
  }
641
 
642
  // Only update plugins which are enabled
643
+ function cau_dontUpdatePlugins( $update, $item ) {
644
 
645
+ $plugins = plugins_donotupdatelist();
646
 
647
  if ( in_array( $item->slug, $plugins ) ) {
648
  return false; // Don't update these plugins
651
  }
652
 
653
 
654
+ }
655
+ function cau_dontUpdateThemes( $update, $item ) {
656
+
657
+ $themes = themes_donotupdatelist();
658
+
659
+ if ( in_array( $item->slug, $themes ) ) {
660
+ return false; // Don't update these plugins
661
+ } else {
662
+ return true; // Always update these plugins
663
+ }
664
+
665
+
666
  }
667
 
668
  // Get plugin information of repository
797
 
798
  }
799
  add_action( 'admin_footer', 'manual_update_check_init', 1000 );
 
 
companion-auto-update.php CHANGED
@@ -3,7 +3,7 @@
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: 3.4.5
7
  * Author: Papin Schipper
8
  * Author URI: http://codeermeneer.nl/
9
  * Contributors: papin
@@ -56,7 +56,7 @@ function cau_donateUrl() {
56
 
57
  // Database version
58
  function cau_db_version() {
59
- return '3.5.0';
60
  }
61
  function cau_database_creation() {
62
 
@@ -70,7 +70,7 @@ function cau_database_creation() {
70
  $sql = "CREATE TABLE $autoupdates (
71
  id INT(9) NOT NULL AUTO_INCREMENT,
72
  name VARCHAR(255) NOT NULL,
73
- onoroff VARCHAR(255) NOT NULL,
74
  UNIQUE KEY id (id)
75
  )";
76
 
@@ -133,6 +133,7 @@ function cau_install_data() {
133
 
134
  // Advanced
135
  if( !cau_check_if_exists( 'notUpdateList' ) ) $wpdb->insert( $table_name, array( 'name' => 'notUpdateList', 'onoroff' => '' ) );
 
136
  if( !cau_check_if_exists( 'translations' ) ) $wpdb->insert( $table_name, array( 'name' => 'translations', 'onoroff' => 'on' ) );
137
  if( !cau_check_if_exists( 'wpemails' ) ) $wpdb->insert( $table_name, array( 'name' => 'wpemails', 'onoroff' => 'on' ) );
138
 
@@ -187,13 +188,13 @@ function cau_frontend() { ?>
187
  <?php
188
 
189
  // Make sure the correct timezone is used
190
- date_default_timezone_set( get_option( 'timezone_string' ) );
191
 
192
  // Allow only access to these pages
193
  $allowedPages = array(
194
  'dashboard' => __( 'Dashboard' ),
195
  'schedule' => __( 'Advanced settings', 'companion-auto-update' ),
196
- 'pluginlist' => __( 'Select plugins', 'companion-auto-update' ),
197
  'log' => __( 'Update log', 'companion-auto-update' ),
198
  'status' => __( 'Status', 'companion-auto-update' ),
199
  'support' => __( 'Support', 'companion-auto-update' )
@@ -327,7 +328,7 @@ class CAU_auto_update {
327
  $configs = $wpdb->get_results( "SELECT * FROM {$table_name} WHERE name = 'plugins'");
328
  foreach ( $configs as $config ) {
329
 
330
- if( $config->onoroff == 'on' ) add_filter( 'auto_update_plugin', 'cau_dont_update', 10, 2 ); // Turn on
331
  if( $config->onoroff != 'on' ) add_filter( 'auto_update_plugin', '__return_false', 1 ); // Turn off
332
 
333
  }
@@ -335,7 +336,7 @@ class CAU_auto_update {
335
  // Enable for themes
336
  $configs = $wpdb->get_results( "SELECT * FROM {$table_name} WHERE name = 'themes'");
337
  foreach ( $configs as $config ) {
338
- if( $config->onoroff == 'on' ) add_filter( 'auto_update_theme', '__return_true', 1 ); // Turn on
339
  if( $config->onoroff != 'on' ) add_filter( 'auto_update_theme', '__return_false', 1 ); // Turn off
340
  }
341
 
@@ -390,5 +391,3 @@ function cau_checkForIssuesStyle() {
390
 
391
  }
392
  add_action( 'admin_enqueue_scripts', 'cau_checkForIssuesStyle', 100 );
393
-
394
- ?>
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: 3.4.6
7
  * Author: Papin Schipper
8
  * Author URI: http://codeermeneer.nl/
9
  * Contributors: papin
56
 
57
  // Database version
58
  function cau_db_version() {
59
+ return '3.5.1';
60
  }
61
  function cau_database_creation() {
62
 
70
  $sql = "CREATE TABLE $autoupdates (
71
  id INT(9) NOT NULL AUTO_INCREMENT,
72
  name VARCHAR(255) NOT NULL,
73
+ onoroff TEXT NOT NULL,
74
  UNIQUE KEY id (id)
75
  )";
76
 
133
 
134
  // Advanced
135
  if( !cau_check_if_exists( 'notUpdateList' ) ) $wpdb->insert( $table_name, array( 'name' => 'notUpdateList', 'onoroff' => '' ) );
136
+ if( !cau_check_if_exists( 'notUpdateListTh' ) ) $wpdb->insert( $table_name, array( 'name' => 'notUpdateListTh', 'onoroff' => '' ) );
137
  if( !cau_check_if_exists( 'translations' ) ) $wpdb->insert( $table_name, array( 'name' => 'translations', 'onoroff' => 'on' ) );
138
  if( !cau_check_if_exists( 'wpemails' ) ) $wpdb->insert( $table_name, array( 'name' => 'wpemails', 'onoroff' => 'on' ) );
139
 
188
  <?php
189
 
190
  // Make sure the correct timezone is used
191
+ date_default_timezone_set( cau_get_proper_timezone() );
192
 
193
  // Allow only access to these pages
194
  $allowedPages = array(
195
  'dashboard' => __( 'Dashboard' ),
196
  'schedule' => __( 'Advanced settings', 'companion-auto-update' ),
197
+ 'pluginlist' => __( 'Update filter', 'companion-auto-update' ),
198
  'log' => __( 'Update log', 'companion-auto-update' ),
199
  'status' => __( 'Status', 'companion-auto-update' ),
200
  'support' => __( 'Support', 'companion-auto-update' )
328
  $configs = $wpdb->get_results( "SELECT * FROM {$table_name} WHERE name = 'plugins'");
329
  foreach ( $configs as $config ) {
330
 
331
+ if( $config->onoroff == 'on' ) add_filter( 'auto_update_plugin', 'cau_dontUpdatePlugins', 10, 2 ); // Turn on
332
  if( $config->onoroff != 'on' ) add_filter( 'auto_update_plugin', '__return_false', 1 ); // Turn off
333
 
334
  }
336
  // Enable for themes
337
  $configs = $wpdb->get_results( "SELECT * FROM {$table_name} WHERE name = 'themes'");
338
  foreach ( $configs as $config ) {
339
+ if( $config->onoroff == 'on' ) add_filter( 'auto_update_theme', 'cau_dontUpdateThemes', 1 ); // Turn on
340
  if( $config->onoroff != 'on' ) add_filter( 'auto_update_theme', '__return_false', 1 ); // Turn off
341
  }
342
 
391
 
392
  }
393
  add_action( 'admin_enqueue_scripts', 'cau_checkForIssuesStyle', 100 );
 
 
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: auto, automatic, background, update, updates, updating, automatic updates,
5
  Requires at least: 3.6.0
6
  Tested up to: 5.3
7
  Requires PHP: 5.1
8
- Stable tag: 3.4.5
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -13,9 +13,6 @@ This plugin automatically updates all plugins, all themes and the wordpress core
13
 
14
  == Description ==
15
 
16
- = For every $10 you donate to one of our plugins we’ll donate $10 to team trees. =
17
- [Read our blog post](https://codeermeneer.nl/blog/companion-supports-teamtrees/)
18
-
19
  = Keep your website safe! =
20
  We understand that you might not always be able to check if your wordpress site has any updates that need to be installed, especially when you maintain multiple websites keeping them up-to-date can be a lot of work.
21
  This plugin enables background auto-updating for all plugins, all themes and the wordpress core (both major and minor updates).
@@ -72,6 +69,15 @@ Your feedback is what made this plugin what is and what it’ll become so keep t
72
 
73
  == Changelog ==
74
 
 
 
 
 
 
 
 
 
 
75
  = 3.4.5 (November 26, 2019) =
76
  * Fix: Some of you reported several database errors in version 3.4.4, these are fixed now
77
  * Tweak: Few minor design changes to fit the changes made in WordPress 5.3
5
  Requires at least: 3.6.0
6
  Tested up to: 5.3
7
  Requires PHP: 5.1
8
+ Stable tag: 3.4.6
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
13
 
14
  == Description ==
15
 
 
 
 
16
  = Keep your website safe! =
17
  We understand that you might not always be able to check if your wordpress site has any updates that need to be installed, especially when you maintain multiple websites keeping them up-to-date can be a lot of work.
18
  This plugin enables background auto-updating for all plugins, all themes and the wordpress core (both major and minor updates).
69
 
70
  == Changelog ==
71
 
72
+ = 3.4.6 (December 31, 2019) =
73
+ * New: Filter themes, just like you do with plugins
74
+ * New: Link to the release notes of the plugin in the email
75
+ * Fixed: Sometimes the pluginfilter wouldn't save when using a lot of plugins
76
+ * Fixed: A few errors regarding emails
77
+ * Fixed: Errors regarding the set timezone
78
+ * Tweak: Changing settings no longer requires page reload to see the changes
79
+ * Few tweaks in code for better performance
80
+
81
  = 3.4.5 (November 26, 2019) =
82
  * Fix: Some of you reported several database errors in version 3.4.4, these are fixed now
83
  * Tweak: Few minor design changes to fit the changes made in WordPress 5.3