Advanced Automatic Updates - Version 0.7

Version Description

  • ADDED: Option to override where the update email is sent
  • ADDED: 'auto_updater_notification_email_address' filter, for the update notification email address
  • ADDED: Reminder in the notification email for users to mark the plugins/themes compatible
  • ADDED: Option to disable notification emails
  • CHANGED: Notification emails now send as HTML emails (for greater flexibility of information to include)
  • UPDATED: Language POT file
  • FIXED: Some strings were formatted incorrectly for translation
  • FIXED: Escape all strings appropriately before displaying
  • FIXED: SVN updates would cause hourly emails, regardless of an update occurring or not
Download this release

Release Info

Developer pento
Plugin Icon wp plugin Advanced Automatic Updates
Version 0.7
Comparing to
See all releases

Code changes from version 0.6.3 to 0.7

admin.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
 
3
  function auto_updater_plugin_menu() {
4
- $hook = add_options_page( __( 'Automatic Updater', 'automatic-updater' ), __( 'Automatic Updater', 'automatic-updater' ), 'update_core', 'automatic-updater', 'auto_updater_settings' );
5
 
6
  add_action( "load-$hook", 'auto_updater_settings_loader' );
7
  }
@@ -10,16 +10,16 @@ add_action( 'admin_menu', 'auto_updater_plugin_menu' );
10
  function auto_updater_settings_loader() {
11
  get_current_screen()->add_help_tab( array(
12
  'id' => 'overview',
13
- 'title' => __( 'Overview', 'automatic-updater' ),
14
  'content' =>
15
- '<p>' . __( 'This settings page allows you to select whether you would like WordPress Core, your plugins, and your themes to be automatically updated.', 'automatic-updater' ) . '</p>' .
16
- '<p>' . __( 'It is very important to keep your WordPress installation up to date for security reasons, so unless you have a specific reason not to, we recommend allowing everything to automatically update.', 'automatic-updater' ) . '</p>'
17
  ) );
18
 
19
  get_current_screen()->set_help_sidebar(
20
- '<p><strong>' . sprintf( __( 'A Plugin By <a href="%s" target="_blank">Gary</a>', 'automatic-updater' ), 'http://pento.net/' ) . '</strong></p>' .
21
- '<p><a href="http://pento.net/donate/">' . __( 'Donations', 'automatic-updater' ) . '</a></p>' .
22
- '<p><a href="http://wordpress.org/support/plugin/automatic-updater">' . __( 'Support Forums', 'automatic-updater' ) . '</a></p>'
23
  );
24
 
25
  wp_enqueue_style( 'automatic-updater-admin', plugins_url( 'css/admin.css', __FILE__ ) );
@@ -27,25 +27,25 @@ function auto_updater_settings_loader() {
27
 
28
  function auto_updater_settings() {
29
  if ( ! current_user_can( 'update_core' ) )
30
- wp_die( __( 'You do not have sufficient permissions to access this page.', 'automatic-updater' ) );
31
 
32
  $message = '';
33
  if ( ! empty( $_REQUEST['submit'] ) ) {
34
  check_admin_referer( 'automatic-updater-settings' );
35
 
36
  auto_updater_save_settings();
37
- $message = __( 'Settings updated', 'automatic-updater' );
38
  }
39
  $options = get_option( 'automatic-updater' );
40
  $messages = array(
41
- 'core' => __( 'Update WordPress Core automatically? <strong>(Strongly Recommended)</strong>', 'automatic-updater' ),
42
- 'plugins' => __( 'Update your plugins automatically?', 'automatic-updater' ),
43
- 'themes' => __( 'Update your themes automatically?', 'automatic-updater' )
44
  );
45
  ?>
46
  <div class="wrap">
47
  <?php screen_icon('tools'); ?>
48
- <h2><?php _e( 'Automatic Updater', 'automatic-updater' ); ?></h2>
49
  <?php
50
  if ( ! empty( $message ) ) {
51
  ?>
@@ -65,23 +65,35 @@ function auto_updater_settings() {
65
 
66
  echo "<p><input type='checkbox' id='$type' name='$type' value='1'$checked> <label for='$type'>{$messages[$type]}</label></p>";
67
  }
68
-
 
 
 
 
 
 
 
 
 
 
 
 
69
  if ( is_dir( ABSPATH . '/.svn' ) ) {
70
  $checked = '';
71
  if ( $options['svn'] )
72
  $checked = ' checked="checked"';
73
  ?>
74
- <br><br>
75
- <h3><?php _e( 'SVN Support', 'automatic-updater' ); ?></h3>
76
- <p><?php _e( "It looks like you're running an SVN version of WordPress, that's cool! Automatic Updater can run <tt>svn up</tt> once an hour, to keep you up-to-date. For safety, enabling this option will disable the normal WordPress core updates.", 'automatic-updater' ) ?></p>
77
  <?php
78
  if ( !is_writable( ABSPATH . '/.svn' ) ) {
79
  $uid = posix_getuid();
80
  $user = posix_getpwuid( $uid );
81
- echo '<div class="automatic-updater-notice"><p>' . sprintf( __( "The .svn directory isn't writable, so <tt>svn up</tt> will probably fail when the web server runs it. You need to give the user <tt>%1s</tt> write permissions to your entire WordPress install, including .svn directories.", 'automatic-updater' ), $user['name'] ) . '</p></div>';
82
  }
83
  ?>
84
- <p><input type="checkbox" id="svn" name="svn" value="1"<?php echo $checked; ?>> <label for="svn"><?php _e( 'Run <tt>svn up</tt> hourly?', 'automatic-updater' ); ?></label></p>
85
  <?php
86
  }
87
  else {
@@ -92,9 +104,9 @@ function auto_updater_settings() {
92
  if ( $options['debug'] )
93
  $checked = ' checked="checked"';
94
  ?>
95
- <br/><br/>
96
- <h3><?php _e( 'Debug Information', 'automatic-updater' ); ?></h3>
97
- <p><input type="checkbox" id="debug" name="debug" value="1"<?php echo $checked; ?>> <label for="debug"><?php _e( 'Show debug information in the notification email.', 'automatic-updater' ); ?></label></p>
98
  <p><input class="button button-primary" type="submit" name="submit" id="submit" value="<?php esc_attr_e( 'Save Changes', 'automatic-updater' ); ?>" /></p>
99
  </form>
100
  </div>
@@ -112,20 +124,24 @@ function auto_updater_save_settings() {
112
  $options['update'][$type] = false;
113
  }
114
 
115
- $top_options = array( 'debug', 'svn' );
116
- foreach ( $top_options as $option ) {
117
  if ( ! empty( $_REQUEST[$option] ) )
118
  $options[$option] = true;
119
  else
120
  $options[$option] = false;
121
  }
122
 
 
 
 
 
123
  update_option( 'automatic-updater', $options );
124
  }
125
 
126
  function auto_updater_plugin_row_meta( $links, $file ) {
127
  if( AUTOMATIC_UPDATER_BASENAME == $file ) {
128
- $links[] = '<a href="options-general.php?page=automatic-updater">' . __( 'Settings', 'automatic-updater' ) . '</a>';
129
  }
130
 
131
  return $links;
1
  <?php
2
 
3
  function auto_updater_plugin_menu() {
4
+ $hook = add_options_page( esc_html__( 'Automatic Updater', 'automatic-updater' ), esc_html__( 'Automatic Updater', 'automatic-updater' ), 'update_core', 'automatic-updater', 'auto_updater_settings' );
5
 
6
  add_action( "load-$hook", 'auto_updater_settings_loader' );
7
  }
10
  function auto_updater_settings_loader() {
11
  get_current_screen()->add_help_tab( array(
12
  'id' => 'overview',
13
+ 'title' => esc_html__( 'Overview', 'automatic-updater' ),
14
  'content' =>
15
+ '<p>' . esc_html__( 'This settings page allows you to select whether you would like WordPress Core, your plugins, and your themes to be automatically updated.', 'automatic-updater' ) . '</p>' .
16
+ '<p>' . esc_html__( 'It is very important to keep your WordPress installation up to date for security reasons, so unless you have a specific reason not to, we recommend allowing everything to automatically update.', 'automatic-updater' ) . '</p>'
17
  ) );
18
 
19
  get_current_screen()->set_help_sidebar(
20
+ '<p><strong>' . wp_kses( sprintf( __( 'A Plugin By <a href="%s" target="_blank">Gary</a>', 'automatic-updater' ), 'http://pento.net/' ), array( 'a' => array( 'href' => array(), 'target' => array() ) ) ) . '</strong></p>' .
21
+ '<p><a href="http://pento.net/donate/">' . esc_html__( 'Donations', 'automatic-updater' ) . '</a></p>' .
22
+ '<p><a href="http://wordpress.org/support/plugin/automatic-updater">' . esc_html__( 'Support Forums', 'automatic-updater' ) . '</a></p>'
23
  );
24
 
25
  wp_enqueue_style( 'automatic-updater-admin', plugins_url( 'css/admin.css', __FILE__ ) );
27
 
28
  function auto_updater_settings() {
29
  if ( ! current_user_can( 'update_core' ) )
30
+ wp_die( esc_html__( 'You do not have sufficient permissions to access this page.', 'automatic-updater' ) );
31
 
32
  $message = '';
33
  if ( ! empty( $_REQUEST['submit'] ) ) {
34
  check_admin_referer( 'automatic-updater-settings' );
35
 
36
  auto_updater_save_settings();
37
+ $message = esc_html__( 'Settings updated', 'automatic-updater' );
38
  }
39
  $options = get_option( 'automatic-updater' );
40
  $messages = array(
41
+ 'core' => wp_kses( __( 'Update WordPress Core automatically? <strong>(Strongly Recommended)</strong>', 'automatic-updater' ), array( 'strong' => array() ) ),
42
+ 'plugins' => esc_html__( 'Update your plugins automatically?', 'automatic-updater' ),
43
+ 'themes' => esc_html__( 'Update your themes automatically?', 'automatic-updater' )
44
  );
45
  ?>
46
  <div class="wrap">
47
  <?php screen_icon('tools'); ?>
48
+ <h2><?php esc_html_e( 'Automatic Updater', 'automatic-updater' ); ?></h2>
49
  <?php
50
  if ( ! empty( $message ) ) {
51
  ?>
65
 
66
  echo "<p><input type='checkbox' id='$type' name='$type' value='1'$checked> <label for='$type'>{$messages[$type]}</label></p>";
67
  }
68
+ ?>
69
+ <br>
70
+ <h3><?php esc_html_e( 'Notification Email', 'automatic-updater' ); ?></h3>
71
+ <p><?php esc_html_e( 'By default, Automatic Updater will send an email to the Site Admin when an update is performed. If you would like to send that email to a different address, you can set it here.', 'automatic-updater' ); ?></p>
72
+ <p><label for="override-email"><?php esc_html_e( 'Override Email Address', 'automatic-updater' ); ?>:</label> <input type="text" name="override-email" id="override-email" value="<?php echo esc_attr( $options['override-email'] ); ?>"></p>
73
+ <?php
74
+ $checked = '';
75
+ if ( $options['disable-email'] )
76
+ $checked = ' checked="checked"';
77
+ ?>
78
+ <p><?php esc_html_e( "If you don't want to receive an email when updates are installed, you can disable them completely.", 'automatic-updater' ); ?></p>
79
+ <p><input type="checkbox" name="disable-email" id="disable-email" value="1"> <label for="disable-email"><?php esc_html_e( 'Disable email notifications.', 'automatic-updater' ); ?></label></p>
80
+ <?php
81
  if ( is_dir( ABSPATH . '/.svn' ) ) {
82
  $checked = '';
83
  if ( $options['svn'] )
84
  $checked = ' checked="checked"';
85
  ?>
86
+ <br>
87
+ <h3><?php esc_html_e( 'SVN Support', 'automatic-updater' ); ?></h3>
88
+ <p><?php echo wp_kses( __( "It looks like you're running an SVN version of WordPress, that's cool! Automatic Updater can run <tt>svn up</tt> once an hour, to keep you up-to-date. For safety, enabling this option will disable the normal WordPress core updates.", 'automatic-updater' ), array( 'tt' => array() ) ); ?></p>
89
  <?php
90
  if ( !is_writable( ABSPATH . '/.svn' ) ) {
91
  $uid = posix_getuid();
92
  $user = posix_getpwuid( $uid );
93
+ echo '<div class="automatic-updater-notice"><p>' . wp_kses( sprintf( __( "The .svn directory isn't writable, so <tt>svn up</tt> will probably fail when the web server runs it. You need to give the user <tt>%s</tt> write permissions to your entire WordPress install, including .svn directories.", 'automatic-updater' ), $user['name'] ), array( 'tt' => array() ) ) . '</p></div>';
94
  }
95
  ?>
96
+ <p><input type="checkbox" id="svn" name="svn" value="1"<?php echo $checked; ?>> <label for="svn"><?php echo wp_kses( __( 'Run <tt>svn up</tt> hourly?', 'automatic-updater' ), array( 'tt' => array() ) ); ?></label></p>
97
  <?php
98
  }
99
  else {
104
  if ( $options['debug'] )
105
  $checked = ' checked="checked"';
106
  ?>
107
+ <br>
108
+ <h3><?php esc_html_e( 'Debug Information', 'automatic-updater' ); ?></h3>
109
+ <p><input type="checkbox" id="debug" name="debug" value="1"<?php echo $checked; ?>> <label for="debug"><?php esc_html_e( 'Show debug information in the notification email.', 'automatic-updater' ); ?></label></p>
110
  <p><input class="button button-primary" type="submit" name="submit" id="submit" value="<?php esc_attr_e( 'Save Changes', 'automatic-updater' ); ?>" /></p>
111
  </form>
112
  </div>
124
  $options['update'][$type] = false;
125
  }
126
 
127
+ $top_bool_options = array( 'debug', 'svn', 'disable-email' );
128
+ foreach ( $top_bool_options as $option ) {
129
  if ( ! empty( $_REQUEST[$option] ) )
130
  $options[$option] = true;
131
  else
132
  $options[$option] = false;
133
  }
134
 
135
+ $top_options = array( 'override-email' );
136
+ foreach ( $top_option as $option )
137
+ $options[$option] = $_REQUEST[$option];
138
+
139
  update_option( 'automatic-updater', $options );
140
  }
141
 
142
  function auto_updater_plugin_row_meta( $links, $file ) {
143
  if( AUTOMATIC_UPDATER_BASENAME == $file ) {
144
+ $links[] = '<a href="options-general.php?page=automatic-updater">' . esc_html__( 'Settings', 'automatic-updater' ) . '</a>';
145
  }
146
 
147
  return $links;
automatic-updater.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin URI: http://pento.net/projects/automatic-updater-for-wordpress/
5
  * Description: Automatically update your WordPress site, as soon as updates are released! Never worry about falling behing on updating again!
6
  * Author: pento
7
- * Version: 0.6.3
8
  * Author URI: http://pento.net/
9
  * License: GPL2+
10
  * Text Domain: automatic-updater
@@ -29,7 +29,7 @@ function auto_updater_requires_wordpress_version() {
29
  add_action( 'admin_init', 'auto_updater_requires_wordpress_version' );
30
 
31
  function auto_updater_disabled_notice() {
32
- echo '<div class="updated"><p><strong>' . __( 'Automatic Updater requires WordPress 3.4 or higher! Please upgrade WordPress manually, then reactivate Automatic Updater.', 'automatic-updater' ) . '</strong></p></div>';
33
  }
34
 
35
  function auto_updater_init() {
@@ -48,6 +48,8 @@ function auto_updater_init() {
48
  'svn' => false,
49
  'debug' => false,
50
  'next-development-update' => time(),
 
 
51
  );
52
  update_option( 'automatic-updater', $options );
53
  }
@@ -70,6 +72,18 @@ function auto_updater_init() {
70
  update_option( 'automatic-updater', $options );
71
  }
72
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  // Configure SVN updates cron, if it's enabled
74
  if ( $options['svn'] ) {
75
  if ( ! wp_next_scheduled( 'auto_updater_svn_event' ) )
@@ -165,22 +179,22 @@ function auto_updater_core() {
165
  do_action( 'auto_updater_after_update', 'core' );
166
 
167
  if ( is_wp_error( $result ) ) {
168
- $message = __( "While trying to upgrade WordPress, we ran into the following error:", 'automatic-updater' );
169
- $message .= "\r\n\r\n" . $result->get_error_message() . "\r\n\r\n";
170
- $message .= __( "We're sorry it didn't work out. Please try upgrading manually, instead.", 'automatic-updater' );
171
  }
172
  else if( 'development' == $update->response ) {
173
- $message = __( "We've successfully upgraded WordPress to the latest nightly build!", 'automatic-updater' );
174
- $message .= "\r\n\r\n" . __( 'Have fun!', 'automatic-updater' );
175
  }
176
  else {
177
- $message = sprintf( __( "We've successfully upgraded WordPress from version %1s to version %2s!", 'automatic-updater' ), $old_version, $update->current );
178
- $message .= "\r\n\r\n" . __( 'Have fun!', 'automatic-updater' );
179
  }
180
 
181
- $message .= "\r\n";
182
 
183
- $debug = join( "\r\n", $skin->messages );
184
 
185
  auto_updater_notification( $message, $debug );
186
 
@@ -220,28 +234,32 @@ function auto_updater_plugins() {
220
 
221
  do_action( 'auto_updater_after_update', 'plugins' );
222
 
223
- $message = _n( 'We found a plugin upgrade!', 'We found upgrades for some plugins!', count( $plugins ), 'automatic-updater' );
224
- $message .= "\r\n\r\n";
225
 
226
  foreach ( $plugins as $id => $plugin ) {
227
  if ( is_wp_error( $result[$id] ) ) {
228
- /* translators: First argument is the Plugin name, second argument is the error encountered while upgrading */
229
- $message .= sprintf( __( "%1s: We encounted an error upgrading this plugin: %2s", 'automatic-updater' ),
 
230
  $plugin->Name,
231
- $result[$id]->get_error_message() );
232
  }
233
  else {
234
- /* tranlators: First argument is the Plugin name, second argument is the old version number, third argument is the new version number */
235
- $message .= sprintf( __( "%1s: Successfully upgraded from version %2s to %3s!", 'automatic-updater' ),
 
236
  $plugin->Name,
237
  $plugin->Version,
238
- $plugin->update->new_version );
239
  }
240
 
241
- $message .= "\r\n";
242
  }
243
 
244
- $debug = join( "\r\n", $skin->messages );
 
 
245
 
246
  auto_updater_notification( $message, $debug );
247
 
@@ -280,28 +298,32 @@ function auto_updater_themes() {
280
 
281
  do_action( 'auto_updater_after_update', 'themes' );
282
 
283
- $message = _n( 'We found a theme upgrade!', 'We found upgrades for some themes!', count( $themes ), 'automatic-updater' );
284
- $message .= "\r\n\r\n";
285
 
286
  foreach ( $themes as $id => $theme ) {
287
  if ( is_wp_error( $result[$id] ) ) {
288
- /* translators: First argument is the Theme name, second argument is the error encountered while upgrading */
289
- $message .= sprintf( __( "%1s: We encounted an error upgrading this theme: %2s", 'automatic-updater' ),
 
290
  $theme->name,
291
- $result[$id]->get_error_message() );
292
  }
293
  else {
294
- /* tranlators: First argument is the Theme name, second argument is the old version number, third argument is the new version number */
295
- $message .= sprintf( __( "%1s: Successfully upgraded from version %2s to %3s!", 'automatic-updater' ),
 
296
  $theme->name,
297
  $theme->version,
298
- $theme->update['new_version'] );
299
  }
300
 
301
- $message .= "\r\n";
302
  }
303
 
304
- $debug = join( "\r\n", $skin->messages );
 
 
305
 
306
  auto_updater_notification( $message, $debug );
307
 
@@ -318,21 +340,21 @@ function auto_updater_svn() {
318
  if ( 0 === $return ) {
319
  $update = end( $output );
320
  // No need to email if there was no update.
321
- if ( 0 === strstr( $update, "At revision" ) )
322
  return;
323
 
324
- $message = __( 'We successfully upgraded from SVN!', 'automatic-updater' );
325
- $message .= "\r\n\r\n$update";
326
  }
327
  else {
328
- $message = __( 'While upgrading from SVN, we ran into the following error:', 'automatic-updater' );
329
- $message .= "\r\n\r\n" . end( $output ) . "\r\n\r\n";
330
- $message .= __( "We're sorry it didn't work out. Please try upgrading manually, instead.", 'automatic-updater' );
331
  }
332
 
333
- $message .= "\r\n";
334
 
335
- $debug = join( "\r\n", $output );
336
 
337
  auto_updater_notification( $message, $debug );
338
  }
@@ -340,26 +362,53 @@ add_action( 'auto_updater_svn_event', 'auto_updater_svn' );
340
 
341
  function auto_updater_notification( $info = '', $debug = '' ) {
342
  $options = get_option( 'automatic-updater', array() );
 
 
 
 
343
  $site = get_home_url();
344
- $subject = sprintf( __( 'WordPress Update: %1s', 'automatic-updater' ), $site );
 
 
 
 
345
 
346
- $message = __( 'Howdy!', 'automatic-updater' );
347
- $message .= "\r\n\r\n";
348
- $message .= sprintf( __( 'Automatic Updater just ran on your site, %1s, with the following result:', 'automatic-updater' ), $site );
349
- $message .= "\r\n\r\n";
350
 
351
  $message .= $info;
352
 
353
- $message .= "\r\n";
354
- $message .= __( 'Thanks for using the Automatic Updater plugin!', 'automatic-updater' );
355
 
356
  if ( ! empty( $options['debug'] ) ) {
357
- $message .= "\r\n\r\n\r\n\r\n";
358
- $message .= __( 'Debug Information:', 'automatic-updater' );
359
- $message .= "\r\n\r\n$debug";
360
  }
361
 
362
- wp_mail( get_option( 'admin_email' ), $subject, $message );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
363
  }
364
 
365
  function auto_updater_get_update_data() {
4
  * Plugin URI: http://pento.net/projects/automatic-updater-for-wordpress/
5
  * Description: Automatically update your WordPress site, as soon as updates are released! Never worry about falling behing on updating again!
6
  * Author: pento
7
+ * Version: 0.7
8
  * Author URI: http://pento.net/
9
  * License: GPL2+
10
  * Text Domain: automatic-updater
29
  add_action( 'admin_init', 'auto_updater_requires_wordpress_version' );
30
 
31
  function auto_updater_disabled_notice() {
32
+ echo '<div class="updated"><p><strong>' . esc_html__( 'Automatic Updater requires WordPress 3.4 or higher! Please upgrade WordPress manually, then reactivate Automatic Updater.', 'automatic-updater' ) . '</strong></p></div>';
33
  }
34
 
35
  function auto_updater_init() {
48
  'svn' => false,
49
  'debug' => false,
50
  'next-development-update' => time(),
51
+ 'override-email' => '',
52
+ 'disable-email' => false,
53
  );
54
  update_option( 'automatic-updater', $options );
55
  }
72
  update_option( 'automatic-updater', $options );
73
  }
74
 
75
+ // Override contact email added in version 0.7
76
+ if ( ! array_key_exists( 'override-email', $options ) ) {
77
+ $options['override-email'] = '';
78
+ update_option( 'automatic-updater', $options );
79
+ }
80
+
81
+ // Ability to disable email added in version 0.7
82
+ if ( ! array_key_exists( 'disable-email', $options ) ) {
83
+ $options['disable-email'] = false;
84
+ update_option( 'automatic-updater', $options );
85
+ }
86
+
87
  // Configure SVN updates cron, if it's enabled
88
  if ( $options['svn'] ) {
89
  if ( ! wp_next_scheduled( 'auto_updater_svn_event' ) )
179
  do_action( 'auto_updater_after_update', 'core' );
180
 
181
  if ( is_wp_error( $result ) ) {
182
+ $message = esc_html__( "While trying to upgrade WordPress, we ran into the following error:", 'automatic-updater' );
183
+ $message .= '<br><br>' . $result->get_error_message() . '<br><br>';
184
+ $message .= esc_html__( "We're sorry it didn't work out. Please try upgrading manually, instead.", 'automatic-updater' );
185
  }
186
  else if( 'development' == $update->response ) {
187
+ $message = esc_html__( "We've successfully upgraded WordPress to the latest nightly build!", 'automatic-updater' );
188
+ $message .= '<br><br>' . esc_html__( 'Have fun!', 'automatic-updater' );
189
  }
190
  else {
191
+ $message = sprintf( esc_html__( 'We\'ve successfully upgraded WordPress from version %1$s to version %2$s!', 'automatic-updater' ), $old_version, $update->current );
192
+ $message .= '<br><br>' . esc_html__( 'Have fun!', 'automatic-updater' );
193
  }
194
 
195
+ $message .= '<br>';
196
 
197
+ $debug = join( '<br>', $skin->messages );
198
 
199
  auto_updater_notification( $message, $debug );
200
 
234
 
235
  do_action( 'auto_updater_after_update', 'plugins' );
236
 
237
+ $message = esc_html( _n( 'We found a plugin upgrade!', 'We found upgrades for some plugins!', count( $plugins ), 'automatic-updater' ) );
238
+ $message .= '<br><br>';
239
 
240
  foreach ( $plugins as $id => $plugin ) {
241
  if ( is_wp_error( $result[$id] ) ) {
242
+ /* translators: First argument is the plugin url, second argument is the Plugin name, third argument is the error encountered while upgrading */
243
+ $message .= wp_kses( sprintf( __( '<a href="%1$s">%2$s</a>: We encounted an error upgrading this plugin: %3$s', 'automatic-updater' ),
244
+ $plugin->update->url,
245
  $plugin->Name,
246
+ $result[$id]->get_error_message() ), array( 'a' => array( 'href' => array() ) ) );
247
  }
248
  else {
249
+ /* translators: First argument is the plugin url, second argument is the Plugin name, third argument is the old version number, fourth argument is the new version number */
250
+ $message .= wp_kses( sprintf( __( '<a href="%1$s">%2$s</a>: Successfully upgraded from version %3$s to %4$s!', 'automatic-updater' ),
251
+ $plugin->update->url,
252
  $plugin->Name,
253
  $plugin->Version,
254
+ $plugin->update->new_version ), array( 'a' => array( 'href' => array() ) ) );
255
  }
256
 
257
+ $message .= '<br>';
258
  }
259
 
260
+ $message .= '<br>' . esc_html__( 'Plugin authors depend on your feedback to make their plugins better, and the WordPress community depends on plugin ratings for checking the quality of a plugin. If you have a couple of minutes, click on the plugin names above, and leave a Compatibility Vote or a Rating!', 'automatic-updater' ) . '<br>';
261
+
262
+ $debug = join( '<br>', $skin->messages );
263
 
264
  auto_updater_notification( $message, $debug );
265
 
298
 
299
  do_action( 'auto_updater_after_update', 'themes' );
300
 
301
+ $message = esc_html( _n( 'We found a theme upgrade!', 'We found upgrades for some themes!', count( $themes ), 'automatic-updater' ) );
302
+ $message .= '<br><br>';
303
 
304
  foreach ( $themes as $id => $theme ) {
305
  if ( is_wp_error( $result[$id] ) ) {
306
+ /* translators: First argument is the theme URL, second argument is the Theme name, third argument is the error encountered while upgrading */
307
+ $message .= wp_kses( sprintf( __( '<a href="%1$s">%2$s</a>: We encounted an error upgrading this theme: %3$s', 'automatic-updater' ),
308
+ $theme->update['url'],
309
  $theme->name,
310
+ $result[$id]->get_error_message() ), array( 'a' => array( 'href' => array() ) ) );
311
  }
312
  else {
313
+ /* translators: First argument is the theme URL, second argument is the Theme name, third argument is the old version number, fourth argument is the new version number */
314
+ $message .= wp_kses( sprintf( __( '<a href="%1$s">%2$s</a>: Successfully upgraded from version %3$s to %4$s!', 'automatic-updater' ),
315
+ $theme->update['url'],
316
  $theme->name,
317
  $theme->version,
318
+ $theme->update['new_version'] ), array( 'a' => array( 'href' => array() ) ) );
319
  }
320
 
321
+ $message .= '<br>';
322
  }
323
 
324
+ $message .= '<br>' . esc_html__( 'Theme authors depend on your feedback to make their plugins better, and the WordPress community depends on theme ratings for checking the quality of a theme. If you have a couple of minutes, click on the theme names above, and leave a Compatibility Vote or a Rating!', 'automatic-updater' ) . '<br>';
325
+
326
+ $debug = join( '<br>', $skin->messages );
327
 
328
  auto_updater_notification( $message, $debug );
329
 
340
  if ( 0 === $return ) {
341
  $update = end( $output );
342
  // No need to email if there was no update.
343
+ if ( 0 === strpos( $update, "At revision" ) )
344
  return;
345
 
346
+ $message = esc_html__( 'We successfully upgraded from SVN!', 'automatic-updater' );
347
+ $message .= "<br><br>$update";
348
  }
349
  else {
350
+ $message = esc_html__( 'While upgrading from SVN, we ran into the following error:', 'automatic-updater' );
351
+ $message .= '<br><br>' . end( $output ) . '<br><br>';
352
+ $message .= esc_html__( "We're sorry it didn't work out. Please try upgrading manually, instead.", 'automatic-updater' );
353
  }
354
 
355
+ $message .= '<br>';
356
 
357
+ $debug = join( '<br>', $output );
358
 
359
  auto_updater_notification( $message, $debug );
360
  }
362
 
363
  function auto_updater_notification( $info = '', $debug = '' ) {
364
  $options = get_option( 'automatic-updater', array() );
365
+
366
+ if ( $options['disable-email'] )
367
+ return;
368
+
369
  $site = get_home_url();
370
+ $subject = sprintf( esc_html__( 'WordPress Update: %s', 'automatic-updater' ), $site );
371
+
372
+ $message = '<html>';
373
+ $message .= '<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head>';
374
+ $message .= '<body>';
375
 
376
+ $message .= esc_html__( 'Howdy!', 'automatic-updater' );
377
+ $message .= '<br><br>';
378
+ $message .= wp_kses( sprintf( __( 'Automatic Updater just ran on your site, <a href="%1$s">%1$s</a>, with the following result:', 'automatic-updater' ), $site ), array( 'a' => array( 'href' => array() ) ) );
379
+ $message .= '<br><br>';
380
 
381
  $message .= $info;
382
 
383
+ $message .= '<br>';
384
+ $message .= esc_html__( 'Thanks for using the Automatic Updater plugin!', 'automatic-updater' );
385
 
386
  if ( ! empty( $options['debug'] ) ) {
387
+ $message .= "<br><br><br>";
388
+ $message .= esc_html__( 'Debug Information:', 'automatic-updater' );
389
+ $message .= "<br><br>$debug";
390
  }
391
 
392
+ $message .= '</body></html>';
393
+
394
+ $email = get_option( 'admin_email' );
395
+ if ( ! empty( $options['override-email'] ) )
396
+ $email = $options['override-email'];
397
+
398
+ $email = apply_filters( 'auto_updater_notification_email_address', $email );
399
+
400
+ $headers = array(
401
+ 'MIME-Version: 1.0',
402
+ 'Content-Type: text/html; charset=UTF-8'
403
+ );
404
+
405
+ add_filter( 'wp_mail_content_type', 'auto_updater_wp_mail_content_type' );
406
+ wp_mail( $email, $subject, $message, $headers );
407
+ remove_filter( 'wp_mail_content_type', 'auto_updater_wp_mail_content_type' );
408
+ }
409
+
410
+ function auto_updater_wp_mail_content_type() {
411
+ return 'text/html';
412
  }
413
 
414
  function auto_updater_get_update_data() {
languages/automatic-updater.pot CHANGED
@@ -2,9 +2,9 @@
2
  # This file is distributed under the same license as the Automatic Updater package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Automatic Updater 0.6\n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/automatic-updater\n"
7
- "POT-Creation-Date: 2012-10-14 11:18:57+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -12,7 +12,7 @@ msgstr ""
12
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
  "Language-Team: LANGUAGE <LL@li.org>\n"
14
 
15
- #. #-#-#-#-# plugin.pot (Automatic Updater 0.6) #-#-#-#-#
16
  #. Plugin Name of the plugin/theme
17
  #: admin.php:4 admin.php:48
18
  msgid "Automatic Updater"
@@ -68,11 +68,36 @@ msgstr ""
68
  msgid "Update your themes automatically?"
69
  msgstr ""
70
 
71
- #: admin.php:75
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
  msgid "SVN Support"
73
  msgstr ""
74
 
75
- #: admin.php:76
76
  msgid ""
77
  "It looks like you're running an SVN version of WordPress, that's cool! "
78
  "Automatic Updater can run <tt>svn up</tt> once an hour, to keep you up-to-"
@@ -80,30 +105,30 @@ msgid ""
80
  "core updates."
81
  msgstr ""
82
 
83
- #: admin.php:81
84
  msgid ""
85
  "The .svn directory isn't writable, so <tt>svn up</tt> will probably fail "
86
- "when the web server runs it. You need to give the user <tt>%1s</tt> write "
87
  "permissions to your entire WordPress install, including .svn directories."
88
  msgstr ""
89
 
90
- #: admin.php:84
91
  msgid "Run <tt>svn up</tt> hourly?"
92
  msgstr ""
93
 
94
- #: admin.php:96
95
  msgid "Debug Information"
96
  msgstr ""
97
 
98
- #: admin.php:97
99
  msgid "Show debug information in the notification email."
100
  msgstr ""
101
 
102
- #: admin.php:98
103
  msgid "Save Changes"
104
  msgstr ""
105
 
106
- #: admin.php:128
107
  msgid "Settings"
108
  msgstr ""
109
 
@@ -113,80 +138,107 @@ msgid ""
113
  "manually, then reactivate Automatic Updater."
114
  msgstr ""
115
 
116
- #: automatic-updater.php:168
117
  msgid "While trying to upgrade WordPress, we ran into the following error:"
118
  msgstr ""
119
 
120
- #: automatic-updater.php:170 automatic-updater.php:330
121
  msgid "We're sorry it didn't work out. Please try upgrading manually, instead."
122
  msgstr ""
123
 
124
- #: automatic-updater.php:173
125
  msgid "We've successfully upgraded WordPress to the latest nightly build!"
126
  msgstr ""
127
 
128
- #: automatic-updater.php:174 automatic-updater.php:178
129
  msgid "Have fun!"
130
  msgstr ""
131
 
132
- #: automatic-updater.php:177
133
- msgid "We've successfully upgraded WordPress from version %1s to version %2s!"
 
134
  msgstr ""
135
 
136
- #: automatic-updater.php:223
137
  msgid "We found a plugin upgrade!"
138
  msgid_plural "We found upgrades for some plugins!"
139
  msgstr[0] ""
140
  msgstr[1] ""
141
 
142
- #. translators: First argument is the Plugin name, second argument is the error
143
- #. encountered while upgrading
144
- #: automatic-updater.php:229
145
- msgid "%1s: We encounted an error upgrading this plugin: %2s"
 
146
  msgstr ""
147
 
148
- #: automatic-updater.php:235 automatic-updater.php:295
149
- msgid "%1s: Successfully upgraded from version %2s to %3s!"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
150
  msgstr ""
151
 
152
- #: automatic-updater.php:283
153
  msgid "We found a theme upgrade!"
154
  msgid_plural "We found upgrades for some themes!"
155
  msgstr[0] ""
156
  msgstr[1] ""
157
 
158
- #. translators: First argument is the Theme name, second argument is the error
159
- #. encountered while upgrading
160
- #: automatic-updater.php:289
161
- msgid "%1s: We encounted an error upgrading this theme: %2s"
 
162
  msgstr ""
163
 
164
  #: automatic-updater.php:324
 
 
 
 
 
 
 
 
165
  msgid "We successfully upgraded from SVN!"
166
  msgstr ""
167
 
168
- #: automatic-updater.php:328
169
  msgid "While upgrading from SVN, we ran into the following error:"
170
  msgstr ""
171
 
172
- #: automatic-updater.php:344
173
- msgid "WordPress Update: %1s"
174
  msgstr ""
175
 
176
- #: automatic-updater.php:346
177
  msgid "Howdy!"
178
  msgstr ""
179
 
180
- #: automatic-updater.php:348
181
  msgid ""
182
- "Automatic Updater just ran on your site, %1s, with the following result:"
 
183
  msgstr ""
184
 
185
- #: automatic-updater.php:354
186
  msgid "Thanks for using the Automatic Updater plugin!"
187
  msgstr ""
188
 
189
- #: automatic-updater.php:358
190
  msgid "Debug Information:"
191
  msgstr ""
192
 
2
  # This file is distributed under the same license as the Automatic Updater package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Automatic Updater 0.7\n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/automatic-updater\n"
7
+ "POT-Creation-Date: 2012-11-18 21:43:46+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
12
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
  "Language-Team: LANGUAGE <LL@li.org>\n"
14
 
15
+ #. #-#-#-#-# plugin.pot (Automatic Updater 0.7) #-#-#-#-#
16
  #. Plugin Name of the plugin/theme
17
  #: admin.php:4 admin.php:48
18
  msgid "Automatic Updater"
68
  msgid "Update your themes automatically?"
69
  msgstr ""
70
 
71
+ #: admin.php:70
72
+ msgid "Notification Email"
73
+ msgstr ""
74
+
75
+ #: admin.php:71
76
+ msgid ""
77
+ "By default, Automatic Updater will send an email to the Site Admin when an "
78
+ "update is performed. If you would like to send that email to a different "
79
+ "address, you can set it here."
80
+ msgstr ""
81
+
82
+ #: admin.php:72
83
+ msgid "Override Email Address"
84
+ msgstr ""
85
+
86
+ #: admin.php:78
87
+ msgid ""
88
+ "If you don't want to receive an email when updates are installed, you can "
89
+ "disable them completely."
90
+ msgstr ""
91
+
92
+ #: admin.php:79
93
+ msgid "Disable email notifications."
94
+ msgstr ""
95
+
96
+ #: admin.php:87
97
  msgid "SVN Support"
98
  msgstr ""
99
 
100
+ #: admin.php:88
101
  msgid ""
102
  "It looks like you're running an SVN version of WordPress, that's cool! "
103
  "Automatic Updater can run <tt>svn up</tt> once an hour, to keep you up-to-"
105
  "core updates."
106
  msgstr ""
107
 
108
+ #: admin.php:93
109
  msgid ""
110
  "The .svn directory isn't writable, so <tt>svn up</tt> will probably fail "
111
+ "when the web server runs it. You need to give the user <tt>%s</tt> write "
112
  "permissions to your entire WordPress install, including .svn directories."
113
  msgstr ""
114
 
115
+ #: admin.php:96
116
  msgid "Run <tt>svn up</tt> hourly?"
117
  msgstr ""
118
 
119
+ #: admin.php:108
120
  msgid "Debug Information"
121
  msgstr ""
122
 
123
+ #: admin.php:109
124
  msgid "Show debug information in the notification email."
125
  msgstr ""
126
 
127
+ #: admin.php:110
128
  msgid "Save Changes"
129
  msgstr ""
130
 
131
+ #: admin.php:144
132
  msgid "Settings"
133
  msgstr ""
134
 
138
  "manually, then reactivate Automatic Updater."
139
  msgstr ""
140
 
141
+ #: automatic-updater.php:182
142
  msgid "While trying to upgrade WordPress, we ran into the following error:"
143
  msgstr ""
144
 
145
+ #: automatic-updater.php:184 automatic-updater.php:352
146
  msgid "We're sorry it didn't work out. Please try upgrading manually, instead."
147
  msgstr ""
148
 
149
+ #: automatic-updater.php:187
150
  msgid "We've successfully upgraded WordPress to the latest nightly build!"
151
  msgstr ""
152
 
153
+ #: automatic-updater.php:188 automatic-updater.php:192
154
  msgid "Have fun!"
155
  msgstr ""
156
 
157
+ #: automatic-updater.php:191
158
+ msgid ""
159
+ "We've successfully upgraded WordPress from version %1$s to version %2$s!"
160
  msgstr ""
161
 
162
+ #: automatic-updater.php:237
163
  msgid "We found a plugin upgrade!"
164
  msgid_plural "We found upgrades for some plugins!"
165
  msgstr[0] ""
166
  msgstr[1] ""
167
 
168
+ #. translators: First argument is the plugin url, second argument is the Plugin
169
+ #. name, third argument is the error encountered while upgrading
170
+ #: automatic-updater.php:243
171
+ msgid ""
172
+ "<a href=\"%1$s\">%2$s</a>: We encounted an error upgrading this plugin: %3$s"
173
  msgstr ""
174
 
175
+ #. translators: First argument is the plugin url, second argument is the Plugin
176
+ #. name, third argument is the old version number, fourth argument is the new
177
+ #. version number
178
+ #. translators: First argument is the theme URL, second argument is the Theme
179
+ #. name, third argument is the old version number, fourth argument is the new
180
+ #. version number
181
+ #: automatic-updater.php:250 automatic-updater.php:314
182
+ msgid ""
183
+ "<a href=\"%1$s\">%2$s</a>: Successfully upgraded from version %3$s to %4$s!"
184
+ msgstr ""
185
+
186
+ #: automatic-updater.php:260
187
+ msgid ""
188
+ "Plugin authors depend on your feedback to make their plugins better, and the "
189
+ "WordPress community depends on plugin ratings for checking the quality of a "
190
+ "plugin. If you have a couple of minutes, click on the plugin names above, "
191
+ "and leave a Compatibility Vote or a Rating!"
192
  msgstr ""
193
 
194
+ #: automatic-updater.php:301
195
  msgid "We found a theme upgrade!"
196
  msgid_plural "We found upgrades for some themes!"
197
  msgstr[0] ""
198
  msgstr[1] ""
199
 
200
+ #. translators: First argument is the theme URL, second argument is the Theme
201
+ #. name, third argument is the error encountered while upgrading
202
+ #: automatic-updater.php:307
203
+ msgid ""
204
+ "<a href=\"%1$s\">%2$s</a>: We encounted an error upgrading this theme: %3$s"
205
  msgstr ""
206
 
207
  #: automatic-updater.php:324
208
+ msgid ""
209
+ "Theme authors depend on your feedback to make their plugins better, and the "
210
+ "WordPress community depends on theme ratings for checking the quality of a "
211
+ "theme. If you have a couple of minutes, click on the theme names above, and "
212
+ "leave a Compatibility Vote or a Rating!"
213
+ msgstr ""
214
+
215
+ #: automatic-updater.php:346
216
  msgid "We successfully upgraded from SVN!"
217
  msgstr ""
218
 
219
+ #: automatic-updater.php:350
220
  msgid "While upgrading from SVN, we ran into the following error:"
221
  msgstr ""
222
 
223
+ #: automatic-updater.php:370
224
+ msgid "WordPress Update: %s"
225
  msgstr ""
226
 
227
+ #: automatic-updater.php:376
228
  msgid "Howdy!"
229
  msgstr ""
230
 
231
+ #: automatic-updater.php:378
232
  msgid ""
233
+ "Automatic Updater just ran on your site, <a href=\"%1$s\">%1$s</a>, with the "
234
+ "following result:"
235
  msgstr ""
236
 
237
+ #: automatic-updater.php:384
238
  msgid "Thanks for using the Automatic Updater plugin!"
239
  msgstr ""
240
 
241
+ #: automatic-updater.php:388
242
  msgid "Debug Information:"
243
  msgstr ""
244
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://pento.net/donate/
4
  Tags: updates, core, plugins, themes, stable, nightly, svn, wordpress automatic upgrader
5
  Requires at least: 3.4
6
  Tested up to: 3.5
7
- Stable tag: 0.6.2
8
  License: GPL2+
9
 
10
  Automatically update WordPress, your themes and plugins! Never have to click the update button again!
@@ -41,6 +41,17 @@ There are some Actions and Filters provided, check the [Documentation](http://pe
41
 
42
  == Changelog ==
43
 
 
 
 
 
 
 
 
 
 
 
 
44
  = 0.6.3 =
45
  * ADDED: Taiwan Traditional Chinese (Taiwan 正體中文) (zh_TW) translation. Props [Pseric](http://www.freegroup.org/)
46
  * ADDED: Italian (it_IT) translation. Props Stefano Giolo.
4
  Tags: updates, core, plugins, themes, stable, nightly, svn, wordpress automatic upgrader
5
  Requires at least: 3.4
6
  Tested up to: 3.5
7
+ Stable tag: 0.6.3
8
  License: GPL2+
9
 
10
  Automatically update WordPress, your themes and plugins! Never have to click the update button again!
41
 
42
  == Changelog ==
43
 
44
+ = 0.7 =
45
+ * ADDED: Option to override where the update email is sent
46
+ * ADDED: 'auto_updater_notification_email_address' filter, for the update notification email address
47
+ * ADDED: Reminder in the notification email for users to mark the plugins/themes compatible
48
+ * ADDED: Option to disable notification emails
49
+ * CHANGED: Notification emails now send as HTML emails (for greater flexibility of information to include)
50
+ * UPDATED: Language POT file
51
+ * FIXED: Some strings were formatted incorrectly for translation
52
+ * FIXED: Escape all strings appropriately before displaying
53
+ * FIXED: SVN updates would cause hourly emails, regardless of an update occurring or not
54
+
55
  = 0.6.3 =
56
  * ADDED: Taiwan Traditional Chinese (Taiwan 正體中文) (zh_TW) translation. Props [Pseric](http://www.freegroup.org/)
57
  * ADDED: Italian (it_IT) translation. Props Stefano Giolo.
updater-skin.php CHANGED
@@ -28,13 +28,11 @@ class Auto_Updater_Skin extends WP_Upgrader_Skin {
28
  $string = vsprintf( $string, $args );
29
  }
30
 
31
- // Strip out HTML tags, and decode entities
32
- $string = strip_tags( $string );
33
- $string = html_entity_decode( $string );
34
- $string = str_replace( '&#8230;', '...', $string );
35
-
36
  $string = trim( $string );
37
 
 
 
 
38
  if ( empty( $string ) )
39
  return;
40
 
28
  $string = vsprintf( $string, $args );
29
  }
30
 
 
 
 
 
 
31
  $string = trim( $string );
32
 
33
+ // Only allow basic HTML in the messages
34
+ $string = wp_kses( $string, array( 'a' => array( 'href' ), 'br', 'em', 'strong' ) );
35
+
36
  if ( empty( $string ) )
37
  return;
38