Companion Auto Update - Version 3.8.6

Version Description

(August 11, 2022) = * Tweak: Code optimization for better performance

Download this release

Release Info

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

Code changes from version 3.8.5 to 3.8.6

Files changed (5) hide show
  1. admin/dashboard.php +66 -68
  2. cau_emails.php +524 -525
  3. cau_functions.php +26 -9
  4. companion-auto-update.php +2 -2
  5. readme.txt +4 -1
admin/dashboard.php CHANGED
@@ -26,10 +26,10 @@ if( isset( $_POST['submit'] ) ) {
26
  $table_name = $wpdb->prefix . "auto_updates";
27
 
28
  // Auto updater
29
- $plugins = isset( $_POST['plugins'] ) ? sanitize_text_field( $_POST['plugins'] ) : '';
30
- $themes = isset( $_POST['themes'] ) ? sanitize_text_field( $_POST['themes'] ) : '';
31
- $minor = isset( $_POST['minor'] ) ? sanitize_text_field( $_POST['minor'] ) : '';
32
- $major = isset( $_POST['major'] ) ? sanitize_text_field( $_POST['major'] ) : '';
33
  $translations = isset( $_POST['translations'] ) ? sanitize_text_field( $_POST['translations'] ) : '';
34
 
35
  $wpdb->query( $wpdb->prepare( "UPDATE $table_name SET onoroff = %s WHERE name = 'plugins'", $plugins ) );
@@ -39,11 +39,11 @@ if( isset( $_POST['submit'] ) ) {
39
  $wpdb->query( $wpdb->prepare( "UPDATE $table_name SET onoroff = %s WHERE name = 'translations'", $translations ) );
40
 
41
  // Emails
42
- $send = isset( $_POST['cau_send'] ) ? sanitize_text_field( $_POST['cau_send'] ) : '';
43
  $sendupdate = isset( $_POST['cau_send_update'] ) ? sanitize_text_field( $_POST['cau_send_update'] ) : '';
44
  $sendoutdated = isset( $_POST['cau_send_outdated'] ) ? sanitize_text_field( $_POST['cau_send_outdated'] ) : '';
45
- $wpemails = isset( $_POST['wpemails'] ) ? sanitize_text_field( $_POST['wpemails'] ) : '';
46
- $email = isset( $_POST['cau_email'] ) ? sanitize_text_field( $_POST['cau_email'] ) : '';
47
  $html_or_text = isset( $_POST['html_or_text'] ) ? sanitize_text_field( $_POST['html_or_text'] ) : 'html';
48
  $dbupdateemails = isset( $_POST['dbupdateemails'] ) ? sanitize_text_field( $_POST['dbupdateemails'] ) : '';
49
 
@@ -56,8 +56,8 @@ if( isset( $_POST['submit'] ) ) {
56
  $wpdb->query( $wpdb->prepare( "UPDATE $table_name SET onoroff = %s WHERE name = 'dbupdateemails'", $dbupdateemails ) );
57
 
58
  // Advanced
59
- $allow_editor = isset( $_POST['allow_editor'] ) ? sanitize_text_field( $_POST['allow_editor'] ) : '';
60
- $allow_author = isset( $_POST['allow_author'] ) ? sanitize_text_field( $_POST['allow_author'] ) : '';
61
  $advanced_info_emails = isset( $_POST['advanced_info_emails'] ) ? sanitize_text_field( $_POST['advanced_info_emails'] ) : '';
62
  $plugin_links_emails = isset( $_POST['plugin_links_emails'] ) ? sanitize_text_field( $_POST['plugin_links_emails'] ) : '';
63
 
@@ -76,21 +76,21 @@ if( isset( $_POST['submit'] ) ) {
76
  // Intervals
77
 
78
  // Set variables
79
- $plugin_sc = sanitize_text_field( $_POST['plugin_schedule'] );
80
- $theme_sc = sanitize_text_field( $_POST['theme_schedule'] );
81
- $core_sc = sanitize_text_field( $_POST['core_schedule'] );
82
  $schedule_mail = sanitize_text_field( $_POST['update_notifications'] );
83
  $outdated_notifier = sanitize_text_field( $_POST['outdated_notifier'] );
84
 
85
  // First clear schedules
86
- wp_clear_scheduled_hook('wp_update_plugins');
87
- wp_clear_scheduled_hook('wp_update_themes');
88
- wp_clear_scheduled_hook('wp_version_check');
89
- wp_clear_scheduled_hook('cau_set_schedule_mail');
90
- wp_clear_scheduled_hook('cau_custom_hooks_plugins');
91
- wp_clear_scheduled_hook('cau_custom_hooks_themes');
92
- wp_clear_scheduled_hook('cau_log_updater');
93
- wp_clear_scheduled_hook('cau_outdated_notifier');
94
 
95
  // Then set the new times
96
 
@@ -109,11 +109,9 @@ if( isset( $_POST['submit'] ) ) {
109
  wp_schedule_event( ( $pluginSetTime - 1800 ), $plugin_sc, 'cau_log_updater' );
110
 
111
  } else {
112
-
113
  wp_schedule_event( time(), $plugin_sc, 'wp_update_plugins' );
114
  wp_schedule_event( time(), $plugin_sc, 'cau_custom_hooks_plugins' );
115
  wp_schedule_event( ( time() - 1800 ), $plugin_sc, 'cau_log_updater' );
116
-
117
  }
118
 
119
  // Themes
@@ -130,10 +128,8 @@ if( isset( $_POST['submit'] ) ) {
130
  wp_schedule_event( $themeSetTime, $theme_sc, 'cau_custom_hooks_themes' );
131
 
132
  } else {
133
-
134
  wp_schedule_event( time(), $theme_sc, 'wp_update_themes' );
135
  wp_schedule_event( time(), $theme_sc, 'cau_custom_hooks_themes' );
136
-
137
  }
138
 
139
  // Core
@@ -149,9 +145,7 @@ if( isset( $_POST['submit'] ) ) {
149
  wp_schedule_event( $coreSetTime, $core_sc, 'wp_version_check' );
150
 
151
  } else {
152
-
153
  wp_schedule_event( time(), $core_sc, 'wp_version_check' );
154
-
155
  }
156
 
157
  // Update notifications
@@ -167,9 +161,7 @@ if( isset( $_POST['submit'] ) ) {
167
  wp_schedule_event( $emailSetTime, $schedule_mail, 'cau_set_schedule_mail' );
168
 
169
  } else {
170
-
171
  wp_schedule_event( time(), $schedule_mail, 'cau_set_schedule_mail' );
172
-
173
  }
174
 
175
  // Outdated notifications
@@ -185,9 +177,7 @@ if( isset( $_POST['submit'] ) ) {
185
  wp_schedule_event( $emailSetTime, $outdated_notifier, 'cau_outdated_notifier' );
186
 
187
  } else {
188
-
189
  wp_schedule_event( time(), $outdated_notifier, 'cau_outdated_notifier' );
190
-
191
  }
192
 
193
 
@@ -195,26 +185,26 @@ if( isset( $_POST['submit'] ) ) {
195
 
196
  }
197
 
 
198
  if( isset( $_GET['welcome'] ) ) {
199
-
200
  echo '<div class="welcome-to-cau welcome-bg" style="margin-bottom: 0px;">
201
  <div class="welcome-image">
202
  </div><div class="welcome-content">
203
 
204
- <h3>'.__( 'Welcome to Companion Auto Update', 'companion-auto-update' ).'</h3>
205
- <br />
206
- <p><strong>'.__( 'You\'re set and ready to go', 'companion-auto-update' ).'</strong></p>
207
- <p>'.__( 'The plugin is all set and ready to go with the recommended settings, but if you\'d like you can change them below.' ).'</p>
208
- <br />
209
- <p><strong>'.__( 'Get Started' ).': </strong> <a href="'.cau_url( 'pluginlist' ).'">'.__( 'Update filter', 'companion-auto-update' ).'</a> &nbsp; | &nbsp;
210
- <strong>'.__( 'More Actions' ).': </strong> <a href="http://codeermeneer.nl/cau_poll/" target="_blank">'.__('Give feedback', 'companion-auto-update').'</a> - <a href="https://translate.wordpress.org/projects/wp-plugins/companion-auto-update/" target="_blank">'.__( 'Help us translate', 'companion-auto-update' ).'</a></p>
211
 
212
  </div>
213
  </div>';
214
  }
215
 
216
- $cs_hooks_p = wp_get_schedule( 'cau_custom_hooks_plugins' );
217
- $cs_hooks_t = wp_get_schedule( 'cau_custom_hooks_themes' );
218
 
219
  ?>
220
 
@@ -233,25 +223,17 @@ $cs_hooks_t = wp_get_schedule( 'cau_custom_hooks_themes' );
233
 
234
  <?php
235
 
236
- echo '<p><input id="plugins" name="plugins" type="checkbox"';
237
- if( cau_get_db_value( 'plugins' ) == 'on' ) echo 'checked';
238
- echo '/> <label for="plugins">'.__('Auto update plugins?', 'companion-auto-update').'</label></p>';
239
-
240
- echo '<p><input id="themes" name="themes" type="checkbox"';
241
- if( cau_get_db_value( 'themes' ) == 'on' ) echo 'checked';
242
- echo '/> <label for="themes">'.__('Auto update themes?', 'companion-auto-update').'</label></p>';
243
 
244
- echo '<p><input id="minor" name="minor" type="checkbox"';
245
- if( cau_get_db_value( 'minor' ) == 'on' ) echo 'checked';
246
- echo '/> <label for="minor">'.__('Auto update minor core updates?', 'companion-auto-update').' <code class="majorMinorExplain">5.3.0 > 5.3.1</code></label></p>';
247
-
248
- echo '<p><input id="major" name="major" type="checkbox"';
249
- if( cau_get_db_value( 'major' ) == 'on' ) echo 'checked';
250
- echo '/> <label for="major">'.__('Auto update major core updates?', 'companion-auto-update').' <code class="majorMinorExplain">5.3.0 > 5.4.0</code></label></p>';
251
-
252
- echo '<p><input id="translations" name="translations" type="checkbox"';
253
- if( cau_get_db_value( 'translations' ) == 'on' ) echo 'checked';
254
- echo '/> <label for="translations">'.__('Auto update translation files?', 'companion-auto-update').'</label></p>';
255
 
256
  ?>
257
 
@@ -267,8 +249,12 @@ $cs_hooks_t = wp_get_schedule( 'cau_custom_hooks_themes' );
267
  <h2 class="title"><?php _e( 'Email Notifications', 'companion-auto-update' );?></h2>
268
 
269
  <?php
270
- if( cau_get_db_value( 'email' ) == '' ) $toemail = get_option('admin_email');
271
- else $toemail = cau_get_db_value( 'email' );
 
 
 
 
272
  ?>
273
 
274
  <table class="form-table">
@@ -281,7 +267,7 @@ $cs_hooks_t = wp_get_schedule( 'cau_custom_hooks_themes' );
281
  </p>
282
  <p>
283
  <input id="cau_send" name="cau_send" type="checkbox" <?php if( cau_get_db_value( 'send' ) == 'on' ) { echo 'checked'; } ?> />
284
- <label for="cau_send"><?php _e('Send me emails when an update is available.', 'companion-auto-update');?></label>
285
  </p>
286
  </td>
287
  </tr>
@@ -299,7 +285,7 @@ $cs_hooks_t = wp_get_schedule( 'cau_custom_hooks_themes' );
299
  <td>
300
  <p>
301
  <label for="cau_email"><?php _e( 'To', 'companion-auto-update' ); ?>:</label>
302
- <input type="text" name="cau_email" id="cau_email" class="regular-text" placeholder="<?php echo get_option('admin_email'); ?>" value="<?php echo esc_html( $toemail ); ?>" />
303
  </p>
304
 
305
  <p class="description"><?php _e('Seperate email addresses using commas.', 'companion-auto-update');?></p>
@@ -310,8 +296,8 @@ $cs_hooks_t = wp_get_schedule( 'cau_custom_hooks_themes' );
310
  <td>
311
  <p>
312
  <select id='html_or_text' name='html_or_text'>
313
- <option value='html' <?php if( cau_get_db_value( 'html_or_text' ) == 'html' ) { echo "SELECTED"; } ?>><?php _e( 'Use HTML', 'companion-auto-update' ); ?></option>
314
- <option value='text' <?php if( cau_get_db_value( 'html_or_text' ) == 'text' ) { echo "SELECTED"; } ?>><?php _e( 'Use plain text', 'companion-auto-update' ); ?></option>
315
  </select>
316
  </p>
317
  </td>
@@ -443,23 +429,35 @@ $cs_hooks_t = wp_get_schedule( 'cau_custom_hooks_themes' );
443
 
444
  <h2 class="title"><?php _e( 'Advanced settings', 'companion-auto-update' ); ?></h2>
445
 
 
 
 
 
 
 
 
 
 
 
 
 
446
  <table class="form-table">
447
  <tbody>
448
  <tr>
449
  <th scope="row"><label><?php _e( 'Allow access to:', 'companion-auto-update' ); ?></label></th>
450
  <td>
451
  <p><label for="allow_administrator"><input name="allow_administrator" type="checkbox" id="allow_administrator" disabled="" checked=""><?php _e( 'Administrator', 'companion-auto-update' ); ?></label></p>
452
- <p><label for="allow_editor"><input name="allow_editor" type="checkbox" id="allow_editor" <?php if( cau_get_db_value( 'allow_editor' ) == 'on' ) { echo "CHECKED"; } ?>><?php _e( 'Editor', 'companion-auto-update' ); ?></label></p>
453
- <p><label for="allow_author"><input name="allow_author" type="checkbox" id="allow_author" <?php if( cau_get_db_value( 'allow_author' ) == 'on' ) { echo "CHECKED"; } ?>><?php _e( 'Author', 'companion-auto-update' ); ?></label></p>
454
  </td>
455
  </tr>
456
  <tr>
457
  <th scope="row"><label><?php _e( 'Delay updates', 'companion-auto-update' ); ?></label></th>
458
  <td>
459
- <p><label for="update_delay"><input name="update_delay" type="checkbox" id="update_delay" <?php if( cau_get_db_value( 'update_delay' ) == 'on' ) { echo "CHECKED"; } ?>><?php _e( 'Delay updates', 'companion-auto-update' ); ?></label></p>
460
  </td>
461
  </tr>
462
- <tr id='update_delay_days_block' <?php if( cau_get_db_value( 'update_delay' ) != 'on' ) { echo "class='disabled_option'"; } ?>>
463
  <th scope="row"><label><?php _e( 'Number of days', 'companion-auto-update' ); ?></label></th>
464
  <td>
465
  <input type="number" min="0" max="31" name="update_delay_days" id="update_delay_days" class="regular-text" value="<?php echo cau_get_db_value( 'update_delay_days' ); ?>" />
26
  $table_name = $wpdb->prefix . "auto_updates";
27
 
28
  // Auto updater
29
+ $plugins = isset( $_POST['plugins'] ) ? sanitize_text_field( $_POST['plugins'] ) : '';
30
+ $themes = isset( $_POST['themes'] ) ? sanitize_text_field( $_POST['themes'] ) : '';
31
+ $minor = isset( $_POST['minor'] ) ? sanitize_text_field( $_POST['minor'] ) : '';
32
+ $major = isset( $_POST['major'] ) ? sanitize_text_field( $_POST['major'] ) : '';
33
  $translations = isset( $_POST['translations'] ) ? sanitize_text_field( $_POST['translations'] ) : '';
34
 
35
  $wpdb->query( $wpdb->prepare( "UPDATE $table_name SET onoroff = %s WHERE name = 'plugins'", $plugins ) );
39
  $wpdb->query( $wpdb->prepare( "UPDATE $table_name SET onoroff = %s WHERE name = 'translations'", $translations ) );
40
 
41
  // Emails
42
+ $send = isset( $_POST['cau_send'] ) ? sanitize_text_field( $_POST['cau_send'] ) : '';
43
  $sendupdate = isset( $_POST['cau_send_update'] ) ? sanitize_text_field( $_POST['cau_send_update'] ) : '';
44
  $sendoutdated = isset( $_POST['cau_send_outdated'] ) ? sanitize_text_field( $_POST['cau_send_outdated'] ) : '';
45
+ $wpemails = isset( $_POST['wpemails'] ) ? sanitize_text_field( $_POST['wpemails'] ) : '';
46
+ $email = isset( $_POST['cau_email'] ) ? sanitize_text_field( $_POST['cau_email'] ) : '';
47
  $html_or_text = isset( $_POST['html_or_text'] ) ? sanitize_text_field( $_POST['html_or_text'] ) : 'html';
48
  $dbupdateemails = isset( $_POST['dbupdateemails'] ) ? sanitize_text_field( $_POST['dbupdateemails'] ) : '';
49
 
56
  $wpdb->query( $wpdb->prepare( "UPDATE $table_name SET onoroff = %s WHERE name = 'dbupdateemails'", $dbupdateemails ) );
57
 
58
  // Advanced
59
+ $allow_editor = isset( $_POST['allow_editor'] ) ? sanitize_text_field( $_POST['allow_editor'] ) : '';
60
+ $allow_author = isset( $_POST['allow_author'] ) ? sanitize_text_field( $_POST['allow_author'] ) : '';
61
  $advanced_info_emails = isset( $_POST['advanced_info_emails'] ) ? sanitize_text_field( $_POST['advanced_info_emails'] ) : '';
62
  $plugin_links_emails = isset( $_POST['plugin_links_emails'] ) ? sanitize_text_field( $_POST['plugin_links_emails'] ) : '';
63
 
76
  // Intervals
77
 
78
  // Set variables
79
+ $plugin_sc = sanitize_text_field( $_POST['plugin_schedule'] );
80
+ $theme_sc = sanitize_text_field( $_POST['theme_schedule'] );
81
+ $core_sc = sanitize_text_field( $_POST['core_schedule'] );
82
  $schedule_mail = sanitize_text_field( $_POST['update_notifications'] );
83
  $outdated_notifier = sanitize_text_field( $_POST['outdated_notifier'] );
84
 
85
  // First clear schedules
86
+ wp_clear_scheduled_hook( 'wp_update_plugins' );
87
+ wp_clear_scheduled_hook( 'wp_update_themes' );
88
+ wp_clear_scheduled_hook( 'wp_version_check' );
89
+ wp_clear_scheduled_hook( 'cau_set_schedule_mail' );
90
+ wp_clear_scheduled_hook( 'cau_custom_hooks_plugins' );
91
+ wp_clear_scheduled_hook( 'cau_custom_hooks_themes' );
92
+ wp_clear_scheduled_hook( 'cau_log_updater' );
93
+ wp_clear_scheduled_hook( 'cau_outdated_notifier' );
94
 
95
  // Then set the new times
96
 
109
  wp_schedule_event( ( $pluginSetTime - 1800 ), $plugin_sc, 'cau_log_updater' );
110
 
111
  } else {
 
112
  wp_schedule_event( time(), $plugin_sc, 'wp_update_plugins' );
113
  wp_schedule_event( time(), $plugin_sc, 'cau_custom_hooks_plugins' );
114
  wp_schedule_event( ( time() - 1800 ), $plugin_sc, 'cau_log_updater' );
 
115
  }
116
 
117
  // Themes
128
  wp_schedule_event( $themeSetTime, $theme_sc, 'cau_custom_hooks_themes' );
129
 
130
  } else {
 
131
  wp_schedule_event( time(), $theme_sc, 'wp_update_themes' );
132
  wp_schedule_event( time(), $theme_sc, 'cau_custom_hooks_themes' );
 
133
  }
134
 
135
  // Core
145
  wp_schedule_event( $coreSetTime, $core_sc, 'wp_version_check' );
146
 
147
  } else {
 
148
  wp_schedule_event( time(), $core_sc, 'wp_version_check' );
 
149
  }
150
 
151
  // Update notifications
161
  wp_schedule_event( $emailSetTime, $schedule_mail, 'cau_set_schedule_mail' );
162
 
163
  } else {
 
164
  wp_schedule_event( time(), $schedule_mail, 'cau_set_schedule_mail' );
 
165
  }
166
 
167
  // Outdated notifications
177
  wp_schedule_event( $emailSetTime, $outdated_notifier, 'cau_outdated_notifier' );
178
 
179
  } else {
 
180
  wp_schedule_event( time(), $outdated_notifier, 'cau_outdated_notifier' );
 
181
  }
182
 
183
 
185
 
186
  }
187
 
188
+ // Welcome screen for first time viewers
189
  if( isset( $_GET['welcome'] ) ) {
 
190
  echo '<div class="welcome-to-cau welcome-bg" style="margin-bottom: 0px;">
191
  <div class="welcome-image">
192
  </div><div class="welcome-content">
193
 
194
+ <h3>'.__( 'Welcome to Companion Auto Update', 'companion-auto-update' ).'</h3>
195
+ <br />
196
+ <p><strong>'.__( 'You\'re set and ready to go', 'companion-auto-update' ).'</strong></p>
197
+ <p>'.__( 'The plugin is all set and ready to go with the recommended settings, but if you\'d like you can change them below.' ).'</p>
198
+ <br />
199
+ <p><strong>'.__( 'Get Started' ).': </strong> <a href="'.cau_url( 'pluginlist' ).'">'.__( 'Update filter', 'companion-auto-update' ).'</a> &nbsp; | &nbsp;
200
+ <strong>'.__( 'More Actions' ).': </strong> <a href="http://codeermeneer.nl/cau_poll/" target="_blank">'.__('Give feedback', 'companion-auto-update').'</a> - <a href="https://translate.wordpress.org/projects/wp-plugins/companion-auto-update/" target="_blank">'.__( 'Help us translate', 'companion-auto-update' ).'</a></p>
201
 
202
  </div>
203
  </div>';
204
  }
205
 
206
+ $cs_hooks_p = wp_get_schedule( 'cau_custom_hooks_plugins' );
207
+ $cs_hooks_t = wp_get_schedule( 'cau_custom_hooks_themes' );
208
 
209
  ?>
210
 
223
 
224
  <?php
225
 
226
+ $plugins_on = ( cau_get_db_value( 'plugins' ) == 'on' ) ? "CHECKED" : "";
227
+ $themes_on = ( cau_get_db_value( 'themes' ) == 'on' ) ? "CHECKED" : "";
228
+ $minor_on = ( cau_get_db_value( 'minor' ) == 'on' ) ? "CHECKED" : "";
229
+ $major_on = ( cau_get_db_value( 'major' ) == 'on' ) ? "CHECKED" : "";
230
+ $translations_on = ( cau_get_db_value( 'translations' ) == 'on' ) ? "CHECKED" : "";
 
 
231
 
232
+ echo "<p><input id='plugins' name='plugins' type='checkbox' {$plugins_on}/><label for='plugins'>".__( 'Auto update plugins?', 'companion-auto-update' )."</label></p>";
233
+ echo "<p><input id='themes' name='themes' type='checkbox' {$themes_on}/><label for='themes'>".__( 'Auto update themes?', 'companion-auto-update' )."</label></p>";
234
+ echo "<p><input id='minor' name='minor' type='checkbox' {$minor_on}/><label for='minor'>".__( 'Auto update minor core updates?', 'companion-auto-update' )." <code class='majorMinorExplain'>6.0.0 > 6.0.1</code></label></p>";
235
+ echo "<p><input id='major' name='major' type='checkbox' {$major_on}/><label for='major'>".__( 'Auto update major core updates?', 'companion-auto-update' )." <code class='majorMinorExplain'>6.0.0 > 6.1.0</code></label></p>";
236
+ echo "<p><input id='translations' name='translations' type='checkbox' {$translations_on}/><label for='translations'>".__( 'Auto update translation files?', 'companion-auto-update' )."</label></p>";
 
 
 
 
 
 
237
 
238
  ?>
239
 
249
  <h2 class="title"><?php _e( 'Email Notifications', 'companion-auto-update' );?></h2>
250
 
251
  <?php
252
+
253
+ $db_email = cau_get_db_value( 'email' );
254
+ $toemail = ( $db_email == '' ) ? get_option( 'admin_email' ) : $db_email;
255
+
256
+ $hot = cau_get_db_value( 'html_or_text' );
257
+
258
  ?>
259
 
260
  <table class="form-table">
267
  </p>
268
  <p>
269
  <input id="cau_send" name="cau_send" type="checkbox" <?php if( cau_get_db_value( 'send' ) == 'on' ) { echo 'checked'; } ?> />
270
+ <label for="cau_send"><?php _e( 'Send me emails when an update is available.', 'companion-auto-update' );?></label>
271
  </p>
272
  </td>
273
  </tr>
285
  <td>
286
  <p>
287
  <label for="cau_email"><?php _e( 'To', 'companion-auto-update' ); ?>:</label>
288
+ <input type="text" name="cau_email" id="cau_email" class="regular-text" placeholder="<?php echo get_option( 'admin_email' ); ?>" value="<?php echo esc_html( $toemail ); ?>" />
289
  </p>
290
 
291
  <p class="description"><?php _e('Seperate email addresses using commas.', 'companion-auto-update');?></p>
296
  <td>
297
  <p>
298
  <select id='html_or_text' name='html_or_text'>
299
+ <option value='html' <?php if( $hot == 'html' ) { echo "SELECTED"; } ?>><?php _e( 'Use HTML', 'companion-auto-update' ); ?></option>
300
+ <option value='text' <?php if( $hot == 'text' ) { echo "SELECTED"; } ?>><?php _e( 'Use plain text', 'companion-auto-update' ); ?></option>
301
  </select>
302
  </p>
303
  </td>
429
 
430
  <h2 class="title"><?php _e( 'Advanced settings', 'companion-auto-update' ); ?></h2>
431
 
432
+ <?php
433
+
434
+ // Access
435
+ $accessallowed = cau_allowed_user_rights_array();
436
+ $has_editor = in_array( 'editor', $accessallowed ) ? true : false;
437
+ $has_author = in_array( 'author', $accessallowed ) ? true : false;
438
+
439
+ // Update delays
440
+ $has_updatedelay = ( cau_get_db_value( 'update_delay' ) == 'on' ) ? true : false;
441
+
442
+ ?>
443
+
444
  <table class="form-table">
445
  <tbody>
446
  <tr>
447
  <th scope="row"><label><?php _e( 'Allow access to:', 'companion-auto-update' ); ?></label></th>
448
  <td>
449
  <p><label for="allow_administrator"><input name="allow_administrator" type="checkbox" id="allow_administrator" disabled="" checked=""><?php _e( 'Administrator', 'companion-auto-update' ); ?></label></p>
450
+ <p><label for="allow_editor"><input name="allow_editor" type="checkbox" id="allow_editor" <?php if( $has_editor ) { echo "CHECKED"; } ?>><?php _e( 'Editor', 'companion-auto-update' ); ?></label></p>
451
+ <p><label for="allow_author"><input name="allow_author" type="checkbox" id="allow_author" <?php if( $has_author ) { echo "CHECKED"; } ?>><?php _e( 'Author', 'companion-auto-update' ); ?></label></p>
452
  </td>
453
  </tr>
454
  <tr>
455
  <th scope="row"><label><?php _e( 'Delay updates', 'companion-auto-update' ); ?></label></th>
456
  <td>
457
+ <p><label for="update_delay"><input name="update_delay" type="checkbox" id="update_delay" <?php echo $has_updatedelay ? "CHECKED" : ""; ?> ><?php _e( 'Delay updates', 'companion-auto-update' ); ?></label></p>
458
  </td>
459
  </tr>
460
+ <tr id='update_delay_days_block' <?php echo !$has_updatedelay ? "class='disabled_option'" : ""; ?>>
461
  <th scope="row"><label><?php _e( 'Number of days', 'companion-auto-update' ); ?></label></th>
462
  <td>
463
  <input type="number" min="0" max="31" name="update_delay_days" id="update_delay_days" class="regular-text" value="<?php echo cau_get_db_value( 'update_delay_days' ); ?>" />
cau_emails.php CHANGED
@@ -1,525 +1,524 @@
1
- <?php
2
-
3
- // Check if emails should be send or not
4
- function cau_check_updates_mail() {
5
-
6
- // Notify of pending updates
7
- if( cau_get_db_value( 'send' ) == 'on' ) {
8
- cau_list_theme_updates(); // Check for theme updates
9
- cau_list_plugin_updates(); // Check for plugin updates
10
- }
11
-
12
- // Notify of completed updates
13
- if( cau_get_db_value( 'sendupdate' ) == 'on' && cau_get_db_value( 'plugins' ) == 'on' ) {
14
- cau_plugin_updated(); // Check for updated plugins
15
- }
16
-
17
- // Notify of required db update
18
- if( cau_get_db_value( 'dbupdateemails' ) == 'on' ) {
19
- cau_notify_outofdate_db();
20
- }
21
-
22
- }
23
-
24
- // Notify of out of date software
25
- function cau_outdated_notifier_mail() {
26
- if( cau_get_db_value( 'sendoutdated' ) == 'on' ) {
27
- cau_list_outdated_software(); // Check for oudated plugins
28
- }
29
- }
30
-
31
- // Ge the emailadresses it should be send to
32
- function cau_set_email() {
33
-
34
- $emailArray = array();
35
-
36
- if( cau_get_db_value( 'email' ) == '' ) {
37
- array_push( $emailArray, get_option('admin_email') );
38
- } else {
39
- $emailAdresses = cau_get_db_value( 'email' );
40
- $list = explode( ", ", $emailAdresses );
41
- foreach ( $list as $key ) {
42
- array_push( $emailArray, $list );
43
- }
44
- }
45
-
46
- return $emailArray;
47
-
48
- }
49
-
50
- // Mail format
51
- function cau_is_html() {
52
-
53
- // Check if cau_get_db_value() function exists.
54
- if ( !function_exists( 'cau_get_db_value' ) ) require_once( plugin_dir_path( __FILE__ ) . 'cau_function.php' );
55
-
56
- // Check if html
57
- if( cau_get_db_value( 'html_or_text' ) == 'html' ) {
58
- $html = true;
59
- } else {
60
- $html = false;
61
- }
62
-
63
- }
64
-
65
- // Set the content for the emails about pending updates
66
- function cau_outdated_message( $single, $plural, $list ) {
67
-
68
- // WP version
69
- $wpversion = get_bloginfo( 'version' );
70
-
71
- // Base text
72
- $text = sprintf( esc_html__( "You have %s on your WordPress site at %s that have not been tested with the latest 3 major releases of WordPress.", "companion-auto-update" ), $plural, get_site_url() );
73
- $text .= "\n";
74
- $text .= "\n";
75
-
76
- // The list
77
- if( !empty( $list ) ) {
78
-
79
- $text .= sprintf( esc_html__( "The following %s have not been tested with WordPress %s:", "companion-auto-update" ), $plural, $wpversion );
80
- $text .= "\n";
81
- $text .= "\n";
82
-
83
- foreach ( $list as $plugin => $version ) {
84
- if( $version == '' ) $version = __( "Unknown", "companion-auto-update" );
85
- $text .= "- ".sprintf( esc_html__( "%s tested up to: %s", "companion-auto-update" ), $plugin, $version )."\n";
86
- }
87
-
88
- }
89
-
90
- return $text;
91
-
92
- }
93
-
94
- // Set the content for the emails about pending updates
95
- function cau_pending_message( $single, $plural, $list ) {
96
-
97
- // What markup to use
98
- if( cau_is_html() ) $break = '<br />';
99
- else $break = "\n";
100
-
101
- // Base text
102
- $text = sprintf( esc_html__( 'You have pending %1$s updates on your WordPress site at %2$s.', 'companion-auto-update' ), $single, get_site_url() );
103
- $text .= $break;
104
-
105
- if( !empty( $list ) ) {
106
-
107
- $text .= $break;
108
- $text .= sprintf( esc_html__( 'The following %1$s have new versions available.', 'companion-auto-update' ), $plural );
109
- $text .= $break;
110
-
111
- if( cau_is_html() ) $text .= "<ol>";
112
- foreach ( $list as $key => $value ) {
113
- if( cau_is_html() ) {
114
- $text .= "<li>$value</li>";
115
- } else {
116
- $text .= "-$value\n";
117
- }
118
- }
119
- if( cau_is_html() ) $text .= "</ol>";
120
-
121
- $text .= $break;
122
- }
123
-
124
- $text .= __( 'Leaving your site outdated is a security risk so please consider manually updating them.', 'companion-auto-update' );
125
- $text .= $break;
126
-
127
- // End
128
- $text .= sprintf( esc_html__( 'Head over to %1$s and check the ones you want to update.', 'companion-auto-update' ), get_admin_url().'update-core.php' );
129
-
130
- return $text;
131
-
132
- }
133
-
134
- // Set the content for the emails about recent updates
135
- function cau_updated_message( $type, $updatedList ) {
136
-
137
- // What markup to use
138
- if( cau_is_html() ) $break = '<br />';
139
- else $break = "\n";
140
-
141
- // The message
142
- $text = sprintf( esc_html__(
143
- '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.
144
- For more info on what is new visit your dashboard and check the changelog.', 'companion-auto-update'
145
- ), $type, get_site_url() );
146
-
147
- $text .= $break;
148
- $text .= $break;
149
- $text .= sprintf( esc_html__(
150
- 'The following %1$s have been updated:', 'companion-auto-update'
151
- ), $type );
152
-
153
- $text .= $break;
154
- $text .= $updatedList;
155
-
156
- $text .= $break;
157
- $text .= __( "(You'll also receive this email if you manually updated a plugin or theme)", "companion-auto-update" );
158
-
159
- return $text;
160
-
161
- }
162
-
163
- // Checks if plugins are out of date
164
- function cau_list_outdated_software() {
165
-
166
- // Check if cau_get_db_value() function exists.
167
- if ( !function_exists( 'cau_get_db_value' ) ) require_once( plugin_dir_path( __FILE__ ) . 'cau_function.php' );
168
-
169
- // Set up mail
170
- $subject = '['.get_bloginfo( 'name' ).'] ' . __( 'You have outdated plugins on your site.', 'companion-auto-update' );
171
- $type = __( 'plugin', 'companion-auto-update' );
172
- $type_plural = __( 'plugins', 'companion-auto-update' );
173
- $message = cau_outdated_message( $type, $type_plural, cau_list_outdated() );
174
-
175
- // Send to all addresses
176
- foreach ( cau_set_email() as $key => $value ) {
177
- foreach ( $value as $k => $v ) {
178
- wp_mail( $v, $subject, $message );
179
- }
180
- break;
181
- }
182
-
183
- }
184
-
185
- // Checks if theme updates are available
186
- function cau_list_theme_updates() {
187
-
188
- global $wpdb;
189
- $table_name = $wpdb->prefix . "auto_updates";
190
-
191
- $configs = $wpdb->get_results( "SELECT * FROM $table_name WHERE name = 'themes'");
192
- foreach ( $configs as $config ) {
193
-
194
- if( $config->onoroff != 'on' ) {
195
-
196
- require_once ABSPATH . '/wp-admin/includes/update.php';
197
- $themes = get_theme_updates();
198
- $list = array();
199
-
200
- if ( !empty( $themes ) ) {
201
-
202
- foreach ( $themes as $stylesheet => $theme ) {
203
- array_push( $list, $theme->get( 'Name' ) );
204
- }
205
-
206
- $subject = '[' . get_bloginfo( 'name' ) . '] ' . __( 'Theme update available.', 'companion-auto-update' );
207
- $type = __('theme', 'companion-auto-update');
208
- $type_plural = __('themes', 'companion-auto-update');
209
- $message = cau_pending_message( $type, $type_plural, $list );
210
-
211
- foreach ( cau_set_email() as $key => $value) {
212
- foreach ($value as $k => $v) {
213
- wp_mail( $v, $subject, $message );
214
- }
215
- break;
216
- }
217
- }
218
-
219
- }
220
-
221
- }
222
-
223
- }
224
-
225
- // Checks if plugin updates are available
226
- function cau_list_plugin_updates() {
227
-
228
- global $wpdb;
229
- $table_name = $wpdb->prefix . "auto_updates";
230
-
231
- $configs = $wpdb->get_results( "SELECT * FROM $table_name WHERE name = 'plugins'");
232
- foreach ( $configs as $config ) {
233
-
234
- if( $config->onoroff != 'on' ) {
235
-
236
- require_once(ABSPATH . 'wp-admin/includes/plugin-install.php');
237
-
238
- if ( !function_exists( 'get_plugin_updates' ) ) require_once ABSPATH . 'wp-admin/includes/update.php';
239
- $plugins = get_plugin_updates();
240
-
241
- if ( !empty( $plugins ) ) {
242
-
243
- $list = array();
244
- foreach ( (array) $plugins as $plugin_file => $plugin_data ) {
245
- $plugin_data = (object) _get_plugin_data_markup_translate( $plugin_file, (array) $plugin_data, false, true );
246
- $name = $plugin_data->Name;
247
- array_push( $list, $name );
248
- }
249
-
250
- $subject = '[' . get_bloginfo( 'name' ) . '] ' . __( 'Plugin update available.', 'companion-auto-update' );
251
- $type = __( 'plugin', 'companion-auto-update' );
252
- $type_plural = __( 'plugins', 'companion-auto-update' );
253
- $message = cau_pending_message( $type, $type_plural, $list );
254
-
255
- foreach ( cau_set_email() as $key => $value) {
256
- foreach ($value as $k => $v) {
257
- wp_mail( $v, $subject, $message );
258
- }
259
- break;
260
- }
261
- }
262
-
263
- }
264
-
265
- }
266
- }
267
-
268
- // Alerts when plugin has been updated
269
- function cau_plugin_updated() {
270
-
271
- // Check if cau_get_db_value() function exists.
272
- if ( !function_exists( 'cau_get_db_value' ) ) require_once( plugin_dir_path( __FILE__ ) . 'cau_function.php' );
273
-
274
- // Set the correct timezone for emails
275
- date_default_timezone_set( cau_get_proper_timezone() );
276
-
277
- // Create arrays
278
- $pluginNames = array();
279
- $pluginDates = array();
280
- $pluginVersion = array();
281
- $pluginSlug = array();
282
- $pluginTimes = array();
283
- $themeNames = array();
284
- $themeDates = array();
285
- $themeTimes = array();
286
-
287
- // Where to look for plugins
288
- $plugdir = plugin_dir_path( __DIR__ );
289
- if ( !function_exists( 'get_plugins' ) ) require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); // Check if get_plugins() function exists.
290
- $allPlugins = get_plugins();
291
-
292
- // Where to look for themes
293
- $themedir = get_theme_root();
294
- $allThemes = wp_get_themes();
295
-
296
- // Mail schedule
297
- $schedule_mail = wp_get_schedule( 'cau_set_schedule_mail' );
298
-
299
- // Loop trough all plugins
300
- foreach ( $allPlugins as $key => $value ) {
301
-
302
- // Get plugin data
303
- $fullPath = $plugdir.'/'.$key;
304
- $getFile = $path_parts = pathinfo( $fullPath );
305
- $pluginData = get_plugin_data( $fullPath );
306
-
307
- // Get the slug
308
- $explosion = explode( '/', $key );
309
- $actualSlug = array_shift( $explosion );
310
-
311
- // Get last update date
312
- $fileDate = date ( 'YmdHi', filemtime( $fullPath ) );
313
-
314
- switch ( $schedule_mail ) {
315
- case 'hourly':
316
- $lastday = date( 'YmdHi', strtotime( '-1 hour', time() ) );
317
- break;
318
- case 'twicedaily':
319
- $lastday = date( 'YmdHi', strtotime( '-12 hours', time() ) );
320
- break;
321
- default:
322
- $lastday = date( 'YmdHi', strtotime( '-1 day', time() ) );
323
- break;
324
- }
325
-
326
- $dateFormat = get_option( 'date_format' );
327
- $timestamp = date_i18n( $dateFormat, filemtime( $fullPath ) );
328
- $timestamp .= ' - '.date( 'H:i', filemtime( $fullPath ) );
329
-
330
- if( $fileDate >= $lastday ) {
331
-
332
- // Get plugin name
333
- foreach ( $pluginData as $dataKey => $dataValue ) {
334
- if( $dataKey == 'Name') {
335
- array_push( $pluginNames , $dataValue );
336
- }
337
- if( $dataKey == 'Version') {
338
- array_push( $pluginVersion , $dataValue );
339
- }
340
- }
341
-
342
- array_push( $pluginDates, $fileDate );
343
- array_push( $pluginSlug, $actualSlug );
344
- array_push( $pluginTimes, $timestamp );
345
- }
346
-
347
- }
348
-
349
- // Loop trough all themes
350
- foreach ( $allThemes as $key => $value ) {
351
-
352
- // Get theme data
353
- $fullPath = $themedir.'/'.$key;
354
- $getFile = $path_parts = pathinfo( $fullPath );
355
-
356
- // Get last update date
357
- $dateFormat = get_option( 'date_format' );
358
- $fileDate = date ( 'YmdHi', filemtime( $fullPath ) );
359
-
360
- if( $schedule_mail == 'hourly' ) {
361
- $lastday = date( 'YmdHi', strtotime( '-1 hour', time() ) );
362
- } elseif( $schedule_mail == 'twicedaily' ) {
363
- $lastday = date( 'YmdHi', strtotime( '-12 hours', time() ) );
364
- } elseif( $schedule_mail == 'daily' ) {
365
- $lastday = date( 'YmdHi', strtotime( '-1 day', time() ) );
366
- }
367
-
368
- $dateFormat = get_option( 'date_format' );
369
- $timestamp = date_i18n( $dateFormat, filemtime( $fullPath ) );
370
- $timestamp .= ' - '.date( 'H:i', filemtime( $fullPath ) );
371
-
372
- if( $fileDate >= $lastday ) {
373
- array_push( $themeNames, $path_parts['filename'] );
374
- array_push( $themeDates, $fileDate );
375
- array_push( $themeTimes, $timestamp );
376
- }
377
-
378
- }
379
-
380
- $totalNumP = 0;
381
- $totalNumT = 0;
382
- $updatedListP = '';
383
- $updatedListT = '';
384
-
385
- if( cau_get_db_value( 'html_or_text' ) == 'html' ) {
386
- $updatedListP .= '<ol>';
387
- $updatedListT .= '<ol>';
388
- }
389
-
390
- foreach ( $pluginDates as $key => $value ) {
391
-
392
- // Set up some var
393
- $plugin_name = $pluginNames[$key];
394
- $plugin_slug = $pluginSlug[$key];
395
- $to_version = __( "to version", "companion-auto-update" ).' '.$pluginVersion[$key];
396
- $more_info_arr = array( __( "Time of update", "companion-auto-update" ) => $pluginTimes[$key] );
397
-
398
- // Plugin links
399
- if( cau_get_db_value( 'plugin_links_emails' ) == 'on' ) {
400
- $more_info_arr[__( "Plugin details", "companion-auto-update" )] = "<a href='https://wordpress.org/plugins/{$plugin_slug}/'>".__( "Visit", "companion-auto-update" )."</a>";
401
- $more_info_arr[__( "Release notes", "companion-auto-update" )] = "<a href='https://wordpress.org/plugins/{$plugin_slug}/#developers'>".__( "Visit", "companion-auto-update" )."</a>";
402
- $more_info_arr[__( "Support", "companion-auto-update" )] = "<a href='https://wordpress.org/support/plugin/{$plugin_slug}/'>".__( "Visit", "companion-auto-update" )."</a>";
403
- }
404
-
405
- // Email format
406
- $use_html = ( cau_get_db_value( 'html_or_text' ) == 'html' ) ? true : false;
407
-
408
- // Email content
409
- $updatedListP .= $use_html ? "<li>" : "-"; // Start row
410
-
411
- $updatedListP .= $use_html ? "<strong>{$plugin_name}</strong> " : "{$plugin_name} "; // Show plugin name
412
- $updatedListP .= $to_version; // To version
413
-
414
- // Get advanced info
415
- if( cau_get_db_value( 'advanced_info_emails' ) == 'on' ) {
416
- foreach( $more_info_arr as $label => $value ) {
417
- $updatedListP .= $use_html ? "<br />{$label}: {$value}" : "\n{$label}: {$value}";
418
- }
419
- }
420
-
421
- $updatedListP .= $use_html ? "</li>" : "\n"; // End row
422
-
423
- $totalNumP++;
424
- }
425
-
426
- foreach ( $themeNames as $key => $value ) {
427
-
428
- if( cau_get_db_value( 'html_or_text' ) == 'html' ) {
429
-
430
- $more_info = '';
431
- if( cau_get_db_value( 'advanced_info_emails' ) == 'on' ) $more_info = "<br /><span style='opacity: 0.5;'>".__( "Time of update", "companion-auto-update" ).": ".$themeTimes[$key]."</span>";
432
- $updatedListT .= "<li><strong>".$themeNames[$key]."</strong>".$more_info."</li>";
433
-
434
- } else {
435
- $updatedListT .= "- ".$themeNames[$key]."\n";
436
- }
437
-
438
- $totalNumT++;
439
- }
440
-
441
- if( cau_get_db_value( 'html_or_text' ) == 'html' ) {
442
- $updatedListP .= '</ol>';
443
- $updatedListT .= '</ol>';
444
- }
445
-
446
- // Set the email content type
447
- if( cau_get_db_value( 'html_or_text' ) == 'html' ) {
448
- function cau_mail_content_type() {
449
- return 'text/html';
450
- }
451
- add_filter( 'wp_mail_content_type', 'cau_mail_content_type' );
452
- }
453
-
454
- // If plugins have been updated, send email
455
- if( $totalNumP > 0 ) {
456
-
457
- // E-mail content
458
- $subject = '[' . get_bloginfo( 'name' ) . '] ' . __('One or more plugins have been updated.', 'companion-auto-update');
459
- $type = __('plugins', 'companion-auto-update');
460
- $message = cau_updated_message( $type, $updatedListP );
461
-
462
- // Send to all addresses
463
- foreach ( cau_set_email() as $key => $value) {
464
- foreach ($value as $k => $v) {
465
- wp_mail( $v, $subject, $message );
466
- }
467
- break;
468
- }
469
-
470
- }
471
-
472
- // If themes have been updated, send email
473
- if( $totalNumT > 0 ) {
474
-
475
- // E-mail content
476
- $subject = '[' . get_bloginfo( 'name' ) . '] ' . __('One or more themes have been updated.', 'companion-auto-update');
477
- $type = __('themes', 'companion-auto-update');
478
- $message = cau_updated_message( $type, $updatedListT );
479
-
480
- // Send to all addresses
481
- foreach ( cau_set_email() as $key => $value) {
482
- foreach ($value as $k => $v) {
483
- wp_mail( $v, $subject, $message );
484
- }
485
- break;
486
- }
487
-
488
- }
489
-
490
- if( cau_get_db_value( 'html_or_text' ) == 'html' ) remove_filter( 'wp_mail_content_type', 'cau_mail_content_type' );
491
-
492
- // Prevent duplicate emails by setting the event again
493
- if( $totalNumT > 0 OR $totalNumP > 0 ) {
494
- if( $schedule_mail == 'hourly' ) {
495
- wp_clear_scheduled_hook('cau_set_schedule_mail');
496
- wp_schedule_event( strtotime( '+1 hour', time() ) , 'hourly', 'cau_set_schedule_mail' );
497
- }
498
- }
499
-
500
- }
501
-
502
- function cau_notify_outofdate_db() {
503
-
504
- // Check if cau_get_db_value() function exists.
505
- if ( !function_exists( 'cau_get_db_value' ) ) require_once( plugin_dir_path( __FILE__ ) . 'cau_function.php' );
506
-
507
- // Database requires an update
508
- if ( cau_incorrectDatabaseVersion() ) {
509
-
510
- // Set up mail
511
- $subject = '[' . get_bloginfo( 'name' ) . '] ' . __( 'We need your help with something', 'companion-auto-update' );
512
- $message = __( 'Hi there! We need your help updating the database of Companion Auto Update to the latest version. No rush, old features will continue to work but some new features might not work until you update the database.', 'companion-auto-update' );
513
-
514
- // Send to all addresses
515
- foreach ( cau_set_email() as $key => $value ) {
516
- foreach ( $value as $k => $v ) {
517
- wp_mail( $v, $subject, $message );
518
- }
519
- break;
520
- }
521
-
522
- }
523
-
524
- }
525
-
1
+ <?php
2
+
3
+ // Check if emails should be send or not
4
+ function cau_check_updates_mail() {
5
+
6
+ // Notify of pending updates
7
+ if( cau_get_db_value( 'send' ) == 'on' ) {
8
+ cau_list_theme_updates(); // Check for theme updates
9
+ cau_list_plugin_updates(); // Check for plugin updates
10
+ }
11
+
12
+ // Notify of completed updates
13
+ if( cau_get_db_value( 'sendupdate' ) == 'on' && cau_get_db_value( 'plugins' ) == 'on' ) {
14
+ cau_plugin_updated(); // Check for updated plugins
15
+ }
16
+
17
+ // Notify of required db update
18
+ if( cau_get_db_value( 'dbupdateemails' ) == 'on' ) {
19
+ cau_notify_outofdate_db();
20
+ }
21
+
22
+ }
23
+
24
+ // Notify of out of date software
25
+ function cau_outdated_notifier_mail() {
26
+ if( cau_get_db_value( 'sendoutdated' ) == 'on' ) {
27
+ cau_list_outdated_software(); // Check for oudated plugins
28
+ }
29
+ }
30
+
31
+ // Ge the emailadresses it should be send to
32
+ function cau_set_email() {
33
+
34
+ $emailArray = array();
35
+
36
+ if( cau_get_db_value( 'email' ) == '' ) {
37
+ array_push( $emailArray, get_option('admin_email') );
38
+ } else {
39
+ $emailAdresses = cau_get_db_value( 'email' );
40
+ $list = explode( ", ", $emailAdresses );
41
+ foreach ( $list as $key ) {
42
+ array_push( $emailArray, $list );
43
+ }
44
+ }
45
+
46
+ return $emailArray;
47
+
48
+ }
49
+
50
+ // Mail format
51
+ function cau_is_html() {
52
+
53
+ // Check if cau_get_db_value() function exists.
54
+ if ( !function_exists( 'cau_get_db_value' ) ) require_once( plugin_dir_path( __FILE__ ) . 'cau_function.php' );
55
+
56
+ // Check if html
57
+ if( cau_get_db_value( 'html_or_text' ) == 'html' ) {
58
+ $html = true;
59
+ } else {
60
+ $html = false;
61
+ }
62
+
63
+ }
64
+
65
+ // Set the content for the emails about pending updates
66
+ function cau_outdated_message( $single, $plural, $list ) {
67
+
68
+ // WP version
69
+ $wpversion = get_bloginfo( 'version' );
70
+
71
+ // Base text
72
+ $text = sprintf( esc_html__( "You have %s on your WordPress site at %s that have not been tested with the latest 3 major releases of WordPress.", "companion-auto-update" ), $plural, get_site_url() );
73
+ $text .= "\n";
74
+ $text .= "\n";
75
+
76
+ // The list
77
+ if( !empty( $list ) ) {
78
+
79
+ $text .= sprintf( esc_html__( "The following %s have not been tested with WordPress %s:", "companion-auto-update" ), $plural, $wpversion );
80
+ $text .= "\n";
81
+ $text .= "\n";
82
+
83
+ foreach ( $list as $plugin => $version ) {
84
+ if( $version == '' ) $version = __( "Unknown", "companion-auto-update" );
85
+ $text .= "- ".sprintf( esc_html__( "%s tested up to: %s", "companion-auto-update" ), $plugin, $version )."\n";
86
+ }
87
+
88
+ }
89
+
90
+ return $text;
91
+
92
+ }
93
+
94
+ // Set the content for the emails about pending updates
95
+ function cau_pending_message( $single, $plural, $list ) {
96
+
97
+ // What markup to use
98
+ if( cau_is_html() ) $break = '<br />';
99
+ else $break = "\n";
100
+
101
+ // Base text
102
+ $text = sprintf( esc_html__( 'You have pending %1$s updates on your WordPress site at %2$s.', 'companion-auto-update' ), $single, get_site_url() );
103
+ $text .= $break;
104
+
105
+ if( !empty( $list ) ) {
106
+
107
+ $text .= $break;
108
+ $text .= sprintf( esc_html__( 'The following %1$s have new versions available.', 'companion-auto-update' ), $plural );
109
+ $text .= $break;
110
+
111
+ if( cau_is_html() ) $text .= "<ol>";
112
+ foreach ( $list as $key => $value ) {
113
+ if( cau_is_html() ) {
114
+ $text .= "<li>$value</li>";
115
+ } else {
116
+ $text .= "-$value\n";
117
+ }
118
+ }
119
+ if( cau_is_html() ) $text .= "</ol>";
120
+
121
+ $text .= $break;
122
+ }
123
+
124
+ $text .= __( 'Leaving your site outdated is a security risk so please consider manually updating them.', 'companion-auto-update' );
125
+ $text .= $break;
126
+
127
+ // End
128
+ $text .= sprintf( esc_html__( 'Head over to %1$s and check the ones you want to update.', 'companion-auto-update' ), get_admin_url().'update-core.php' );
129
+
130
+ return $text;
131
+
132
+ }
133
+
134
+ // Set the content for the emails about recent updates
135
+ function cau_updated_message( $type, $updatedList ) {
136
+
137
+ // What markup to use
138
+ if( cau_is_html() ) $break = '<br />';
139
+ else $break = "\n";
140
+
141
+ // The message
142
+ $text = sprintf( esc_html__(
143
+ '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.
144
+ For more info on what is new visit your dashboard and check the changelog.', 'companion-auto-update'
145
+ ), $type, get_site_url() );
146
+
147
+ $text .= $break;
148
+ $text .= $break;
149
+ $text .= sprintf( esc_html__(
150
+ 'The following %1$s have been updated:', 'companion-auto-update'
151
+ ), $type );
152
+
153
+ $text .= $break;
154
+ $text .= $updatedList;
155
+
156
+ $text .= $break;
157
+ $text .= __( "(You'll also receive this email if you manually updated a plugin or theme)", "companion-auto-update" );
158
+
159
+ return $text;
160
+
161
+ }
162
+
163
+ // Checks if plugins are out of date
164
+ function cau_list_outdated_software() {
165
+
166
+ // Check if cau_get_db_value() function exists.
167
+ if ( !function_exists( 'cau_get_db_value' ) ) require_once( plugin_dir_path( __FILE__ ) . 'cau_function.php' );
168
+
169
+ // Set up mail
170
+ $subject = '['.get_bloginfo( 'name' ).'] ' . __( 'You have outdated plugins on your site.', 'companion-auto-update' );
171
+ $type = __( 'plugin', 'companion-auto-update' );
172
+ $type_plural = __( 'plugins', 'companion-auto-update' );
173
+ $message = cau_outdated_message( $type, $type_plural, cau_list_outdated() );
174
+
175
+ // Send to all addresses
176
+ foreach ( cau_set_email() as $key => $value ) {
177
+ foreach ( $value as $k => $v ) {
178
+ wp_mail( $v, $subject, $message );
179
+ }
180
+ break;
181
+ }
182
+
183
+ }
184
+
185
+ // Checks if theme updates are available
186
+ function cau_list_theme_updates() {
187
+
188
+ global $wpdb;
189
+ $table_name = $wpdb->prefix . "auto_updates";
190
+
191
+ $configs = $wpdb->get_results( "SELECT * FROM $table_name WHERE name = 'themes'");
192
+ foreach ( $configs as $config ) {
193
+
194
+ if( $config->onoroff != 'on' ) {
195
+
196
+ require_once ABSPATH . '/wp-admin/includes/update.php';
197
+ $themes = get_theme_updates();
198
+ $list = array();
199
+
200
+ if ( !empty( $themes ) ) {
201
+
202
+ foreach ( $themes as $stylesheet => $theme ) {
203
+ array_push( $list, $theme->get( 'Name' ) );
204
+ }
205
+
206
+ $subject = '[' . get_bloginfo( 'name' ) . '] ' . __( 'Theme update available.', 'companion-auto-update' );
207
+ $type = __('theme', 'companion-auto-update');
208
+ $type_plural = __('themes', 'companion-auto-update');
209
+ $message = cau_pending_message( $type, $type_plural, $list );
210
+
211
+ foreach ( cau_set_email() as $key => $value) {
212
+ foreach ($value as $k => $v) {
213
+ wp_mail( $v, $subject, $message );
214
+ }
215
+ break;
216
+ }
217
+ }
218
+
219
+ }
220
+
221
+ }
222
+
223
+ }
224
+
225
+ // Checks if plugin updates are available
226
+ function cau_list_plugin_updates() {
227
+
228
+ global $wpdb;
229
+ $table_name = $wpdb->prefix . "auto_updates";
230
+
231
+ $configs = $wpdb->get_results( "SELECT * FROM $table_name WHERE name = 'plugins'");
232
+ foreach ( $configs as $config ) {
233
+
234
+ if( $config->onoroff != 'on' ) {
235
+
236
+ require_once(ABSPATH . 'wp-admin/includes/plugin-install.php');
237
+
238
+ if ( !function_exists( 'get_plugin_updates' ) ) require_once ABSPATH . 'wp-admin/includes/update.php';
239
+ $plugins = get_plugin_updates();
240
+
241
+ if ( !empty( $plugins ) ) {
242
+
243
+ $list = array();
244
+ foreach ( (array) $plugins as $plugin_file => $plugin_data ) {
245
+ $plugin_data = (object) _get_plugin_data_markup_translate( $plugin_file, (array) $plugin_data, false, true );
246
+ $name = $plugin_data->Name;
247
+ array_push( $list, $name );
248
+ }
249
+
250
+ $subject = '[' . get_bloginfo( 'name' ) . '] ' . __( 'Plugin update available.', 'companion-auto-update' );
251
+ $type = __( 'plugin', 'companion-auto-update' );
252
+ $type_plural = __( 'plugins', 'companion-auto-update' );
253
+ $message = cau_pending_message( $type, $type_plural, $list );
254
+
255
+ foreach ( cau_set_email() as $key => $value) {
256
+ foreach ($value as $k => $v) {
257
+ wp_mail( $v, $subject, $message );
258
+ }
259
+ break;
260
+ }
261
+ }
262
+
263
+ }
264
+
265
+ }
266
+ }
267
+
268
+ // Alerts when plugin has been updated
269
+ function cau_plugin_updated() {
270
+
271
+ // Check if cau_get_db_value() function exists.
272
+ if ( !function_exists( 'cau_get_db_value' ) ) require_once( plugin_dir_path( __FILE__ ) . 'cau_function.php' );
273
+
274
+ // Set the correct timezone for emails
275
+ date_default_timezone_set( cau_get_proper_timezone() );
276
+
277
+ // Create arrays
278
+ $pluginNames = array();
279
+ $pluginDates = array();
280
+ $pluginVersion = array();
281
+ $pluginSlug = array();
282
+ $pluginTimes = array();
283
+ $themeNames = array();
284
+ $themeDates = array();
285
+ $themeTimes = array();
286
+
287
+ // Where to look for plugins
288
+ $plugdir = plugin_dir_path( __DIR__ );
289
+ if ( !function_exists( 'get_plugins' ) ) require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); // Check if get_plugins() function exists.
290
+ $allPlugins = get_plugins();
291
+
292
+ // Where to look for themes
293
+ $themedir = get_theme_root();
294
+ $allThemes = wp_get_themes();
295
+
296
+ // Mail schedule
297
+ $schedule_mail = wp_get_schedule( 'cau_set_schedule_mail' );
298
+
299
+ // Loop trough all plugins
300
+ foreach ( $allPlugins as $key => $value ) {
301
+
302
+ // Get plugin data
303
+ $fullPath = $plugdir.'/'.$key;
304
+ $getFile = $path_parts = pathinfo( $fullPath );
305
+ $pluginData = get_plugin_data( $fullPath );
306
+
307
+ // Get the slug
308
+ $explosion = explode( '/', $key );
309
+ $actualSlug = array_shift( $explosion );
310
+
311
+ // Get last update date
312
+ $fileDate = date ( 'YmdHi', filemtime( $fullPath ) );
313
+
314
+ switch ( $schedule_mail ) {
315
+ case 'hourly':
316
+ $lastday = date( 'YmdHi', strtotime( '-1 hour', time() ) );
317
+ break;
318
+ case 'twicedaily':
319
+ $lastday = date( 'YmdHi', strtotime( '-12 hours', time() ) );
320
+ break;
321
+ default:
322
+ $lastday = date( 'YmdHi', strtotime( '-1 day', time() ) );
323
+ break;
324
+ }
325
+
326
+ $dateFormat = get_option( 'date_format' );
327
+ $timestamp = date_i18n( $dateFormat, filemtime( $fullPath ) );
328
+ $timestamp .= ' - '.date( 'H:i', filemtime( $fullPath ) );
329
+
330
+ if( $fileDate >= $lastday ) {
331
+
332
+ // Get plugin name
333
+ foreach ( $pluginData as $dataKey => $dataValue ) {
334
+ if( $dataKey == 'Name') {
335
+ array_push( $pluginNames , $dataValue );
336
+ }
337
+ if( $dataKey == 'Version') {
338
+ array_push( $pluginVersion , $dataValue );
339
+ }
340
+ }
341
+
342
+ array_push( $pluginDates, $fileDate );
343
+ array_push( $pluginSlug, $actualSlug );
344
+ array_push( $pluginTimes, $timestamp );
345
+ }
346
+
347
+ }
348
+
349
+ // Loop trough all themes
350
+ foreach ( $allThemes as $key => $value ) {
351
+
352
+ // Get theme data
353
+ $fullPath = $themedir.'/'.$key;
354
+ $getFile = $path_parts = pathinfo( $fullPath );
355
+
356
+ // Get last update date
357
+ $dateFormat = get_option( 'date_format' );
358
+ $fileDate = date ( 'YmdHi', filemtime( $fullPath ) );
359
+
360
+ if( $schedule_mail == 'hourly' ) {
361
+ $lastday = date( 'YmdHi', strtotime( '-1 hour', time() ) );
362
+ } elseif( $schedule_mail == 'twicedaily' ) {
363
+ $lastday = date( 'YmdHi', strtotime( '-12 hours', time() ) );
364
+ } elseif( $schedule_mail == 'daily' ) {
365
+ $lastday = date( 'YmdHi', strtotime( '-1 day', time() ) );
366
+ }
367
+
368
+ $dateFormat = get_option( 'date_format' );
369
+ $timestamp = date_i18n( $dateFormat, filemtime( $fullPath ) );
370
+ $timestamp .= ' - '.date( 'H:i', filemtime( $fullPath ) );
371
+
372
+ if( $fileDate >= $lastday ) {
373
+ array_push( $themeNames, $path_parts['filename'] );
374
+ array_push( $themeDates, $fileDate );
375
+ array_push( $themeTimes, $timestamp );
376
+ }
377
+
378
+ }
379
+
380
+ $totalNumP = 0;
381
+ $totalNumT = 0;
382
+ $updatedListP = '';
383
+ $updatedListT = '';
384
+
385
+ if( cau_get_db_value( 'html_or_text' ) == 'html' ) {
386
+ $updatedListP .= '<ol>';
387
+ $updatedListT .= '<ol>';
388
+ }
389
+
390
+ foreach ( $pluginDates as $key => $value ) {
391
+
392
+ // Set up some var
393
+ $plugin_name = $pluginNames[$key];
394
+ $plugin_slug = $pluginSlug[$key];
395
+ $to_version = __( "to version", "companion-auto-update" ).' '.$pluginVersion[$key];
396
+ $more_info_arr = array( __( "Time of update", "companion-auto-update" ) => $pluginTimes[$key] );
397
+
398
+ // Plugin links
399
+ if( cau_get_db_value( 'plugin_links_emails' ) == 'on' ) {
400
+ $more_info_arr[__( "Plugin details", "companion-auto-update" )] = "<a href='https://wordpress.org/plugins/{$plugin_slug}/'>".__( "Visit", "companion-auto-update" )."</a>";
401
+ $more_info_arr[__( "Release notes", "companion-auto-update" )] = "<a href='https://wordpress.org/plugins/{$plugin_slug}/#developers'>".__( "Visit", "companion-auto-update" )."</a>";
402
+ $more_info_arr[__( "Support", "companion-auto-update" )] = "<a href='https://wordpress.org/support/plugin/{$plugin_slug}/'>".__( "Visit", "companion-auto-update" )."</a>";
403
+ }
404
+
405
+ // Email format
406
+ $use_html = ( cau_get_db_value( 'html_or_text' ) == 'html' ) ? true : false;
407
+
408
+ // Email content
409
+ $updatedListP .= $use_html ? "<li>" : "-"; // Start row
410
+
411
+ $updatedListP .= $use_html ? "<strong>{$plugin_name}</strong> " : "{$plugin_name} "; // Show plugin name
412
+ $updatedListP .= $to_version; // To version
413
+
414
+ // Get advanced info
415
+ if( cau_get_db_value( 'advanced_info_emails' ) == 'on' ) {
416
+ foreach( $more_info_arr as $label => $value ) {
417
+ $updatedListP .= $use_html ? "<br />{$label}: {$value}" : "\n{$label}: {$value}";
418
+ }
419
+ }
420
+
421
+ $updatedListP .= $use_html ? "</li>" : "\n"; // End row
422
+
423
+ $totalNumP++;
424
+ }
425
+
426
+ foreach ( $themeNames as $key => $value ) {
427
+
428
+ if( cau_get_db_value( 'html_or_text' ) == 'html' ) {
429
+
430
+ $more_info = '';
431
+ if( cau_get_db_value( 'advanced_info_emails' ) == 'on' ) $more_info = "<br /><span style='opacity: 0.5;'>".__( "Time of update", "companion-auto-update" ).": ".$themeTimes[$key]."</span>";
432
+ $updatedListT .= "<li><strong>".$themeNames[$key]."</strong>".$more_info."</li>";
433
+
434
+ } else {
435
+ $updatedListT .= "- ".$themeNames[$key]."\n";
436
+ }
437
+
438
+ $totalNumT++;
439
+ }
440
+
441
+ if( cau_get_db_value( 'html_or_text' ) == 'html' ) {
442
+ $updatedListP .= '</ol>';
443
+ $updatedListT .= '</ol>';
444
+ }
445
+
446
+ // Set the email content type
447
+ if( cau_get_db_value( 'html_or_text' ) == 'html' ) {
448
+ function cau_mail_content_type() {
449
+ return 'text/html';
450
+ }
451
+ add_filter( 'wp_mail_content_type', 'cau_mail_content_type' );
452
+ }
453
+
454
+ // If plugins have been updated, send email
455
+ if( $totalNumP > 0 ) {
456
+
457
+ // E-mail content
458
+ $subject = '[' . get_bloginfo( 'name' ) . '] ' . __('One or more plugins have been updated.', 'companion-auto-update');
459
+ $type = __('plugins', 'companion-auto-update');
460
+ $message = cau_updated_message( $type, $updatedListP );
461
+
462
+ // Send to all addresses
463
+ foreach ( cau_set_email() as $key => $value) {
464
+ foreach ($value as $k => $v) {
465
+ wp_mail( $v, $subject, $message );
466
+ }
467
+ break;
468
+ }
469
+
470
+ }
471
+
472
+ // If themes have been updated, send email
473
+ if( $totalNumT > 0 ) {
474
+
475
+ // E-mail content
476
+ $subject = '[' . get_bloginfo( 'name' ) . '] ' . __('One or more themes have been updated.', 'companion-auto-update');
477
+ $type = __('themes', 'companion-auto-update');
478
+ $message = cau_updated_message( $type, $updatedListT );
479
+
480
+ // Send to all addresses
481
+ foreach ( cau_set_email() as $key => $value) {
482
+ foreach ($value as $k => $v) {
483
+ wp_mail( $v, $subject, $message );
484
+ }
485
+ break;
486
+ }
487
+
488
+ }
489
+
490
+ if( cau_get_db_value( 'html_or_text' ) == 'html' ) remove_filter( 'wp_mail_content_type', 'cau_mail_content_type' );
491
+
492
+ // Prevent duplicate emails by setting the event again
493
+ if( $totalNumT > 0 OR $totalNumP > 0 ) {
494
+ if( $schedule_mail == 'hourly' ) {
495
+ wp_clear_scheduled_hook('cau_set_schedule_mail');
496
+ wp_schedule_event( strtotime( '+1 hour', time() ) , 'hourly', 'cau_set_schedule_mail' );
497
+ }
498
+ }
499
+
500
+ }
501
+
502
+ function cau_notify_outofdate_db() {
503
+
504
+ // Check if cau_get_db_value() function exists.
505
+ if ( !function_exists( 'cau_get_db_value' ) ) require_once( plugin_dir_path( __FILE__ ) . 'cau_function.php' );
506
+
507
+ // Database requires an update
508
+ if ( cau_incorrectDatabaseVersion() ) {
509
+
510
+ // Set up mail
511
+ $subject = '[' . get_bloginfo( 'name' ) . '] ' . __( 'We need your help with something', 'companion-auto-update' );
512
+ $message = __( 'Hi there! We need your help updating the database of Companion Auto Update to the latest version. No rush, old features will continue to work but some new features might not work until you update the database.', 'companion-auto-update' );
513
+
514
+ // Send to all addresses
515
+ foreach ( cau_set_email() as $key => $value ) {
516
+ foreach ( $value as $k => $v ) {
517
+ wp_mail( $v, $subject, $message );
518
+ }
519
+ break;
520
+ }
521
+
522
+ }
523
+
524
+ }
 
cau_functions.php CHANGED
@@ -1,15 +1,33 @@
1
  <?php
2
 
3
- // What user rights can edit plugin settings?
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  function cau_allowed_user_rights() {
5
 
6
  // Current user
7
  $user = wp_get_current_user();
8
 
9
  // Allow roles
10
- $allowed_roles = array( 'administrator' );
11
- if( cau_get_db_value( 'allow_editor' ) == 'on' ) array_push( $allowed_roles, 'editor' );
12
- if( cau_get_db_value( 'allow_author' ) == 'on' ) array_push( $allowed_roles, 'author' );
13
 
14
  // Check
15
  if ( array_intersect( $allowed_roles, $user->roles ) ) {
@@ -17,6 +35,7 @@ function cau_allowed_user_rights() {
17
  } else {
18
  return false;
19
  }
 
20
  }
21
 
22
  // Get database value
@@ -24,7 +43,7 @@ function cau_get_db_value( $name, $table = 'auto_updates' ) {
24
 
25
  global $wpdb;
26
  $table_name = $wpdb->prefix.$table;
27
- $cau_configs = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$table_name} WHERE name = '%s'", $name ) );
28
  foreach ( $cau_configs as $config ) return $config->onoroff;
29
 
30
  }
@@ -1089,13 +1108,11 @@ function cau_active_plugin_info( $slug, $what ) {
1089
 
1090
  $allPlugins = get_plugins();
1091
 
1092
- foreach ($allPlugins as $key => $value) {
1093
  $thisSlug = explode('/', $key);
1094
  $thisSlugE = $thisSlug[0];
1095
  if( $thisSlug == $slug ) {
1096
-
1097
  if( $what == 'version' ) return $value['Version'];
1098
-
1099
  }
1100
  }
1101
 
@@ -1437,4 +1454,4 @@ function cau_unhold_all_updates() {
1437
  $plugin_file = $plugin->slug;
1438
  $wpdb->query( $wpdb->prepare( "UPDATE {$updateLog} SET put_on_hold = '%s' WHERE slug = '%s'", '0', $plugin_file ) );
1439
  }
1440
- }
1
  <?php
2
 
3
+ // What user rights can edit plugin settings? ARRAY
4
+ function cau_allowed_user_rights_array() {
5
+
6
+ // Base rights
7
+ $allowed_roles[] = 'administrator';
8
+
9
+ // Fetch from database
10
+ global $wpdb;
11
+ $table_name = $wpdb->prefix.'auto_updates';
12
+ $cau_configs = $wpdb->get_results( "SELECT name, onoroff FROM {$table_name} WHERE name = 'allow_editor' OR name = 'allow_author'" );
13
+
14
+ foreach ( $cau_configs as $config ) {
15
+ if( $config->onoroff == 'on' ) $allowed_roles[] = str_replace( "allow_", "", $config->name );
16
+ }
17
+
18
+ // Return array
19
+ return $allowed_roles;
20
+
21
+ }
22
+
23
+ // What user rights can edit plugin settings? TRUE/FALSE
24
  function cau_allowed_user_rights() {
25
 
26
  // Current user
27
  $user = wp_get_current_user();
28
 
29
  // Allow roles
30
+ $allowed_roles = cau_allowed_user_rights_array();
 
 
31
 
32
  // Check
33
  if ( array_intersect( $allowed_roles, $user->roles ) ) {
35
  } else {
36
  return false;
37
  }
38
+
39
  }
40
 
41
  // Get database value
43
 
44
  global $wpdb;
45
  $table_name = $wpdb->prefix.$table;
46
+ $cau_configs = $wpdb->get_results( $wpdb->prepare( "SELECT onoroff FROM {$table_name} WHERE name = '%s'", $name ) );
47
  foreach ( $cau_configs as $config ) return $config->onoroff;
48
 
49
  }
1108
 
1109
  $allPlugins = get_plugins();
1110
 
1111
+ foreach( $allPlugins as $key => $value ) {
1112
  $thisSlug = explode('/', $key);
1113
  $thisSlugE = $thisSlug[0];
1114
  if( $thisSlug == $slug ) {
 
1115
  if( $what == 'version' ) return $value['Version'];
 
1116
  }
1117
  }
1118
 
1454
  $plugin_file = $plugin->slug;
1455
  $wpdb->query( $wpdb->prepare( "UPDATE {$updateLog} SET put_on_hold = '%s' WHERE slug = '%s'", '0', $plugin_file ) );
1456
  }
1457
+ }
companion-auto-update.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: Companion Auto Update
5
  * Plugin URI: http://codeermeneer.nl/portfolio/companion-auto-update/
6
  * Description: This plugin auto updates all plugins, all themes and the wordpress core.
7
- * Version: 3.8.5
8
  * Author: Papin Schipper
9
  * Author URI: http://codeermeneer.nl/
10
  * Contributors: papin
@@ -417,4 +417,4 @@ function cau_checkForIssues( $admin_bar ) {
417
  ));
418
  }
419
  }
420
- add_action( 'admin_bar_menu', 'cau_checkForIssues', 150 );
4
  * Plugin Name: Companion Auto Update
5
  * Plugin URI: http://codeermeneer.nl/portfolio/companion-auto-update/
6
  * Description: This plugin auto updates all plugins, all themes and the wordpress core.
7
+ * Version: 3.8.6
8
  * Author: Papin Schipper
9
  * Author URI: http://codeermeneer.nl/
10
  * Contributors: papin
417
  ));
418
  }
419
  }
420
+ add_action( 'admin_bar_menu', 'cau_checkForIssues', 150 );
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: 6.0
7
  Requires PHP: 5.1
8
- Stable tag: 3.8.5
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -82,6 +82,9 @@ So obviously, some of you wondered what the difference would be between the defa
82
 
83
  == Changelog ==
84
 
 
 
 
85
  = 3.8.5 (March 17, 2022) =
86
  * New: Added more checks on the status page and added an explanation to some of them.
87
  * New: Added an list of delayed updates on the status page to help with troubleshooting.
5
  Requires at least: 3.6.0
6
  Tested up to: 6.0
7
  Requires PHP: 5.1
8
+ Stable tag: 3.8.6
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
82
 
83
  == Changelog ==
84
 
85
+ = 3.8.6 (August 11, 2022) =
86
+ * Tweak: Code optimization for better performance
87
+
88
  = 3.8.5 (March 17, 2022) =
89
  * New: Added more checks on the status page and added an explanation to some of them.
90
  * New: Added an list of delayed updates on the status page to help with troubleshooting.