Migration, Backup, Staging – WPvivid - Version 0.9.36

Version Description

  • Added an option to overwrite existing pages in an import.
  • Fixed: Could not retrieve posts list on a multilingual site in an export.
  • Fixed some bugs in the plugin code and optimized the plugin code.
Download this release

Release Info

Developer wpvivid
Plugin Icon 128x128 Migration, Backup, Staging – WPvivid
Version 0.9.36
Comparing to
See all releases

Code changes from version 0.9.35 to 0.9.36

admin/class-wpvivid-admin.php CHANGED
@@ -83,6 +83,7 @@ class WPvivid_Admin {
83
  $screen_ids[]='wpvivid-backup_page_wpvivid-log';
84
  $screen_ids[]='wpvivid-backup_page_wpvivid-key';
85
  $screen_ids[]='wpvivid-backup_page_wpvivid-mainwp';
 
86
  return $screen_ids;
87
  }
88
 
@@ -203,7 +204,7 @@ class WPvivid_Admin {
203
  if(in_array(get_current_screen()->id,$this->screen_ids))
204
  {
205
  wp_enqueue_script($this->plugin_name, WPVIVID_PLUGIN_DIR_URL . 'js/wpvivid-admin.js', array('jquery'), $this->version, false);
206
- wp_localize_script($this->plugin_name, 'ajax_object', array('ajax_url' => admin_url('admin-ajax.php')));
207
 
208
  wp_enqueue_script('plupload-all');
209
  do_action('wpvivid_do_enqueue_scripts');
@@ -617,6 +618,7 @@ class WPvivid_Admin {
617
  $page_array['website_info'] = array('index' => '6', 'tab_func' => array($this, 'wpvivid_add_tab_website_info'), 'page_func' => array($this, 'wpvivid_add_page_website_info'));
618
  $page_array['log'] = array('index' => '7', 'tab_func' => array($this, 'wpvivid_add_tab_log'), 'page_func' => array($this, 'wpvivid_add_page_log'));
619
  $page_array['read_log'] = array('index' => '9', 'tab_func' => array($this, 'wpvivid_add_tab_read_log'), 'page_func' => array($this, 'wpvivid_add_page_read_log'));
 
620
  $hide_mwp_tab_page = get_option('wpvivid_hide_mwp_tab_page_v1', false);
621
  if($hide_mwp_tab_page === false) {
622
  $page_array['mwp'] = array('index' => '30', 'tab_func' => array($this, 'wpvivid_add_tab_mwp'), 'page_func' => array($this, 'wpvivid_add_page_mwp'));
@@ -682,6 +684,12 @@ class WPvivid_Admin {
682
  <?php
683
  }
684
 
 
 
 
 
 
 
685
  public function wpvivid_add_page_backup()
686
  {
687
  ?>
@@ -954,7 +962,7 @@ class WPvivid_Admin {
954
  */
955
  function wpvivid_download_website_info(){
956
  wpvivid_location_href=true;
957
- location.href =ajaxurl+'?action=wpvivid_create_debug_package';
958
  }
959
 
960
  jQuery("#wpvivid_debug_type").change(function()
@@ -1189,4 +1197,121 @@ class WPvivid_Admin {
1189
  </script>
1190
  <?php
1191
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1192
  }
83
  $screen_ids[]='wpvivid-backup_page_wpvivid-log';
84
  $screen_ids[]='wpvivid-backup_page_wpvivid-key';
85
  $screen_ids[]='wpvivid-backup_page_wpvivid-mainwp';
86
+ $screen_ids[]='wpvivid-backup_page_wpvivid_premium';
87
  return $screen_ids;
88
  }
89
 
204
  if(in_array(get_current_screen()->id,$this->screen_ids))
205
  {
206
  wp_enqueue_script($this->plugin_name, WPVIVID_PLUGIN_DIR_URL . 'js/wpvivid-admin.js', array('jquery'), $this->version, false);
207
+ wp_localize_script($this->plugin_name, 'wpvivid_ajax_object', array('ajax_url' => admin_url('admin-ajax.php'),'ajax_nonce'=>wp_create_nonce('wpvivid_ajax')));
208
 
209
  wp_enqueue_script('plupload-all');
210
  do_action('wpvivid_do_enqueue_scripts');
618
  $page_array['website_info'] = array('index' => '6', 'tab_func' => array($this, 'wpvivid_add_tab_website_info'), 'page_func' => array($this, 'wpvivid_add_page_website_info'));
619
  $page_array['log'] = array('index' => '7', 'tab_func' => array($this, 'wpvivid_add_tab_log'), 'page_func' => array($this, 'wpvivid_add_page_log'));
620
  $page_array['read_log'] = array('index' => '9', 'tab_func' => array($this, 'wpvivid_add_tab_read_log'), 'page_func' => array($this, 'wpvivid_add_page_read_log'));
621
+ $page_array['premium'] = array('index' => '29', 'tab_func' => array($this, 'wpvivid_add_tab_premium'), 'page_func' => array($this, 'wpvivid_add_page_premium'));
622
  $hide_mwp_tab_page = get_option('wpvivid_hide_mwp_tab_page_v1', false);
623
  if($hide_mwp_tab_page === false) {
624
  $page_array['mwp'] = array('index' => '30', 'tab_func' => array($this, 'wpvivid_add_tab_mwp'), 'page_func' => array($this, 'wpvivid_add_page_mwp'));
684
  <?php
685
  }
686
 
687
+ public function wpvivid_add_tab_premium(){
688
+ ?>
689
+ <a href="#" id="wpvivid_tab_premium" class="nav-tab wrap-nav-tab" onclick="switchTabs(event,'premium-page')"><?php _e('Premium', 'wpvivid'); ?></a>
690
+ <?php
691
+ }
692
+
693
  public function wpvivid_add_page_backup()
694
  {
695
  ?>
962
  */
963
  function wpvivid_download_website_info(){
964
  wpvivid_location_href=true;
965
+ location.href =ajaxurl+'?_wpnonce='+wpvivid_ajax_object.ajax_nonce+'&action=wpvivid_create_debug_package';
966
  }
967
 
968
  jQuery("#wpvivid_debug_type").change(function()
1197
  </script>
1198
  <?php
1199
  }
1200
+
1201
+ public function wpvivid_add_page_premium(){
1202
+ ?>
1203
+ <div id="premium-page" class="wrap-tab-content wpvivid_tab_premium" name="tab-premium" style="display: none;">
1204
+ <!--<div class="postbox">-->
1205
+ <table class="wp-list-table widefat plugins" id="wpvivid_backuplist_table" style="border-collapse: collapse;">
1206
+ <thead>
1207
+ <tr class="backup-list-head" style="border-bottom: 0;">
1208
+ <th>Pro Version Features</th>
1209
+ <th style="text-align:center;">Basic</th>
1210
+ <th style="text-align:center;">Freelancer</th>
1211
+ <th style="text-align:center;">Ultimate</th>
1212
+ </tr>
1213
+ </thead>
1214
+ <tbody class="wpvivid-backuplist" id="wpvivid_backup_list">
1215
+ <tr style="">
1216
+ <td>
1217
+ <p><strong>Websites</strong></p>
1218
+ <p><strong>Backup: </strong>Custom Content</p>
1219
+ <p style="color: #dd9933;"><strong>Backup: </strong>Incremental Backup</p>
1220
+ <p><strong>Backup: </strong>Create a restore point</p>
1221
+ <p><strong>Backup: </strong>Include/exclude files/folders</p>
1222
+ <p><strong>Migration: </strong>Custom Content</p>
1223
+ <p><strong>Migration: </strong>Migration via remote storage</p>
1224
+ <p><strong>Remote Storage: </strong>Custom Directory (leading cloud storage providers)</p>
1225
+ <p><strong>Remote Storage: </strong>WASABI/Pcloud (Only Pro)</p>
1226
+ <p style="color: #dd9933;"><strong>Schedule: </strong>Incremental Backup Schedule</p>
1227
+ <p><strong>Schedule: </strong>Custom Timezone</p>
1228
+ <p><strong>Schedule: </strong>Custom content for each schedule</p>
1229
+ <p><strong>Schedule: </strong>Custom start time of schedule</p>
1230
+ <p><strong>Restore: </strong>Restore a website from remote storage</p>
1231
+ <p><strong>Restore: </strong>Restore what you want from a backup</p>
1232
+ <p><strong>Email Reports: </strong>Send email reports to multiple email addresses</p>
1233
+ <p style="color: #dd9933;"><strong>Staging (add-on): </strong>Create a sub-directory staging site with one-click</p>
1234
+ <p style="color: #dd9933;"><strong>Staging (add-on): </strong>Publish a staging site to a live site with one-click</p>
1235
+ <p style="color: #dd9933;"><strong>Roles & Capabilities (add-on): </strong>Display the individual sections according to user roles & capabilities</p>
1236
+ <p><strong>Support: </strong> Ticket 7x24 support</p>
1237
+ </td>
1238
+ <td style="text-align:center;">
1239
+ <p>Up to 3 sites</p>
1240
+ <p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
1241
+ <p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
1242
+ <p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
1243
+ <p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
1244
+ <p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
1245
+ <p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
1246
+ <p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
1247
+ <p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
1248
+ <p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
1249
+ <p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
1250
+ <p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
1251
+ <p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
1252
+ <p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
1253
+ <p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
1254
+ <p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
1255
+ <p><span style="height: 12px;width: 12px;background-color: #f1f1f1;border-radius: 50%;display: inline-block;"></span></p>
1256
+ <p><span style="height: 12px;width: 12px;background-color: #f1f1f1;border-radius: 50%;display: inline-block;"></span></p>
1257
+ <p><span style="height: 12px;width: 12px;background-color: #f1f1f1;border-radius: 50%;display: inline-block;"></span></p>
1258
+ <p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
1259
+ </td>
1260
+ <td style="text-align:center;">
1261
+ <p>Up to 100 sites</p>
1262
+ <p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
1263
+ <p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
1264
+ <p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
1265
+ <p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
1266
+ <p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
1267
+ <p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
1268
+ <p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
1269
+ <p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
1270
+ <p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
1271
+ <p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
1272
+ <p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
1273
+ <p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
1274
+ <p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
1275
+ <p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
1276
+ <p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
1277
+ <p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
1278
+ <p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
1279
+ <p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
1280
+ <p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
1281
+ </td>
1282
+ <td style="text-align:center;">
1283
+ <p>Unlimited</p>
1284
+ <p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
1285
+ <p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
1286
+ <p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
1287
+ <p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
1288
+ <p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
1289
+ <p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
1290
+ <p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
1291
+ <p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
1292
+ <p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
1293
+ <p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
1294
+ <p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
1295
+ <p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
1296
+ <p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
1297
+ <p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
1298
+ <p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
1299
+ <p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
1300
+ <p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
1301
+ <p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
1302
+ <p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
1303
+ </td>
1304
+ </tr>
1305
+ </tbody>
1306
+ <tfoot>
1307
+ <tr>
1308
+ <th>*No credit card needed. Trial starts with the Free Trial plan with 2 sites. You can choose a plan at the end of the trial.</th>
1309
+ <th colspan="3" style="text-align:center;"><p style="margin-top: 6px;"><a href="https://wpvivid.com/pricing" class="page-title-action">START 14-DAY FREE TRIAL</a></p></th>
1310
+ </tr>
1311
+ </tfoot>
1312
+ </table>
1313
+ <!--</div>-->
1314
+ </div>
1315
+ <?php
1316
+ }
1317
  }
admin/js/wpvivid-admin.js CHANGED
@@ -138,9 +138,10 @@ function wpvivid_activate_cron(){
138
  */
139
  function wpvivid_post_request(ajax_data, callback, error_callback, time_out){
140
  if(typeof time_out === 'undefined') time_out = 30000;
 
141
  jQuery.ajax({
142
  type: "post",
143
- url: ajax_object.ajax_url,
144
  data: ajax_data,
145
  success: function (data) {
146
  callback(data);
@@ -336,11 +337,16 @@ function wpvivid_check_runningtask(){
336
  catch(err){
337
  alert(err);
338
  }
339
- }, function (XMLHttpRequest, textStatus, errorThrown) {
340
- setTimeout(function () {
341
- m_need_update = true;
342
- wpvivid_manage_task();
343
- }, 3000);
 
 
 
 
 
344
  });
345
  }
346
  }
@@ -465,13 +471,13 @@ function wpvivid_interface_flow_control(){
465
  wpvivid_settings_changed = true;
466
  });
467
 
468
- jQuery("#wpvivid_storage_account_block input:not([type=checkbox])").on("keyup", function(){
469
  wpvivid_settings_changed = true;
470
- });
471
 
472
- jQuery('#wpvivid_storage_account_block input[type=checkbox]').on("change", function(){
473
  wpvivid_settings_changed = true;
474
- });
475
 
476
  jQuery('input:radio[option=restore]').click(function() {
477
  jQuery('input:radio[option=restore]').each(function () {
138
  */
139
  function wpvivid_post_request(ajax_data, callback, error_callback, time_out){
140
  if(typeof time_out === 'undefined') time_out = 30000;
141
+ ajax_data.nonce=wpvivid_ajax_object.ajax_nonce;
142
  jQuery.ajax({
143
  type: "post",
144
+ url: wpvivid_ajax_object.ajax_url,
145
  data: ajax_data,
146
  success: function (data) {
147
  callback(data);
337
  catch(err){
338
  alert(err);
339
  }
340
+ }, function (XMLHttpRequest, textStatus, errorThrown)
341
+ {
342
+ task_retry_times++;
343
+ if (task_retry_times < 5)
344
+ {
345
+ setTimeout(function () {
346
+ m_need_update = true;
347
+ wpvivid_manage_task();
348
+ }, 3000);
349
+ }
350
  });
351
  }
352
  }
471
  wpvivid_settings_changed = true;
472
  });
473
 
474
+ /*jQuery("#wpvivid_storage_account_block input:not([type=checkbox])").on("keyup", function(){
475
  wpvivid_settings_changed = true;
476
+ });*/
477
 
478
+ /*jQuery('#wpvivid_storage_account_block input[type=checkbox]').on("change", function(){
479
  wpvivid_settings_changed = true;
480
+ });*/
481
 
482
  jQuery('input:radio[option=restore]').click(function() {
483
  jQuery('input:radio[option=restore]').each(function () {
admin/partials/wpvivid-backup-restore-page-display.php CHANGED
@@ -531,7 +531,7 @@ function wpvivid_backuppage_add_page_backup(){
531
  */
532
  function wpvivid_download(backup_id, backup_type, file_name){
533
  wpvivid_location_href=true;
534
- location.href =ajaxurl+'?action=wpvivid_download_backup&backup_id='+backup_id+'&download_type='+backup_type+'&file_name='+file_name;
535
  }
536
 
537
  function wpvivid_initialize_restore(backup_id, backup_time, backup_type, restore_type='backup'){
531
  */
532
  function wpvivid_download(backup_id, backup_type, file_name){
533
  wpvivid_location_href=true;
534
+ location.href =ajaxurl+'?_wpnonce='+wpvivid_ajax_object.ajax_nonce+'&action=wpvivid_download_backup&backup_id='+backup_id+'&download_type='+backup_type+'&file_name='+file_name;
535
  }
536
 
537
  function wpvivid_initialize_restore(backup_id, backup_time, backup_type, restore_type='backup'){
admin/partials/wpvivid-schedule-page-display.php CHANGED
@@ -114,7 +114,7 @@ function wpvivid_schedule_notice($html)
114
  $offset=get_option('gmt_offset');
115
  $time = '00:00:00';
116
  $utime = strtotime($time) + $offset * 60 * 60;
117
- $html='<p>1) Scheduled job will start at utc time: '.date('H:i:s', $utime).'</p>';
118
  $html.='<p>2) Being subjected to mechanisms of PHP, a scheduled backup task for your site will be triggered only when the site receives at least a visit at any page.</p>';
119
  return $html;
120
  }
114
  $offset=get_option('gmt_offset');
115
  $time = '00:00:00';
116
  $utime = strtotime($time) + $offset * 60 * 60;
117
+ $html='<p>1) Scheduled job will start at <strong>UTC</strong> time: '.date('H:i:s', $utime).'</p>';
118
  $html.='<p>2) Being subjected to mechanisms of PHP, a scheduled backup task for your site will be triggered only when the site receives at least a visit at any page.</p>';
119
  return $html;
120
  }
admin/partials/wpvivid-settings-page-display.php CHANGED
@@ -448,7 +448,7 @@ function wpvivid_export_import_settings()
448
 
449
  function wpvivid_export_settings() {
450
  wpvivid_location_href=true;
451
- location.href =ajaxurl+'?action=wpvivid_export_setting&setting=1&history=1&review=0';
452
  }
453
 
454
  function wpvivid_import_settings(){
448
 
449
  function wpvivid_export_settings() {
450
  wpvivid_location_href=true;
451
+ location.href =ajaxurl+'?_wpnonce='+wpvivid_ajax_object.ajax_nonce+'&action=wpvivid_export_setting&setting=1&history=1&review=0';
452
  }
453
 
454
  function wpvivid_import_settings(){
admin/partials/wpvivid-website-info-page-display.php CHANGED
@@ -16,12 +16,14 @@
16
  });
17
  }
18
  catch (err) {
19
- setTimeout(function () {
 
20
  wpvivid_get_ini_memory_limit();
21
  }, 3000);
22
  }
23
  }, function (XMLHttpRequest, textStatus, errorThrown) {
24
- setTimeout(function () {
 
25
  wpvivid_get_ini_memory_limit();
26
  }, 3000);
27
  });
16
  });
17
  }
18
  catch (err) {
19
+ setTimeout(function ()
20
+ {
21
  wpvivid_get_ini_memory_limit();
22
  }, 3000);
23
  }
24
  }, function (XMLHttpRequest, textStatus, errorThrown) {
25
+ setTimeout(function ()
26
+ {
27
  wpvivid_get_ini_memory_limit();
28
  }, 3000);
29
  });
includes/class-wpvivid-backup-uploader.php CHANGED
@@ -20,6 +20,8 @@ class Wpvivid_BackupUploader
20
 
21
  function get_file_id()
22
  {
 
 
23
  if(isset($_POST['file_name']))
24
  {
25
  if(preg_match('/wpvivid-.*_.*_.*\.zip$/',$_POST['file_name']))
@@ -94,6 +96,8 @@ class Wpvivid_BackupUploader
94
 
95
  function upload_files()
96
  {
 
 
97
  $options['test_form'] =true;
98
  $options['action'] ='wpvivid_upload_files';
99
  $options['test_type'] = false;
@@ -158,6 +162,9 @@ class Wpvivid_BackupUploader
158
 
159
  function upload_files_finish()
160
  {
 
 
 
161
  $ret['html']=false;
162
  if(isset($_POST['files']))
163
  {
@@ -459,6 +466,9 @@ class Wpvivid_BackupUploader
459
 
460
  function rescan_local_folder_set_backup()
461
  {
 
 
 
462
  $ret = $this->_rescan_local_folder_set_backup();
463
  echo json_encode($ret);
464
  die();
@@ -509,6 +519,9 @@ class Wpvivid_BackupUploader
509
 
510
  function get_backup_count()
511
  {
 
 
 
512
  $backuplist=WPvivid_Backuplist::get_backuplist();
513
  echo sizeof($backuplist);
514
  die();
@@ -547,6 +560,7 @@ class Wpvivid_BackupUploader
547
  'urlstream_upload' => true,
548
  // additional post data to send to our ajax hook
549
  'multipart_params' => array(
 
550
  'action' => 'wpvivid_upload_files', // the ajax action name
551
  ),
552
  );
20
 
21
  function get_file_id()
22
  {
23
+ global $wpvivid_plugin;
24
+ $wpvivid_plugin->ajax_check_security();
25
  if(isset($_POST['file_name']))
26
  {
27
  if(preg_match('/wpvivid-.*_.*_.*\.zip$/',$_POST['file_name']))
96
 
97
  function upload_files()
98
  {
99
+ global $wpvivid_plugin;
100
+ $wpvivid_plugin->ajax_check_security();
101
  $options['test_form'] =true;
102
  $options['action'] ='wpvivid_upload_files';
103
  $options['test_type'] = false;
162
 
163
  function upload_files_finish()
164
  {
165
+ global $wpvivid_plugin;
166
+ $wpvivid_plugin->ajax_check_security();
167
+
168
  $ret['html']=false;
169
  if(isset($_POST['files']))
170
  {
466
 
467
  function rescan_local_folder_set_backup()
468
  {
469
+ global $wpvivid_plugin;
470
+ $wpvivid_plugin->ajax_check_security();
471
+
472
  $ret = $this->_rescan_local_folder_set_backup();
473
  echo json_encode($ret);
474
  die();
519
 
520
  function get_backup_count()
521
  {
522
+ global $wpvivid_plugin;
523
+ $wpvivid_plugin->ajax_check_security();
524
+
525
  $backuplist=WPvivid_Backuplist::get_backuplist();
526
  echo sizeof($backuplist);
527
  die();
560
  'urlstream_upload' => true,
561
  // additional post data to send to our ajax hook
562
  'multipart_params' => array(
563
+ '_ajax_nonce' => wp_create_nonce('wpvivid_ajax'),
564
  'action' => 'wpvivid_upload_files', // the ajax action name
565
  ),
566
  );
includes/class-wpvivid-backup.php CHANGED
@@ -2198,6 +2198,7 @@ class WPvivid_Backup_Item
2198
  class WPvivid_Backup
2199
  {
2200
  public $task;
 
2201
  //public $config;
2202
 
2203
  public function __construct($task_id=false,$task=false)
@@ -2227,12 +2228,15 @@ class WPvivid_Backup
2227
  $this->init_options($task_id);
2228
  $next_backup=$this->task->get_need_backup();
2229
 
 
 
2230
  while($next_backup!==false)
2231
  {
2232
  global $wpvivid_plugin;
2233
  $wpvivid_plugin->set_time_limit($this->task->get_id());
2234
  $this->task->update_sub_task_progress($next_backup['key'],0,'Start backing up '.$next_backup['key'].'.');
2235
  $wpvivid_plugin->wpvivid_log->WriteLog('Prepare to backup '.$next_backup['key'].' files.','notice');
 
2236
  if(isset($next_backup['files'])) {
2237
  $wpvivid_plugin->wpvivid_log->WriteLog('File number: ' . sizeof($next_backup['files']), 'notice');
2238
  }
@@ -2245,6 +2249,7 @@ class WPvivid_Backup
2245
  $next_backup=$this->task->get_need_backup();
2246
  }
2247
 
 
2248
  $this->cleanup();
2249
 
2250
  $ret=$this->task->get_backup_result();
2198
  class WPvivid_Backup
2199
  {
2200
  public $task;
2201
+ public $backup_type_report = '';
2202
  //public $config;
2203
 
2204
  public function __construct($task_id=false,$task=false)
2228
  $this->init_options($task_id);
2229
  $next_backup=$this->task->get_need_backup();
2230
 
2231
+ $this->backup_type_report = '';
2232
+
2233
  while($next_backup!==false)
2234
  {
2235
  global $wpvivid_plugin;
2236
  $wpvivid_plugin->set_time_limit($this->task->get_id());
2237
  $this->task->update_sub_task_progress($next_backup['key'],0,'Start backing up '.$next_backup['key'].'.');
2238
  $wpvivid_plugin->wpvivid_log->WriteLog('Prepare to backup '.$next_backup['key'].' files.','notice');
2239
+ $this->backup_type_report .= $next_backup['key'].',';
2240
  if(isset($next_backup['files'])) {
2241
  $wpvivid_plugin->wpvivid_log->WriteLog('File number: ' . sizeof($next_backup['files']), 'notice');
2242
  }
2249
  $next_backup=$this->task->get_need_backup();
2250
  }
2251
 
2252
+ WPvivid_Setting::update_option('wpvivid_backup_report', $this->backup_type_report);
2253
  $this->cleanup();
2254
 
2255
  $ret=$this->task->get_backup_result();
includes/class-wpvivid-export-import.php CHANGED
@@ -151,7 +151,7 @@ class WPvivid_Export_Import
151
  </div>
152
 
153
  <div id="wpvivid_export_page">
154
- <input class="button-primary wpvivid-button-export-archieve" type="submit" name="<?php _e('post'); ?>" value="Next Step" />
155
  </div>
156
  <div class="postbox" id="wpvivid_export_task_progress" style="display: none; margin-top: 10px; margin-bottom: 0;">
157
  <div class="action-progress-bar" id="wpvivid_export_bar_percent">
@@ -578,7 +578,7 @@ class WPvivid_Export_Import
578
  }
579
 
580
  function wpvivid_download_export(file_name, file_size){
581
- location.href =ajaxurl+'?action=wpvivid_download_export_backup&file_name='+file_name+'&file_size='+file_size;
582
  }
583
 
584
  jQuery(document).ready(function (){
@@ -605,6 +605,8 @@ class WPvivid_Export_Import
605
 
606
  public function export_post_step2()
607
  {
 
 
608
  if(isset($_POST['post_type']))
609
  {
610
  global $wpdb;
@@ -801,6 +803,8 @@ class WPvivid_Export_Import
801
 
802
  public function export_post_step3()
803
  {
 
 
804
  if(isset($_POST['post_type'])&&isset($_POST['all']))
805
  {
806
  $post_type=$_POST['post_type'];
@@ -880,6 +884,9 @@ class WPvivid_Export_Import
880
 
881
  public function get_list()
882
  {
 
 
 
883
  if(!isset($_POST['post_type'])&&!isset($_POST['cat'])&&!isset($_POST['authors'])&&!isset($_POST['post_start_date'])&&!isset($_POST['post_end_date']))
884
  {
885
  die();
@@ -974,6 +981,8 @@ class WPvivid_Export_Import
974
 
975
  public function get_export_list()
976
  {
 
 
977
  $list = get_option('wpvivid_export_list',array());
978
  $display_list=new WPvivid_Export_List();
979
  $display_list->set_parent('wpvivid_import_list');
@@ -991,6 +1000,9 @@ class WPvivid_Export_Import
991
 
992
  public function get_list_page()
993
  {
 
 
 
994
  if(!isset($_POST['post_type'])&&!isset($_POST['page']))
995
  {
996
  die();
@@ -1051,6 +1063,8 @@ class WPvivid_Export_Import
1051
 
1052
  public function prepare_export_post()
1053
  {
 
 
1054
  if(isset($_POST['post_type'])&&isset($_POST['export_data']))
1055
  {
1056
  $post_type = sanitize_text_field($_POST['post_type']);
@@ -1233,6 +1247,9 @@ class WPvivid_Export_Import
1233
 
1234
  public function list_tasks()
1235
  {
 
 
 
1236
  $ret['result']='success';
1237
  $ret['show']=false;
1238
  $tasks=WPvivid_Exporter_taskmanager::get_tasks();
@@ -1356,6 +1373,9 @@ class WPvivid_Export_Import
1356
 
1357
  public function delete_export_list()
1358
  {
 
 
 
1359
  if(isset($_POST['export_id']))
1360
  {
1361
  $id=sanitize_key($_POST['export_id']);
@@ -1504,10 +1524,20 @@ class WPvivid_Export_Import
1504
  <div id="wpvivid_import_file_data">
1505
  </div>
1506
  <h3>Assign author</h3>
1507
- <div style="margin-bottom: 10px;">
1508
  Select an existing author:
1509
  <?php wp_dropdown_users( array( 'name' => "user_map", 'multi' => true, 'show_option_all' => __( '- Select -', 'wpvivid' ) ) );?>
1510
  </div>
 
 
 
 
 
 
 
 
 
 
1511
  <input class="button button-primary" type="button" id="wpvivid_start_import" value="Start to Import" />
1512
  <input class="button button-primary" type="button" id="wpvivid_rechoose_import_file" value="Back to Import Page" />
1513
  </div>
@@ -1533,6 +1563,7 @@ class WPvivid_Export_Import
1533
  'multi_selection' => false,
1534
  // additional post data to send to our ajax hook
1535
  'multipart_params' => array(
 
1536
  'action' => 'wpvivid_upload_import_files', // the ajax action name
1537
  ),
1538
  );
@@ -1877,13 +1908,21 @@ class WPvivid_Export_Import
1877
 
1878
  function wpvivid_start_import (file_name, user)
1879
  {
 
 
 
 
 
 
 
1880
  wpvivid_import_lock_unlock('lock');
1881
  wpvivid_monitor_import_task();
1882
  wpvivid_import_step3();
1883
  var ajax_data = {
1884
  'action':'wpvivid_start_import',
1885
  'file_name':file_name,
1886
- 'user':user
 
1887
  };
1888
 
1889
  wpvivid_post_request(ajax_data, function(data)
@@ -2056,6 +2095,8 @@ class WPvivid_Export_Import
2056
 
2057
  public function check_import_file()
2058
  {
 
 
2059
  if(isset($_POST['file_name']))
2060
  {
2061
  $ret = $this->wpvivid_check_import_file_name($_POST['file_name']);
@@ -2078,18 +2119,18 @@ class WPvivid_Export_Import
2078
 
2079
  public function upload_import_files()
2080
  {
 
 
2081
  $options['test_form'] =true;
2082
  $options['action'] ='wpvivid_upload_import_files';
2083
  $options['test_type'] = false;
2084
  $options['ext'] = 'zip';
2085
  $options['type'] = 'application/zip';
2086
-
2087
  add_filter('upload_dir', array($this, 'upload_import_dir'));
2088
 
2089
  $status = wp_handle_upload($_FILES['async-upload'],$options);
2090
 
2091
  remove_filter('upload_dir', array($this, 'upload_import_dir'));
2092
-
2093
  if (isset($status['error']))
2094
  {
2095
  echo json_encode(array('result'=>WPVIVID_FAILED, 'error' => $status['error']));
@@ -2133,6 +2174,9 @@ class WPvivid_Export_Import
2133
  {
2134
  try
2135
  {
 
 
 
2136
  $tasks=WPvivid_Impoter_taskmanager::get_tasks();
2137
  foreach ($tasks as $task)
2138
  {
@@ -2168,6 +2212,9 @@ class WPvivid_Export_Import
2168
 
2169
  public function upload_import_file_complete()
2170
  {
 
 
 
2171
  $ret['html']=false;
2172
  if(isset($_POST['files']))
2173
  {
@@ -2334,6 +2381,7 @@ class WPvivid_Export_Import
2334
  public function calc_import_folder_size()
2335
  {
2336
  global $wpvivid_plugin;
 
2337
  $path = WP_CONTENT_DIR.DIRECTORY_SEPARATOR.WPvivid_Setting::get_backupdir().DIRECTORY_SEPARATOR.WPVIVID_IMPORT_EXPORT_DIR.DIRECTORY_SEPARATOR;
2338
  $bytes_total = 0;
2339
  $path = realpath($path);
@@ -2350,6 +2398,8 @@ class WPvivid_Export_Import
2350
  }
2351
 
2352
  public function clean_import_folder(){
 
 
2353
  $path = WP_CONTENT_DIR.DIRECTORY_SEPARATOR.WPvivid_Setting::get_backupdir().DIRECTORY_SEPARATOR.WPVIVID_IMPORT_EXPORT_DIR.DIRECTORY_SEPARATOR;
2354
  if(is_dir($path))
2355
  {
@@ -2401,6 +2451,9 @@ class WPvivid_Export_Import
2401
 
2402
  public function wpvivid_scan_import_folder()
2403
  {
 
 
 
2404
  $path=WP_CONTENT_DIR.DIRECTORY_SEPARATOR.WPvivid_Setting::get_backupdir().DIRECTORY_SEPARATOR.WPVIVID_IMPORT_EXPORT_DIR.DIRECTORY_SEPARATOR;
2405
 
2406
  $data=array();
@@ -2465,6 +2518,8 @@ class WPvivid_Export_Import
2465
  }
2466
 
2467
  public function get_import_list_page(){
 
 
2468
  if(!isset($_POST['page']))
2469
  {
2470
  die();
@@ -2561,6 +2616,11 @@ class WPvivid_Export_Import
2561
  {
2562
  $options['user']=$_POST['user'];
2563
  }
 
 
 
 
 
2564
 
2565
  $task_id=$this->get_file_id($_POST['file_name']);
2566
  WPvivid_Impoter_taskmanager::new_task($task_id, $files,$options);
151
  </div>
152
 
153
  <div id="wpvivid_export_page">
154
+ <input class="button-primary wpvivid-button-export-archieve" type="submit" name="post" value="Next Step" />
155
  </div>
156
  <div class="postbox" id="wpvivid_export_task_progress" style="display: none; margin-top: 10px; margin-bottom: 0;">
157
  <div class="action-progress-bar" id="wpvivid_export_bar_percent">
578
  }
579
 
580
  function wpvivid_download_export(file_name, file_size){
581
+ location.href =ajaxurl+'?_wpnonce='+wpvivid_ajax_object.ajax_nonce+'&action=wpvivid_download_export_backup&file_name='+file_name+'&file_size='+file_size;
582
  }
583
 
584
  jQuery(document).ready(function (){
605
 
606
  public function export_post_step2()
607
  {
608
+ global $wpvivid_plugin;
609
+ $wpvivid_plugin->ajax_check_security();
610
  if(isset($_POST['post_type']))
611
  {
612
  global $wpdb;
803
 
804
  public function export_post_step3()
805
  {
806
+ global $wpvivid_plugin;
807
+ $wpvivid_plugin->ajax_check_security();
808
  if(isset($_POST['post_type'])&&isset($_POST['all']))
809
  {
810
  $post_type=$_POST['post_type'];
884
 
885
  public function get_list()
886
  {
887
+ global $wpvivid_plugin;
888
+ $wpvivid_plugin->ajax_check_security();
889
+
890
  if(!isset($_POST['post_type'])&&!isset($_POST['cat'])&&!isset($_POST['authors'])&&!isset($_POST['post_start_date'])&&!isset($_POST['post_end_date']))
891
  {
892
  die();
981
 
982
  public function get_export_list()
983
  {
984
+ global $wpvivid_plugin;
985
+ $wpvivid_plugin->ajax_check_security();
986
  $list = get_option('wpvivid_export_list',array());
987
  $display_list=new WPvivid_Export_List();
988
  $display_list->set_parent('wpvivid_import_list');
1000
 
1001
  public function get_list_page()
1002
  {
1003
+ global $wpvivid_plugin;
1004
+ $wpvivid_plugin->ajax_check_security();
1005
+
1006
  if(!isset($_POST['post_type'])&&!isset($_POST['page']))
1007
  {
1008
  die();
1063
 
1064
  public function prepare_export_post()
1065
  {
1066
+ global $wpvivid_plugin;
1067
+ $wpvivid_plugin->ajax_check_security();
1068
  if(isset($_POST['post_type'])&&isset($_POST['export_data']))
1069
  {
1070
  $post_type = sanitize_text_field($_POST['post_type']);
1247
 
1248
  public function list_tasks()
1249
  {
1250
+ global $wpvivid_plugin;
1251
+ $wpvivid_plugin->ajax_check_security();
1252
+
1253
  $ret['result']='success';
1254
  $ret['show']=false;
1255
  $tasks=WPvivid_Exporter_taskmanager::get_tasks();
1373
 
1374
  public function delete_export_list()
1375
  {
1376
+ global $wpvivid_plugin;
1377
+ $wpvivid_plugin->ajax_check_security();
1378
+
1379
  if(isset($_POST['export_id']))
1380
  {
1381
  $id=sanitize_key($_POST['export_id']);
1524
  <div id="wpvivid_import_file_data">
1525
  </div>
1526
  <h3>Assign author</h3>
1527
+ <div>
1528
  Select an existing author:
1529
  <?php wp_dropdown_users( array( 'name' => "user_map", 'multi' => true, 'show_option_all' => __( '- Select -', 'wpvivid' ) ) );?>
1530
  </div>
1531
+ <h3>Import Setting</h3>
1532
+ <div style="margin-bottom: 10px;">
1533
+ <label>
1534
+ <input type="checkbox" id="wpvivid_overwrite_existing" />
1535
+ <span><strong>Overwrite existing pages</strong></span>
1536
+ </label>
1537
+ </div>
1538
+ <div style="margin-bottom: 10px;">
1539
+ <span>With this option checked, Pages/posts already existing will be overwritten with the updated ones in an import.</span>
1540
+ </div>
1541
  <input class="button button-primary" type="button" id="wpvivid_start_import" value="Start to Import" />
1542
  <input class="button button-primary" type="button" id="wpvivid_rechoose_import_file" value="Back to Import Page" />
1543
  </div>
1563
  'multi_selection' => false,
1564
  // additional post data to send to our ajax hook
1565
  'multipart_params' => array(
1566
+ '_ajax_nonce' => wp_create_nonce('wpvivid_ajax'),
1567
  'action' => 'wpvivid_upload_import_files', // the ajax action name
1568
  ),
1569
  );
1908
 
1909
  function wpvivid_start_import (file_name, user)
1910
  {
1911
+ if(jQuery('#wpvivid_overwrite_existing').prop('checked')){
1912
+ var overwrite_existing = 1;
1913
+ }
1914
+ else{
1915
+ var overwrite_existing = 0;
1916
+ }
1917
+
1918
  wpvivid_import_lock_unlock('lock');
1919
  wpvivid_monitor_import_task();
1920
  wpvivid_import_step3();
1921
  var ajax_data = {
1922
  'action':'wpvivid_start_import',
1923
  'file_name':file_name,
1924
+ 'user':user,
1925
+ 'update_exist':overwrite_existing
1926
  };
1927
 
1928
  wpvivid_post_request(ajax_data, function(data)
2095
 
2096
  public function check_import_file()
2097
  {
2098
+ global $wpvivid_plugin;
2099
+ $wpvivid_plugin->ajax_check_security();
2100
  if(isset($_POST['file_name']))
2101
  {
2102
  $ret = $this->wpvivid_check_import_file_name($_POST['file_name']);
2119
 
2120
  public function upload_import_files()
2121
  {
2122
+ global $wpvivid_plugin;
2123
+ $wpvivid_plugin->ajax_check_security();
2124
  $options['test_form'] =true;
2125
  $options['action'] ='wpvivid_upload_import_files';
2126
  $options['test_type'] = false;
2127
  $options['ext'] = 'zip';
2128
  $options['type'] = 'application/zip';
 
2129
  add_filter('upload_dir', array($this, 'upload_import_dir'));
2130
 
2131
  $status = wp_handle_upload($_FILES['async-upload'],$options);
2132
 
2133
  remove_filter('upload_dir', array($this, 'upload_import_dir'));
 
2134
  if (isset($status['error']))
2135
  {
2136
  echo json_encode(array('result'=>WPVIVID_FAILED, 'error' => $status['error']));
2174
  {
2175
  try
2176
  {
2177
+ global $wpvivid_plugin;
2178
+ $wpvivid_plugin->ajax_check_security();
2179
+
2180
  $tasks=WPvivid_Impoter_taskmanager::get_tasks();
2181
  foreach ($tasks as $task)
2182
  {
2212
 
2213
  public function upload_import_file_complete()
2214
  {
2215
+ global $wpvivid_plugin;
2216
+ $wpvivid_plugin->ajax_check_security();
2217
+
2218
  $ret['html']=false;
2219
  if(isset($_POST['files']))
2220
  {
2381
  public function calc_import_folder_size()
2382
  {
2383
  global $wpvivid_plugin;
2384
+ $wpvivid_plugin->ajax_check_security();
2385
  $path = WP_CONTENT_DIR.DIRECTORY_SEPARATOR.WPvivid_Setting::get_backupdir().DIRECTORY_SEPARATOR.WPVIVID_IMPORT_EXPORT_DIR.DIRECTORY_SEPARATOR;
2386
  $bytes_total = 0;
2387
  $path = realpath($path);
2398
  }
2399
 
2400
  public function clean_import_folder(){
2401
+ global $wpvivid_plugin;
2402
+ $wpvivid_plugin->ajax_check_security();
2403
  $path = WP_CONTENT_DIR.DIRECTORY_SEPARATOR.WPvivid_Setting::get_backupdir().DIRECTORY_SEPARATOR.WPVIVID_IMPORT_EXPORT_DIR.DIRECTORY_SEPARATOR;
2404
  if(is_dir($path))
2405
  {
2451
 
2452
  public function wpvivid_scan_import_folder()
2453
  {
2454
+ global $wpvivid_plugin;
2455
+ $wpvivid_plugin->ajax_check_security();
2456
+
2457
  $path=WP_CONTENT_DIR.DIRECTORY_SEPARATOR.WPvivid_Setting::get_backupdir().DIRECTORY_SEPARATOR.WPVIVID_IMPORT_EXPORT_DIR.DIRECTORY_SEPARATOR;
2458
 
2459
  $data=array();
2518
  }
2519
 
2520
  public function get_import_list_page(){
2521
+ global $wpvivid_plugin;
2522
+ $wpvivid_plugin->ajax_check_security();
2523
  if(!isset($_POST['page']))
2524
  {
2525
  die();
2616
  {
2617
  $options['user']=$_POST['user'];
2618
  }
2619
+ $options['update_exist']=0;
2620
+ if(isset($_POST['update_exist']))
2621
+ {
2622
+ $options['update_exist']=$_POST['update_exist'];
2623
+ }
2624
 
2625
  $task_id=$this->get_file_id($_POST['file_name']);
2626
  WPvivid_Impoter_taskmanager::new_task($task_id, $files,$options);
includes/class-wpvivid-importer.php CHANGED
@@ -667,6 +667,15 @@ class WPvivid_media_importer
667
  $this->default_user=get_current_user_id();
668
  }
669
 
 
 
 
 
 
 
 
 
 
670
  $ret=$this->import_start( $file );
671
 
672
  if($ret['result']=='failed')
@@ -697,7 +706,7 @@ class WPvivid_media_importer
697
  {
698
  return $ret;
699
  }
700
- $ret=$this->process_posts_ex();
701
  if($ret['result']=='failed')
702
  {
703
  return $ret;
@@ -987,7 +996,7 @@ class WPvivid_media_importer
987
  return $ret;
988
  }
989
 
990
- private function process_posts_ex()
991
  {
992
  $this->import_log->wpvivid_write_import_log('Start importing posts.', 'notice');
993
  $ret['result']='success';
@@ -1005,6 +1014,82 @@ class WPvivid_media_importer
1005
  $this->import_log->wpvivid_write_import_log('The post already exists.', 'notice');
1006
  $comment_post_ID=$post_id = $post_exists;
1007
  $this->processed_posts[ intval( $post['post_id'] ) ] = intval( $post_exists );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1008
  } else {
1009
  $post_parent = (int) $post['post_parent'];
1010
  if ( $post_parent )
@@ -1209,8 +1294,16 @@ class WPvivid_media_importer
1209
  // export gets meta straight from the DB so could have a serialized string
1210
  if ( ! $value )
1211
  $value = maybe_unserialize( $meta['value'] );
 
 
 
 
 
 
 
 
 
1212
 
1213
- add_post_meta( $post_id, $key, $value );
1214
  do_action( 'import_post_meta', $post_id, $key, $value );
1215
 
1216
  // if the post has a featured image, take note of this in case of remap
667
  $this->default_user=get_current_user_id();
668
  }
669
 
670
+ if(isset($options['update_exist']))
671
+ {
672
+ $update_exist=$options['update_exist'];
673
+ }
674
+ else
675
+ {
676
+ $update_exist=false;
677
+ }
678
+
679
  $ret=$this->import_start( $file );
680
 
681
  if($ret['result']=='failed')
706
  {
707
  return $ret;
708
  }
709
+ $ret=$this->process_posts_ex($update_exist);
710
  if($ret['result']=='failed')
711
  {
712
  return $ret;
996
  return $ret;
997
  }
998
 
999
+ private function process_posts_ex($update_exist=false)
1000
  {
1001
  $this->import_log->wpvivid_write_import_log('Start importing posts.', 'notice');
1002
  $ret['result']='success';
1014
  $this->import_log->wpvivid_write_import_log('The post already exists.', 'notice');
1015
  $comment_post_ID=$post_id = $post_exists;
1016
  $this->processed_posts[ intval( $post['post_id'] ) ] = intval( $post_exists );
1017
+
1018
+ if($update_exist)
1019
+ {
1020
+ $post_parent = (int) $post['post_parent'];
1021
+ if ( $post_parent )
1022
+ {
1023
+ // if we already know the parent, map it to the new local ID
1024
+ if ( isset( $this->processed_posts[$post_parent] ) )
1025
+ {
1026
+ $post_parent = $this->processed_posts[$post_parent];
1027
+ // otherwise record the parent for later
1028
+ } else {
1029
+ $this->post_orphans[intval($post['post_id'])] = $post_parent;
1030
+ $post_parent = 0;
1031
+ }
1032
+ }
1033
+ $author = sanitize_user( $post['post_author'], true );
1034
+ if ( isset( $this->author_mapping[$author] ) ) {
1035
+ $author = $this->author_mapping[$author];
1036
+ }
1037
+ else {
1038
+ $author = (int)$this->default_user;
1039
+ }
1040
+
1041
+ $postdata = array(
1042
+ 'ID' => $post['post_id'], 'post_author' => $author, 'post_date' => $post['post_date'],
1043
+ 'post_date_gmt' => $post['post_date_gmt'], 'post_content' => $post['post_content'],
1044
+ 'post_excerpt' => $post['post_excerpt'], 'post_title' => $post['post_title'],
1045
+ 'post_status' => $post['status'], 'post_name' => $post['post_name'],
1046
+ 'comment_status' => $post['comment_status'], 'ping_status' => $post['ping_status'],
1047
+ 'guid' => $post['guid'], 'post_parent' => $post_parent, 'menu_order' => $post['menu_order'],
1048
+ 'post_type' => $post['post_type'], 'post_password' => $post['post_password']
1049
+ );
1050
+
1051
+ wp_update_post($postdata);
1052
+
1053
+ if ( ! empty( $post['postmeta'] ) )
1054
+ {
1055
+ foreach ( $post['postmeta'] as $meta )
1056
+ {
1057
+ $key = apply_filters( 'import_post_meta_key', $meta['key'], $post_id, $post );
1058
+ $value = false;
1059
+
1060
+ if ( '_edit_last' == $key )
1061
+ {
1062
+ if ( isset( $this->processed_authors[intval($meta['value'])] ) )
1063
+ $value = $this->processed_authors[intval($meta['value'])];
1064
+ else
1065
+ $key = false;
1066
+ }
1067
+
1068
+ if ( $key )
1069
+ {
1070
+ // export gets meta straight from the DB so could have a serialized string
1071
+ if ( ! $value )
1072
+ $value = maybe_unserialize( $meta['value'] );
1073
+ if(metadata_exists('post', $post_id, $key))
1074
+ {
1075
+ update_post_meta($post_id,$key,$value);
1076
+ }
1077
+ else
1078
+ {
1079
+ add_post_meta( $post_id, $key, $value );
1080
+ }
1081
+
1082
+
1083
+ do_action( 'import_post_meta', $post_id, $key, $value );
1084
+
1085
+ // if the post has a featured image, take note of this in case of remap
1086
+ if ( '_thumbnail_id' == $key )
1087
+ $this->featured_images[$post_id] = (int) $value;
1088
+ }
1089
+ }
1090
+ }
1091
+ }
1092
+
1093
  } else {
1094
  $post_parent = (int) $post['post_parent'];
1095
  if ( $post_parent )
1294
  // export gets meta straight from the DB so could have a serialized string
1295
  if ( ! $value )
1296
  $value = maybe_unserialize( $meta['value'] );
1297
+ if(metadata_exists('post', $post_id, $key))
1298
+ {
1299
+ update_post_meta($post_id,$key,$value);
1300
+ }
1301
+ else
1302
+ {
1303
+ add_post_meta( $post_id, $key, $value );
1304
+ }
1305
+
1306
 
 
1307
  do_action( 'import_post_meta', $post_id, $key, $value );
1308
 
1309
  // if the post has a featured image, take note of this in case of remap
includes/class-wpvivid-migrate.php CHANGED
@@ -438,6 +438,9 @@ class WPvivid_Migrate
438
  {
439
  if(isset($_POST['url']))
440
  {
 
 
 
441
  $url=strtok($_POST['url'],'?');
442
 
443
  if (filter_var($url, FILTER_VALIDATE_URL) === FALSE)
@@ -567,7 +570,10 @@ class WPvivid_Migrate
567
  die();
568
  }
569
 
570
- public function delete_transfer_key(){
 
 
 
571
  $ret['result']=WPVIVID_SUCCESS;
572
  delete_option('wpvivid_saved_api_token');
573
  $html='';
@@ -580,6 +586,9 @@ class WPvivid_Migrate
580
  public function send_backup_to_site()
581
  {
582
  try {
 
 
 
583
  $options = WPvivid_Setting::get_option('wpvivid_saved_api_token');
584
 
585
  if (empty($options)) {
@@ -694,6 +703,9 @@ class WPvivid_Migrate
694
 
695
  public function migrate_now()
696
  {
 
 
 
697
  if (!isset($_POST['task_id'])||empty($_POST['task_id'])||!is_string($_POST['task_id']))
698
  {
699
  $ret['result']='failed';
@@ -703,8 +715,6 @@ class WPvivid_Migrate
703
  }
704
  $task_id=sanitize_key($_POST['task_id']);
705
 
706
- //Start backup site
707
- global $wpvivid_plugin;
708
  //flush buffer
709
  $wpvivid_plugin->flush($task_id);
710
  $wpvivid_plugin->backup($task_id);
@@ -713,6 +723,9 @@ class WPvivid_Migrate
713
 
714
  function export_download_backup()
715
  {
 
 
 
716
  $schedule_options=WPvivid_Schedule::get_schedule();
717
  if(empty($schedule_options))
718
  {
@@ -731,7 +744,6 @@ class WPvivid_Migrate
731
  $task=$backup_task->new_backup_task($backup,'Manual', 'export');
732
 
733
  $task_id=$task['task_id'];
734
- global $wpvivid_plugin;
735
  //add_action('wpvivid_handle_upload_succeed',array($this,'wpvivid_deal_upload_succeed'),11);
736
  $wpvivid_plugin->check_backup($task_id,$backup['backup_files']);
737
  $wpvivid_plugin->flush($task_id);
@@ -782,6 +794,9 @@ class WPvivid_Migrate
782
  {
783
  include_once WPVIVID_PLUGIN_DIR . '/vendor/autoload.php';
784
 
 
 
 
785
  $expires=time()+3600;
786
 
787
  if(isset($_POST['expires']))
@@ -1118,6 +1133,7 @@ class WPvivid_Migrate
1118
  public function list_tasks()
1119
  {
1120
  global $wpvivid_plugin;
 
1121
  $tasks=WPvivid_Setting::get_tasks();
1122
  $ret=array();
1123
  $list_tasks=array();
438
  {
439
  if(isset($_POST['url']))
440
  {
441
+ global $wpvivid_plugin;
442
+ $wpvivid_plugin->ajax_check_security();
443
+
444
  $url=strtok($_POST['url'],'?');
445
 
446
  if (filter_var($url, FILTER_VALIDATE_URL) === FALSE)
570
  die();
571
  }
572
 
573
+ public function delete_transfer_key()
574
+ {
575
+ global $wpvivid_plugin;
576
+ $wpvivid_plugin->ajax_check_security();
577
  $ret['result']=WPVIVID_SUCCESS;
578
  delete_option('wpvivid_saved_api_token');
579
  $html='';
586
  public function send_backup_to_site()
587
  {
588
  try {
589
+ global $wpvivid_plugin;
590
+ $wpvivid_plugin->ajax_check_security();
591
+
592
  $options = WPvivid_Setting::get_option('wpvivid_saved_api_token');
593
 
594
  if (empty($options)) {
703
 
704
  public function migrate_now()
705
  {
706
+ global $wpvivid_plugin;
707
+ $wpvivid_plugin->ajax_check_security();
708
+
709
  if (!isset($_POST['task_id'])||empty($_POST['task_id'])||!is_string($_POST['task_id']))
710
  {
711
  $ret['result']='failed';
715
  }
716
  $task_id=sanitize_key($_POST['task_id']);
717
 
 
 
718
  //flush buffer
719
  $wpvivid_plugin->flush($task_id);
720
  $wpvivid_plugin->backup($task_id);
723
 
724
  function export_download_backup()
725
  {
726
+ global $wpvivid_plugin;
727
+ $wpvivid_plugin->ajax_check_security();
728
+
729
  $schedule_options=WPvivid_Schedule::get_schedule();
730
  if(empty($schedule_options))
731
  {
744
  $task=$backup_task->new_backup_task($backup,'Manual', 'export');
745
 
746
  $task_id=$task['task_id'];
 
747
  //add_action('wpvivid_handle_upload_succeed',array($this,'wpvivid_deal_upload_succeed'),11);
748
  $wpvivid_plugin->check_backup($task_id,$backup['backup_files']);
749
  $wpvivid_plugin->flush($task_id);
794
  {
795
  include_once WPVIVID_PLUGIN_DIR . '/vendor/autoload.php';
796
 
797
+ global $wpvivid_plugin;
798
+ $wpvivid_plugin->ajax_check_security();
799
+
800
  $expires=time()+3600;
801
 
802
  if(isset($_POST['expires']))
1133
  public function list_tasks()
1134
  {
1135
  global $wpvivid_plugin;
1136
+ $wpvivid_plugin->ajax_check_security();
1137
  $tasks=WPvivid_Setting::get_tasks();
1138
  $ret=array();
1139
  $list_tasks=array();
includes/class-wpvivid-restore-database.php CHANGED
@@ -903,7 +903,7 @@ class WPvivid_RestoreDB
903
  $unserialize_data = @unserialize($old_data);
904
  if($unserialize_data===false)
905
  {
906
- $old_data=$this->replace_string($old_data);
907
  }
908
  else
909
  {
@@ -946,7 +946,7 @@ class WPvivid_RestoreDB
946
  $serialize_data =@unserialize($data);
947
  if($serialize_data===false)
948
  {
949
- $data=$this->replace_string($data);
950
  }
951
  else
952
  {
@@ -959,7 +959,7 @@ class WPvivid_RestoreDB
959
  {
960
  if(is_string($value))
961
  {
962
- $data[$key]=$this->replace_string($value);
963
  }
964
  else if(is_array($value))
965
  {
@@ -994,7 +994,7 @@ class WPvivid_RestoreDB
994
  continue;
995
  if(is_string($value))
996
  {
997
- $temp->$key =$this->replace_string($value);
998
  }
999
  else if(is_array($value))
1000
  {
@@ -1078,6 +1078,168 @@ class WPvivid_RestoreDB
1078
  return str_replace('/','\/',$url);
1079
  }
1080
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1081
  private function replace_string($old_string)
1082
  {
1083
  if(!is_string($old_string))
903
  $unserialize_data = @unserialize($old_data);
904
  if($unserialize_data===false)
905
  {
906
+ $old_data=$this->replace_string_v2($old_data);
907
  }
908
  else
909
  {
946
  $serialize_data =@unserialize($data);
947
  if($serialize_data===false)
948
  {
949
+ $data=$this->replace_string_v2($data);
950
  }
951
  else
952
  {
959
  {
960
  if(is_string($value))
961
  {
962
+ $data[$key]=$this->replace_string_v2($value);
963
  }
964
  else if(is_array($value))
965
  {
994
  continue;
995
  if(is_string($value))
996
  {
997
+ $temp->$key =$this->replace_string_v2($value);
998
  }
999
  else if(is_array($value))
1000
  {
1078
  return str_replace('/','\/',$url);
1079
  }
1080
 
1081
+ public function replace_string_v2($old_string)
1082
+ {
1083
+ if(!is_string($old_string))
1084
+ {
1085
+ return $old_string;
1086
+ }
1087
+
1088
+ $from=array();
1089
+ $to=array();
1090
+
1091
+ $new_url_use_https=false;
1092
+ if (0 === stripos($this->new_site_url, 'https://')|| stripos($this->new_site_url, 'https:\/\/'))
1093
+ {
1094
+ $new_url_use_https=true;
1095
+ }
1096
+ else if (0 === stripos($this->new_site_url, 'http://')|| stripos($this->new_site_url, 'http:\/\/'))
1097
+ {
1098
+ $new_url_use_https=false;
1099
+ }
1100
+
1101
+ if($this->old_site_url!=$this->new_site_url)
1102
+ {
1103
+ if(substr($this->replacing_table, strlen($this->new_prefix))=='posts'||substr($this->replacing_table, strlen($this->new_prefix))=='postmeta'||substr($this->replacing_table, strlen($this->new_prefix))=='options')
1104
+ {
1105
+ $remove_http_link=$this->get_remove_http_link($this->old_site_url);
1106
+ if($remove_http_link!==false)
1107
+ {
1108
+ $new_remove_http_link=$this->get_remove_http_link($this->new_site_url);
1109
+ $from[]=$remove_http_link;
1110
+ $to[]=$new_remove_http_link;
1111
+
1112
+ if($new_url_use_https)
1113
+ {
1114
+ $from[]='http:'.$new_remove_http_link;
1115
+ $to[]='https:'.$new_remove_http_link;
1116
+ }
1117
+ else
1118
+ {
1119
+ $from[]='https:'.$new_remove_http_link;
1120
+ $to[]='http:'.$new_remove_http_link;
1121
+ }
1122
+
1123
+ $quote_old_site_url=$this->get_http_link_at_quote($remove_http_link);
1124
+ $quote_new_site_url=$this->get_http_link_at_quote($new_remove_http_link);
1125
+ $from[]=$quote_old_site_url;
1126
+ $to[]=$quote_new_site_url;
1127
+ if($new_url_use_https)
1128
+ {
1129
+ $from[]='http:'.$quote_new_site_url;
1130
+ $to[]='https:'.$quote_new_site_url;
1131
+ }
1132
+ else
1133
+ {
1134
+ $from[]='https:'.$quote_new_site_url;
1135
+ $to[]='http:'.$quote_new_site_url;
1136
+ }
1137
+ }
1138
+ else
1139
+ {
1140
+ $remove_http_link=$this->get_remove_http_link_ex($this->old_site_url);
1141
+ if($remove_http_link!==false)
1142
+ {
1143
+ $new_remove_http_link=$this->get_remove_http_link_ex($this->new_site_url);
1144
+ $from[]=$remove_http_link;
1145
+ $to[]=$new_remove_http_link;
1146
+
1147
+ if($new_url_use_https)
1148
+ {
1149
+ $from[]='http:'.$new_remove_http_link;
1150
+ $to[]='https:'.$new_remove_http_link;
1151
+ }
1152
+ else
1153
+ {
1154
+ $from[]='https:'.$new_remove_http_link;
1155
+ $to[]='http:'.$new_remove_http_link;
1156
+ }
1157
+ }
1158
+ }
1159
+ }
1160
+ else
1161
+ {
1162
+ $from[]=$this->old_site_url;
1163
+ $to[]=$this->new_site_url;
1164
+ }
1165
+ }
1166
+
1167
+
1168
+ if($this->old_home_url!=$this->old_site_url&&$this->old_home_url!=$this->new_home_url)
1169
+ {
1170
+ if(substr($this->replacing_table, strlen($this->new_prefix))=='posts'||substr($this->replacing_table, strlen($this->new_prefix))=='postmeta'||substr($this->replacing_table, strlen($this->new_prefix))=='options')
1171
+ {
1172
+ $remove_http_link=$this->get_remove_http_link($this->old_home_url);
1173
+ if($remove_http_link!==false)
1174
+ {
1175
+ $new_remove_http_link=$this->get_remove_http_link($this->new_home_url);
1176
+ $from[]=$remove_http_link;
1177
+ $to[]=$new_remove_http_link;
1178
+
1179
+ if($new_url_use_https)
1180
+ {
1181
+ $from[]='http:'.$new_remove_http_link;
1182
+ $to[]='https:'.$new_remove_http_link;
1183
+ }
1184
+ else
1185
+ {
1186
+ $from[]='https:'.$new_remove_http_link;
1187
+ $to[]='http:'.$new_remove_http_link;
1188
+ }
1189
+
1190
+ $quote_old_site_url=$this->get_http_link_at_quote($remove_http_link);
1191
+ $quote_new_site_url=$this->get_http_link_at_quote($new_remove_http_link);
1192
+ $from[]=$quote_old_site_url;
1193
+ $to[]=$quote_new_site_url;
1194
+ if($new_url_use_https)
1195
+ {
1196
+ $from[]='http:'.$quote_new_site_url;
1197
+ $to[]='https:'.$quote_new_site_url;
1198
+ }
1199
+ else
1200
+ {
1201
+ $from[]='https:'.$quote_new_site_url;
1202
+ $to[]='http:'.$quote_new_site_url;
1203
+ }
1204
+ }
1205
+ else
1206
+ {
1207
+ $remove_http_link=$this->get_remove_http_link_ex($this->old_home_url);
1208
+ if($remove_http_link!==false)
1209
+ {
1210
+ $new_remove_http_link=$this->get_remove_http_link_ex($this->new_home_url);
1211
+ $from[]=$remove_http_link;
1212
+ $to[]=$new_remove_http_link;
1213
+
1214
+ if($new_url_use_https)
1215
+ {
1216
+ $from[]='http:'.$new_remove_http_link;
1217
+ $to[]='https:'.$new_remove_http_link;
1218
+ }
1219
+ else
1220
+ {
1221
+ $from[]='https:'.$new_remove_http_link;
1222
+ $to[]='http:'.$new_remove_http_link;
1223
+ }
1224
+ }
1225
+ }
1226
+ }
1227
+ else
1228
+ {
1229
+ $from[]=$this->old_home_url;
1230
+ $to[]=$this->new_home_url;
1231
+ }
1232
+ }
1233
+
1234
+
1235
+ if(!empty($from)&&!empty($to))
1236
+ {
1237
+ $old_string=str_replace($from,$to,$old_string);
1238
+ }
1239
+
1240
+ return $old_string;
1241
+ }
1242
+
1243
  private function replace_string($old_string)
1244
  {
1245
  if(!is_string($old_string))
includes/class-wpvivid-tools.php CHANGED
@@ -105,10 +105,24 @@ class WPvivid_tools
105
  }
106
  public static function file_get_array($file){
107
  global $wpvivid_plugin;
108
- if(file_exists($file)){
 
109
  $get_file_ret = json_decode(file_get_contents($file),true);
110
- if(empty($get_file_ret)){
111
- $wpvivid_plugin->restore_data->write_log('Failed to decode restore data file.', 'notice');
 
 
 
 
 
 
 
 
 
 
 
 
 
112
  }
113
  return $get_file_ret;
114
  }else{
105
  }
106
  public static function file_get_array($file){
107
  global $wpvivid_plugin;
108
+ if(file_exists($file))
109
+ {
110
  $get_file_ret = json_decode(file_get_contents($file),true);
111
+ if(empty($get_file_ret))
112
+ {
113
+ sleep(1);
114
+ $contents=file_get_contents($file);
115
+ if($contents==false)
116
+ {
117
+ $wpvivid_plugin->restore_data->write_log('file_get_contents failed.', 'notice');
118
+ }
119
+ $get_file_ret = json_decode($contents,true);
120
+ if(empty($get_file_ret))
121
+ {
122
+ $wpvivid_plugin->restore_data->write_log('Failed to decode restore data file.', 'notice');
123
+ }
124
+
125
+ return $get_file_ret;
126
  }
127
  return $get_file_ret;
128
  }else{
includes/class-wpvivid.php CHANGED
@@ -1636,6 +1636,8 @@ class WPvivid {
1636
 
1637
  public function task_monitor_ex()
1638
  {
 
 
1639
  $tasks=WPvivid_Setting::get_tasks();
1640
  $task_id='';
1641
  foreach ($tasks as $task)
@@ -2545,6 +2547,7 @@ class WPvivid {
2545
  */
2546
  public function add_remote()
2547
  {
 
2548
  try {
2549
  if (empty($_POST) || !isset($_POST['remote']) || !is_string($_POST['remote']) || !isset($_POST['type']) || !is_string($_POST['type'])) {
2550
  die();
@@ -5103,9 +5106,9 @@ class WPvivid {
5103
 
5104
  public function ajax_check_security($role='administrator')
5105
  {
 
5106
  $check=is_admin()&&current_user_can($role);
5107
  $check=apply_filters('wpvivid_ajax_check_security',$check);
5108
-
5109
  if(!$check)
5110
  {
5111
  die();
@@ -5597,6 +5600,7 @@ class WPvivid {
5597
  }
5598
 
5599
  public function hide_mainwp_tab_page(){
 
5600
  WPvivid_Setting::update_option('wpvivid_hide_mwp_tab_page_v1', true);
5601
  $ret['result']=WPVIVID_SUCCESS;
5602
  echo json_encode($ret);
@@ -5604,6 +5608,7 @@ class WPvivid {
5604
  }
5605
 
5606
  public function hide_wp_cron_notice(){
 
5607
  WPvivid_Setting::update_option('wpvivid_hide_wp_cron_notice', true);
5608
  $ret['result']=WPVIVID_SUCCESS;
5609
  echo json_encode($ret);
1636
 
1637
  public function task_monitor_ex()
1638
  {
1639
+ $this->ajax_check_security();
1640
+
1641
  $tasks=WPvivid_Setting::get_tasks();
1642
  $task_id='';
1643
  foreach ($tasks as $task)
2547
  */
2548
  public function add_remote()
2549
  {
2550
+ $this->ajax_check_security();
2551
  try {
2552
  if (empty($_POST) || !isset($_POST['remote']) || !is_string($_POST['remote']) || !isset($_POST['type']) || !is_string($_POST['type'])) {
2553
  die();
5106
 
5107
  public function ajax_check_security($role='administrator')
5108
  {
5109
+ check_ajax_referer( 'wpvivid_ajax', 'nonce' );
5110
  $check=is_admin()&&current_user_can($role);
5111
  $check=apply_filters('wpvivid_ajax_check_security',$check);
 
5112
  if(!$check)
5113
  {
5114
  die();
5600
  }
5601
 
5602
  public function hide_mainwp_tab_page(){
5603
+ $this->ajax_check_security();
5604
  WPvivid_Setting::update_option('wpvivid_hide_mwp_tab_page_v1', true);
5605
  $ret['result']=WPVIVID_SUCCESS;
5606
  echo json_encode($ret);
5608
  }
5609
 
5610
  public function hide_wp_cron_notice(){
5611
+ $this->ajax_check_security();
5612
  WPvivid_Setting::update_option('wpvivid_hide_wp_cron_notice', true);
5613
  $ret['result']=WPVIVID_SUCCESS;
5614
  echo json_encode($ret);
includes/customclass/class-wpvivid-send-to-site.php CHANGED
@@ -24,16 +24,6 @@ class WPvivid_Send_to_site extends WPvivid_Remote
24
  {
25
  add_action('plugins_loaded', array($this, 'plugins_loaded'));
26
 
27
- //add_action('wp_ajax_wpvivid_send_to_site_connect',array( $this,'send_to_site_connect'));
28
- //add_action('wp_ajax_nopriv_wpvivid_send_to_site_finish',array( $this,'send_to_site_finish'));
29
- //add_action('wp_ajax_wpvivid_send_to_site_finish',array( $this,'send_to_site_finish'));
30
- //add_action('wp_ajax_nopriv_wpvivid_send_to_site_connect',array( $this,'send_to_site_connect'));
31
- //add_action('wp_ajax_nopriv_wpvivid_send_to_site',array( $this,'send_to_site'));
32
- //add_action('wp_ajax_wpvivid_send_to_site',array( $this,'send_to_site'));
33
- //add_action('wp_ajax_nopriv_wpvivid_send_to_site_file_status',array( $this,'send_to_site_file_status'));
34
- //add_action('wp_ajax_wpvivid_send_to_site_file_status',array( $this,'send_to_site_file_status'));
35
- //add_filter('wpvivid_remote_register', array($this, 'init_remotes'),11);
36
-
37
  define('WPVIVID_INIT_SEND_TO_SITE',1);
38
  }
39
  }
24
  {
25
  add_action('plugins_loaded', array($this, 'plugins_loaded'));
26
 
 
 
 
 
 
 
 
 
 
 
27
  define('WPVIVID_INIT_SEND_TO_SITE',1);
28
  }
29
  }
readme.txt CHANGED
@@ -4,16 +4,16 @@ Tags: move, clone, migrate, copy, backup, restore, auto backup, cloud backup
4
  Requires at least: 4.5
5
  Tested up to: 5.3.2
6
  Requires PHP: 5.3
7
- Stable tag: 0.9.35
8
  License: GPLv3 or later
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.en.html
10
 
11
- Migrate a copy of WP site to a new host (a new domain),schedule backups,send backups to leading remote storage. All in one backup&migration plugin
12
 
13
  == Description ==
14
  WPvivid Backup Plugin is the only free all-in-one backup, restore and migration WordPress plugin.
15
 
16
- Migrate a copy of WP site to a new host (a new domain),schedule backups,send backups to leading remote storage. All in one backup&migration plugin.
17
 
18
  == WPvivid Backup for MainWP ==
19
  [WPvivid Backup for MainWP](https://wpvivid.com/wpvivid-backup-for-mainwp) is now available to download.
@@ -25,14 +25,19 @@ Click to download [WPvivid Backup for MainWP](https://wordpress.org/plugins/wpvi
25
  * Customize everything to backup
26
  * Create staging sites and push staging to live site
27
  * Incremental backups
28
- * Rollback WordPress core, themes, and plugins
29
  * WordPress Multisite backup
30
  * Advanced remote storage
31
  * Advanced backup schedules
32
- * Restore from remote storage
33
  * Migrate everything via remote storage
34
  * Edit user roles capabilities
35
- [Click to purchase WPvivid Backup Pro](https://pro.wpvivid.com/pricing)
 
 
 
 
 
36
 
37
  == Supported Page Builders ==
38
  WPvivid Backup Plugin has been tested by our users to migrate well on websites built with:
@@ -43,7 +48,7 @@ WPvivid Backup Plugin has been tested by our users to migrate well on websites b
43
  == Core Features ==
44
 
45
  = 1. Easy Site Move or Migration (New Feature) =
46
- Migrate your WordPress site to a new domain with a single click. The plugin supports site migration from dev environment to a new server, from dev environment to a new domain or from a live server to another.
47
 
48
  You can also migrate a site to a subdirectory, from a.com to b.com, from a.com to a.com/directory and from a.com to b.com/directory.
49
 
@@ -52,7 +57,7 @@ You are free to choose what to migrate: the entire site, files or just the datab
52
  Upload a backup to restore or migrate.
53
  You can migrate or restore backups created with 0.9.14 or a higher version.
54
  = 3. Automatic Backup =
55
- Setup and forget, the plugin will do the rest automatically backing up your website.
56
  = 4. One-Click Restore =
57
  Restore your WordPress site from a backup with a single click.
58
 
@@ -62,7 +67,7 @@ Dropbox, Google Drive, Microsoft OneDrive, Amazon S3, DigitalOcean Spaces, SFTP,
62
  The pro version also supports Wasabi, pCloud and more are coming soon.
63
 
64
  == Site Migration Process ==
65
- 1. Install the WPvivid Backup plugin on both the destination site and the sending site.
66
  2. Generate a site key on the destination site with one click.
67
  3. Paste the key in the sending site and save it.
68
  4. Migrate the site with one-click.
@@ -71,10 +76,10 @@ The pro version also supports Wasabi, pCloud and more are coming soon.
71
  * One-Click Site Move or Migration
72
  * Upload Backups to Restore or Migrate
73
  * Schedule Automated Backups
74
- * One-Click Restore
75
- * Manual Backup
76
- * Filter Large Files
77
- * Large Database Support
78
  * Optimized for Web Hosting/Shared Web Hosting
79
  * Set Backup Retention
80
  * Backup Splitting
@@ -101,29 +106,29 @@ The pro version also supports Wasabi, pCloud and more are coming soon.
101
 
102
  == Support ==
103
  We offer free support in 3 channels:
104
- = Forum Support: = Post questions and get faster answers from the plugin [support forum](https://wordpress.org/support/plugin/wpvivid-backuprestore/) on WordPress.org.
105
  = Email Support: = Leave us a message at our [contact page](https://wpvivid.com/contact-us) and we will back to you soon.
106
  = FAQs: = Check out our FAQs section on the page, you can easily find an answer for the most part.
107
 
108
  == Installation and Uninstallation ==
109
 
110
- = Installation =
111
  1.Go to your sites admin dashboard.
112
  2.Navigate to Plugin Menu and simply search for WPvivid.
113
  3.Click Install Now then click Activate Plugin.
114
 
115
- = Uninstallation =
116
  1.Click Deactivate from the Plugin Menu.
117
  2.Click Delete.
118
 
119
  == Privacy Policy and GDPR Compliance ==
120
  WPvivid Backup plugin is created and operated with full respect and protection of users personal information, and is in full compliance with General Data Protection Regulation(GDPR). Check out the following content to know the details:
121
  = What personal data can WPvivid Backup plugin access and how is the data processed? =
122
- The free version of WPvivid Backup plugin is only available to download from WordPress plugin repository. Thus, all the data related to the updates of the versions as well as the support forum for the plugin on WordPress.org is held by WordPress.org.
123
  In addition, the implementations of all migrations, backups and restores of your site happen completely on your website server, there are no data come across any of our servers in the whole process.
124
  The only personal data currently we can access are the contact data when you contact us by email, which may include your name, email address and other contact details. The data will only be used for the purposes of handling and resolving your enquiry.
125
  = How does WPvivid Backup plugin help users create a GDPR compliant backup? =
126
- In order to help users create a GDPR compliant backup, the plugin comes with multiple features including selection for backup content, backup and restore logs, and email report. Moreover, as the plugin itself does not collect any personal data, you do not need to sign a Data Processing Agreement (DPA) with us.
127
  However, if you migrate your backups to cloud storage with Migrate & Backup WordPress - WPvivid Backup Plugin, the personal data is moved to that storage provider. You'll need to sign a Data Processing Agreement with that provider.
128
  Check out the [privacy policy](https://wpvivid.com/privacy-policy) involving the use of Google Drive, Dropbox and Microsoft OneDrive.
129
 
@@ -140,22 +145,22 @@ This program is distributed in the hope that it will be useful, but WITHOUT ANY
140
  6. Upload a backup to restore or migrate
141
 
142
  == Frequently Asked Questions ==
143
- = What does WPvivid Backup plugin do? =
144
- As its name says, it is an all in one free WP backup plugin that enables you to easily migrate a WordPress site to a new domain, to perform manual and scheduled backups of your WordPress site, to back up to cloud storage and restore backups directly from your sites admin dashboard.
145
- = Does the plugin also migrate my site? Is it a free feature? =
146
  Yes, we have added website migration feature since version 0.9.14.
147
  Yes, it's a completely free feature.
148
- = How many cloud options does it support? Are they free to access? =
149
  Out of the box we support Dropbox, Google Drive, Amazon S3, Microsoft OneDrive, DigitalOcean Spaces, we also support FTP, SFTP methods which you can use on any other remote storage provider supporting these methods. We are working hard to add more soon.
150
 
151
  Yes, all the cloud access is free.
152
- = Is the restore feature free? =
153
  Yes, absolutely. With no limits, no strings attached.
154
  = Will there be updates, will they be free and how can I update to the latest version? =
155
  Yes, we are dedicated to creating a secure and robust solution and will regularly update the plugin. These will be available totally free and can be easily applied through your WP admin area once they are available.
156
  = Do you provide support for the free version? Where? =
157
  Yes, absolutely. Whenever you need it, help can be found from the plugin [support forum](https://wordpress.org/support/plugin/wpvivid-backuprestore/) on WordPress.org, by [email](https://wpvivid.com/contact-us), on [Twitter](https://twitter.com/WPvividcom).
158
- = Will the plugin work on my host? =
159
  If your website is running on WordPress then yes it will.
160
 
161
  The plugin has been extensively tested on the shared and dedicated hosting plans from the leading website hosting providers like Godaddy, Siteground, and many others.
@@ -163,7 +168,7 @@ The plugin has been extensively tested on the shared and dedicated hosting plans
163
  Yes, we do. Here are the guides for [migrating your site to a new host](https://wpvivid.com/get-started-transfer-site.html), [creating a manual backup](https://wpvivid.com/get-started-create-a-manual-backup.html), [restoring your site from a backup](https://wpvivid.com/get-started-restore-site.html), and more on [our docs page](https://wpvivid.com/documents).
164
 
165
  == Contact us ==
166
- Feel free to let us know how we can help using the [support forum](https://wordpress.org/support/plugin/wpvivid-backuprestore) for the plugin on WordPress.org or our [contact form](https://wpvivid.com/contact-us). You can also reach us with a direct message on [Twitter](https://twitter.com/WPvividcom).
167
 
168
  == Languages and Translators ==
169
  Thank you for translating WPvivid Backup Plugin to your languages!
@@ -172,6 +177,10 @@ Thank you for translating WPvivid Backup Plugin to your languages!
172
  * [Shohei OKADA](https://ja.gravatar.com/silversword0630)(Japanese)
173
 
174
  == Changelog ==
 
 
 
 
175
  = 0.9.35 =
176
  - Fixed a bug occurred when connecting with remote storage in some cases.
177
  - Fixed some bugs in the plugin code.
4
  Requires at least: 4.5
5
  Tested up to: 5.3.2
6
  Requires PHP: 5.3
7
+ Stable tag: 0.9.36
8
  License: GPLv3 or later
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.en.html
10
 
11
+ Migrate a backup of WP site to a new host (a new domain),schedule and send a backup to leading remote storage. All in one backup&migration plugin
12
 
13
  == Description ==
14
  WPvivid Backup Plugin is the only free all-in-one backup, restore and migration WordPress plugin.
15
 
16
+ Migrate a copy of WP site to a new host (a new domain), schedule backups, send backups to leading remote storage. All in one backup & migration plugin.
17
 
18
  == WPvivid Backup for MainWP ==
19
  [WPvivid Backup for MainWP](https://wpvivid.com/wpvivid-backup-for-mainwp) is now available to download.
25
  * Customize everything to backup
26
  * Create staging sites and push staging to live site
27
  * Incremental backups
28
+ * Auto backup WordPress core, themes, and plugins
29
  * WordPress Multisite backup
30
  * Advanced remote storage
31
  * Advanced backup schedules
32
+ * Restore backups from remote storage
33
  * Migrate everything via remote storage
34
  * Edit user roles capabilities
35
+
36
+ See a review video on WPvivid Backup Pro:
37
+
38
+ https://www.youtube.com/watch?v=D1aYbayFpfU&t=7s
39
+
40
+ [Click to Start A 14-Day Free Trial of WPvivid Backup Pro](https://wpvivid.com/pricing)
41
 
42
  == Supported Page Builders ==
43
  WPvivid Backup Plugin has been tested by our users to migrate well on websites built with:
48
  == Core Features ==
49
 
50
  = 1. Easy Site Move or Migration (New Feature) =
51
+ Migrate your WordPress site to a new domain with a single click. WPvivid Backup Plugin supports site migration from dev environment to a new server, from dev environment to a new domain or from a live server to another.
52
 
53
  You can also migrate a site to a subdirectory, from a.com to b.com, from a.com to a.com/directory and from a.com to b.com/directory.
54
 
57
  Upload a backup to restore or migrate.
58
  You can migrate or restore backups created with 0.9.14 or a higher version.
59
  = 3. Automatic Backup =
60
+ Setup and forget, WPvivid Backup Plugin will do the rest automatically backing up your website.
61
  = 4. One-Click Restore =
62
  Restore your WordPress site from a backup with a single click.
63
 
67
  The pro version also supports Wasabi, pCloud and more are coming soon.
68
 
69
  == Site Migration Process ==
70
+ 1. Install WPvivid Backup plugin on both the destination site and the sending site.
71
  2. Generate a site key on the destination site with one click.
72
  3. Paste the key in the sending site and save it.
73
  4. Migrate the site with one-click.
76
  * One-Click Site Move or Migration
77
  * Upload Backups to Restore or Migrate
78
  * Schedule Automated Backups
79
+ * Restore A Backup with One Click
80
+ * Create A Manual Backup
81
+ * Filter Large Files from A Backup
82
+ * Large Database Backup Support
83
  * Optimized for Web Hosting/Shared Web Hosting
84
  * Set Backup Retention
85
  * Backup Splitting
106
 
107
  == Support ==
108
  We offer free support in 3 channels:
109
+ = Forum Support: = Post questions and get faster answers from [WPvivid Backup Plugin support forum](https://wordpress.org/support/plugin/wpvivid-backuprestore/) on WordPress.org.
110
  = Email Support: = Leave us a message at our [contact page](https://wpvivid.com/contact-us) and we will back to you soon.
111
  = FAQs: = Check out our FAQs section on the page, you can easily find an answer for the most part.
112
 
113
  == Installation and Uninstallation ==
114
 
115
+ = Install WPvivid Backup Plugin =
116
  1.Go to your sites admin dashboard.
117
  2.Navigate to Plugin Menu and simply search for WPvivid.
118
  3.Click Install Now then click Activate Plugin.
119
 
120
+ = Uninstall WPvivid Backup Plugin =
121
  1.Click Deactivate from the Plugin Menu.
122
  2.Click Delete.
123
 
124
  == Privacy Policy and GDPR Compliance ==
125
  WPvivid Backup plugin is created and operated with full respect and protection of users personal information, and is in full compliance with General Data Protection Regulation(GDPR). Check out the following content to know the details:
126
  = What personal data can WPvivid Backup plugin access and how is the data processed? =
127
+ The free version of WPvivid Backup plugin is only available to download from WordPress plugin repository. Thus, all the data related to the updates of the versions as well as the support forum for WPvivid Backup Plugin on WordPress.org is held by WordPress.org.
128
  In addition, the implementations of all migrations, backups and restores of your site happen completely on your website server, there are no data come across any of our servers in the whole process.
129
  The only personal data currently we can access are the contact data when you contact us by email, which may include your name, email address and other contact details. The data will only be used for the purposes of handling and resolving your enquiry.
130
  = How does WPvivid Backup plugin help users create a GDPR compliant backup? =
131
+ In order to help users create a GDPR compliant backup, WPvivid Backup Plugin comes with multiple features including selection for backup content, backup and restore logs, and email report. Moreover, as WPvivid Backup Plugin itself does not collect any personal data, you do not need to sign a Data Processing Agreement (DPA) with us.
132
  However, if you migrate your backups to cloud storage with Migrate & Backup WordPress - WPvivid Backup Plugin, the personal data is moved to that storage provider. You'll need to sign a Data Processing Agreement with that provider.
133
  Check out the [privacy policy](https://wpvivid.com/privacy-policy) involving the use of Google Drive, Dropbox and Microsoft OneDrive.
134
 
145
  6. Upload a backup to restore or migrate
146
 
147
  == Frequently Asked Questions ==
148
+ = What does WPvivid Backup Plugin do? =
149
+ As the name says, WPvivid Backup Plugin is an all in one free WP backup plugin that enables you to easily migrate a WordPress site to a new domain, to perform manual and scheduled backups of your WordPress site, to back up to cloud storage and restore backups directly from your sites admin dashboard.
150
+ = Does WPvivid Backup Plugin also migrate my site? Is it a free feature? =
151
  Yes, we have added website migration feature since version 0.9.14.
152
  Yes, it's a completely free feature.
153
+ = How many cloud options does WPvivid Backup Plugin support? Are they free to access? =
154
  Out of the box we support Dropbox, Google Drive, Amazon S3, Microsoft OneDrive, DigitalOcean Spaces, we also support FTP, SFTP methods which you can use on any other remote storage provider supporting these methods. We are working hard to add more soon.
155
 
156
  Yes, all the cloud access is free.
157
+ = Can I use WPvivid Backup Plugin to restore my site? =
158
  Yes, absolutely. With no limits, no strings attached.
159
  = Will there be updates, will they be free and how can I update to the latest version? =
160
  Yes, we are dedicated to creating a secure and robust solution and will regularly update the plugin. These will be available totally free and can be easily applied through your WP admin area once they are available.
161
  = Do you provide support for the free version? Where? =
162
  Yes, absolutely. Whenever you need it, help can be found from the plugin [support forum](https://wordpress.org/support/plugin/wpvivid-backuprestore/) on WordPress.org, by [email](https://wpvivid.com/contact-us), on [Twitter](https://twitter.com/WPvividcom).
163
+ = Will WPvivid Backup Plugin work on my host? =
164
  If your website is running on WordPress then yes it will.
165
 
166
  The plugin has been extensively tested on the shared and dedicated hosting plans from the leading website hosting providers like Godaddy, Siteground, and many others.
168
  Yes, we do. Here are the guides for [migrating your site to a new host](https://wpvivid.com/get-started-transfer-site.html), [creating a manual backup](https://wpvivid.com/get-started-create-a-manual-backup.html), [restoring your site from a backup](https://wpvivid.com/get-started-restore-site.html), and more on [our docs page](https://wpvivid.com/documents).
169
 
170
  == Contact us ==
171
+ Feel free to let us know how we can help using the [support forum](https://wordpress.org/support/plugin/wpvivid-backuprestore) for WPvivid Backup Plugin on WordPress.org or our [contact form](https://wpvivid.com/contact-us). You can also reach us with a direct message on [Twitter](https://twitter.com/WPvividcom).
172
 
173
  == Languages and Translators ==
174
  Thank you for translating WPvivid Backup Plugin to your languages!
177
  * [Shohei OKADA](https://ja.gravatar.com/silversword0630)(Japanese)
178
 
179
  == Changelog ==
180
+ = 0.9.36 =
181
+ - Added an option to overwrite existing pages in an import.
182
+ - Fixed: Could not retrieve posts list on a multilingual site in an export.
183
+ - Fixed some bugs in the plugin code and optimized the plugin code.
184
  = 0.9.35 =
185
  - Fixed a bug occurred when connecting with remote storage in some cases.
186
  - Fixed some bugs in the plugin code.
uninstall.php CHANGED
@@ -39,6 +39,7 @@ delete_option('wpvivid_transfer_success_count');
39
  delete_option('wpvivid_api_token');
40
  delete_option('wpvivid_download_task_v2');
41
  delete_option('wpvivid_export_list');
 
42
 
43
  define('WPVIVID_MAIN_SCHEDULE_EVENT','wpvivid_main_schedule_event');
44
 
39
  delete_option('wpvivid_api_token');
40
  delete_option('wpvivid_download_task_v2');
41
  delete_option('wpvivid_export_list');
42
+ delete_option('wpvivid_backup_report');
43
 
44
  define('WPVIVID_MAIN_SCHEDULE_EVENT','wpvivid_main_schedule_event');
45
 
wpvivid-backuprestore.php CHANGED
@@ -7,7 +7,7 @@
7
  * @wordpress-plugin
8
  * Plugin Name: WPvivid Backup Plugin
9
  * Description: Clone or copy WP sites then move or migrate them to new host (new domain), schedule backups, transfer backups to leading remote storage. All in one.
10
- * Version: 0.9.35
11
  * Author: WPvivid Team
12
  * Author URI: https://wpvivid.com
13
  * License: GPL-3.0+
@@ -21,7 +21,7 @@ if ( ! defined( 'WPINC' ) ) {
21
  die;
22
  }
23
 
24
- define( 'WPVIVID_PLUGIN_VERSION', '0.9.35' );
25
  //
26
  define('WPVIVID_RESTORE_INIT','init');
27
  define('WPVIVID_RESTORE_READY','ready');
7
  * @wordpress-plugin
8
  * Plugin Name: WPvivid Backup Plugin
9
  * Description: Clone or copy WP sites then move or migrate them to new host (new domain), schedule backups, transfer backups to leading remote storage. All in one.
10
+ * Version: 0.9.36
11
  * Author: WPvivid Team
12
  * Author URI: https://wpvivid.com
13
  * License: GPL-3.0+
21
  die;
22
  }
23
 
24
+ define( 'WPVIVID_PLUGIN_VERSION', '0.9.36' );
25
  //
26
  define('WPVIVID_RESTORE_INIT','init');
27
  define('WPVIVID_RESTORE_READY','ready');