Companion Auto Update - Version 3.1.4

Version Description

(August 8, 2018) = * Fix: No theme update notification

Download this release

Release Info

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

Code changes from version 3.1.3 to 3.1.4

Files changed (4) hide show
  1. admin/support.php +6 -0
  2. cau_emails.php +70 -9
  3. companion-auto-update.php +1 -1
  4. readme.txt +4 -1
admin/support.php CHANGED
@@ -24,6 +24,12 @@
24
  <a href="https://translate.wordpress.org/projects/wp-plugins/companion-auto-update/" target="_blank" class="button"><span class="dashicons dashicons-welcome-learn-more"></span> <?php _e('Help us translate', 'companion-auto-update'); ?></a>
25
  </td>
26
  </tr>
 
 
 
 
 
 
27
 
28
  </table>
29
 
24
  <a href="https://translate.wordpress.org/projects/wp-plugins/companion-auto-update/" target="_blank" class="button"><span class="dashicons dashicons-welcome-learn-more"></span> <?php _e('Help us translate', 'companion-auto-update'); ?></a>
25
  </td>
26
  </tr>
27
+ <tr>
28
+ <th scope="row"><?php _e('Check out my other plugins', 'companion-auto-update');?></th>
29
+ <td>
30
+ <a href="https://codeermeneer.nl/plugins/" target="_blank" class="button"><span class="dashicons dashicons-category"></span> <?php _e('View my portfolio', 'companion-auto-update'); ?></a>
31
+ </td>
32
+ </tr>
33
 
34
  </table>
35
 
cau_emails.php CHANGED
@@ -130,10 +130,16 @@ function cau_plugin_updated() {
130
  // Create arrays
131
  $pluginNames = array();
132
  $pluginDates = array();
 
 
133
 
134
  // Where to look for plugins
135
- $plugdir = plugin_dir_path( __DIR__ );
136
- $allPlugins = get_plugins();
 
 
 
 
137
 
138
  // Loop trough all plugins
139
  foreach ( $allPlugins as $key => $value) {
@@ -167,24 +173,79 @@ function cau_plugin_updated() {
167
  array_push( $pluginDates, $fileDate );
168
  }
169
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
170
  }
171
 
172
- $totalNum = 0;
173
- $updatedList = '';
 
 
174
 
175
  foreach ( $pluginDates as $key => $value ) {
176
 
177
- $updatedList .= "- ".$pluginNames[$key]."\n";
178
- $totalNum++;
179
 
180
  }
 
181
 
182
- // If plugins have been updated in the last day, send email
183
- if( $totalNum > 0 ) {
 
 
 
 
 
184
 
185
  $subject = '[' . get_bloginfo( 'name' ) . '] ' . __('One or more plugins have been updated.', 'companion-auto-update');
186
  $type = __('plugins', 'companion-auto-update');
187
- $message = cau_updated_message( $type, "\n".$updatedList );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
188
 
189
  foreach ( cau_set_email() as $key => $value) {
190
  foreach ($value as $k => $v) {
130
  // Create arrays
131
  $pluginNames = array();
132
  $pluginDates = array();
133
+ $themeNames = array();
134
+ $themeDates = array();
135
 
136
  // Where to look for plugins
137
+ $plugdir = plugin_dir_path( __DIR__ );
138
+ $allPlugins = get_plugins();
139
+
140
+ // Where to look for themes
141
+ $themedir = get_theme_root();
142
+ $allThemes = wp_get_themes();
143
 
144
  // Loop trough all plugins
145
  foreach ( $allPlugins as $key => $value) {
173
  array_push( $pluginDates, $fileDate );
174
  }
175
 
176
+ }
177
+
178
+ // Loop trough all themes
179
+ foreach ( $allThemes as $key => $value) {
180
+
181
+ // Get theme data
182
+ $fullPath = $themedir.'/'.$key;
183
+ $getFile = $path_parts = pathinfo( $fullPath );
184
+
185
+ // Get last update date
186
+ $dateFormat = get_option( 'date_format' );
187
+ $fileDate = date ( 'YmdHi', filemtime( $fullPath ) );
188
+ $mailSched = wp_get_schedule( 'cau_set_schedule_mail' );
189
+
190
+ if( $mailSched == 'hourly' ) {
191
+ $lastday = date( 'YmdHi', strtotime( '-1 hour' ) );
192
+ } elseif( $mailSched == 'twicedaily' ) {
193
+ $lastday = date( 'YmdHi', strtotime( '-12 hours' ) );
194
+ } elseif( $mailSched == 'daily' ) {
195
+ $lastday = date( 'YmdHi', strtotime( '-1 day' ) );
196
+ }
197
+
198
+ if( $fileDate >= $lastday ) {
199
+
200
+ // Get theme name
201
+ array_push( $themeNames , $path_parts['filename'] );
202
+ array_push( $themeDates, $fileDate );
203
+
204
+ }
205
+
206
+
207
  }
208
 
209
+ $totalNumP = 0;
210
+ $totalNumT = 0;
211
+ $updatedListP = '';
212
+ $updatedListT = '';
213
 
214
  foreach ( $pluginDates as $key => $value ) {
215
 
216
+ $updatedListP .= "- ".$pluginNames[$key]."\n";
217
+ $totalNumP++;
218
 
219
  }
220
+ foreach ( $themeNames as $key => $value ) {
221
 
222
+ $updatedListT .= "- ".$themeNames[$key]."\n";
223
+ $totalNumT++;
224
+
225
+ }
226
+
227
+ // If plugins have been updated, send email
228
+ if( $totalNumP > 0 ) {
229
 
230
  $subject = '[' . get_bloginfo( 'name' ) . '] ' . __('One or more plugins have been updated.', 'companion-auto-update');
231
  $type = __('plugins', 'companion-auto-update');
232
+ $message = cau_updated_message( $type, "\n".$updatedListP );
233
+
234
+ foreach ( cau_set_email() as $key => $value) {
235
+ foreach ($value as $k => $v) {
236
+ wp_mail( $v, $subject, $message, $headers );
237
+ }
238
+ break;
239
+ }
240
+
241
+ }
242
+
243
+ // If themes have been updated, send email
244
+ if( $totalNumT > 0 ) {
245
+
246
+ $subject = '[' . get_bloginfo( 'name' ) . '] ' . __('One or more themes have been updated.', 'companion-auto-update');
247
+ $type = __('theme', 'companion-auto-update');
248
+ $message = cau_updated_message( $type, "\n".$updatedListT );
249
 
250
  foreach ( cau_set_email() as $key => $value) {
251
  foreach ($value as $k => $v) {
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.1.3
7
  * Author: Papin Schipper
8
  * Author URI: http://codeermeneer.nl/
9
  * Contributors: papin
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.1.4
7
  * Author: Papin Schipper
8
  * Author URI: http://codeermeneer.nl/
9
  * Contributors: papin
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.me/dakel/2
4
  Tags: auto, automatic, background, update, updates, updating, automatic updates, automatic background updates, easy update, wordpress update, theme update, plugin update, up-to-date, security, update latest version, update core, update wp, update wp core, major updates, minor updates, update to new version, update core, update plugin, update plugins, update plugins automatically, update theme, plugin, theme, advance, control, mail, notifations, enable
5
  Requires at least: 3.5.0
6
  Tested up to: 4.9
7
- Stable tag: 3.1.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -77,6 +77,9 @@ If you launched your website a few years ago using cPanel it could be the case t
77
 
78
  == Changelog ==
79
 
 
 
 
80
  = 3.1.3 (August 3, 2018) =
81
  * Fix: Issue with , in links in email notifications
82
 
4
  Tags: auto, automatic, background, update, updates, updating, automatic updates, automatic background updates, easy update, wordpress update, theme update, plugin update, up-to-date, security, update latest version, update core, update wp, update wp core, major updates, minor updates, update to new version, update core, update plugin, update plugins, update plugins automatically, update theme, plugin, theme, advance, control, mail, notifations, enable
5
  Requires at least: 3.5.0
6
  Tested up to: 4.9
7
+ Stable tag: 3.1.4
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
77
 
78
  == Changelog ==
79
 
80
+ = 3.1.4 (August 8, 2018) =
81
+ * Fix: No theme update notification
82
+
83
  = 3.1.3 (August 3, 2018) =
84
  * Fix: Issue with , in links in email notifications
85