BackUpWordPress - Version 2.4.2

Version Description

Download this release

Release Info

Developer willmot
Plugin Icon 128x128 BackUpWordPress
Version 2.4.2
Comparing to
See all releases

Code changes from version 2.4.1 to 2.4.2

admin/actions.php CHANGED
@@ -21,7 +21,7 @@ function hmbkp_request_delete_backup() {
21
  die;
22
 
23
  }
24
- add_action( 'load-tools_page_' . HMBKP_PLUGIN_SLUG, 'hmbkp_request_delete_backup' );
25
 
26
  /**
27
  * Enable support and then redirect back to the backups page
@@ -39,7 +39,7 @@ function hmbkp_request_enable_support() {
39
  die;
40
 
41
  }
42
- add_action( 'load-tools_page_' . HMBKP_PLUGIN_SLUG, 'hmbkp_request_enable_support' );
43
 
44
  /**
45
  * Delete a schedule and all it's backups and then redirect
@@ -58,7 +58,7 @@ function hmbkp_request_delete_schedule() {
58
  die;
59
 
60
  }
61
- add_action( 'load-tools_page_' . HMBKP_PLUGIN_SLUG, 'hmbkp_request_delete_schedule' );
62
 
63
  /**
64
  * Perform a manual backup via ajax
@@ -138,7 +138,7 @@ function hmbkp_request_download_backup() {
138
  die;
139
 
140
  }
141
- add_action( 'load-tools_page_' . HMBKP_PLUGIN_SLUG, 'hmbkp_request_download_backup' );
142
 
143
  /**
144
  * Cancels a running backup then redirect
@@ -162,7 +162,7 @@ function hmbkp_request_cancel_backup() {
162
  die;
163
 
164
  }
165
- add_action( 'load-tools_page_' . HMBKP_PLUGIN_SLUG, 'hmbkp_request_cancel_backup' );
166
 
167
  /**
168
  * Dismiss an error and then redirect
21
  die;
22
 
23
  }
24
+ add_action( 'load-' . HMBKP_ADMIN_PAGE, 'hmbkp_request_delete_backup' );
25
 
26
  /**
27
  * Enable support and then redirect back to the backups page
39
  die;
40
 
41
  }
42
+ add_action( 'load-' . HMBKP_ADMIN_PAGE, 'hmbkp_request_enable_support' );
43
 
44
  /**
45
  * Delete a schedule and all it's backups and then redirect
58
  die;
59
 
60
  }
61
+ add_action( 'load-' . HMBKP_ADMIN_PAGE, 'hmbkp_request_delete_schedule' );
62
 
63
  /**
64
  * Perform a manual backup via ajax
138
  die;
139
 
140
  }
141
+ add_action( 'load-' . HMBKP_ADMIN_PAGE, 'hmbkp_request_download_backup' );
142
 
143
  /**
144
  * Cancels a running backup then redirect
162
  die;
163
 
164
  }
165
+ add_action( 'load-' . HMBKP_ADMIN_PAGE, 'hmbkp_request_cancel_backup' );
166
 
167
  /**
168
  * Dismiss an error and then redirect
admin/backups.php CHANGED
@@ -37,7 +37,7 @@
37
 
38
  <?php endforeach; ?>
39
 
40
- <li><a class="colorbox" href="<?php esc_attr_e( esc_url( add_query_arg( array( 'action' => 'hmbkp_add_schedule_load' ), admin_url( 'admin-ajax.php' ) ) ) ); ?>"> + <?php _e( 'add schedule', 'hmbkp' ); ?></a></li>
41
 
42
  </ul>
43
 
37
 
38
  <?php endforeach; ?>
39
 
40
+ <li><a class="colorbox" href="<?php esc_attr_e( esc_url( add_query_arg( array( 'action' => 'hmbkp_add_schedule_load' ), is_multisite() ? admin_url( 'admin-ajax.php' ) : network_admin_url( 'admin-ajax.php' ) ) ) ); ?>"> + <?php _e( 'add schedule', 'hmbkp' ); ?></a></li>
41
 
42
  </ul>
43
 
admin/menu.php CHANGED
@@ -7,8 +7,13 @@
7
  * @return null
8
  */
9
  function hmbkp_admin_menu() {
10
- add_management_page( __( 'Manage Backups','hmbkp' ), __( 'Backups','hmbkp' ), ( defined( 'HMBKP_CAPABILITY' ) && HMBKP_CAPABILITY ) ? HMBKP_CAPABILITY : 'manage_options', HMBKP_PLUGIN_SLUG, 'hmbkp_manage_backups' );
 
 
 
 
11
  }
 
12
  add_action( 'admin_menu', 'hmbkp_admin_menu' );
13
 
14
  /**
@@ -31,7 +36,7 @@ function hmbkp_manage_backups() {
31
  function hmbkp_plugin_action_link( $links, $file ) {
32
 
33
  if ( strpos( $file, HMBKP_PLUGIN_SLUG ) !== false )
34
- array_push( $links, '<a href="tools.php?page=' . esc_attr( HMBKP_PLUGIN_SLUG ) . '">' . __( 'Backups', 'hmbkp' ) . '</a>' );
35
 
36
  return $links;
37
 
7
  * @return null
8
  */
9
  function hmbkp_admin_menu() {
10
+
11
+ if ( is_multisite() )
12
+ add_submenu_page( 'settings.php', __( 'Manage Backups','hmbkp' ), __( 'Backups','hmbkp' ), ( defined( 'HMBKP_CAPABILITY' ) && HMBKP_CAPABILITY ) ? HMBKP_CAPABILITY : 'manage_options', HMBKP_PLUGIN_SLUG, 'hmbkp_manage_backups' );
13
+ else
14
+ add_management_page( __( 'Manage Backups','hmbkp' ), __( 'Backups','hmbkp' ), ( defined( 'HMBKP_CAPABILITY' ) && HMBKP_CAPABILITY ) ? HMBKP_CAPABILITY : 'manage_options', HMBKP_PLUGIN_SLUG, 'hmbkp_manage_backups' );
15
  }
16
+ add_action( 'network_admin_menu', 'hmbkp_admin_menu' );
17
  add_action( 'admin_menu', 'hmbkp_admin_menu' );
18
 
19
  /**
36
  function hmbkp_plugin_action_link( $links, $file ) {
37
 
38
  if ( strpos( $file, HMBKP_PLUGIN_SLUG ) !== false )
39
+ array_push( $links, '<a href="' . esc_url( HMBKP_ADMIN_URL ) . '">' . __( 'Backups', 'hmbkp' ) . '</a>' );
40
 
41
  return $links;
42
 
admin/page.php CHANGED
@@ -11,7 +11,7 @@
11
 
12
  <?php } else { ?>
13
 
14
- <a id="intercom-info" class="colorbox add-new-h2" href="<?php echo wp_nonce_url( add_query_arg( array( 'action' => 'load_enable_support' ), admin_url( 'admin-ajax.php' ) ), 'hmbkp_nonce' ); ?>">Enable Support</a>
15
 
16
  <?php } ?>
17
 
11
 
12
  <?php } else { ?>
13
 
14
+ <a id="intercom-info" class="colorbox add-new-h2" href="<?php echo wp_nonce_url( add_query_arg( array( 'action' => 'load_enable_support' ), is_multisite() ? admin_url( 'admin-ajax.php' ) : network_admin_url( 'admin-ajax.php' ) ), 'hmbkp_nonce' ); ?>">Enable Support</a>
15
 
16
  <?php } ?>
17
 
assets/hmbkp.css CHANGED
@@ -38,14 +38,15 @@ tfoot p { margin: 0; font-weight: normal; }
38
  .hmbkp-form label > input[type="text"], .hmbkp-form label > select, .hmbkp-form label > input[type="password"] { min-width: 200px; }
39
  .hmbkp-form label > input[type="checkbox"] { margin-top: 6px; }
40
  .hmbkp-form label .description { line-height: 16px; margin-top: 10px; float: none; }
41
- .hmbkp-form p.submit { margin: 20px 0 0; padding: 0; }
42
  .hmbkp-form .button-primary { float: right; }
43
  .hmbkp-form [type="number"] { min-width: 50px; width: 50px; }
44
  .hmbkp-error span { position: absolute; top: -14px; right: 1px; color: #FFF; background-color: red; white-space: nowrap; line-height: 16px; font-size: 11px; padding: 0 3px; border-radius: 3px 3px 0 0; }
45
  .hmbkp-error input[type], .hmbkp-error select { border-color: red; border-top-right-radius: 0; }
 
46
 
47
  .hmbkp-form ul { width: 320px; overflow: hidden; }
48
- .hmbkp-form ul.hmbkp_file_list { background-color: #FFF; max-height: 200px; overflow-y: scroll; display: block; border-radius: 4px; box-sizing: border-box; clear: both; box-shadow: inset 0px 0px 2px #CCC; font-size: 11px; }
49
  .hmbkp_file_list li { margin: 0; padding: 5px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 16px; }
50
  .hmbkp_file_list li + li { border-top: 1px dotted #CCC; }
51
 
38
  .hmbkp-form label > input[type="text"], .hmbkp-form label > select, .hmbkp-form label > input[type="password"] { min-width: 200px; }
39
  .hmbkp-form label > input[type="checkbox"] { margin-top: 6px; }
40
  .hmbkp-form label .description { line-height: 16px; margin-top: 10px; float: none; }
41
+ .hmbkp-form p.submit { margin:0; padding:0; }
42
  .hmbkp-form .button-primary { float: right; }
43
  .hmbkp-form [type="number"] { min-width: 50px; width: 50px; }
44
  .hmbkp-error span { position: absolute; top: -14px; right: 1px; color: #FFF; background-color: red; white-space: nowrap; line-height: 16px; font-size: 11px; padding: 0 3px; border-radius: 3px 3px 0 0; }
45
  .hmbkp-error input[type], .hmbkp-error select { border-color: red; border-top-right-radius: 0; }
46
+ .hmbkp-edit-schedule-excludes-form .code{word-break: break-word;}
47
 
48
  .hmbkp-form ul { width: 320px; overflow: hidden; }
49
+ .hmbkp-form ul.hmbkp_file_list { background-color: #FFF; display: block; border-radius: 4px; box-sizing: border-box; clear: both; box-shadow: inset 0px 0px 2px #CCC; font-size: 11px; }
50
  .hmbkp_file_list li { margin: 0; padding: 5px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 16px; }
51
  .hmbkp_file_list li + li { border-top: 1px dotted #CCC; }
52
 
assets/hmbkp.js CHANGED
@@ -19,14 +19,20 @@ jQuery( document ).ready( function( $ ) {
19
  if ( ! $( '.subsubsub a.current' ).size() )
20
  $( '.subsubsub li:first a').addClass( 'current' );
21
 
 
 
 
 
 
 
22
  // Initialize colorbox
23
  $( '.colorbox' ).colorbox( {
24
  'initialWidth' : '320px',
25
  'initialHeight' : '100px',
26
  'transition' : 'elastic',
27
- 'scrolling' : false,
28
  'innerWidth' : "320px",
29
- 'maxHeight' : "100%",
30
  'escKey' : false,
31
  'overlayClose' : false,
32
  'onLoad' : function() {
@@ -38,16 +44,13 @@ jQuery( document ).ready( function( $ ) {
38
 
39
  if ( $( ".hmbkp-form p.submit:contains('" + hmbkp.update + "')" ).size() )
40
  $( '<button type="button" class="button-secondary hmbkp-colorbox-close">' + hmbkp.cancel + '</button>' ).appendTo( '.hmbkp-form p.submit' );
41
-
42
- $.colorbox.resize();
43
-
44
  }
45
 
46
  } );
47
 
48
  // Resize the colorbox when switching tabs
49
  $( document).on( 'click', '.ui-tabs-anchor', function( e ) {
50
- $.colorbox.resize();
51
  } );
52
 
53
  // Show delete confirm message for delete schedule
@@ -101,7 +104,7 @@ jQuery( document ).ready( function( $ ) {
101
 
102
  $( '.hmbkp-edit-schedule-excludes-form' ).addClass( 'hmbkp-exclude-preview-open' );
103
 
104
- $.colorbox.resize();
105
 
106
  }
107
  )
@@ -133,8 +136,6 @@ jQuery( document ).ready( function( $ ) {
133
 
134
  $( '.hmbkp-edit-schedule-excludes-form' ).removeClass( 'hmbkp-exclude-preview-open' );
135
 
136
- $.colorbox.resize();
137
-
138
  } );
139
 
140
  // Add exclude rule
@@ -149,7 +150,7 @@ jQuery( document ).ready( function( $ ) {
149
  $( '.hmbkp-edit-schedule-excludes-form' ).replaceWith( data );
150
  $( '.hmbkp-edit-schedule-excludes-form' ).show();
151
  $( '.hmbkp-tabs' ).tabs();
152
- $.colorbox.resize();
153
  }
154
  );
155
 
@@ -160,7 +161,7 @@ jQuery( document ).ready( function( $ ) {
160
 
161
  $( this ).addClass( 'hmbkp-ajax-loading' ).text( '' );
162
 
163
- $.colorbox.resize();
164
 
165
  e.preventDefault();
166
 
@@ -171,7 +172,7 @@ jQuery( document ).ready( function( $ ) {
171
  $( '.hmbkp-edit-schedule-excludes-form' ).replaceWith( data );
172
  $( '.hmbkp-edit-schedule-excludes-form' ).show();
173
  $( '.hmbkp-tabs' ).tabs();
174
- $.colorbox.resize();
175
  }
176
  );
177
 
@@ -337,13 +338,13 @@ function catchResponseAndOfferToEmail( data ) {
337
 
338
  jQuery.colorbox( {
339
  'innerWidth' : "320px",
340
- 'maxHeight' : "100%",
341
  'html' : data,
342
  'overlayClose' : false,
343
  'escKey' : false,
344
  'onLoad' : function() {
345
  jQuery( '#cboxClose' ).remove();
346
- jQuery.colorbox.resize();
347
  }
348
  } );
349
 
19
  if ( ! $( '.subsubsub a.current' ).size() )
20
  $( '.subsubsub li:first a').addClass( 'current' );
21
 
22
+ // Carries the same resize options we want
23
+ // to use to all other .resize()
24
+ var resize_options = {
25
+ height: '85%'
26
+ };
27
+
28
  // Initialize colorbox
29
  $( '.colorbox' ).colorbox( {
30
  'initialWidth' : '320px',
31
  'initialHeight' : '100px',
32
  'transition' : 'elastic',
33
+ 'scrolling' : true,
34
  'innerWidth' : "320px",
35
+ 'maxHeight' : resize_options.height, //85% Takes into account the WP Admin bar.
36
  'escKey' : false,
37
  'overlayClose' : false,
38
  'onLoad' : function() {
44
 
45
  if ( $( ".hmbkp-form p.submit:contains('" + hmbkp.update + "')" ).size() )
46
  $( '<button type="button" class="button-secondary hmbkp-colorbox-close">' + hmbkp.cancel + '</button>' ).appendTo( '.hmbkp-form p.submit' );
 
 
 
47
  }
48
 
49
  } );
50
 
51
  // Resize the colorbox when switching tabs
52
  $( document).on( 'click', '.ui-tabs-anchor', function( e ) {
53
+ $.colorbox.resize(resize_options);
54
  } );
55
 
56
  // Show delete confirm message for delete schedule
104
 
105
  $( '.hmbkp-edit-schedule-excludes-form' ).addClass( 'hmbkp-exclude-preview-open' );
106
 
107
+ $.colorbox.resize(resize_options);
108
 
109
  }
110
  )
136
 
137
  $( '.hmbkp-edit-schedule-excludes-form' ).removeClass( 'hmbkp-exclude-preview-open' );
138
 
 
 
139
  } );
140
 
141
  // Add exclude rule
150
  $( '.hmbkp-edit-schedule-excludes-form' ).replaceWith( data );
151
  $( '.hmbkp-edit-schedule-excludes-form' ).show();
152
  $( '.hmbkp-tabs' ).tabs();
153
+ $.colorbox.resize(resize_options);
154
  }
155
  );
156
 
161
 
162
  $( this ).addClass( 'hmbkp-ajax-loading' ).text( '' );
163
 
164
+ $.colorbox.resize(resize_options);
165
 
166
  e.preventDefault();
167
 
172
  $( '.hmbkp-edit-schedule-excludes-form' ).replaceWith( data );
173
  $( '.hmbkp-edit-schedule-excludes-form' ).show();
174
  $( '.hmbkp-tabs' ).tabs();
175
+ $.colorbox.resize(resize_options);
176
  }
177
  );
178
 
338
 
339
  jQuery.colorbox( {
340
  'innerWidth' : "320px",
341
+ 'maxHeight' : "85%",
342
  'html' : data,
343
  'overlayClose' : false,
344
  'escKey' : false,
345
  'onLoad' : function() {
346
  jQuery( '#cboxClose' ).remove();
347
+ jQuery.colorbox.resize(resize_options);
348
  }
349
  } );
350
 
backupwordpress.php CHANGED
@@ -5,7 +5,7 @@ Plugin Name: BackUpWordPress
5
  Plugin URI: http://hmn.md/backupwordpress/
6
  Description: Simple automated backups of your WordPress powered website. Once activated you'll find me under <strong>Tools &rarr; Backups</strong>.
7
  Author: Human Made Limited
8
- Version: 2.4.1
9
  Author URI: http://hmn.md/
10
  */
11
 
@@ -38,8 +38,13 @@ if ( ! defined( 'HMBKP_PLUGIN_URL' ) )
38
 
39
  define( 'HMBKP_PLUGIN_LANG_DIR', apply_filters( 'hmbkp_filter_lang_dir', HMBKP_PLUGIN_SLUG . '/languages/' ) );
40
 
41
- if ( ! defined( 'HMBKP_ADMIN_URL' ) )
42
- define( 'HMBKP_ADMIN_URL', add_query_arg( 'page', HMBKP_PLUGIN_SLUG, admin_url( 'tools.php' ) ) );
 
 
 
 
 
43
 
44
  $key = array( ABSPATH, time() );
45
 
@@ -79,6 +84,16 @@ if ( ! defined( 'WEEK_IN_SECONDS' ) )
79
  if ( ! defined( 'YEAR_IN_SECONDS' ) )
80
  define( 'YEAR_IN_SECONDS', 365 * DAY_IN_SECONDS );
81
 
 
 
 
 
 
 
 
 
 
 
82
  // Load the admin menu
83
  require_once( HMBKP_PLUGIN_PATH . '/admin/menu.php' );
84
  require_once( HMBKP_PLUGIN_PATH . '/admin/actions.php' );
@@ -177,7 +192,9 @@ function hmbkp_load_scripts() {
177
  );
178
 
179
  }
180
- add_action( 'admin_print_scripts-tools_page_backupwordpress', 'hmbkp_load_scripts' );
 
 
181
 
182
  /**
183
  * Load Intercom and send across user information and server info
@@ -221,7 +238,9 @@ function hmbkp_load_intercom_script() {
221
  <script>(function(){var w=window;var ic=w.Intercom;if(typeof ic==="function"){ic('reattach_activator');ic('update',intercomSettings);}else{var d=document;var i=function(){i.c(arguments)};i.q=[];i.c=function(args){i.q.push(args)};w.Intercom=i;function l(){var s=d.createElement('script');s.type='text/javascript';s.async=true;s.src='https://static.intercomcdn.com/intercom.v1.js';var x=d.getElementsByTagName('script')[0];x.parentNode.insertBefore(s,x);}if(w.attachEvent){w.attachEvent('onload',l);}else{w.addEventListener('load',l,false);}};})()</script>
222
 
223
  <?php }
224
- add_action( 'admin_footer-tools_page_backupwordpress', 'hmbkp_load_intercom_script' );
 
 
225
 
226
  function hmbkp_load_styles(){
227
 
@@ -229,8 +248,7 @@ function hmbkp_load_styles(){
229
  wp_enqueue_style( 'hmbkp', HMBKP_PLUGIN_URL . 'assets/hmbkp.css', false, HMBKP_VERSION );
230
 
231
  }
232
- add_action( 'admin_print_styles-tools_page_backupwordpress', 'hmbkp_load_styles' );
233
-
234
 
235
  /**
236
  * Function to run when the schedule cron fires
@@ -292,4 +310,28 @@ function hmbkp_display_server_info_tab() {
292
  );
293
 
294
  }
295
- add_action( 'load-tools_page_backupwordpress', 'hmbkp_display_server_info_tab' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  Plugin URI: http://hmn.md/backupwordpress/
6
  Description: Simple automated backups of your WordPress powered website. Once activated you'll find me under <strong>Tools &rarr; Backups</strong>.
7
  Author: Human Made Limited
8
+ Version: 2.4.2
9
  Author URI: http://hmn.md/
10
  */
11
 
38
 
39
  define( 'HMBKP_PLUGIN_LANG_DIR', apply_filters( 'hmbkp_filter_lang_dir', HMBKP_PLUGIN_SLUG . '/languages/' ) );
40
 
41
+ if ( ! defined( 'HMBKP_ADMIN_URL' ) ) {
42
+ if ( is_multisite() )
43
+ define( 'HMBKP_ADMIN_URL', add_query_arg( 'page', HMBKP_PLUGIN_SLUG, network_admin_url( 'settings.php' ) ) );
44
+ else
45
+ define( 'HMBKP_ADMIN_URL', add_query_arg( 'page', HMBKP_PLUGIN_SLUG, admin_url( 'tools.php' ) ) );
46
+ }
47
+
48
 
49
  $key = array( ABSPATH, time() );
50
 
84
  if ( ! defined( 'YEAR_IN_SECONDS' ) )
85
  define( 'YEAR_IN_SECONDS', 365 * DAY_IN_SECONDS );
86
 
87
+ if ( ! defined( 'HMBKP_ADMIN_PAGE' ) ) {
88
+
89
+ if ( is_multisite() )
90
+ define( 'HMBKP_ADMIN_PAGE', 'settings_page_' . HMBKP_PLUGIN_SLUG );
91
+ else
92
+ define( 'HMBKP_ADMIN_PAGE', 'tools_page_' . HMBKP_PLUGIN_SLUG );
93
+
94
+ }
95
+
96
+
97
  // Load the admin menu
98
  require_once( HMBKP_PLUGIN_PATH . '/admin/menu.php' );
99
  require_once( HMBKP_PLUGIN_PATH . '/admin/actions.php' );
192
  );
193
 
194
  }
195
+ add_action( 'admin_print_scripts-' . HMBKP_ADMIN_PAGE, 'hmbkp_load_scripts' );
196
+
197
+
198
 
199
  /**
200
  * Load Intercom and send across user information and server info
238
  <script>(function(){var w=window;var ic=w.Intercom;if(typeof ic==="function"){ic('reattach_activator');ic('update',intercomSettings);}else{var d=document;var i=function(){i.c(arguments)};i.q=[];i.c=function(args){i.q.push(args)};w.Intercom=i;function l(){var s=d.createElement('script');s.type='text/javascript';s.async=true;s.src='https://static.intercomcdn.com/intercom.v1.js';var x=d.getElementsByTagName('script')[0];x.parentNode.insertBefore(s,x);}if(w.attachEvent){w.attachEvent('onload',l);}else{w.addEventListener('load',l,false);}};})()</script>
239
 
240
  <?php }
241
+ add_action( 'admin_footer-' . HMBKP_ADMIN_PAGE, 'hmbkp_load_intercom_script' );
242
+
243
+
244
 
245
  function hmbkp_load_styles(){
246
 
248
  wp_enqueue_style( 'hmbkp', HMBKP_PLUGIN_URL . 'assets/hmbkp.css', false, HMBKP_VERSION );
249
 
250
  }
251
+ add_action( 'admin_print_styles-' . HMBKP_ADMIN_PAGE, 'hmbkp_load_styles' );
 
252
 
253
  /**
254
  * Function to run when the schedule cron fires
310
  );
311
 
312
  }
313
+ add_action( 'load-' . HMBKP_ADMIN_PAGE, 'hmbkp_display_server_info_tab' );
314
+
315
+ /**
316
+ * Ensure BackUpWordPress is loaded before addons
317
+ */
318
+ function hmbkp_load_first() {
319
+
320
+ $active_plugins = get_option( 'active_plugins' );
321
+
322
+ $plugin_path = plugin_basename( __FILE__ );
323
+
324
+ $key = array_search( $plugin_path, $active_plugins );
325
+
326
+ if ( $key > 0 ) {
327
+
328
+ array_splice( $active_plugins, $key, 1 );
329
+
330
+ array_unshift( $active_plugins, $plugin_path );
331
+
332
+ update_option( 'active_plugins', $active_plugins );
333
+
334
+ }
335
+
336
+ }
337
+ add_action( 'activated_plugin', 'hmbkp_load_first' );
classes/class-email.php CHANGED
@@ -164,7 +164,7 @@ class HMBKP_Email_Service extends HMBKP_Service {
164
  $subject = sprintf( __( 'Backup of %s', 'hmbkp' ), $domain );
165
 
166
  // If it's larger than the max attachment size limit assume it's not going to be able to send the backup
167
- if ( filesize( $file ) < hmbkp_get_max_attachment_size() ) {
168
 
169
  $message = sprintf( __( 'BackUpWordPress has completed a backup of your site %1$s.', 'hmbkp' ) . "\n\n" . __( 'The backup file should be attached to this email.', 'hmbkp' ) . "\n\n" . __( 'You can download the backup file by clicking the link below:', 'hmbkp' ) . "\n\n" . '%2$s' . "\n\n" . __( "Kind Regards,\nThe Happy BackUpWordPress Backup Emailing Robot", 'hmbkp' ), home_url(), $download );
170
 
164
  $subject = sprintf( __( 'Backup of %s', 'hmbkp' ), $domain );
165
 
166
  // If it's larger than the max attachment size limit assume it's not going to be able to send the backup
167
+ if ( @filesize( $file ) < hmbkp_get_max_attachment_size() ) {
168
 
169
  $message = sprintf( __( 'BackUpWordPress has completed a backup of your site %1$s.', 'hmbkp' ) . "\n\n" . __( 'The backup file should be attached to this email.', 'hmbkp' ) . "\n\n" . __( 'You can download the backup file by clicking the link below:', 'hmbkp' ) . "\n\n" . '%2$s' . "\n\n" . __( "Kind Regards,\nThe Happy BackUpWordPress Backup Emailing Robot", 'hmbkp' ), home_url(), $download );
170
 
classes/class-requirements.php CHANGED
@@ -251,6 +251,9 @@ class HMBKP_Requirement_PHP_User extends HMBKP_Requirement {
251
  */
252
  protected function test() {
253
 
 
 
 
254
  return shell_exec( 'whoami' );
255
 
256
  }
@@ -274,6 +277,9 @@ class HMBKP_Requirement_PHP_Group extends HMBKP_Requirement {
274
  */
275
  protected function test() {
276
 
 
 
 
277
  return shell_exec( 'groups' );
278
 
279
  }
@@ -557,9 +563,13 @@ class HMBKP_Requirement_Calculated_Size extends HMBKP_Requirement {
557
  */
558
  protected function test() {
559
 
560
- $schedule = new HMBKP_Scheduled_Backup( 'support' );
 
 
 
 
561
 
562
- return $schedule->get_formatted_file_size();
563
 
564
  }
565
 
251
  */
252
  protected function test() {
253
 
254
+ if ( ! HM_Backup::is_shell_exec_available() )
255
+ return '';
256
+
257
  return shell_exec( 'whoami' );
258
 
259
  }
277
  */
278
  protected function test() {
279
 
280
+ if ( ! HM_Backup::is_shell_exec_available() )
281
+ return '';
282
+
283
  return shell_exec( 'groups' );
284
 
285
  }
563
  */
564
  protected function test() {
565
 
566
+ $schedules = HMBKP_Schedules::get_instance();
567
+
568
+ foreach ( $schedules->get_schedules() as $schedule )
569
+ if ( $schedule->is_filesize_cached() )
570
+ $backup_sizes[$schedule->get_id()] = $schedule->get_formatted_file_size();
571
 
572
+ return $backup_sizes;
573
 
574
  }
575
 
classes/class-schedule.php CHANGED
@@ -880,9 +880,11 @@ class HMBKP_Scheduled_Backup extends HM_Backup {
880
  $excluded = array();
881
 
882
  // Leftover backup folders can be either under content dir, or under the uploads dir
 
 
883
  $hmbkp_folders = array_merge(
884
  $this->find_backup_folders( 'backupwordpress-', WP_CONTENT_DIR ),
885
- $this->find_backup_folders( 'backupwordpress-', WP_CONTENT_DIR . '/uploads' )
886
  );
887
 
888
 
@@ -897,7 +899,7 @@ class HMBKP_Scheduled_Backup extends HM_Backup {
897
  'updraft' => trailingslashit( WP_CONTENT_DIR ) . trailingslashit( 'updraft' ),
898
  'wponlinebckp' => trailingslashit( WP_CONTENT_DIR ) . trailingslashit( 'backups' ),
899
  'duplicator' => trailingslashit( ABSPATH ) . trailingslashit( 'wp-snapshots' ),
900
- 'backupbuddy' => trailingslashit( WP_CONTENT_DIR ) . trailingslashit( 'uploads/backupbuddy_backups' ),
901
  'wpdbmanager' => trailingslashit( WP_CONTENT_DIR ) . trailingslashit( 'backup-db' ),
902
  'supercache' => trailingslashit( WP_CONTENT_DIR ) . trailingslashit( 'cache' )
903
  );
@@ -927,15 +929,21 @@ class HMBKP_Scheduled_Backup extends HM_Backup {
927
 
928
  $found_folders = array();
929
 
930
- foreach ( glob( $haystack . '/*', GLOB_ONLYDIR | GLOB_NOSORT ) as $folder ) {
 
 
 
 
931
 
932
- $pos = strpos( $folder, $needle );
933
 
934
- $default_path = get_option( 'hmbkp_default_path' );
935
 
936
- if ( ( false !== $pos ) && ( $folder !== $default_path ) ) {
937
 
938
- $found_folders[] = trailingslashit( $folder );
 
 
939
 
940
  }
941
 
880
  $excluded = array();
881
 
882
  // Leftover backup folders can be either under content dir, or under the uploads dir
883
+ $hmn_upload_dir = wp_upload_dir();
884
+
885
  $hmbkp_folders = array_merge(
886
  $this->find_backup_folders( 'backupwordpress-', WP_CONTENT_DIR ),
887
+ $this->find_backup_folders( 'backupwordpress-', $hmn_upload_dir['path'] )
888
  );
889
 
890
 
899
  'updraft' => trailingslashit( WP_CONTENT_DIR ) . trailingslashit( 'updraft' ),
900
  'wponlinebckp' => trailingslashit( WP_CONTENT_DIR ) . trailingslashit( 'backups' ),
901
  'duplicator' => trailingslashit( ABSPATH ) . trailingslashit( 'wp-snapshots' ),
902
+ 'backupbuddy' => trailingslashit( $hmn_upload_dir['path'] ) . trailingslashit( 'backupbuddy_backups' ),
903
  'wpdbmanager' => trailingslashit( WP_CONTENT_DIR ) . trailingslashit( 'backup-db' ),
904
  'supercache' => trailingslashit( WP_CONTENT_DIR ) . trailingslashit( 'cache' )
905
  );
929
 
930
  $found_folders = array();
931
 
932
+ $folders_to_search = glob( $haystack . '/*', GLOB_ONLYDIR | GLOB_NOSORT );
933
+
934
+ if ( ! empty( $folders_to_search ) ) {
935
+
936
+ foreach ( $folders_to_search as $folder ) {
937
 
938
+ $pos = strpos( $folder, $needle );
939
 
940
+ $default_path = get_option( 'hmbkp_default_path' );
941
 
942
+ if ( ( false !== $pos ) && ( $folder !== $default_path ) ) {
943
 
944
+ $found_folders[] = trailingslashit( $folder );
945
+
946
+ }
947
 
948
  }
949
 
functions/interface.php CHANGED
@@ -9,7 +9,16 @@
9
  function hmbkp_get_backup_row( $file, HMBKP_Scheduled_Backup $schedule ) {
10
 
11
  $encoded_file = urlencode( base64_encode( $file ) );
12
- $offset = get_option( 'gmt_offset' ) * 3600; ?>
 
 
 
 
 
 
 
 
 
13
 
14
  <tr class="hmbkp_manage_backups_row<?php if ( file_exists( hmbkp_path() . '/.backup_complete' ) ) : ?> completed<?php unlink( hmbkp_path() . '/.backup_complete' ); endif; ?>">
15
 
@@ -26,10 +35,10 @@ function hmbkp_get_backup_row( $file, HMBKP_Scheduled_Backup $schedule ) {
26
  <td>
27
 
28
  <?php if ( hmbkp_is_path_accessible( hmbkp_path() ) ) : ?>
29
- <a href="<?php echo wp_nonce_url( admin_url( 'tools.php?page=' . HMBKP_PLUGIN_SLUG . '&amp;hmbkp_download_backup=' . $encoded_file . '&amp;hmbkp_schedule_id=' . $schedule->get_id() ), 'hmbkp-download_backup' ); ?>"><?php _e( 'Download', 'hmbkp' ); ?></a> |
30
  <?php endif; ?>
31
 
32
- <a href="<?php echo wp_nonce_url( admin_url( 'tools.php?page=' . HMBKP_PLUGIN_SLUG . '&amp;hmbkp_delete_backup=' . $encoded_file . '&amp;hmbkp_schedule_id=' . $schedule->get_id() ), 'hmbkp-delete_backup' ); ?>" class="delete-action"><?php _e( 'Delete', 'hmbkp' ); ?></a>
33
 
34
  </td>
35
 
@@ -127,8 +136,13 @@ add_action( 'admin_head', 'hmbkp_admin_notices' );
127
  */
128
  function hmbkp_plugin_row( $plugins ) {
129
 
 
 
 
 
 
130
  if ( isset( $plugins[HMBKP_PLUGIN_SLUG . '/backupwordpress.php'] ) )
131
- $plugins[HMBKP_PLUGIN_SLUG . '/backupwordpress.php']['Description'] = str_replace( 'Once activated you\'ll find me under <strong>Tools &rarr; Backups</strong>', 'Find me under <strong><a href="' . admin_url( 'tools.php?page=' . HMBKP_PLUGIN_SLUG ) . '">Tools &rarr; Backups</a></strong>', $plugins[HMBKP_PLUGIN_SLUG . '/backupwordpress.php']['Description'] );
132
 
133
  return $plugins;
134
 
@@ -255,26 +269,31 @@ function hmbkp_human_get_type( $type, HMBKP_Scheduled_Backup $schedule = null )
255
  */
256
  function hmbkp_schedule_actions( HMBKP_Scheduled_Backup $schedule ) {
257
 
 
 
 
 
 
258
  // Start output buffering
259
  ob_start(); ?>
260
 
261
- <span class="hmbkp-status"><?php echo $schedule->get_status() ? wp_kses_data( $schedule->get_status() ) : __( 'Starting Backup', 'hmbkp' ); ?> <a href="<?php echo esc_url( add_query_arg( array( 'action' => 'hmbkp_cancel', 'hmbkp_schedule_id' => $schedule->get_id() ), HMBKP_ADMIN_URL ) ); ?>"><?php _e( 'cancel', 'hmbkp' ); ?></a></span>
262
 
263
  <div class="hmbkp-schedule-actions row-actions">
264
 
265
- <a class="colorbox" href="<?php echo esc_url( add_query_arg( array( 'action' => 'hmbkp_edit_schedule_load', 'hmbkp_schedule_id' => $schedule->get_id() ), admin_url( 'admin-ajax.php' ) ) ); ?>"><?php _e( 'Settings', 'hmbkp' ); ?></a> |
266
 
267
  <?php if ( $schedule->get_type() !== 'database' ) { ?>
268
- <a class="colorbox" href="<?php echo esc_url( add_query_arg( array( 'action' => 'hmbkp_edit_schedule_excludes_load', 'hmbkp_schedule_id' => $schedule->get_id() ), admin_url( 'admin-ajax.php' ) ) ); ?>"><?php _e( 'Excludes', 'hmbkp' ); ?></a> |
269
  <?php } ?>
270
 
271
  <?php // capture output
272
  $output = ob_get_clean();
273
  echo apply_filters( 'hmbkp_schedule_actions_menu', $output, $schedule ); ?>
274
 
275
- <a class="hmbkp-run" href="<?php echo esc_url( add_query_arg( array( 'action' => 'hmbkp_run_schedule', 'hmbkp_schedule_id' => $schedule->get_id() ), admin_url( 'admin-ajax.php' ) ) ); ?>"><?php _e( 'Run now', 'hmbkp' ); ?></a> |
276
 
277
- <a class="delete-action" href="<?php echo wp_nonce_url( add_query_arg( array( 'action' => 'hmbkp_delete_schedule', 'hmbkp_schedule_id' => $schedule->get_id() ), HMBKP_ADMIN_URL ), 'hmbkp-delete_schedule' ); ?>"><?php _e( 'Delete', 'hmbkp' ); ?></a>
278
 
279
  </div>
280
 
9
  function hmbkp_get_backup_row( $file, HMBKP_Scheduled_Backup $schedule ) {
10
 
11
  $encoded_file = urlencode( base64_encode( $file ) );
12
+ $offset = get_option( 'gmt_offset' ) * 3600;
13
+
14
+ if ( is_multisite() ) {
15
+ $delete_action_url = network_admin_url( 'settings.php?page=' . HMBKP_PLUGIN_SLUG . '&amp;hmbkp_delete_backup=' . $encoded_file . '&amp;hmbkp_schedule_id=' . $schedule->get_id() );
16
+ $download_action_url = network_admin_url( 'settings.php?page=' . HMBKP_PLUGIN_SLUG . '&amp;hmbkp_download_backup=' . $encoded_file . '&amp;hmbkp_schedule_id=' . $schedule->get_id() );
17
+ } else {
18
+ $delete_action_url = admin_url( 'tools.php?page=' . HMBKP_PLUGIN_SLUG . '&amp;hmbkp_delete_backup=' . $encoded_file . '&amp;hmbkp_schedule_id=' . $schedule->get_id() );
19
+ $download_action_url = admin_url( 'tools.php?page=' . HMBKP_PLUGIN_SLUG . '&amp;hmbkp_download_backup=' . $encoded_file . '&amp;hmbkp_schedule_id=' . $schedule->get_id() );
20
+ }
21
+ ?>
22
 
23
  <tr class="hmbkp_manage_backups_row<?php if ( file_exists( hmbkp_path() . '/.backup_complete' ) ) : ?> completed<?php unlink( hmbkp_path() . '/.backup_complete' ); endif; ?>">
24
 
35
  <td>
36
 
37
  <?php if ( hmbkp_is_path_accessible( hmbkp_path() ) ) : ?>
38
+ <a href="<?php echo wp_nonce_url( $download_action_url, 'hmbkp-download_backup' ); ?>"><?php _e( 'Download', 'hmbkp' ); ?></a> |
39
  <?php endif; ?>
40
 
41
+ <a href="<?php echo wp_nonce_url( $delete_action_url, 'hmbkp-delete_backup' ); ?>" class="delete-action"><?php _e( 'Delete', 'hmbkp' ); ?></a>
42
 
43
  </td>
44
 
136
  */
137
  function hmbkp_plugin_row( $plugins ) {
138
 
139
+ if ( is_multisite() )
140
+ $settings_url = network_admin_url( 'settings.php?page=' . HMBKP_PLUGIN_SLUG );
141
+ else
142
+ $settings_url = admin_url( 'tools.php?page=' . HMBKP_PLUGIN_SLUG );
143
+
144
  if ( isset( $plugins[HMBKP_PLUGIN_SLUG . '/backupwordpress.php'] ) )
145
+ $plugins[HMBKP_PLUGIN_SLUG . '/backupwordpress.php']['Description'] = str_replace( 'Once activated you\'ll find me under <strong>Tools &rarr; Backups</strong>', 'Find me under <strong><a href="' . esc_url( $settings_url ) . '">Tools &rarr; Backups</a></strong>', $plugins[HMBKP_PLUGIN_SLUG . '/backupwordpress.php']['Description'] );
146
 
147
  return $plugins;
148
 
269
  */
270
  function hmbkp_schedule_actions( HMBKP_Scheduled_Backup $schedule ) {
271
 
272
+ if ( is_multisite() )
273
+ $settings_url = network_admin_url( 'settings.php?page=' . HMBKP_PLUGIN_SLUG );
274
+ else
275
+ $settings_url = admin_url( 'tools.php?page=' . HMBKP_PLUGIN_SLUG );
276
+
277
  // Start output buffering
278
  ob_start(); ?>
279
 
280
+ <span class="hmbkp-status"><?php echo $schedule->get_status() ? wp_kses_data( $schedule->get_status() ) : __( 'Starting Backup', 'hmbkp' ); ?> <a href="<?php echo esc_url( add_query_arg( array( 'action' => 'hmbkp_cancel', 'hmbkp_schedule_id' => $schedule->get_id() ), $settings_url ) ); ?>"><?php _e( 'cancel', 'hmbkp' ); ?></a></span>
281
 
282
  <div class="hmbkp-schedule-actions row-actions">
283
 
284
+ <a class="colorbox" href="<?php echo esc_url( add_query_arg( array( 'action' => 'hmbkp_edit_schedule_load', 'hmbkp_schedule_id' => $schedule->get_id() ), is_multisite() ? admin_url( 'admin-ajax.php' ) : network_admin_url( 'admin-ajax.php' ) ) ); ?>"><?php _e( 'Settings', 'hmbkp' ); ?></a> |
285
 
286
  <?php if ( $schedule->get_type() !== 'database' ) { ?>
287
+ <a class="colorbox" href="<?php echo esc_url( add_query_arg( array( 'action' => 'hmbkp_edit_schedule_excludes_load', 'hmbkp_schedule_id' => $schedule->get_id() ), is_multisite() ? admin_url( 'admin-ajax.php' ) : network_admin_url( 'admin-ajax.php' ) ) ); ?>"><?php _e( 'Excludes', 'hmbkp' ); ?></a> |
288
  <?php } ?>
289
 
290
  <?php // capture output
291
  $output = ob_get_clean();
292
  echo apply_filters( 'hmbkp_schedule_actions_menu', $output, $schedule ); ?>
293
 
294
+ <a class="hmbkp-run" href="<?php echo esc_url( add_query_arg( array( 'action' => 'hmbkp_run_schedule', 'hmbkp_schedule_id' => $schedule->get_id() ), is_multisite() ? admin_url( 'admin-ajax.php' ) : network_admin_url( 'admin-ajax.php' ) ) ); ?>"><?php _e( 'Run now', 'hmbkp' ); ?></a> |
295
 
296
+ <a class="delete-action" href="<?php echo wp_nonce_url( add_query_arg( array( 'action' => 'hmbkp_delete_schedule', 'hmbkp_schedule_id' => $schedule->get_id() ), $settings_url ), 'hmbkp-delete_schedule' ); ?>"><?php _e( 'Delete', 'hmbkp' ); ?></a>
297
 
298
  </div>
299
 
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: humanmade, willmot, pauldewouters, joehoyle, mattheu, tcrsavage, c
3
  Tags: back up, backup, backups, database, zip, db, files, archive, wp-cli, humanmade
4
  Requires at least: 3.3.3
5
  Tested up to: 3.8
6
- Stable tag: 2.4.1
7
 
8
  Simple automated back ups of your WordPress powered website.
9
 
@@ -103,6 +103,14 @@ You can also tweet <a href="http://twitter.com/humanmadeltd">@humanmadeltd</a> o
103
 
104
  == Changelog ==
105
 
 
 
 
 
 
 
 
 
106
  #### 2.4.1
107
 
108
  * Add missing colorbox images
3
  Tags: back up, backup, backups, database, zip, db, files, archive, wp-cli, humanmade
4
  Requires at least: 3.3.3
5
  Tested up to: 3.8
6
+ Stable tag: 2.4.2
7
 
8
  Simple automated back ups of your WordPress powered website.
9
 
103
 
104
  == Changelog ==
105
 
106
+ #### 2.4.2
107
+
108
+ * In WordPress Multisite the backups admin page is now located in Network admin instead of the wp-admin of the main site.
109
+ * Fixed an issue with the new intercom support integration that could cause loading the backups page to timeout
110
+ * Fixed 3 stray PHP warnings.
111
+ * BackUpWordPress will now always be loaded before any BackUpWordPress Extensions.
112
+ * Fixed an issue that could cause a long modal (excludes) to show underneath the WP admin bar.
113
+
114
  #### 2.4.1
115
 
116
  * Add missing colorbox images