Companion Auto Update - Version 3.4.2

Version Description

(June 28, 2019) = * Fixed: Times being all messed up * New: Set the time of email notifications * Fixed: Email notifications will no longer show as active on the status page when they actually aren't active

Download this release

Release Info

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

Code changes from version 3.4.1 to 3.4.2

admin/log.php CHANGED
@@ -16,12 +16,4 @@ if( isset( $_GET['filter'] ) ) {
16
 
17
  <div class='cau_spacing'></div>
18
 
19
- <?php
20
-
21
- // Make sure it shows the correct time
22
- date_default_timezone_set( get_option('timezone_string') );
23
-
24
- // Show log
25
- cau_fetch_log( 'all', 'table' );
26
-
27
- ?>
16
 
17
  <div class='cau_spacing'></div>
18
 
19
+ <?php cau_fetch_log( 'all', 'table' ); ?>
 
 
 
 
 
 
 
 
admin/schedule.php CHANGED
@@ -85,7 +85,23 @@ if( isset( $_POST['submit'] ) ) {
85
 
86
  }
87
 
88
- wp_schedule_event( time(), $schedule_mail, 'cau_set_schedule_mail' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
89
 
90
  echo '<div id="message" class="updated"><p>'.__( 'Settings saved.' ).'</p></div>';
91
 
@@ -217,12 +233,34 @@ if( isset( $_POST['submit'] ) ) {
217
  <th scope="row"><?php _e( 'Email Notifications', 'companion-auto-update' );?></th>
218
  <td>
219
  <p>
220
- <select name='schedule_mail'>
221
  <option value='hourly' <?php if( $mail_sc == 'hourly' ) { echo "SELECTED"; } ?> ><?php _e('Hourly', 'companion-auto-update');?></option>
222
  <option value='twicedaily' <?php if( $mail_sc == 'twicedaily' ) { echo "SELECTED"; } ?> ><?php _e('Twice Daily', 'companion-auto-update');?></option>
223
  <option value='daily' <?php if( $mail_sc == 'daily' ) { echo "SELECTED"; } ?> ><?php _e('Daily', 'companion-auto-update');?></option>
224
  </select>
225
  </p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
226
  </td>
227
  </tr>
228
  <tr>
@@ -297,5 +335,17 @@ if( isset( $_POST['submit'] ) ) {
297
  }
298
 
299
  });
 
 
 
 
 
 
 
 
 
 
 
 
300
 
301
  </script>
85
 
86
  }
87
 
88
+ // Emails
89
+ if( $schedule_mail == 'daily' ) {
90
+
91
+ $dateT = date( 'Y-m-d' );
92
+ $hoursT = sanitize_text_field( $_POST['timeScheduleEmailTimeH'] );
93
+ $minutesT = sanitize_text_field( $_POST['timeScheduleEmailTimeM'] );
94
+ $secondsT = date( 's' );
95
+ $fullDateT = $dateT.' '.$hoursT.':'.$minutesT.':'.$secondsT;
96
+ $emailSetTime = strtotime( $fullDateT );
97
+
98
+ wp_schedule_event( $emailSetTime, $schedule_mail, 'cau_set_schedule_mail' );
99
+
100
+ } else {
101
+
102
+ wp_schedule_event( time(), $schedule_mail, 'cau_set_schedule_mail' );
103
+
104
+ }
105
 
106
  echo '<div id="message" class="updated"><p>'.__( 'Settings saved.' ).'</p></div>';
107
 
233
  <th scope="row"><?php _e( 'Email Notifications', 'companion-auto-update' );?></th>
234
  <td>
235
  <p>
236
+ <select id='schedule_mail' name='schedule_mail'>
237
  <option value='hourly' <?php if( $mail_sc == 'hourly' ) { echo "SELECTED"; } ?> ><?php _e('Hourly', 'companion-auto-update');?></option>
238
  <option value='twicedaily' <?php if( $mail_sc == 'twicedaily' ) { echo "SELECTED"; } ?> ><?php _e('Twice Daily', 'companion-auto-update');?></option>
239
  <option value='daily' <?php if( $mail_sc == 'daily' ) { echo "SELECTED"; } ?> ><?php _e('Daily', 'companion-auto-update');?></option>
240
  </select>
241
  </p>
242
+ <div class='timeScheduleEmail' <?php if( $mail_sc != 'daily' ) { echo "style='display: none;'"; } ?> >
243
+
244
+ <?php
245
+
246
+ $setTimeEmails = wp_next_scheduled( 'cau_set_schedule_mail' );
247
+ $setTimeEmailHour = date( 'H' , $setTimeEmails );
248
+ $setTimeEmailMins = date( 'i' , $setTimeEmails );
249
+
250
+ ?>
251
+
252
+ <div class='cau_schedule_input'>
253
+ <input type='text' name='timeScheduleEmailTimeH' value='<?php echo $setTimeEmailHour; ?>' maxlength='2' >
254
+ </div><div class='cau_schedule_input_div'>
255
+ :
256
+ </div><div class='cau_schedule_input'>
257
+ <input type='text' name='timeScheduleEmailTimeM' value='<?php echo $setTimeEmailMins; ?>' maxlength='2' >
258
+ </div><div class='cau_shedule_notation'>
259
+ <b><?php _e('Time notation: 24H', 'companion-auto-update'); ?></b>
260
+ </div>
261
+
262
+ <p class='description'><?php _e( 'At what time should the updater run? Only works when set to <u>daily</u>.', 'companion-auto-update' ); ?></p>
263
+ </div>
264
  </td>
265
  </tr>
266
  <tr>
335
  }
336
 
337
  });
338
+
339
+ jQuery( '#schedule_mail' ).change( function() {
340
+
341
+ var selected = jQuery(this).val();
342
+
343
+ if( selected == 'daily' ) {
344
+ jQuery('.timeScheduleEmail').show();
345
+ } else {
346
+ jQuery('.timeScheduleEmail').hide();
347
+ }
348
+
349
+ });
350
 
351
  </script>
admin/status.php CHANGED
@@ -89,10 +89,34 @@
89
 
90
  // E-mail notifications
91
  if ( wp_next_scheduled ( 'cau_set_schedule_mail' ) ) {
92
- $setScheduleStatus = 'enabled';
93
- $setScheduleIcon = 'yes';
94
- $setScheduleInterval = wp_get_schedule( 'cau_set_schedule_mail' );
95
- $setScheduleNext = date_i18n( $dateFormat, wp_next_scheduled( 'cau_set_schedule_mail' ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
  } else {
97
  $setScheduleStatus = 'disabled';
98
  $setScheduleIcon = 'no';
@@ -100,6 +124,22 @@
100
  $setScheduleNext = '&dash;';
101
  }
102
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
  ?>
104
 
105
  <h2><?php _e('Status', 'companion-auto-update'); ?></h2>
@@ -164,6 +204,12 @@
164
  <td class="cau_status_interval"><?php echo $setScheduleInterval; ?></td>
165
  <td class="cau_status_next"><span class="cau_mobile_prefix"><?php _e( 'Next', 'companion-auto-update' ); ?>: </span><?php echo $setScheduleNext; ?></td>
166
  </tr>
 
 
 
 
 
 
167
  </tbody>
168
 
169
  </table>
@@ -362,6 +408,10 @@ if( cau_incompatiblePlugins() ) { ?>
362
  <td>PHP</td>
363
  <td><?php echo phpversion(); ?></td>
364
  </tr>
 
 
 
 
365
  </tbody>
366
 
367
  </table>
89
 
90
  // E-mail notifications
91
  if ( wp_next_scheduled ( 'cau_set_schedule_mail' ) ) {
92
+
93
+ $emailCase = false;
94
+
95
+ $configs = $wpdb->get_results( "SELECT * FROM {$table_name} WHERE name = 'send'");
96
+ foreach ( $configs as $config ) {
97
+ if( $config->onoroff == 'on' ) {
98
+ $emailCase = true;
99
+ }
100
+ }
101
+ $configs = $wpdb->get_results( "SELECT * FROM {$table_name} WHERE name = 'sendupdate'");
102
+ foreach ( $configs as $config ) {
103
+ if( $config->onoroff == 'on' ) {
104
+ $emailCase = true;
105
+ }
106
+ }
107
+
108
+ if( $emailCase ) {
109
+ $setScheduleStatus = 'enabled';
110
+ $setScheduleIcon = 'yes';
111
+ $setScheduleInterval = wp_get_schedule( 'cau_set_schedule_mail' );
112
+ $setScheduleNext = date_i18n( $dateFormat, wp_next_scheduled( 'cau_set_schedule_mail' ) );
113
+ } else {
114
+ $setScheduleStatus = 'disabled';
115
+ $setScheduleIcon = 'no';
116
+ $setScheduleInterval = '&dash;';
117
+ $setScheduleNext = '&dash;';
118
+ }
119
+
120
  } else {
121
  $setScheduleStatus = 'disabled';
122
  $setScheduleIcon = 'no';
124
  $setScheduleNext = '&dash;';
125
  }
126
 
127
+ // Core notifcations
128
+ $configs = $wpdb->get_results( "SELECT * FROM {$table_name} WHERE name = 'wpemails'");
129
+ foreach ( $configs as $config ) {
130
+ if( $config->onoroff == 'on' ) {
131
+ $setCoreStatus = 'enabled';
132
+ $setCoreIcon = 'yes';
133
+ $setCoreInterval = wp_get_schedule( 'cau_set_schedule_mail' );
134
+ $setCoreNext = date_i18n( $dateFormat, wp_next_scheduled( 'cau_set_schedule_mail' ) );
135
+ } else {
136
+ $setCoreStatus = 'disabled';
137
+ $setCoreIcon = 'no';
138
+ $setCoreInterval = '&dash;';
139
+ $setCoreNext = '&dash;';
140
+ }
141
+ }
142
+
143
  ?>
144
 
145
  <h2><?php _e('Status', 'companion-auto-update'); ?></h2>
204
  <td class="cau_status_interval"><?php echo $setScheduleInterval; ?></td>
205
  <td class="cau_status_next"><span class="cau_mobile_prefix"><?php _e( 'Next', 'companion-auto-update' ); ?>: </span><?php echo $setScheduleNext; ?></td>
206
  </tr>
207
+ <tr>
208
+ <td class="cau_status_name"><?php _e( 'Core notifications', 'companion-auto-update' ); ?></td>
209
+ <td class="cau_status_active_state"><span class='cau_<?php echo $setCoreStatus; ?>'><span class="dashicons dashicons-<?php echo $setCoreIcon; ?>"></span></span></td>
210
+ <td class="cau_status_interval"><?php echo $setCoreInterval; ?></td>
211
+ <td class="cau_status_next"><span class="cau_mobile_prefix"><?php _e( 'Next', 'companion-auto-update' ); ?>: </span><?php echo $setScheduleNext; ?></td>
212
+ </tr>
213
  </tbody>
214
 
215
  </table>
408
  <td>PHP</td>
409
  <td><?php echo phpversion(); ?></td>
410
  </tr>
411
+ <tr>
412
+ <td class="cau_status_name"><?php _e( 'Timezone' ); ?></td>
413
+ <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>
414
+ </tr>
415
  </tbody>
416
 
417
  </table>
backend/style.css CHANGED
@@ -97,6 +97,8 @@
97
  height: 11px;
98
  border-radius: 10px;
99
  margin-left: 5px;
 
 
100
  }
101
  .nav-tab .cau_melding.level-okay {
102
  background: #7AD03A;
97
  height: 11px;
98
  border-radius: 10px;
99
  margin-left: 5px;
100
+ position: relative;
101
+ bottom: -1px;
102
  }
103
  .nav-tab .cau_melding.level-okay {
104
  background: #7AD03A;
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.1
7
  * Author: Papin Schipper
8
  * Author URI: http://codeermeneer.nl/
9
  * Contributors: papin
@@ -167,6 +167,9 @@ function cau_frontend() { ?>
167
  <hr class="wp-header-end">
168
 
169
  <?php
 
 
 
170
 
171
  // Allow only access to these pages
172
  $allowedPages = array(
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.2
7
  * Author: Papin Schipper
8
  * Author URI: http://codeermeneer.nl/
9
  * Contributors: papin
167
  <hr class="wp-header-end">
168
 
169
  <?php
170
+
171
+ // Make sure the correct timezone is used
172
+ date_default_timezone_set( get_option( 'timezone_string' ) );
173
 
174
  // Allow only access to these pages
175
  $allowedPages = array(
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: auto, automatic, background, update, updates, updating, automatic updates,
5
  Requires at least: 3.5.0
6
  Tested up to: 5.2
7
  Requires PHP: 5.1
8
- Stable tag: 3.4.1
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -72,6 +72,11 @@ For some reason this plugin seems to have trouble with updating themes by Elegan
72
 
73
  == Changelog ==
74
 
 
 
 
 
 
75
  = 3.4.1 (May 4, 2019) =
76
  * Fixed issue where sometimes settings wouldn't safe
77
  * Fixed issue where sometimes the status page would show incorrect times at events
5
  Requires at least: 3.5.0
6
  Tested up to: 5.2
7
  Requires PHP: 5.1
8
+ Stable tag: 3.4.2
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
72
 
73
  == Changelog ==
74
 
75
+ = 3.4.2 (June 28, 2019) =
76
+ * Fixed: Times being all messed up
77
+ * New: Set the time of email notifications
78
+ * Fixed: Email notifications will no longer show as active on the status page when they actually aren't active
79
+
80
  = 3.4.1 (May 4, 2019) =
81
  * Fixed issue where sometimes settings wouldn't safe
82
  * Fixed issue where sometimes the status page would show incorrect times at events