WP Reset – Fastest WordPress Reset Plugin - Version 1.90

Version Description

Download this release

Release Info

Developer WebFactory
Plugin Icon 128x128 WP Reset – Fastest WordPress Reset Plugin
Version 1.90
Comparing to
See all releases

Code changes from version 1.86 to 1.90

css/wp-reset.css CHANGED
@@ -50,7 +50,7 @@ body.tools_page_wp-reset {
50
  .wpr-container {
51
  margin: 0 auto;
52
  max-width: 100%;
53
- width: 760px;
54
  }
55
 
56
  .tools_page_wp-reset header {
@@ -292,6 +292,7 @@ body.tools_page_wp-reset {
292
  .tools_page_wp-reset .swal2-popup .swal2-title {
293
  line-height: 1.1;
294
  font-weight: 700;
 
295
  }
296
 
297
  .tools_page_wp-reset code {
50
  .wpr-container {
51
  margin: 0 auto;
52
  max-width: 100%;
53
+ width: 910px;
54
  }
55
 
56
  .tools_page_wp-reset header {
292
  .tools_page_wp-reset .swal2-popup .swal2-title {
293
  line-height: 1.1;
294
  font-weight: 700;
295
+ display: block !important;
296
  }
297
 
298
  .tools_page_wp-reset code {
js/wp-reset.js CHANGED
@@ -285,7 +285,13 @@ jQuery(document).ready(function ($) {
285
  } else {
286
  msg = $(button).data('text-done').replace('%n', cnt);
287
  }
288
- wpr_swal.fire({ icon: 'success', title: msg });
 
 
 
 
 
 
289
  });
290
 
291
  return false;
@@ -851,7 +857,7 @@ jQuery(document).ready(function ($) {
851
  wp_reset.collections = [];
852
  wp_reset.collections[1] = {
853
  id: 1,
854
- name: 'Must-have WordPress Plugins',
855
  created: '2020-04-01',
856
  items: [],
857
  };
285
  } else {
286
  msg = $(button).data('text-done').replace('%n', cnt);
287
  }
288
+ wpr_swal.fire({
289
+ icon: 'success',
290
+ title: msg,
291
+ timer: 2000,
292
+ timerProgressBar: true,
293
+ showConfirmButton: true,
294
+ });
295
  });
296
 
297
  return false;
857
  wp_reset.collections = [];
858
  wp_reset.collections[1] = {
859
  id: 1,
860
+ name: 'Must Have WordPress Plugins',
861
  created: '2020-04-01',
862
  items: [],
863
  };
readme.txt CHANGED
@@ -3,8 +3,8 @@ Tags: wordpress reset, reset database, reset wordpress database, reset, advanced
3
  Contributors: WebFactory
4
  Requires at least: 4.0
5
  Requires PHP: 5.2
6
- Tested up to: 5.7
7
- Stable tag: 1.86
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -115,6 +115,11 @@ Or if needed, upload manually;
115
 
116
  == Changelog ==
117
 
 
 
 
 
 
118
  = v1.86 =
119
  * 2021/02/20
120
  * fixed a small but nasty translation bug that prevented some users from resetting
3
  Contributors: WebFactory
4
  Requires at least: 4.0
5
  Requires PHP: 5.2
6
+ Tested up to: 5.8
7
+ Stable tag: 1.90
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
115
 
116
  == Changelog ==
117
 
118
+ = v1.90 =
119
+ * 2021/06/01
120
+ * security fixes
121
+ * cleaned up unused code
122
+
123
  = v1.86 =
124
  * 2021/02/20
125
  * fixed a small but nasty translation bug that prevented some users from resetting
wf-flyout/config.php CHANGED
@@ -16,6 +16,6 @@ $config['menu_items'] = array(
16
  array('href' => 'https://wp301redirects.com/?ref=wff-wp-reset&coupon=50off', 'label' => 'Get WP 301 Redirects PRO with 50% off', 'icon' => '301-logo.png', 'class' => 'wp301-icon'),
17
  array('href' => 'https://underconstructionpage.com/?ref=wff-wp-reset&coupon=welcome', 'target' => '_blank', 'label' => 'Create the perfect Under Construction Page', 'icon' => 'ucp.png', 'class' => 'ucp-icon'),
18
  array('href' => 'https://wpsticky.com/?ref=wff-wp-reset', 'target' => '_blank', 'label' => 'Make any element sticky with WP Sticky', 'icon' => 'dashicons-admin-post'),
19
- array('href' => 'https://wordpress.org/support/plugin/wp-reset/reviews/?filter=5#new-post', 'target' => '_blank', 'label' => 'Rate the Plugin', 'icon' => 'dashicons-thumbs-up'),
20
  array('href' => 'https://wordpress.org/support/plugin/wp-reset/#new-post', 'target' => '_blank', 'label' => 'Get Support', 'icon' => 'dashicons-sos'),
21
  );
16
  array('href' => 'https://wp301redirects.com/?ref=wff-wp-reset&coupon=50off', 'label' => 'Get WP 301 Redirects PRO with 50% off', 'icon' => '301-logo.png', 'class' => 'wp301-icon'),
17
  array('href' => 'https://underconstructionpage.com/?ref=wff-wp-reset&coupon=welcome', 'target' => '_blank', 'label' => 'Create the perfect Under Construction Page', 'icon' => 'ucp.png', 'class' => 'ucp-icon'),
18
  array('href' => 'https://wpsticky.com/?ref=wff-wp-reset', 'target' => '_blank', 'label' => 'Make any element sticky with WP Sticky', 'icon' => 'dashicons-admin-post'),
19
+ array('href' => 'https://wordpress.org/support/plugin/wp-reset/reviews/#new-post', 'target' => '_blank', 'label' => 'Rate the Plugin', 'icon' => 'dashicons-thumbs-up'),
20
  array('href' => 'https://wordpress.org/support/plugin/wp-reset/#new-post', 'target' => '_blank', 'label' => 'Get Support', 'icon' => 'dashicons-sos'),
21
  );
wf-flyout/wf-flyout.php CHANGED
@@ -1,5 +1,4 @@
1
  <?php
2
-
3
  /**
4
  * Universal fly-out menu for WebFactory plugins
5
  * (c) WebFactory Ltd, 2021
@@ -95,21 +94,21 @@ if (false == class_exists('wf_flyout')) {
95
 
96
  $out = '<style type="text/css">';
97
  $out .= '#wf-flyout {
98
- right: ' . $this->config['icon_right'] . ';
99
- bottom: ' . $this->config['icon_bottom'] . ';
100
  }';
101
  $out .= '#wf-flyout #wff-image-wrapper {
102
- border: ' . $this->config['icon_border'] . ';
103
  }';
104
  $out .= '#wf-flyout #wff-button img {
105
- padding: ' . $this->config['icon_padding'] . ';
106
- width: ' . $this->config['icon_size'] . ';
107
- height: ' . $this->config['icon_size'] . ';
108
  }';
109
  $out .= '#wf-flyout .wff-menu-item.accent {
110
- background: ' . $this->config['menu_accent_color'] . ';
111
  }';
112
- $out .= $this->config['custom_css'];
113
  $out .= '</style>';
114
 
115
  echo $out;
@@ -133,7 +132,7 @@ if (false == class_exists('wf_flyout')) {
133
  $out .= '<a href="#" id="wff-button">';
134
  $out .= '<span class="wff-label">Open Quick Links</span>';
135
  $out .= '<span id="wff-image-wrapper">';
136
- $out .= '<img src="' . $icons_url . $this->config['icon_image'] . '" alt="Open Quick Links" title="Open Quick Links">';
137
  $out .= '</span>';
138
  $out .= '</a>';
139
 
@@ -148,12 +147,12 @@ if (false == class_exists('wf_flyout')) {
148
  $item['class'] = trim($item['class']);
149
  }
150
 
151
- $out .= '<a ' . $item['data'] . ' href="' . $item['href'] . '" class="wff-menu-item wff-menu-item-' . $i . ' ' . $item['class'] . '" target="_blank">';
152
- $out .= '<span class="wff-label visible">' . $item['label'] . '</span>';
153
  if (substr($item['icon'], 0, 9) == 'dashicons') {
154
- $out .= '<span class="dashicons ' . $item['icon'] . '"></span>';
155
  } elseif (!empty($item['icon'])) {
156
- $out .= '<span class="wff-icon"><img src="' . $icons_url . $item['icon'] . '"></span>';
157
  }
158
  $out .= '</a>';
159
  } // foreach
1
  <?php
 
2
  /**
3
  * Universal fly-out menu for WebFactory plugins
4
  * (c) WebFactory Ltd, 2021
94
 
95
  $out = '<style type="text/css">';
96
  $out .= '#wf-flyout {
97
+ right: ' . sanitize_text_field($this->config['icon_right']) . ';
98
+ bottom: ' . sanitize_text_field($this->config['icon_bottom']) . ';
99
  }';
100
  $out .= '#wf-flyout #wff-image-wrapper {
101
+ border: ' . sanitize_text_field($this->config['icon_border']) . ';
102
  }';
103
  $out .= '#wf-flyout #wff-button img {
104
+ padding: ' . sanitize_text_field($this->config['icon_padding']) . ';
105
+ width: ' . sanitize_text_field($this->config['icon_size']) . ';
106
+ height: ' . sanitize_text_field($this->config['icon_size']) . ';
107
  }';
108
  $out .= '#wf-flyout .wff-menu-item.accent {
109
+ background: ' . sanitize_text_field($this->config['menu_accent_color']) . ';
110
  }';
111
+ $out .= sanitize_text_field($this->config['custom_css']);
112
  $out .= '</style>';
113
 
114
  echo $out;
132
  $out .= '<a href="#" id="wff-button">';
133
  $out .= '<span class="wff-label">Open Quick Links</span>';
134
  $out .= '<span id="wff-image-wrapper">';
135
+ $out .= '<img src="' . esc_url($icons_url . $this->config['icon_image']) . '" alt="Open Quick Links" title="Open Quick Links">';
136
  $out .= '</span>';
137
  $out .= '</a>';
138
 
147
  $item['class'] = trim($item['class']);
148
  }
149
 
150
+ $out .= '<a href="' . esc_url($item['href']) . '" class="wff-menu-item wff-menu-item-' . $i . ' ' . esc_attr($item['class']) . '" target="_blank">';
151
+ $out .= '<span class="wff-label visible">' . esc_html($item['label']) . '</span>';
152
  if (substr($item['icon'], 0, 9) == 'dashicons') {
153
+ $out .= '<span class="dashicons ' . sanitize_text_field($item['icon']) . '"></span>';
154
  } elseif (!empty($item['icon'])) {
155
+ $out .= '<span class="wff-icon"><img src="' . esc_url($icons_url . $item['icon']) . '"></span>';
156
  }
157
  $out .= '</a>';
158
  } // foreach
wp-reset-licensing.php CHANGED
@@ -37,6 +37,7 @@ if (false === class_exists('WF_Licensing')) {
37
  $this->slug = dirname(plugin_basename(trim($params['plugin_file'])));
38
  $this->basename = plugin_basename(trim($params['plugin_file']));
39
  $this->plugin_file = $params['plugin_file'];
 
40
  $this->debug = !empty($params['debug']);
41
 
42
  if ($params['js_folder']) {
@@ -68,29 +69,40 @@ if (false === class_exists('WF_Licensing')) {
68
  function init()
69
  {
70
  if (is_admin()) {
71
- $vars = array(
72
- 'prefix' => $this->prefix,
73
- 'debug' => $this->debug,
74
- 'nonce' => wp_create_nonce('wf_licensing_' . $this->prefix),
75
- 'licensing_endpoint' => $this->licensing_servers[0] . $this->api_ver,
76
- 'request_data' => array(
77
- 'action' => 'validate_license',
78
- 'license_key' => '',
79
- 'rand' => rand(1000, 9999),
80
- 'version' => $this->version,
81
- 'wp_version' => get_bloginfo('version'),
82
- 'site_url' => get_home_url(),
83
- 'site_title' => get_bloginfo('name'),
84
- 'meta' => array()
85
- )
86
- );
87
-
88
- wp_enqueue_script('wf_licensing', $this->js_folder . 'wf-licensing.js', array(), 1.0, true);
89
- wp_localize_script('wf_licensing', 'wf_licensing_' . $this->prefix, $vars);
90
  }
91
  } // init
92
 
93
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
94
  /**
95
  * Log message if debugging is enabled.
96
  * Log file: /wp-content/wf-licensing.log
@@ -433,7 +445,8 @@ if (false === class_exists('WF_Licensing')) {
433
  {
434
  check_ajax_referer('wf_licensing_' . $this->prefix);
435
 
436
- $license_key = trim($_REQUEST['license_key']);
 
437
  if (empty($license_key)) {
438
  $this->update_license(false);
439
  do_action('wf_licensing_' . $this->prefix . '_validate_ajax', $license_key, false);
@@ -469,15 +482,17 @@ if (false === class_exists('WF_Licensing')) {
469
  {
470
  check_ajax_referer('wf_licensing_' . $this->prefix);
471
 
472
- $out['license_key'] = trim($_POST['license_key']);
 
 
473
 
474
  if ($_POST['success'] == 'true') {
475
- $out['error'] = trim($_POST['data']['error']);
476
- $out['name'] = trim($_POST['data']['name']);
477
- $out['valid_until'] = trim($_POST['data']['valid_until']);
478
- $out['meta'] = $_POST['data']['meta'];
479
  } else {
480
- $out['error'] = trim($_POST['data']);
481
  $out['name'] = '';
482
  $out['valid_until'] = '';
483
  $out['meta'] = array();
37
  $this->slug = dirname(plugin_basename(trim($params['plugin_file'])));
38
  $this->basename = plugin_basename(trim($params['plugin_file']));
39
  $this->plugin_file = $params['plugin_file'];
40
+ $this->plugin_page = trim($params['plugin_page']);
41
  $this->debug = !empty($params['debug']);
42
 
43
  if ($params['js_folder']) {
69
  function init()
70
  {
71
  if (is_admin()) {
72
+ add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  }
74
  } // init
75
 
76
 
77
+ function admin_enqueue_scripts() {
78
+ $current_screen = get_current_screen();
79
+
80
+ if (empty($current_screen->id) || $current_screen->id != $this->plugin_page) {
81
+ return false;
82
+ }
83
+
84
+ $vars = array(
85
+ 'prefix' => $this->prefix,
86
+ 'debug' => $this->debug,
87
+ 'nonce' => wp_create_nonce('wf_licensing_' . $this->prefix),
88
+ 'licensing_endpoint' => $this->licensing_servers[0] . $this->api_ver,
89
+ 'request_data' => array(
90
+ 'action' => 'validate_license',
91
+ 'license_key' => '',
92
+ 'rand' => rand(1000, 9999),
93
+ 'version' => $this->version,
94
+ 'wp_version' => get_bloginfo('version'),
95
+ 'site_url' => get_home_url(),
96
+ 'site_title' => get_bloginfo('name'),
97
+ 'meta' => array()
98
+ )
99
+ );
100
+
101
+ wp_enqueue_script('wf_licensing', $this->js_folder . 'wf-licensing.js', array(), 1.0, true);
102
+ wp_localize_script('wf_licensing', 'wf_licensing_' . $this->prefix, $vars);
103
+ } // admin_enqueue_scripts
104
+
105
+
106
  /**
107
  * Log message if debugging is enabled.
108
  * Log file: /wp-content/wf-licensing.log
445
  {
446
  check_ajax_referer('wf_licensing_' . $this->prefix);
447
 
448
+ $license_key = sanitize_text_field($_REQUEST['license_key']);
449
+ $license_key = trim(substr($license_key, 0, 64));
450
  if (empty($license_key)) {
451
  $this->update_license(false);
452
  do_action('wf_licensing_' . $this->prefix . '_validate_ajax', $license_key, false);
482
  {
483
  check_ajax_referer('wf_licensing_' . $this->prefix);
484
 
485
+ $license_key = sanitize_text_field($_POST['license_key']);
486
+ $license_key = trim(substr($license_key, 0, 64));
487
+ $out['license_key'] = $license_key;
488
 
489
  if ($_POST['success'] == 'true') {
490
+ $out['error'] = sanitize_text_field($_POST['data']['error']);
491
+ $out['name'] = sanitize_text_field($_POST['data']['name']);
492
+ $out['valid_until'] = sanitize_text_field($_POST['data']['valid_until']);
493
+ $out['meta'] = sanitize_text_field($_POST['data']['meta']);
494
  } else {
495
+ $out['error'] = sanitize_text_field($_POST['data']);
496
  $out['name'] = '';
497
  $out['valid_until'] = '';
498
  $out['meta'] = array();
wp-reset-utility.php CHANGED
@@ -19,7 +19,7 @@ class WP_Reset_Utility
19
  */
20
  static function get_wordpress_versions()
21
  {
22
- $versions = '{"5.7-alpha-49984":"bleeding","5.6.1-alpha-49877":"point","5.6":1607510561,"5.5.3":1604135302,"5.5.2":1604048028,"5.5.1":1599016376,"5.5":1597196480,"5.4.2":1591904327,"5.4.1":1588268252,"5.4":1586433381,"5.3.2":1578431355,"5.3.1":1576222826,"5.3":1573985840,"5.2.4":1572476910,"5.2.3":1567634400,"5.2.2":1560816000,"5.2.1":1558396800,"5.2":1557187200,"5.1.2":1567641600,"5.1.1":1552435200,"5.1":1550707200,"5.0.6":1567641600,"5.0.4":1552435200,"5.0.3":1546992000,"5.0.2":1545177600,"5.0.1":1544659200,"0":1544054400,"4.9.11":1567641600,"4.9.10":1552435200,"4.9.9":1544659200,"4.9.8":1533168000,"4.9.7":1530748800,"4.9.6":1526515200,"4.9.5":1522713600,"4.9.4":1517875200,"4.9.3":1517788800,"4.9.2":1516060800,"4.9.1":1511913600,"4.9":1510790400,"4.8.10":1567641600,"4.8.9":1552435200,"4.8.8":1544659200,"4.8.7":1530748800,"4.8.6":1522713600,"4.8.5":1516060800,"4.8.4":1511913600,"4.8.3":1509408000,"4.8.2":1505779200,"4.8.1":1501632000,"4.8":1496880000,"4.7.14":1567641600,"4.7.13":1552435200,"4.7.12":1544659200,"4.7.11":1530748800,"4.7.10":1522713600,"4.7.9":1516060800,"4.7.8":1511913600,"4.7.7":1509408000,"4.7.6":1505779200,"4.7.5":1494892800,"4.7.4":1492646400,"4.7.3":1488758400,"4.7.2":1485388800,"4.7.1":1484092800,"4.7":1480982400,"4.6.15":1567641600,"4.6.14":1552435200,"4.6.13":1544659200,"4.6.12":1530748800,"4.6.11":1522713600,"4.6.10":1516060800,"4.6.9":1511913600,"4.6.8":1509408000,"4.6.7":1505779200,"4.6.6":1494892800,"4.6.5":1492646400,"4.6.4":1488758400,"4.6.3":1485388800,"4.6.2":1484092800,"4.6.1":1473206400,"4.6":1471305600,"4.5.18":1567641600,"4.5.17":1552435200,"4.5.16":1544659200,"4.5.15":1530748800,"4.5.14":1522713600,"4.5.13":1516060800,"4.5.12":1511913600,"4.5.11":1509408000,"4.5.10":1505779200,"4.5.9":1494892800,"4.5.8":1492646400,"4.5.7":1488758400,"4.5.6":1485388800,"4.5.5":1484092800,"4.5.4":1473206400,"4.5.3":1466467200,"4.5.2":1462492800,"4.5.1":1461628800,"4.5":1460419200,"4.4.19":1567641600,"4.4.18":1552435200,"4.4.17":1544659200,"4.4.16":1530748800,"4.4.15":1522713600,"4.4.14":1516060800,"4.4.13":1511913600,"4.4.12":1509408000,"4.4.11":1505779200,"4.4.10":1494892800,"4.4.9":1492646400,"4.4.8":1488758400,"4.4.7":1485388800,"4.4.6":1484092800,"4.4.5":1473206400,"4.4.4":1466467200,"4.4.3":1462492800,"4.4.2":1454371200,"4.4.1":1452038400,"4.4":1449532800,"4.3.20":1567641600,"4.3.19":1552435200,"4.3.18":1544659200,"4.3.17":1530748800,"4.3.16":1522713600,"4.3.15":1516060800,"4.3.14":1511913600,"4.3.13":1509408000,"4.3.12":1505779200,"4.3.11":1494892800,"4.3.10":1492646400,"4.3.9":1488758400,"4.3.8":1485388800,"4.3.7":1484092800,"4.3.6":1473206400,"4.3.5":1466467200,"4.3.4":1462492800,"4.3.3":1454371200,"4.3.2":1452038400,"4.3.1":1442275200,"4.3":1439856000,"4.2.24":1567641600,"4.2.23":1552435200,"4.2.22":1544659200,"4.2.21":1530748800,"4.2.20":1522713600,"4.2.19":1516060800,"4.2.18":1511913600,"4.2.17":1509408000,"4.2.16":1505779200,"4.2.15":1494892800,"4.2.14":1492646400,"4.2.13":1488758400,"4.2.12":1485388800,"4.2.11":1484092800,"4.2.10":1473206400,"4.2.9":1466467200,"4.2.8":1462492800,"4.2.7":1454371200,"4.2.6":1452038400,"4.2.5":1442275200,"4.2.4":1438646400,"4.2.3":1437609600,"4.2.2":1430956800,"4.2.1":1430092800,"4.2":1429747200,"4.1.27":1567641600,"4.1.26":1552435200,"4.1.25":1544659200,"4.1.24":1530748800,"4.1.23":1522713600,"4.1.22":1516060800,"4.1.21":1511913600,"4.1.20":1509408000,"4.1.19":1505779200,"4.1.18":1494892800,"4.1.17":1492646400,"4.1.16":1488758400,"4.1.15":1485388800,"4.1.14":1484092800,"4.1.13":1473206400,"4.1.12":1466467200,"4.1.11":1462492800,"4.1.10":1454371200,"4.1.9":1452038400,"4.1.8":1442275200,"4.1.7":1438646400,"4.1.6":1437609600,"4.1.5":1430956800,"4.1.4":1430092800,"4.1.3":1429747200,"4.1.2":1429574400,"4.1.1":1424217600,"4.1":1418860800,"4.0.27":1567641600,"4.0.26":1552435200,"4.0.25":1544659200,"4.0.24":1530748800,"4.0.23":1522713600,"4.0.22":1516060800,"4.0.21":1511913600,"4.0.20":1509408000,"4.0.19":1505779200,"4.0.18":1494892800,"4.0.17":1492646400,"4.0.16":1488758400,"4.0.15":1485388800,"4.0.14":1484092800,"4.0.13":1473206400,"4.0.12":1466467200,"4.0.11":1462492800,"4.0.10":1454371200,"4.0.9":1452038400,"4.0.8":1442275200,"4.0.7":1438646400,"4.0.6":1437609600,"4.0.5":1430870400,"4.0.4":1430092800,"4.0.3":1429747200,"4.0.2":1429574400,"4.0.1":1416441600,"1":1409788800,"3.9.28":1567641600,"3.9.27":1552435200,"3.9.26":1544659200,"3.9.25":1530748800,"3.9.24":1522713600,"3.9.23":1516060800,"3.9.22":1511913600,"3.9.21":1509408000,"3.9.20":1505779200,"3.9.19":1494892800,"3.9.18":1492646400,"3.9.17":1488758400,"3.9.16":1485388800,"3.9.15":1484092800,"3.9.14":1473206400,"3.9.13":1466467200,"3.9.12":1462492800,"3.9.11":1454371200,"3.9.10":1452038400,"3.9.9":1442275200,"3.9.8":1438646400,"3.9.7":1437609600,"3.9.6":1430956800,"3.9.5":1429747200,"3.9.4":1429574400,"3.9.3":1416441600,"3.9.2":1407283200,"3.9.1":1399507200,"3.9":1397606400,"3.8.30":1567641600,"3.8.29":1553126400,"3.8.28":1544659200,"3.8.27":1530748800,"3.8.26":1522713600,"3.8.25":1516060800,"3.8.24":1511913600,"3.8.23":1509408000,"3.8.22":1505779200,"3.8.21":1494892800,"3.8.20":1492646400,"3.8.19":1488758400,"3.8.18":1485388800,"3.8.17":1484092800,"3.8.16":1473206400,"3.8.15":1466467200,"3.8.14":1462492800,"3.8.13":1454371200,"3.8.12":1452038400,"3.8.11":1442275200,"3.8.10":1438646400,"3.8.9":1437609600,"3.8.8":1430956800,"3.8.7":1429747200,"3.8.6":1429574400,"3.8.5":1416441600,"3.8.4":1407283200,"3.8.3":1397433600,"3.8.2":1396915200,"3.8.1":1390435200,"3.8":1386806400,"3.7.30":1567641600,"3.7.29":1553126400,"3.7.28":1544659200,"3.7.27":1530748800,"3.7.26":1522713600,"3.7.25":1516060800,"3.7.24":1511913600,"3.7.23":1509408000,"3.7.22":1505779200,"3.7.21":1494892800,"3.7.20":1492646400,"3.7.19":1488758400,"3.7.18":1485388800,"3.7.17":1484092800,"3.7.16":1473206400,"3.7.15":1466467200,"3.7.14":1462492800,"3.7.13":1454371200,"3.7.12":1452038400,"3.7.11":1442275200,"3.7.10":1438646400,"3.7.9":1437609600,"3.7.8":1430956800,"3.7.7":1429747200,"3.7.6":1429574400,"3.7.5":1416441600,"3.7.4":1407283200,"3.7.3":1397433600,"3.7.2":1396915200,"3.7.1":1383004800,"3.7":1382572800,"3.6.1":1378857600,"3.6":1375315200,"3.5.2":1371772800,"3.5.1":1358985600,"3.5":1355184000,"3.4.2":1346889600,"3.4.1":1340755200,"3.4":1339545600,"3.3.3":1340755200,"3.3.2":1334880000,"3.3.1":1325548800,"3.3":1323648000,"3.2.1":1310428800,"3.2":1309737600,"3.1.4":1309305600,"3.1.3":1306281600,"3.1.2":1303776000,"3.1.1":1301875200,"3.1":1298419200,"3.0.6":1303776000,"3.0.5":1297036800,"3.0.4":1293580800,"3.0.3":1291766400,"3.0.2":1291075200,"3.0.1":1280361600,"2":1276732800,"2.9.2":1266192000,"2.9.1":1262563200,"2.9":1261094400,"2.8.6":1257984000,"2.8.5":1255996800,"2.8.4":1250035200,"2.8.3":1249257600,"2.8.2":1248048000,"2.8.1":1247097600,"2.8":1244678400,"2.7.1":1234224000,"2.7":1228867200,"2.6.5":1227571200,"2.6.3":1224720000,"2.6.2":1220832000,"2.6.1":1218758400,"2.6":1216080000,"2.5.1":1209081600,"2.5":1206748800,"2.3.3":1202169600,"2.3.2":1198886400,"2.3.1":1193356800,"2.3":1190678400,"2.2.3":1190592000,"2.2.2":1190592000,"2.2.1":1190592000,"2.2":1190592000,"2.1.3":1190592000,"2.1.2":1190592000,"2.1.1":1190592000,"2.1":1190592000,"2.0.11":1190592000,"2.0.10":1190592000,"2.0.9":1190592000,"2.0.8":1190592000,"2.0.7":1190592000,"2.0.6":1190592000,"2.0.5":1190592000,"2.0.4":1190592000,"2.0.1":1190592000,"3":1190592000,"1.5.2":1190592000,"1.5.1.3":1190592000,"1.5.1.2":1190592000,"1.5.1.1":1190592000,"1.5.1":1190592000,"1.5-strayhorn":1190592000,"1.2.2":1190592000,"1.2.1":1190592000,"1.2-mingus":1190592000,"1.2-delta":1190592000,"1.0-platinum":1190592000,"1.0.2":1190592000,"1.0.2-blakey":1190592000,"1.0.1-miles":1190592000}';
23
 
24
  $versions = json_decode($versions);
25
 
@@ -27,62 +27,6 @@ class WP_Reset_Utility
27
  } // get_wordpress_versions
28
 
29
 
30
- /**
31
- * Creates a fancy, iOS alike toggle switch
32
- *
33
- * @param string $name ID used for checkbox.
34
- * @param array $options Various options: value, saved_value, option_key, class
35
- * @param boolean $echo Default: true.
36
- * @return void
37
- */
38
- static function create_toogle_switch($name, $options = array(), $echo = true)
39
- {
40
- $default_options = array('value' => '1', 'saved_value' => '', 'option_key' => $name, 'class' => '');
41
- $options = array_merge($default_options, $options);
42
-
43
- $out = "\n";
44
- $out .= '<div class="toggle-wrapper ' . $options['class'] . '">';
45
- $out .= '<input type="checkbox" id="' . $name . '" ' . self::checked($options['value'], $options['saved_value']) . ' type="checkbox" value="' . $options['value'] . '" name="' . $options['option_key'] . '">';
46
- $out .= '<label for="' . $name . '" class="toggle"><span class="toggle_handler"></span></label>';
47
- $out .= '</div>';
48
-
49
- if ($echo) {
50
- echo $out;
51
- } else {
52
- return $out;
53
- }
54
- } // create_toggle_switch
55
-
56
-
57
- /**
58
- * Helper for creating checkboxes.
59
- *
60
- * @param string $value Checkbox value, in HTML.
61
- * @param array $current Current, saved value of checkbox.
62
- * @param boolean $echo Default: false.
63
- *
64
- * @return void|string
65
- */
66
- static function checked($value, $current, $echo = false)
67
- {
68
- $out = '';
69
-
70
- if (!is_array($current)) {
71
- $current = (array) $current;
72
- }
73
-
74
- if (in_array($value, $current)) {
75
- $out = ' checked="checked" ';
76
- }
77
-
78
- if ($echo) {
79
- echo $out;
80
- } else {
81
- return $out;
82
- }
83
- } // checked
84
-
85
-
86
  /**
87
  * Format file size to human readable string
88
  *
@@ -126,9 +70,9 @@ class WP_Reset_Utility
126
 
127
  foreach ($options as $tmp) {
128
  if ($selected == $tmp['val']) {
129
- $out .= "<option selected=\"selected\" value=\"{$tmp['val']}\">{$tmp['label']}&nbsp;</option>\n";
130
  } else {
131
- $out .= "<option value=\"{$tmp['val']}\">{$tmp['label']}&nbsp;</option>\n";
132
  }
133
  }
134
 
19
  */
20
  static function get_wordpress_versions()
21
  {
22
+ $versions = '{"5.8-alpha-51049":"bleeding","5.7.3-alpha-51036":"point","5.7.2":1620870664,"5.7.1":1618466956,"5.7":1615323910,"5.6.2":1614009199,"5.6.1":1612403115,"5.6":1607510561,"5.5.3":1604135302,"5.5.2":1604048028,"5.5.1":1599016376,"5.5":1597196480,"5.4.2":1591904327,"5.4.1":1588268252,"5.4":1586433381,"5.3.2":1578431355,"5.3.1":1576222826,"5.3":1573985840,"5.2.4":1572476910,"5.2.3":1567634400,"5.2.2":1560816000,"5.2.1":1558396800,"5.2":1557187200,"5.1.2":1567641600,"5.1.1":1552435200,"5.1":1550707200,"5.0.6":1567641600,"5.0.4":1552435200,"5.0.3":1546992000,"5.0.2":1545177600,"5.0.1":1544659200,"0":1544054400,"4.9.11":1567641600,"4.9.10":1552435200,"4.9.9":1544659200,"4.9.8":1533168000,"4.9.7":1530748800,"4.9.6":1526515200,"4.9.5":1522713600,"4.9.4":1517875200,"4.9.3":1517788800,"4.9.2":1516060800,"4.9.1":1511913600,"4.9":1510790400,"4.8.10":1567641600,"4.8.9":1552435200,"4.8.8":1544659200,"4.8.7":1530748800,"4.8.6":1522713600,"4.8.5":1516060800,"4.8.4":1511913600,"4.8.3":1509408000,"4.8.2":1505779200,"4.8.1":1501632000,"4.8":1496880000,"4.7.14":1567641600,"4.7.13":1552435200,"4.7.12":1544659200,"4.7.11":1530748800,"4.7.10":1522713600,"4.7.9":1516060800,"4.7.8":1511913600,"4.7.7":1509408000,"4.7.6":1505779200,"4.7.5":1494892800,"4.7.4":1492646400,"4.7.3":1488758400,"4.7.2":1485388800,"4.7.1":1484092800,"4.7":1480982400,"4.6.15":1567641600,"4.6.14":1552435200,"4.6.13":1544659200,"4.6.12":1530748800,"4.6.11":1522713600,"4.6.10":1516060800,"4.6.9":1511913600,"4.6.8":1509408000,"4.6.7":1505779200,"4.6.6":1494892800,"4.6.5":1492646400,"4.6.4":1488758400,"4.6.3":1485388800,"4.6.2":1484092800,"4.6.1":1473206400,"4.6":1471305600,"4.5.18":1567641600,"4.5.17":1552435200,"4.5.16":1544659200,"4.5.15":1530748800,"4.5.14":1522713600,"4.5.13":1516060800,"4.5.12":1511913600,"4.5.11":1509408000,"4.5.10":1505779200,"4.5.9":1494892800,"4.5.8":1492646400,"4.5.7":1488758400,"4.5.6":1485388800,"4.5.5":1484092800,"4.5.4":1473206400,"4.5.3":1466467200,"4.5.2":1462492800,"4.5.1":1461628800,"4.5":1460419200,"4.4.19":1567641600,"4.4.18":1552435200,"4.4.17":1544659200,"4.4.16":1530748800,"4.4.15":1522713600,"4.4.14":1516060800,"4.4.13":1511913600,"4.4.12":1509408000,"4.4.11":1505779200,"4.4.10":1494892800,"4.4.9":1492646400,"4.4.8":1488758400,"4.4.7":1485388800,"4.4.6":1484092800,"4.4.5":1473206400,"4.4.4":1466467200,"4.4.3":1462492800,"4.4.2":1454371200,"4.4.1":1452038400,"4.4":1449532800,"4.3.20":1567641600,"4.3.19":1552435200,"4.3.18":1544659200,"4.3.17":1530748800,"4.3.16":1522713600,"4.3.15":1516060800,"4.3.14":1511913600,"4.3.13":1509408000,"4.3.12":1505779200,"4.3.11":1494892800,"4.3.10":1492646400,"4.3.9":1488758400,"4.3.8":1485388800,"4.3.7":1484092800,"4.3.6":1473206400,"4.3.5":1466467200,"4.3.4":1462492800,"4.3.3":1454371200,"4.3.2":1452038400,"4.3.1":1442275200,"4.3":1439856000,"4.2.24":1567641600,"4.2.23":1552435200,"4.2.22":1544659200,"4.2.21":1530748800,"4.2.20":1522713600,"4.2.19":1516060800,"4.2.18":1511913600,"4.2.17":1509408000,"4.2.16":1505779200,"4.2.15":1494892800,"4.2.14":1492646400,"4.2.13":1488758400,"4.2.12":1485388800,"4.2.11":1484092800,"4.2.10":1473206400,"4.2.9":1466467200,"4.2.8":1462492800,"4.2.7":1454371200,"4.2.6":1452038400,"4.2.5":1442275200,"4.2.4":1438646400,"4.2.3":1437609600,"4.2.2":1430956800,"4.2.1":1430092800,"4.2":1429747200,"4.1.27":1567641600,"4.1.26":1552435200,"4.1.25":1544659200,"4.1.24":1530748800,"4.1.23":1522713600,"4.1.22":1516060800,"4.1.21":1511913600,"4.1.20":1509408000,"4.1.19":1505779200,"4.1.18":1494892800,"4.1.17":1492646400,"4.1.16":1488758400,"4.1.15":1485388800,"4.1.14":1484092800,"4.1.13":1473206400,"4.1.12":1466467200,"4.1.11":1462492800,"4.1.10":1454371200,"4.1.9":1452038400,"4.1.8":1442275200,"4.1.7":1438646400,"4.1.6":1437609600,"4.1.5":1430956800,"4.1.4":1430092800,"4.1.3":1429747200,"4.1.2":1429574400,"4.1.1":1424217600,"4.1":1418860800,"4.0.27":1567641600,"4.0.26":1552435200,"4.0.25":1544659200,"4.0.24":1530748800,"4.0.23":1522713600,"4.0.22":1516060800,"4.0.21":1511913600,"4.0.20":1509408000,"4.0.19":1505779200,"4.0.18":1494892800,"4.0.17":1492646400,"4.0.16":1488758400,"4.0.15":1485388800,"4.0.14":1484092800,"4.0.13":1473206400,"4.0.12":1466467200,"4.0.11":1462492800,"4.0.10":1454371200,"4.0.9":1452038400,"4.0.8":1442275200,"4.0.7":1438646400,"4.0.6":1437609600,"4.0.5":1430870400,"4.0.4":1430092800,"4.0.3":1429747200,"4.0.2":1429574400,"4.0.1":1416441600,"1":1409788800,"3.9.28":1567641600,"3.9.27":1552435200,"3.9.26":1544659200,"3.9.25":1530748800,"3.9.24":1522713600,"3.9.23":1516060800,"3.9.22":1511913600,"3.9.21":1509408000,"3.9.20":1505779200,"3.9.19":1494892800,"3.9.18":1492646400,"3.9.17":1488758400,"3.9.16":1485388800,"3.9.15":1484092800,"3.9.14":1473206400,"3.9.13":1466467200,"3.9.12":1462492800,"3.9.11":1454371200,"3.9.10":1452038400,"3.9.9":1442275200,"3.9.8":1438646400,"3.9.7":1437609600,"3.9.6":1430956800,"3.9.5":1429747200,"3.9.4":1429574400,"3.9.3":1416441600,"3.9.2":1407283200,"3.9.1":1399507200,"3.9":1397606400,"3.8.30":1567641600,"3.8.29":1553126400,"3.8.28":1544659200,"3.8.27":1530748800,"3.8.26":1522713600,"3.8.25":1516060800,"3.8.24":1511913600,"3.8.23":1509408000,"3.8.22":1505779200,"3.8.21":1494892800,"3.8.20":1492646400,"3.8.19":1488758400,"3.8.18":1485388800,"3.8.17":1484092800,"3.8.16":1473206400,"3.8.15":1466467200,"3.8.14":1462492800,"3.8.13":1454371200,"3.8.12":1452038400,"3.8.11":1442275200,"3.8.10":1438646400,"3.8.9":1437609600,"3.8.8":1430956800,"3.8.7":1429747200,"3.8.6":1429574400,"3.8.5":1416441600,"3.8.4":1407283200,"3.8.3":1397433600,"3.8.2":1396915200,"3.8.1":1390435200,"3.8":1386806400,"3.7.30":1567641600,"3.7.29":1553126400,"3.7.28":1544659200,"3.7.27":1530748800,"3.7.26":1522713600,"3.7.25":1516060800,"3.7.24":1511913600,"3.7.23":1509408000,"3.7.22":1505779200,"3.7.21":1494892800,"3.7.20":1492646400,"3.7.19":1488758400,"3.7.18":1485388800,"3.7.17":1484092800,"3.7.16":1473206400,"3.7.15":1466467200,"3.7.14":1462492800,"3.7.13":1454371200,"3.7.12":1452038400,"3.7.11":1442275200,"3.7.10":1438646400,"3.7.9":1437609600,"3.7.8":1430956800,"3.7.7":1429747200,"3.7.6":1429574400,"3.7.5":1416441600,"3.7.4":1407283200,"3.7.3":1397433600,"3.7.2":1396915200,"3.7.1":1383004800,"3.7":1382572800,"3.6.1":1378857600,"3.6":1375315200,"3.5.2":1371772800,"3.5.1":1358985600,"3.5":1355184000,"3.4.2":1346889600,"3.4.1":1340755200,"3.4":1339545600,"3.3.3":1340755200,"3.3.2":1334880000,"3.3.1":1325548800,"3.3":1323648000,"3.2.1":1310428800,"3.2":1309737600,"3.1.4":1309305600,"3.1.3":1306281600,"3.1.2":1303776000,"3.1.1":1301875200,"3.1":1298419200,"3.0.6":1303776000,"3.0.5":1297036800,"3.0.4":1293580800,"3.0.3":1291766400,"3.0.2":1291075200,"3.0.1":1280361600,"2":1276732800,"2.9.2":1266192000,"2.9.1":1262563200,"2.9":1261094400,"2.8.6":1257984000,"2.8.5":1255996800,"2.8.4":1250035200,"2.8.3":1249257600,"2.8.2":1248048000,"2.8.1":1247097600,"2.8":1244678400,"2.7.1":1234224000,"2.7":1228867200,"2.6.5":1227571200,"2.6.3":1224720000,"2.6.2":1220832000,"2.6.1":1218758400,"2.6":1216080000,"2.5.1":1209081600,"2.5":1206748800,"2.3.3":1202169600,"2.3.2":1198886400,"2.3.1":1193356800,"2.3":1190678400,"2.2.3":1190592000,"2.2.2":1190592000,"2.2.1":1190592000,"2.2":1190592000,"2.1.3":1190592000,"2.1.2":1190592000,"2.1.1":1190592000,"2.1":1190592000,"2.0.11":1190592000,"2.0.10":1190592000,"2.0.9":1190592000,"2.0.8":1190592000,"2.0.7":1190592000,"2.0.6":1190592000,"2.0.5":1190592000,"2.0.4":1190592000,"2.0.1":1190592000,"3":1190592000,"1.5.2":1190592000,"1.5.1.3":1190592000,"1.5.1.2":1190592000,"1.5.1.1":1190592000,"1.5.1":1190592000,"1.5-strayhorn":1190592000,"1.2.2":1190592000,"1.2.1":1190592000,"1.2-mingus":1190592000,"1.2-delta":1190592000,"1.0-platinum":1190592000,"1.0.2":1190592000,"1.0.2-blakey":1190592000,"1.0.1-miles":1190592000}';
23
 
24
  $versions = json_decode($versions);
25
 
27
  } // get_wordpress_versions
28
 
29
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  /**
31
  * Format file size to human readable string
32
  *
70
 
71
  foreach ($options as $tmp) {
72
  if ($selected == $tmp['val']) {
73
+ $out .= '<option selected="selected" value="' . esc_attr($tmp['val']) . '">' . esc_html($tmp['label']) . '&nbsp;</option>' . PHP_EOL;
74
  } else {
75
+ $out .= '<option value="' . esc_attr($tmp['val']) . '">' . esc_html($tmp['label']) . '&nbsp;</option>' . PHP_EOL;
76
  }
77
  }
78
 
wp-reset.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: WP Reset
4
  Plugin URI: https://wpreset.com/
5
  Description: Reset the entire site or just selected parts while reserving the option to undo by using snapshots.
6
- Version: 1.86
7
  Requires at least: 4.0
8
  Requires PHP: 5.2
9
  Tested up to: 5.6
@@ -93,6 +93,7 @@ class WP_Reset
93
  'licensing_servers' => $this->licensing_servers,
94
  'version' => $this->version,
95
  'plugin_file' => __FILE__,
 
96
  'skip_hooks' => false,
97
  'debug' => false,
98
  'js_folder' => plugin_dir_url(__FILE__) . '/js/'
@@ -104,7 +105,6 @@ class WP_Reset
104
  add_action('admin_action_wpr_dismiss_notice', array($this, 'action_dismiss_notice'));
105
  add_action('wp_ajax_wp_reset_dismiss_notice', array($this, 'ajax_dismiss_notice'));
106
  add_action('wp_ajax_wp_reset_run_tool', array($this, 'ajax_run_tool'));
107
- add_action('wp_ajax_wp_reset_submit_survey', array($this, 'ajax_submit_survey'));
108
  add_action('admin_print_scripts', array($this, 'remove_admin_notices'));
109
 
110
  add_filter('plugin_action_links_' . plugin_basename(__FILE__), array($this, 'plugin_action_links'));
@@ -260,7 +260,7 @@ class WP_Reset
260
  wp_send_json_error(__('You are not allowed to run this action.', 'wp-reset'));
261
  }
262
 
263
- $notice_name = trim(@$_GET['notice_name']);
264
  if (!$this->dismiss_notice($notice_name)) {
265
  wp_send_json_error(__('Notice is already dismissed.', 'wp-reset'));
266
  } else {
@@ -285,7 +285,7 @@ class WP_Reset
285
  exit;
286
  }
287
 
288
- $notice_name = trim(@$_GET['notice']);
289
  $this->dismiss_notice($notice_name);
290
 
291
  if (!empty($_GET['redirect'])) {
@@ -327,7 +327,7 @@ class WP_Reset
327
  {
328
  $pointers = array();
329
 
330
- $pointers['welcome'] = array('target' => '#menu-tools', 'edge' => 'left', 'align' => 'right', 'content' => 'Thank you for installing the <b style="font-weight: 800;">WP Reset</b> plugin!<br>Open <a href="' . admin_url('tools.php?page=wp-reset') . '">Tools - WP Reset</a> to access resetting tools and start developing &amp; debugging faster.');
331
 
332
  return $pointers;
333
  } // get_pointers
@@ -343,7 +343,6 @@ class WP_Reset
343
  // welcome pointer is shown on all pages except WPR to admins, until dismissed
344
  $pointers = $this->get_pointers();
345
  $dismissed_notices = $this->get_dismissed_notices();
346
- $meta = $this->get_meta();
347
 
348
  foreach ($dismissed_notices as $notice_name => $tmp) {
349
  if ($tmp) {
@@ -366,12 +365,6 @@ class WP_Reset
366
  return;
367
  }
368
 
369
- // features survey is shown 5min after install or after first reset
370
- $survey = false;
371
- if ($this->is_survey_active('features')) {
372
- $survey = true;
373
- }
374
-
375
  $js_localize = array(
376
  'undocumented_error' => __('An undocumented error has occurred. Please refresh the page and try again.', 'wp-reset'),
377
  'documented_error' => __('An error has occurred.', 'wp-reset'),
@@ -381,7 +374,6 @@ class WP_Reset
381
  'invalid_confirmation' => __('Please type "reset" in the confirmation field.', 'wp-reset'),
382
  'invalid_confirmation_title' => __('Invalid confirmation', 'wp-reset'),
383
  'cancel_button' => __('Cancel', 'wp-reset'),
384
- 'open_survey' => $survey,
385
  'ok_button' => __('OK', 'wp-reset'),
386
  'confirm_button' => __('Reset WordPress', 'wp-reset'),
387
  'confirm_title' => __('Are you sure you want to proceed?', 'wp-reset'),
@@ -409,10 +401,6 @@ class WP_Reset
409
  'nonce_do_reset' => wp_create_nonce('wp-reset_do_reset'),
410
  );
411
 
412
- if ($survey) {
413
- $js_localize['nonce_submit_survey'] = wp_create_nonce('wp-reset_submit_survey');
414
- }
415
-
416
  wp_enqueue_style('plugin-install');
417
  wp_enqueue_style('wp-reset', $this->plugin_url . 'css/wp-reset.css', array(), $this->version);
418
  wp_enqueue_style('wp-reset-sweetalert2', $this->plugin_url . 'css/sweetalert2.min.css', array(), $this->version);
@@ -458,79 +446,6 @@ class WP_Reset
458
  } // remove_admin_notices
459
 
460
 
461
- /**
462
- * Submit user selected survey answers to WPR servers
463
- *
464
- * @return null
465
- */
466
- function ajax_submit_survey()
467
- {
468
- check_ajax_referer('wp-reset_submit_survey');
469
-
470
- $meta = $this->get_meta();
471
-
472
- $vars = wp_parse_args($_POST, array('survey' => '', 'answers' => '', 'custom_answer' => '', 'emailme' => ''));
473
- $vars['answers'] = trim($vars['answers'], ',');
474
- $vars['custom_answer'] = substr(trim(strip_tags($vars['custom_answer'])), 0, 256);
475
-
476
- if (empty($vars['survey']) || empty($vars['answers'])) {
477
- wp_send_json_error();
478
- }
479
-
480
- $request_params = array('sslverify' => false, 'timeout' => 15, 'redirection' => 2);
481
- $request_args = array(
482
- 'action' => 'submit_survey',
483
- 'survey' => $vars['survey'],
484
- 'email' => $vars['emailme'],
485
- 'answers' => $vars['answers'],
486
- 'custom_answer' => $vars['custom_answer'],
487
- 'first_version' => $meta['first_version'],
488
- 'version' => $this->version,
489
- 'codebase' => 'free',
490
- 'site' => get_home_url()
491
- );
492
-
493
- $url = add_query_arg($request_args, $this->licensing_servers[0]);
494
- $response = wp_remote_get(esc_url_raw($url), $request_params);
495
-
496
- if (is_wp_error($response) || !wp_remote_retrieve_body($response)) {
497
- $url = add_query_arg($request_args, $this->licensing_servers[1]);
498
- $response = wp_remote_get(esc_url_raw($url), $request_params);
499
- }
500
-
501
- $this->dismiss_notice('survey-' . $vars['survey']);
502
-
503
- wp_send_json_success();
504
- } // ajax_submit_survey
505
-
506
-
507
- /**
508
- * Check if named survey should be shown or not
509
- *
510
- * @param [string] $survey_name Name of the survey to check
511
- * @return boolean
512
- */
513
- function is_survey_active($survey_name)
514
- {
515
- if (empty($survey_name)) {
516
- return false;
517
- }
518
-
519
- // all surveys are curently disabled
520
- return false;
521
-
522
- if ($this->get_dismissed_notices('survey-' . $survey_name)) {
523
- return false;
524
- }
525
-
526
- $meta = $this->get_meta();
527
- if (current_time('timestamp', true) - $meta['first_install'] > 300 || $meta['reset_count'] > 0) {
528
- return true;
529
- }
530
-
531
- return false;
532
- } // is_survey_active
533
-
534
  /**
535
  * Check if WP-CLI is available and running
536
  *
@@ -648,7 +563,8 @@ class WP_Reset
648
  {
649
  global $wpdb;
650
 
651
- $count = $wpdb->query("DELETE FROM $wpdb->options WHERE option_name LIKE 'theme_mods\_%' OR option_name LIKE 'mods\_%'");
 
652
 
653
  do_action('wp_reset_reset_theme_options', $count);
654
 
@@ -797,7 +713,7 @@ class WP_Reset
797
  if (version_compare($wp_version, '5.0', '<') === true) {
798
  $default_theme = 'twentyseventeen';
799
  } else {
800
- $default_theme = 'twentynineteen';
801
  }
802
 
803
  $all_themes = wp_get_themes(array('errors' => null));
@@ -834,7 +750,7 @@ class WP_Reset
834
 
835
  foreach ($custom_tables as $tbl) {
836
  $wpdb->query('SET foreign_key_checks = 0');
837
- $wpdb->query('TRUNCATE TABLE ' . $tbl['name']);
838
  } // foreach
839
 
840
  do_action('wp_reset_truncate_custom_tables', $custom_tables);
@@ -855,7 +771,7 @@ class WP_Reset
855
 
856
  foreach ($custom_tables as $tbl) {
857
  $wpdb->query('SET foreign_key_checks = 0');
858
- $wpdb->query('DROP TABLE IF EXISTS ' . $tbl['name']);
859
  } // foreach
860
 
861
  do_action('wp_reset_drop_custom_tables', $custom_tables);
@@ -933,8 +849,8 @@ class WP_Reset
933
  wp_send_json_error(__('You are not allowed to run this action.', 'wp-reset'));
934
  }
935
 
936
- $tool = trim(@$_GET['tool']);
937
- $extra_data = trim(@$_GET['extra_data']);
938
 
939
  if ($tool == 'delete_transients') {
940
  $cnt = $this->do_delete_transients();
@@ -1018,10 +934,10 @@ class WP_Reset
1018
  $tool == 'check_install_plugin' ||
1019
  $tool == 'check_activate_plugin'
1020
  ) {
1021
- $path = $this->get_plugin_path($_GET['slug']);
1022
 
1023
- if (false !== ($error = get_transient('wf_install_error_' . $_GET['slug']))) {
1024
- delete_transient('wf_install_error_' . $_GET['slug']);
1025
  wp_send_json_success($error);
1026
  }
1027
 
@@ -1036,7 +952,7 @@ class WP_Reset
1036
  wp_send_json_success('deleted');
1037
  }
1038
  } elseif ($tool == 'install_plugin') {
1039
- $slug = $_GET['slug'];
1040
 
1041
  @include_once ABSPATH . 'wp-admin/includes/plugin.php';
1042
  @include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
@@ -1059,7 +975,7 @@ class WP_Reset
1059
  wp_send_json_success();
1060
  }
1061
  } elseif ($tool == 'activate_plugin') {
1062
- $path = $this->get_plugin_path($_GET['slug']);
1063
  activate_plugin($path);
1064
  wp_send_json_success();
1065
  } else {
@@ -1202,7 +1118,7 @@ class WP_Reset
1202
  return;
1203
  }
1204
 
1205
- if (!empty($_GET['wp-reset']) && $_GET['wp-reset'] == 'success') {
1206
  add_action('admin_notices', array($this, 'notice_successful_reset'));
1207
  }
1208
 
@@ -1213,19 +1129,27 @@ class WP_Reset
1213
  }
1214
 
1215
  // check confirmation code
1216
- if (true === isset($_POST['wp_reset_confirm']) && 'reset' !== $_POST['wp_reset_confirm']) {
1217
  add_settings_error('wp-reset', 'bad-confirm', __('<b>Invalid confirmation code.</b> Please type "reset" in the confirmation field.', 'wp-reset'), 'error');
1218
  return false;
1219
  }
1220
 
1221
  // only one action at the moment
1222
- if (true === isset($_POST['wp_reset_confirm']) && 'reset' === $_POST['wp_reset_confirm']) {
1223
- $defaults = array(
1224
  'reactivate_theme' => '0',
1225
  'reactivate_plugins' => '0',
1226
  'reactivate_wpreset' => '0',
1227
  );
1228
- $params = shortcode_atts($defaults, (array) @$_POST['wpr-post-reset']);
 
 
 
 
 
 
 
 
1229
 
1230
  $this->do_reinstall($params);
1231
  }
@@ -1241,7 +1165,7 @@ class WP_Reset
1241
  */
1242
  function plugin_action_links($links)
1243
  {
1244
- $settings_link = '<a href="' . admin_url('tools.php?page=wp-reset') . '" title="' . __('Open WP Reset Tools', 'wp-reset') . '">' . __('Open WP Reset Tools', 'wp-reset') . '</a>';
1245
 
1246
  array_unshift($links, $settings_link);
1247
 
@@ -1264,7 +1188,7 @@ class WP_Reset
1264
  }
1265
 
1266
  $support_link = '<a target="_blank" href="https://wordpress.org/support/plugin/wp-reset" title="' . __('Get help', 'wp-reset') . '">' . __('Support', 'wp-reset') . '</a>';
1267
- $home_link = '<a target="_blank" href="' . $this->generate_web_link('plugins-table-right') . '" title="' . __('Plugin Homepage', 'wp-reset') . '">' . __('Plugin Homepage', 'wp-reset') . '</a>';
1268
  $rate_link = '<a target="_blank" href="https://wordpress.org/support/plugin/wp-reset/reviews/#new-post" title="' . __('Rate the plugin', 'wp-reset') . '">' . __('Rate the plugin ★★★★★', 'wp-reset') . '</a>';
1269
 
1270
  $links[] = $support_link;
@@ -1305,7 +1229,7 @@ class WP_Reset
1305
  return $text;
1306
  }
1307
 
1308
- $text = '<i><a href="' . $this->generate_web_link('admin_footer') . '" title="' . __('Visit WP Reset page for more info', 'wp-reset') . '" target="_blank">WP Reset</a> v' . $this->version . '. Please <a target="_blank" href="https://wordpress.org/support/plugin/wp-reset/reviews/#new-post" title="Rate the plugin">rate the plugin <span>★★★★★</span></a> to help us spread the word. Thank you from the WP Reset team!</i>';
1309
 
1310
  return $text;
1311
  } // admin_footer_text
@@ -1331,7 +1255,7 @@ class WP_Reset
1331
  {
1332
  global $current_user;
1333
 
1334
- echo '<div style="padding: 15px; display: inline-block; font-size: 14px;" id="message" class="updated"><p style="font-size: 14px;">' . sprintf(__('<b>Site has been successfully reset to default settings.</b><br>User "%s" was restored with the password unchanged. Open <a href="%s">WP Reset</a> to do another reset.', 'wp-reset'), $current_user->user_login, admin_url('tools.php?page=wp-reset')) . '</p>';
1335
 
1336
  if (false == $this->get_dismissed_notices('rate')) {
1337
  $dismiss_url = add_query_arg(array('action' => 'wpr_dismiss_notice', 'notice' => 'rate', 'redirect' => urlencode($_SERVER['REQUEST_URI'])), admin_url('admin.php'));
@@ -1339,7 +1263,7 @@ class WP_Reset
1339
 
1340
  echo '<p style="font-size: 14px;">';
1341
  echo 'If WP Reset helped you please rate it so we can continue supporting it and helping others. Thank you!<br>';
1342
- echo '<a style="margin-top: 5px;" class="button button-secondary" href="https://wordpress.org/support/plugin/wp-reset/reviews/?filter=5#new-post" target="_blank">You deserve it, I\'ll rate it!</a> &nbsp; &nbsp; <a href="' . $dismiss_url . '">I already rated it</a>';
1343
  echo '</p>';
1344
  }
1345
 
@@ -1358,7 +1282,7 @@ class WP_Reset
1358
  function get_snapshot_button($tool_id = '', $description = '')
1359
  {
1360
  $out = '';
1361
- $out .= '<a data-tool-id="' . $tool_id . '" data-description="' . esc_attr($description) . '" class="button create-new-snapshot" href="#">Create snapshot</a>';
1362
 
1363
  return $out;
1364
  } // get_snapshot_button
@@ -1388,14 +1312,14 @@ class WP_Reset
1388
  }
1389
 
1390
  $out = '';
1391
- $out .= '<h4 id="' . $card_id . '"><span class="card-name">' . htmlspecialchars($title);
1392
  if ($params['pro']) {
1393
- $out .= ' - <a data-feature="' . $card_id . '" class="pro-feature tooltip" title="WP Reset PRO tool" href="#"><span class="pro">PRO</span> tool</a>';
1394
  }
1395
  $out .= '</span>';
1396
  $out .= '<div class="card-header-right">';
1397
  if ($params['documentation_link']) {
1398
- $out .= '<a class="documentation-link tooltip" href="' . $this->generate_web_link('documentation_link', '/documentation/') . '" title="' . __('Open documentation for this tool', 'wp-reset') . '" target="blank"><span class="dashicons dashicons-editor-help"></span></a>';
1399
  }
1400
  if ($params['iot_button']) {
1401
  $out .= '<a class="scrollto tooltip" href="#iot" title="Jump to Index of Tools"><span class="dashicons dashicons-screenoptions"></span></a>';
@@ -1424,6 +1348,9 @@ class WP_Reset
1424
  function get_tool_icons($modify_files = false, $modify_db = false, $plural = false)
1425
  {
1426
  $out = '';
 
 
 
1427
 
1428
  $out .= '<p class="tool-icons">';
1429
  $out .= '<i class="icon-doc-text-inv' . ($modify_files ? ' red' : '') . '"></i> ';
@@ -1444,6 +1371,8 @@ class WP_Reset
1444
  $out .= 'this tool <b>modifies the database</b> but it doesn\'t modify any files</b>';
1445
  } elseif ($modify_files && !$modify_db) {
1446
  $out .= 'this tool <b>modifies files</b> but it doesn\'t modify the database</b>';
 
 
1447
  }
1448
  }
1449
  $out .= '</p>';
@@ -1465,27 +1394,27 @@ class WP_Reset
1465
  }
1466
 
1467
  echo '<div class="wrap">';
1468
- echo '<form id="wp_reset_form" action="' . admin_url('tools.php?page=wp-reset') . '" method="post" autocomplete="off">';
1469
 
1470
  echo '<header>';
1471
  echo '<div class="wpr-container">';
1472
- echo '<img id="logo-icon" src="' . $this->plugin_url . 'img/wp-reset-logo.png" title="' . __('WP Reset', 'wp-reset') . '" alt="' . __('WP Reset', 'wp-reset') . '">';
1473
  echo '</div>';
1474
  echo '</header>';
1475
 
1476
- echo '<div id="loading-tabs"><img class="rotating" src="' . $this->plugin_url . 'img/wp-reset-icon.png' . '" alt="Loading. Please wait." title="Loading. Please wait."></div>';
1477
 
1478
  echo '<div id="wp-reset-tabs" class="ui-tabs" style="display: none;">';
1479
 
1480
  echo '<nav>';
1481
  echo '<div class="wpr-container">';
1482
  echo '<ul class="wpr-main-tab">';
1483
- echo '<li><a href="#tab-reset">' . __('Reset', 'wp-reset') . '</a></li>';
1484
- echo '<li><a href="#tab-tools">' . __('Tools', 'wp-reset') . '</a></li>';
1485
- echo '<li><a href="#tab-snapshots">' . __('Snapshots', 'wp-reset') . '</a></li>';
1486
- echo '<li><a href="#tab-collections">' . __('Collections', 'wp-reset') . '</a></li>';
1487
- echo '<li><a href="#tab-support">' . __('Support', 'wp-reset') . '</a></li>';
1488
- echo '<li><a href="#tab-pro">' . __('PRO', 'wp-reset') . '</a></li>';
1489
  echo '</ul>';
1490
  echo '</div>'; // container
1491
  echo '</nav>';
@@ -1547,11 +1476,11 @@ class WP_Reset
1547
  // update to PRO after activating the license
1548
  if ($this->license->is_active()) {
1549
  echo '<div class="card notice-wrapper notice-info">';
1550
- echo '<h2>' . __('Thank you for purchasing WP Reset PRO!', 'wp-reset') . '</h2>';
1551
  echo '<p>Your license has been verified &amp; activated.</b><br>To start using the PRO version, please follow these steps:';
1552
  echo '<ol>';
1553
  echo '<li><a href="https://dashboard.wpreset.com/pro-download/" target="_blank">Download</a> the latest version of the PRO plugin.</li>';
1554
- echo '<li>Go to <a href="' . admin_url('plugin-install.php') . '">Plugins - Add New - Upload Plugin</a> and upload the ZIP you just downloaded.</li>';
1555
  echo '<li>If asked to replace (overwrite) the free version - confirm it.</li>';
1556
  echo '<li>Activate the plugin.</li>';
1557
  echo '<li>That\'s it, no more steps.</li>';
@@ -1577,7 +1506,7 @@ class WP_Reset
1577
  echo '<div class="card notice-wrapper notice-info">';
1578
  echo '<h2>' . __('Please help us spread the word &amp; keep the plugin up-to-date', 'wp-reset') . '</h2>';
1579
  echo '<p>' . __('If you use &amp; enjoy WP Reset, <b>please rate it on WordPress.org</b>. It only takes a second and helps us keep the plugin maintained. Thank you!', 'wp-reset') . '</p>';
1580
- echo '<p><a class="button-primary button" title="' . __('Rate WP Reset', 'wp-reset') . '" target="_blank" href="https://wordpress.org/support/plugin/wp-reset/reviews/?filter=5#new-post">' . __('Rate the plugin ★★★★★', 'wp-reset') . '</a> <a href="#" class="wpr-dismiss-notice dismiss-notice-rate" data-notice="rate">' . __('I\'ve already rated it', 'wp-reset') . '</a></p>';
1581
  echo '</div>';
1582
  $notice_shown = true;
1583
  }
@@ -1605,12 +1534,13 @@ class WP_Reset
1605
  echo '<table id="reset-details" class="">';
1606
  echo '<tr>';
1607
  echo '<th>&nbsp;</th>';
1608
- echo '<th>Options Reset<a data-feature="tool-options-reset" class="pro-feature" href="#"><span class="pro">PRO</span> tool</a></th>';
1609
  echo '<th nowrap>Site Reset</th>';
1610
- echo '<th>Nuclear Reset<a data-feature="tool-nuclear-reset" class="pro-feature" href="#"><span class="pro">PRO</span> tool</a></th>';
1611
  echo '</tr>';
 
1612
  $rows = array();
1613
- $rows['Posts, pages &amp; custom post types'] = array(0, 1, 1);
1614
  $rows['Comments'] = array(0, 1, 1);
1615
  $rows['Media'] = array(0, 1, 1);
1616
  $rows['Media files'] = array(0, 0, 1);
@@ -1619,8 +1549,8 @@ class WP_Reset
1619
  $rows['Current user - ' . $current_user->user_login] = array(0, 0, 0);
1620
  $rows['Widgets'] = array(1, 1, 1);
1621
  $rows['Transients'] = array(1, 1, 1);
1622
- $rows['Settings &amp; options (from WP, plugins &amp; themes)'] = array(1, 1, 1);
1623
- $rows['Site title, WP address, site address,<br>search engine visibility, timezone'] = array(0, 0, 0);
1624
  $rows['Site language'] = array(0, 0, 1);
1625
  $rows['Data in all default WP tables'] = array(0, 1, 1);
1626
  $rows['Custom database tables with prefix ' . $wpdb->prefix] = array(0, 1, 1);
@@ -1634,7 +1564,7 @@ class WP_Reset
1634
 
1635
  foreach ($rows as $tool => $opt) {
1636
  echo '<tr>';
1637
- echo '<td>' . $tool . '</td>';
1638
  if (empty($opt[0])) {
1639
  echo '<td><i class="dashicons dashicons-yes tooltip" title="Data will NOT be deleted, reset or modified"></i></td>';
1640
  } else {
@@ -1655,9 +1585,9 @@ class WP_Reset
1655
  echo '<tfoot>';
1656
  echo '<tr>';
1657
  echo '<th>&nbsp;</th>';
1658
- echo '<th>Options Reset<a data-feature="tool-options-reset" class="pro-feature" href="#"><span class="pro">PRO</span> tool</a></th>';
1659
  echo '<th nowrap>Site Reset</th>';
1660
- echo '<th>Nuclear Reset<a data-feature="tool-nuclear-reset" class="pro-feature" href="#"><span class="pro">PRO</span> tool</a></th>';
1661
  echo '</tr>';
1662
  echo '</tfoot>';
1663
  echo '</table>';
@@ -1686,14 +1616,14 @@ class WP_Reset
1686
  $active_plugins = get_option('active_plugins');
1687
 
1688
  // options reset
1689
- echo '<div class="card default-collapsed">';
1690
  echo $this->get_card_header(__('Options Reset', 'wp-reset'), 'tool-options-reset', array('collapse_button' => true, 'pro' => true));
1691
  echo '<div class="card-body">';
1692
  echo '<p>Options table will be reset to default values meaning all WP core settings, widgets, theme settings and customizations, and plugin settings will be gone. Other content and files will not be touched including posts, pages, custom post types, comments and other data stored in separate tables. Site URL and name will be kept as well. Please see the <a href="#reset-details" class="scrollto">table above</a> for details.</p>';
1693
 
1694
  echo $this->get_tool_icons(false, true);
1695
 
1696
- echo '<p><br><label for="reset-options-reactivate-theme"><input type="checkbox" id="reset-options-reactivate-theme" value="1"> ' . __('Reactivate current theme', 'wp-reset') . ' - ' . $theme_name . '</label></p>';
1697
  echo '<p><label for="reset-options-reactivate-plugins"><input type="checkbox" id="reset-options-reactivate-plugins" value="1"> Reactivate ' . sizeof($active_plugins) . ' currently active plugin' . (sizeof($active_plugins) != 1 ? 's' : '') . ' (WP Reset will reactivate by default)</label></p>';
1698
 
1699
  echo '<p class="mb0"><a class="button button-delete button-pro-feature" href="#">Reset all options - <span data-feature="tool-options-reset" class="pro-feature"><span class="pro">PRO</span> tool</span></a></p>';
@@ -1703,7 +1633,7 @@ class WP_Reset
1703
  echo '<div class="card">';
1704
  echo $this->get_card_header(__('Site Reset', 'wp-reset'), 'tool-site-reset', array('collapse_button' => true));
1705
  echo '<div class="card-body">';
1706
- echo '<p><label for="reactivate-theme"><input name="wpr-post-reset[reactivate_theme]" type="checkbox" id="reactivate-theme" value="1"> ' . __('Reactivate current theme', 'wp-reset') . ' - ' . $theme->get('Name') . '</label></p>';
1707
  echo '<p><label for="reactivate-wpreset"><input name="wpr-post-reset[reactivate_wpreset]" type="checkbox" id="reactivate-wpreset" value="1" checked> ' . __('Reactivate WP Reset plugin', 'wp-reset') . '</label></p>';
1708
 
1709
  echo '<p><label for="reactivate-plugins"><input name="wpr-post-reset[reactivate_plugins]" type="checkbox" id="reactivate-plugins" value="1"> ' . __('Reactivate all currently active plugins', 'wp-reset') . '</label></p>';
@@ -1716,10 +1646,10 @@ class WP_Reset
1716
  echo '</div>'; // card reset
1717
 
1718
  // nuclear reset
1719
- echo '<div class="card default-collapsed">';
1720
  echo $this->get_card_header(__('Nuclear Site Reset', 'wp-reset'), 'tool-nuclear-reset', array('collapse_button' => true, 'pro' => true));
1721
  echo '<div class="card-body">';
1722
- echo '<p>All data will be deleted or reset (see the <a href="#reset-details" class="scrollto">explanation table</a> for details). All data stored in the database including custom tables with <code>' . $wpdb->prefix . '</code> prefix, as well as all files in wp-content, themes and plugins folders. The only thing restored after reset will be your user account so you can log in again, and the basic WP settings like site URL. Please see the <a href="#reset-details" class="scrollto">table above</a> for details.</p>';
1723
 
1724
  echo $this->get_tool_icons(true, true);
1725
 
@@ -1757,7 +1687,7 @@ class WP_Reset
1757
  '_tool-delete-widgets' => 'Delete Widgets',
1758
  'tool-delete-themes' => 'Delete Themes',
1759
  'tool-delete-plugins' => 'Delete Plugins',
1760
- '_tool-delete-mu-plugins-dropins' => 'Delete MU Plugins &amp; Drop-ins',
1761
  'tool-delete-uploads' => 'Clean uploads Folder',
1762
  '_tool-delete-wp-content' => 'Clean wp-content Folder',
1763
  'tool-empty-delete-custom-tables' => 'Empty or Delete Custom Tables',
@@ -1783,9 +1713,9 @@ class WP_Reset
1783
 
1784
  if ($tool_id[0] == '_') {
1785
  $tool_id = ltrim($tool_id, '_');
1786
- echo '<li><a title="Jump to ' . $tool_name . ' tool" class="scrollto" href="#' . $tool_id . '">' . $tool_name . '</a> <a class="pro-feature" href="#" data-feature="' . $tool_id . '"><span class="pro">PRO</span> tool</a></li>';
1787
  } else {
1788
- echo '<li><a title="Jump to ' . $tool_name . ' tool" class="scrollto" href="#' . $tool_id . '">' . $tool_name . '</a></li>';
1789
  }
1790
 
1791
  if ($i == $tools_nb - 1) {
@@ -1863,10 +1793,10 @@ class WP_Reset
1863
  foreach ($count as $cnt) {
1864
  $tmp += (int) $cnt;
1865
  }
1866
- echo '<option value="' . $type->name . '">Post type - ' . $type->label . ' (' . $tmp . ')</option>';
1867
  } // foreach post types
1868
  foreach ($taxonomies as $tax) {
1869
- echo '<option value="_tax_' . $tax->name . '">Taxonomy - ' . $tax->label . ' (' . wp_count_terms($tax->name) . ')</option>';
1870
  } // foreach post types
1871
 
1872
  echo '</select><br>';
@@ -1892,7 +1822,7 @@ class WP_Reset
1892
  echo '<div class="card">';
1893
  echo $this->get_card_header(__('Delete Themes', 'wp-reset'), 'tool-delete-themes', array('iot_button' => true, 'collapse_button' => true));
1894
  echo '<div class="card-body">';
1895
- echo '<p>' . __('All themes will be deleted. Including the currently active theme - ' . $theme->get('Name') . '.<br><b>There is NO UNDO. WP Reset does not make any file backups.</b>', 'wp-reset') . '</p>';
1896
  echo $this->get_tool_icons(true, true);
1897
  echo '<p class="mb0"><a data-confirm-title="Are you sure you want to delete all themes?" data-btn-confirm="Delete all themes" data-text-wait="Deleting all themes. Please wait." data-text-confirm="All themes will be deleted. There is NO UNDO. WP Reset does not make any file backups." data-text-done="%n themes have been deleted." data-text-done-singular="One theme has been deleted." class="button button-delete" href="#" id="delete-themes">Delete all themes</a></p>';
1898
  echo '</div>';
@@ -1910,8 +1840,8 @@ class WP_Reset
1910
  echo '<div class="card default-collapsed">';
1911
  echo $this->get_card_header(__('Delete MU Plugins & Drop-ins', 'wp-reset'), 'tool-delete-mu-plugins-dropins', array('collapse_button' => true, 'iot_button' => true, 'pro' => true));
1912
  echo '<div class="card-body">';
1913
- echo '<p>MU Plugins are located in <code>/wp-content/mu-plugins/</code> and are, as the name suggests, must-use plugins that are automatically activated by WP and can\'t be deactiavated via the <a href="' . admin_url('plugins.php?plugin_status=mustuse') . '" target="_blank">plugins interface</a>, although if any are used, they are listed in the "Must Use" tab.<br>';
1914
- echo 'Drop-ins are pieces of code found in <code>/wp-content/</code> that replace default, built-in WordPress functionality. Most often used are <code>db.php</code> and <code>advanced-cache.php</code> that implement custom DB and cache functionality. They can\'t be deactivated via the <a href="' . admin_url('plugins.php?plugin_status=dropins') . '" target="_blank">plugins interface</a> but if any are present are listed in the "Drop-in" tab.</p>';
1915
 
1916
  if (is_multisite()) {
1917
  echo '<p class="mb0 wpmu-error">This tool is <b>not compatible</b> with WP multisite (WPMU). Using it would delete plugins for all sites in the network since they all share the same plugin files.</p>';
@@ -1928,7 +1858,7 @@ class WP_Reset
1928
  echo '<div class="card">';
1929
  echo $this->get_card_header(__('Clean uploads Folder', 'wp-reset'), 'tool-delete-uploads', array('iot_button' => true, 'collapse_button' => true));
1930
  echo '<div class="card-body">';
1931
- echo '<p>' . __('All files in <code>' . $upload_dir['basedir'] . '</code> folder will be deleted. Including folders and subfolders, and files in subfolders. Files associated with <a href="' . admin_url('upload.php') . '">media</a> entries will be deleted too.<br><b>There is NO UNDO. WP Reset does not make any file backups.</b>', 'wp-reset') . '</p>';
1932
  echo $this->get_tool_icons(true, false);
1933
  if (false != $upload_dir['error']) {
1934
  echo '<p class="mb0"><span style="color:#dd3036;"><b>Tool is not available.</b></span> Folder is not writeable by WordPress. Please check file and folder access rights.</p>';
@@ -1956,11 +1886,11 @@ class WP_Reset
1956
  echo '<div class="card">';
1957
  echo $this->get_card_header(__('Empty or Delete Custom Tables', 'wp-reset'), 'tool-empty-delete-custom-tables', array('iot_button' => true, 'collapse_button' => true));
1958
  echo '<div class="card-body">';
1959
- echo '<p>' . __('This action affects only custom tables with <code>' . $wpdb->prefix . '</code> prefix. Core WP tables and other tables in the database that do not have that prefix will not be deleted/emptied. Deleting (dropping) tables completely removes them from the database. Emptying (truncating) removes all content from them, but keeps the structure intact.<br>Always <a href="#" class="create-new-snapshot" data-description="Before deleting custom tables">create a snapshot</a> before using this tool if you want to be able to undo its actions.</p>', 'wp-reset');
1960
  if ($custom_tables) {
1961
- echo '<p>' . __('The following ' . sizeof($custom_tables) . ' custom tables are affected by this tool: ');
1962
  foreach ($custom_tables as $tbl) {
1963
- echo '<code>' . $tbl['name'] . '</code>';
1964
  if (next($custom_tables)) {
1965
  echo ', ';
1966
  }
@@ -1972,8 +1902,8 @@ class WP_Reset
1972
  $custom_tables_btns = ' disabled';
1973
  }
1974
  echo $this->get_tool_icons(false, true, true);
1975
- echo '<p class="mb0"><a data-confirm-title="Are you sure you want to empty all custom tables?" data-btn-confirm="Empty custom tables" data-text-wait="Emptying custom tables. Please wait." data-text-confirm="All custom tables with prefix <code>' . $wpdb->prefix . '</code> will be emptied. Always ' . esc_attr('<a href="#" class="create-new-snapshot" data-description="Before emptying custom tables">create a snapshot</a> if you want to be able to undo') . '." data-text-done="%n custom tables have been emptied." data-text-done-singular="One custom table has been emptied." class="button button-delete' . $custom_tables_btns . '" href="#" id="truncate-custom-tables">Empty (truncate) custom tables</a>';
1976
- echo '<a data-confirm-title="Are you sure you want to delete all custom tables?" data-btn-confirm="Delete custom tables" data-text-wait="Deleting custom tables. Please wait." data-text-confirm="All custom tables with prefix <code>' . $wpdb->prefix . '</code> will be deleted. Always ' . esc_attr('<a href="#" class="create-new-snapshot" data-description="Before deleting custom tables">create a snapshot</a> if you want to be able to undo') . '." data-text-done="%n custom tables have been deleted." data-text-done-singular="One custom table has been deleted." class="button button-delete' . $custom_tables_btns . '" href="#" id="drop-custom-tables">Delete (drop) custom tables</a>' . $this->get_snapshot_button('drop-custom-tables', 'Before deleting custom tables') . '</p>';
1977
  echo '</div>';
1978
  echo '</div>'; // empty custom tables
1979
 
@@ -1992,11 +1922,11 @@ class WP_Reset
1992
  echo '<option value="">select WordPress version</option>';
1993
  foreach ($wp_versions as $version => $release_date) {
1994
  if ($release_date == 'bleeding') {
1995
- echo '<option value="bleeding">WordPress v' . $version . ' (Bleeding edge nightly)' . ($wp_version == $version ? ' - installed' : '') . '</option>';
1996
- } else if ($release_date == 'point') {
1997
- echo '<option value="point-' . substr($version, 0, 3) . '">WordPress v' . $version . ' (Point release nightly)' . ($wp_version == $version ? ' - installed' : '') . '</option>';
1998
  } else {
1999
- echo '<option value="' . $version . '">WordPress v' . $version . ' (' . date('Y-m-d', $release_date) . ')' . ($wp_version == $version ? ' - installed' : '') . '</option>';
2000
  }
2001
  }
2002
  echo '</select></p>';
@@ -2011,9 +1941,9 @@ class WP_Reset
2011
  echo '<div class="card">';
2012
  echo $this->get_card_header(__('Delete .htaccess File', 'wp-reset'), 'tool-delete-htaccess', array('iot_button' => true, 'collapse_button' => true));
2013
  echo '<div class="card-body">';
2014
- echo '<p>' . __('This action deletes the .htaccess file located in <code>' . $this->get_htaccess_path() . '</code><br><b>There is NO UNDO. WP Reset does not make any file backups.</b></p>', 'wp-reset');
2015
 
2016
- echo '<p>If you need to edit .htaccess, install our free <a href="' . admin_url('plugin-install.php?tab=plugin-information&plugin=wp-htaccess-editor&TB_iframe=true&width=600&height=550') . '" class="thickbox open-plugin-details-modal">WP Htaccess Editor</a> plugin. It automatically creates backups when you edit .htaccess as well as checks for syntax errors. To create the default .htaccess file open <a href="' . admin_url('options-permalink.php') . '">Settings - Permalinks</a> and re-save settings. WordPress will recreate the file.</p>';
2017
  echo $this->get_tool_icons(true, false);
2018
  echo '<p class="mb0"><a data-confirm-title="Are you sure you want to delete the .htaccess file?" data-btn-confirm="Delete .htaccess file" data-text-wait="Deleting .htaccess file. Please wait." data-text-confirm="Htaccess file will be deleted. There is NO UNDO. WP Reset does not make any file backups." data-text-done="Htaccess file has been deleted." data-text-done-singular="Htaccess file has been deleted." class="button button-delete" href="#" id="delete-htaccess">Delete .htaccess file</a></p>';
2019
 
@@ -2046,7 +1976,7 @@ class WP_Reset
2046
  $plugins['wp-external-links'] = array('name' => 'WP External Links', 'desc' => 'Manage all external & internal links. Control icons, nofollow, noopener, UGC, sponsored and if links open in new window or new tab.');
2047
 
2048
  echo '<div class="card" data-collection-id="1">';
2049
- echo $this->get_card_header('Must-have WordPress Plugins', 'collection-id-1', array('collapse_button' => false));
2050
  echo '<div class="card-body"><div class="thirdx2"><p class="_mb0"></p><div class="dropdown dropdown-right">
2051
  <a class="button dropdown-toggle" href="#">Install collection</a>
2052
  <div class="dropdown-menu">
@@ -2064,7 +1994,7 @@ class WP_Reset
2064
  </div>
2065
  </div><p></p></div><table class="collection-table"><tbody><tr><th>Type</th><th>Name &amp; Note</th><th class="actions">Actions</th></tr>';
2066
  foreach ($plugins as $slug => $plugin) {
2067
- echo '<tr data-slug="' . $slug . '"><td><span class="dashicons dashicons-admin-plugins tooltip" title="Plugin"></span><span class="dashicons dashicons-wordpress tooltip" title="Comes from the WordPress repository"></span></td><td class="collection-item-details"><span>' . $plugin['name'] . '</span><i>' . $plugin['desc'] . '</i></td><td class="textcenter"><div class="dropdown">
2068
  <a class="button dropdown-toggle" href="#">Actions</a>
2069
  <div class="dropdown-menu">
2070
  <a href="#" class="dropdown-item install-collection-item button-pro-feature">Install - <span class="pro-feature" data-feature="collections"><span class="pro">PRO</span> Feature</span></a>
@@ -2088,7 +2018,7 @@ class WP_Reset
2088
  echo '<div class="card">';
2089
  echo $this->get_card_header(__('Documentation', 'wp-reset'), 'support-documentation', array('collapse_button' => false));
2090
  echo '<div class="card-body">';
2091
- echo '<p class="mb0">' . __('All tools and features are explained in detail in <a href="' . $this->generate_web_link('support-tab', '/documentation/') . '" target="_blank">the documentation</a>. We did our best to describe how things work on both the code level and an "average user" level.', 'wp-reset') . '</p>';
2092
  echo '</div>';
2093
  echo '</div>'; // documentation
2094
 
@@ -2163,7 +2093,7 @@ class WP_Reset
2163
  echo '</tr>';
2164
 
2165
  $rows = array();
2166
- $rows['Options &amp; Nuclear Reset'] = array(false, true, true, true);
2167
  $rows['Site Reset'] = array(true, true, true, true);
2168
  $rows['9 Basic Reset Tools'] = array(true, true, true, true);
2169
  $rows['17+ PRO Reset Tools'] = array(false, true, true, true);
@@ -2171,8 +2101,8 @@ class WP_Reset
2171
  $rows['User Snapshots'] = array(true, true, true, true);
2172
  $rows['Automatic Snapshots'] = array(false, true, true, true);
2173
  $rows['Automatically Offload Snapshots to WP Reset Cloud, 2GB storage per site'] = array(false, true, true, true);
2174
- $rows['Automatically Offload Snapshots to Dropbox, Google Drive &amp; pCloud'] = array(false, true, true, true);
2175
- $rows['Plugins &amp; Themes Collections'] = array(false, true, true, true);
2176
  $rows['Emergency Recovery Script'] = array(false, true, true, true);
2177
  $rows['Email Support'] = array(false, true, true, true);
2178
  $rows['WP Reset Dashboard'] = array(false, true, true, true);
@@ -2180,12 +2110,12 @@ class WP_Reset
2180
  $rows['White-Label'] = array(false, false, false, true);
2181
  $rows['Manage Snapshots for all sites in Dashboard'] = array(false, true, true, true);
2182
  $rows['Manage Collections for all sites in Dashboard'] = array(false, true, true, true);
2183
- $rows['Number of sites included in the license (localhosts are not counted &amp; you can change sites)'] = array('&infin;', 1, 5, 100);
2184
- $rows['Number of WP Reset Cloud site licenses with 2GB storage per site (localhosts are not counted &amp; you can change sites)'] = array(0, 1, 5, 20);
2185
 
2186
  foreach ($rows as $feature => $details) {
2187
  echo '<tr>';
2188
- echo '<td>' . $feature . '</td>';
2189
  $details = array_reverse($details);
2190
  foreach ($details as $tmp) {
2191
  echo '<td>';
@@ -2206,14 +2136,14 @@ class WP_Reset
2206
  $team_lifetime = $this->generate_web_link('pricing-table', '/buy/', array('p' => 'wp-reset-pro-team-lifetime-launch'));
2207
  $personal = $this->generate_web_link('pricing-table', '/buy/', array('p' => 'wp-reset-pro-personal-launch'));
2208
  echo '<tr class="pricing"><td>Yearly Price</td>';
2209
- echo '<td><del>&nbsp;$299/y&nbsp;</del><br><b>50% OFF</b><br>$149 <small>/y</small><br><a href="' . $agency . '" class="button" target="_blank">BUY NOW</a></td>';
2210
- echo '<td><del>&nbsp;$158/y&nbsp;</del><br><b>50% OFF</b><br>$79 <small>/y</small><br><a href="' . $team . '" class="button" target="_blank">BUY NOW</a></td>';
2211
- echo '<td><del>&nbsp;$79 <small>/y</small>&nbsp;</del><br><b>50% OFF</b><br>$39 <small>/y</small><br><a href="' . $personal . '" class="button" target="_blank">BUY NOW</a></td>';
2212
  echo '<td>free</td>';
2213
  echo '</tr>';
2214
  echo '<tr class="pricing"><td>Lifetime Price</td>';
2215
  echo '<td><i>n/a</i></td>';
2216
- echo '<td><del>&nbsp;$319&nbsp;</del><br><b>one-time payment<br>50% OFF</b><br>$159<br><a href="' . $team_lifetime . '" class="button button-primary" target="_blank">BUY NOW</a></td>';
2217
  echo '<td><i>n/a</i></td>';
2218
  echo '<td>free</td>';
2219
  echo '</tr>';
@@ -2227,7 +2157,7 @@ class WP_Reset
2227
  echo '<div class="card-body">';
2228
 
2229
  echo '<p>License key is visible on the confirmation screen, right after purchasing. You can also find it in the confirmation email sent to the email address provided on purchase. Or use keys created with the <a href="https://dashboard.wpreset.com/licenses/" target="_blank">license manager</a>.</p>
2230
- <p>If you don\'t have a license - <a class="scrollto" href="#pro-pricing">purchase one now</a>. In case of problems with the license please <a href="' . $this->generate_web_link('pro-tab-license', '/contact/') . '" target="_blank">contact support</a>.</p>';
2231
 
2232
  echo '<hr>';
2233
  echo '<p><label for="wpr-license-key">License Key: </label><input class="regular-text" type="text" id="wpr-license-key" value="' . ($this->license->get_license('license_key') != 'keyless' ? esc_attr($this->license->get_license('license_key')) : '') . '" placeholder="12345678-12345678-12345678-12345678">';
@@ -2236,14 +2166,14 @@ class WP_Reset
2236
  if ($this->license->is_active()) {
2237
  $license_formatted = $this->license->get_license_formatted();
2238
  echo '<b style="color: #66b317;">Active</b><br>
2239
- <label>Type: </label>' . $license_formatted['name_long'];
2240
- echo '<br><label>Valid: </label>' . $license_formatted['valid_until'];
2241
 
2242
  echo '<p>Thank you for purchasing WP Reset PRO! <b>Your license has been verified and activated.</b>';
2243
  echo '<br>To start using the PRO version, please follow these steps:</p>';
2244
  echo '<ol>';
2245
  echo '<li><a href="https://dashboard.wpreset.com/pro-download/" target="_blank">Download</a> the latest version of the PRO plugin.</li>';
2246
- echo '<li>Go to <a href="' . admin_url('plugin-install.php') . '">Plugins - Add New - Upload Plugin</a> and upload the ZIP you just downloaded.</li>';
2247
  echo '<li>If asked to replace (overwrite) the free version - confirm it.</li>';
2248
  echo '<li>Activate the plugin.</li>';
2249
  echo '<li>That\'s it, no more steps.</li>';
@@ -2251,7 +2181,7 @@ class WP_Reset
2251
  } else { // not active
2252
  echo '<strong style="color: #ea1919;">Inactive</strong>';
2253
  if (!empty($this->license->get_license('error'))) {
2254
- echo '<br><label>Error: </label>' . $this->license->get_license('error');
2255
  }
2256
  }
2257
  echo '</p>';
@@ -2303,7 +2233,7 @@ class WP_Reset
2303
  echo '<div class="card-body">';
2304
  echo '<p>A snapshot is a copy of all WP database tables, standard and custom ones, saved in the site\'s database. <a href="https://www.youtube.com/watch?v=xBfMmS12vMY" target="_blank">Watch a short video</a> overview and tutorial about Snapshots.</p>';
2305
 
2306
- echo '<p>Snapshots are primarily a development tool. When using various reset tools we advise using our 1-click snapshot tool available in every tool\'s confirmation dialog. If a full backup that includes files is needed, use one of the <a href="' . admin_url('plugin-install.php?s=backup&tab=search&type=term') . '" target="_blank">backup plugins</a> from the repo.</p>';
2307
 
2308
  echo '<p>Use snapshots to find out what changes a plugin made to your database or to quickly restore the dev environment after testing database related changes. Restoring a snapshot does not affect other snapshots, or WP Reset settings.</p>';
2309
 
@@ -2323,7 +2253,7 @@ class WP_Reset
2323
  }
2324
  } // foreach
2325
 
2326
- echo '<p class="mb0"><b>Currently used WordPress tables</b>, prefixed with <i>' . $wpdb->prefix . '</i>, consist of ' . $tbl_core . ' standard and ';
2327
  if ($tbl_custom) {
2328
  echo $tbl_custom . ' custom table' . ($tbl_custom == 1 ? '' : 's');
2329
  } else {
@@ -2345,7 +2275,7 @@ class WP_Reset
2345
  echo '<table id="wpr-snapshots">';
2346
  echo '<tr><th>Date</th><th>Description</th><th class="ss-size">Size</th><th class="ss-actions">&nbsp;</th></tr>';
2347
  foreach ($snapshots as $ss) {
2348
- echo '<tr id="wpr-ss-' . $ss['uid'] . '">';
2349
  if (!empty($ss['name'])) {
2350
  $name = $ss['name'];
2351
  } else {
@@ -2362,7 +2292,7 @@ class WP_Reset
2362
 
2363
  echo '<td>';
2364
  if (!empty($ss['name'])) {
2365
- echo '<b>' . $ss['name'] . '</b><br>';
2366
  }
2367
  echo $ss['tbl_core'] . ' standard &amp; ';
2368
  if ($ss['tbl_custom']) {
@@ -2376,10 +2306,10 @@ class WP_Reset
2376
  echo '<div class="dropdown">
2377
  <a class="button dropdown-toggle" href="#">Actions</a>
2378
  <div class="dropdown-menu">';
2379
- echo '<a data-title="Current DB tables compared to snapshot %s" data-wait-msg="Comparing. Please wait." data-name="' . $name . '" title="Compare snapshot to current database tables" href="#" class="ss-action compare-snapshot dropdown-item tooltip" data-ss-uid="' . $ss['uid'] . '">Compare snapshot to current data</a>';
2380
- echo '<a data-btn-confirm="Restore snapshot" data-text-wait="Restoring snapshot. Please wait." data-text-confirm="Are you sure you want to restore the selected snapshot? There is NO UNDO.<br>Restoring the snapshot will delete all current standard and custom tables and replace them with tables from the snapshot." data-text-done="Snapshot has been restored. Click OK to reload the page with new data." title="Restore snapshot by overwriting current database tables" href="#" class="ss-action restore-snapshot dropdown-item tooltip" data-ss-uid="' . $ss['uid'] . '">Restore snapshot</a>';
2381
- echo '<a data-success-msg="Snapshot export created!<br><a href=\'%s\'>Download it</a>" data-wait-msg="Exporting snapshot. Please wait." title="Download snapshot as gzipped SQL dump" href="#" class="ss-action download-snapshot dropdown-item tooltip" data-ss-uid="' . $ss['uid'] . '">Download snapshot</a>';
2382
- echo '<a data-btn-confirm="Delete snapshot" data-text-wait="Deleting snapshot. Please wait." data-text-confirm="Are you sure you want to delete the selected snapshot and all its data? There is NO UNDO.<br>Deleting the snapshot will not affect the active database tables in any way." data-text-done="Snapshot has been deleted." title="Permanently delete snapshot" href="#" class="ss-action delete-snapshot dropdown-item tooltip" data-ss-uid="' . $ss['uid'] . '">Delete snapshot</a>';
2383
  echo '<a href="#" title="WP Reset PRO feature" data-feature="cloud-wpr" class="ss-action dropdown-item button-pro-feature tooltip">Upload to WP Reset Cloud - <span class="pro-feature" data-feature="cloud-wpr"><span class="pro">PRO</span> Feature</span></a>';
2384
  echo '<a href="#" title="WP Reset PRO feature" class="ss-action dropdown-item button-pro-feature tooltip" data-feature="cloud-general">Upload to Dropbox, Google Drive, or pCloud - <span class="pro-feature" data-feature="cloud-general"><span class="pro">PRO</span> Feature</span></a>';
2385
  echo '</div></div></td>';
@@ -2529,9 +2459,9 @@ class WP_Reset
2529
  $tbl_custom++;
2530
  }
2531
 
2532
- $wpdb->query('OPTIMIZE TABLE ' . $table->Name);
2533
- $wpdb->query('CREATE TABLE ' . $uid . '_' . $table->Name . ' LIKE ' . $table->Name);
2534
- $wpdb->query('INSERT ' . $uid . '_' . $table->Name . ' SELECT * FROM ' . $table->Name);
2535
  } // foreach
2536
  } else {
2537
  return new WP_Error(1, 'Can\'t get table status data.');
@@ -2688,8 +2618,8 @@ class WP_Reset
2688
  foreach ($new_tables as $table) {
2689
  $new_name = str_replace($uid . '_', '', $table);
2690
 
2691
- $wpdb->query('CREATE TABLE ' . $new_name . ' LIKE ' . $table);
2692
- $wpdb->query('INSERT ' . $new_name . ' SELECT * FROM ' . $table);
2693
  }
2694
 
2695
  wp_cache_flush();
@@ -2809,7 +2739,7 @@ class WP_Reset
2809
 
2810
  $out .= '<br><br>';
2811
  foreach ($in_current_only as $table) {
2812
- $out .= '<div class="wpr-table-container in-current-only" data-table="' . $table['basename'] . '">';
2813
  $out .= '<table>';
2814
  $out .= '<tr title="Click to show/hide more info" class="wpr-table-missing header-row">';
2815
  $out .= '<td><b>' . $table['fullname'] . '</b></td>';
@@ -2827,11 +2757,11 @@ class WP_Reset
2827
  } // foreach in current only
2828
 
2829
  foreach ($in_snapshot_only as $table) {
2830
- $out .= '<div class="wpr-table-container in-snapshot-only" data-table="' . $table['basename'] . '">';
2831
  $out .= '<table>';
2832
  $out .= '<tr title="Click to show/hide more info" class="wpr-table-missing header-row">';
2833
  $out .= '<td>table is not present in current tables</td>';
2834
- $out .= '<td><b>' . $table['fullname'] . '</b><span class="dashicons dashicons-arrow-down-alt2"></span></td>';
2835
  $out .= '</tr>';
2836
  $out .= '<tr class="hidden">';
2837
  $out .= '<td>&nbsp;</td>';
@@ -2854,7 +2784,7 @@ class WP_Reset
2854
  $schema2 = str_replace($tbl_snapshot['uid'] . '_' . $tablename, $tablename, $schema2);
2855
 
2856
  if ($tbl_current['rows'] == $tbl_snapshot['rows'] && $tbl_current['schema'] == $tbl_snapshot['tmp_schema']) {
2857
- $out3 .= '<div class="wpr-table-container identical" data-table="' . $tablename . '">';
2858
  $out3 .= '<table>';
2859
  $out3 .= '<tr title="Click to show/hide more info" class="wpr-table-match header-row">';
2860
  $out3 .= '<td><b>' . $tbl_current['fullname'] . '</b></td>';
3
  Plugin Name: WP Reset
4
  Plugin URI: https://wpreset.com/
5
  Description: Reset the entire site or just selected parts while reserving the option to undo by using snapshots.
6
+ Version: 1.90
7
  Requires at least: 4.0
8
  Requires PHP: 5.2
9
  Tested up to: 5.6
93
  'licensing_servers' => $this->licensing_servers,
94
  'version' => $this->version,
95
  'plugin_file' => __FILE__,
96
+ 'plugin_page' => 'tools_page_wp-reset',
97
  'skip_hooks' => false,
98
  'debug' => false,
99
  'js_folder' => plugin_dir_url(__FILE__) . '/js/'
105
  add_action('admin_action_wpr_dismiss_notice', array($this, 'action_dismiss_notice'));
106
  add_action('wp_ajax_wp_reset_dismiss_notice', array($this, 'ajax_dismiss_notice'));
107
  add_action('wp_ajax_wp_reset_run_tool', array($this, 'ajax_run_tool'));
 
108
  add_action('admin_print_scripts', array($this, 'remove_admin_notices'));
109
 
110
  add_filter('plugin_action_links_' . plugin_basename(__FILE__), array($this, 'plugin_action_links'));
260
  wp_send_json_error(__('You are not allowed to run this action.', 'wp-reset'));
261
  }
262
 
263
+ $notice_name = trim(sanitize_text_field(@$_GET['notice_name']));
264
  if (!$this->dismiss_notice($notice_name)) {
265
  wp_send_json_error(__('Notice is already dismissed.', 'wp-reset'));
266
  } else {
285
  exit;
286
  }
287
 
288
+ $notice_name = trim(sanitize_text_field(@$_GET['notice']));
289
  $this->dismiss_notice($notice_name);
290
 
291
  if (!empty($_GET['redirect'])) {
327
  {
328
  $pointers = array();
329
 
330
+ $pointers['welcome'] = array('target' => '#menu-tools', 'edge' => 'left', 'align' => 'right', 'content' => 'Thank you for installing the <b style="font-weight: 800;">WP Reset</b> plugin!<br>Open <a href="' . esc_url(admin_url('tools.php?page=wp-reset')) . '">Tools - WP Reset</a> to access resetting tools and start developing &amp; debugging faster.');
331
 
332
  return $pointers;
333
  } // get_pointers
343
  // welcome pointer is shown on all pages except WPR to admins, until dismissed
344
  $pointers = $this->get_pointers();
345
  $dismissed_notices = $this->get_dismissed_notices();
 
346
 
347
  foreach ($dismissed_notices as $notice_name => $tmp) {
348
  if ($tmp) {
365
  return;
366
  }
367
 
 
 
 
 
 
 
368
  $js_localize = array(
369
  'undocumented_error' => __('An undocumented error has occurred. Please refresh the page and try again.', 'wp-reset'),
370
  'documented_error' => __('An error has occurred.', 'wp-reset'),
374
  'invalid_confirmation' => __('Please type "reset" in the confirmation field.', 'wp-reset'),
375
  'invalid_confirmation_title' => __('Invalid confirmation', 'wp-reset'),
376
  'cancel_button' => __('Cancel', 'wp-reset'),
 
377
  'ok_button' => __('OK', 'wp-reset'),
378
  'confirm_button' => __('Reset WordPress', 'wp-reset'),
379
  'confirm_title' => __('Are you sure you want to proceed?', 'wp-reset'),
401
  'nonce_do_reset' => wp_create_nonce('wp-reset_do_reset'),
402
  );
403
 
 
 
 
 
404
  wp_enqueue_style('plugin-install');
405
  wp_enqueue_style('wp-reset', $this->plugin_url . 'css/wp-reset.css', array(), $this->version);
406
  wp_enqueue_style('wp-reset-sweetalert2', $this->plugin_url . 'css/sweetalert2.min.css', array(), $this->version);
446
  } // remove_admin_notices
447
 
448
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
449
  /**
450
  * Check if WP-CLI is available and running
451
  *
563
  {
564
  global $wpdb;
565
 
566
+ $query = $wpdb->prepare("DELETE FROM $wpdb->options WHERE option_name LIKE %s OR option_name LIKE %s", array('mods\_%', 'theme_mods\_%'));
567
+ $count = $wpdb->query($query);
568
 
569
  do_action('wp_reset_reset_theme_options', $count);
570
 
713
  if (version_compare($wp_version, '5.0', '<') === true) {
714
  $default_theme = 'twentyseventeen';
715
  } else {
716
+ $default_theme = 'twentytwentyone';
717
  }
718
 
719
  $all_themes = wp_get_themes(array('errors' => null));
750
 
751
  foreach ($custom_tables as $tbl) {
752
  $wpdb->query('SET foreign_key_checks = 0');
753
+ $wpdb->query("TRUNCATE TABLE {$tbl['name']}");
754
  } // foreach
755
 
756
  do_action('wp_reset_truncate_custom_tables', $custom_tables);
771
 
772
  foreach ($custom_tables as $tbl) {
773
  $wpdb->query('SET foreign_key_checks = 0');
774
+ $wpdb->query("DROP TABLE IF EXISTS {$tbl['name']}");
775
  } // foreach
776
 
777
  do_action('wp_reset_drop_custom_tables', $custom_tables);
849
  wp_send_json_error(__('You are not allowed to run this action.', 'wp-reset'));
850
  }
851
 
852
+ $tool = trim(sanitize_text_field(@$_GET['tool']));
853
+ $extra_data = trim(sanitize_text_field(@$_GET['extra_data']));
854
 
855
  if ($tool == 'delete_transients') {
856
  $cnt = $this->do_delete_transients();
934
  $tool == 'check_install_plugin' ||
935
  $tool == 'check_activate_plugin'
936
  ) {
937
+ $path = $this->get_plugin_path(sanitize_text_field($_GET['slug']));
938
 
939
+ if (false !== ($error = get_transient('wf_install_error_' . sanitize_text_field($_GET['slug'])))) {
940
+ delete_transient('wf_install_error_' . sanitize_text_field($_GET['slug']));
941
  wp_send_json_success($error);
942
  }
943
 
952
  wp_send_json_success('deleted');
953
  }
954
  } elseif ($tool == 'install_plugin') {
955
+ $slug = sanitize_text_field($_GET['slug']);
956
 
957
  @include_once ABSPATH . 'wp-admin/includes/plugin.php';
958
  @include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
975
  wp_send_json_success();
976
  }
977
  } elseif ($tool == 'activate_plugin') {
978
+ $path = $this->get_plugin_path(sanitize_text_field($_GET['slug']));
979
  activate_plugin($path);
980
  wp_send_json_success();
981
  } else {
1118
  return;
1119
  }
1120
 
1121
+ if (!empty($_GET['wp-reset']) && sanitize_text_field($_GET['wp-reset']) == 'success') {
1122
  add_action('admin_notices', array($this, 'notice_successful_reset'));
1123
  }
1124
 
1129
  }
1130
 
1131
  // check confirmation code
1132
+ if (true === isset($_POST['wp_reset_confirm']) && 'reset' !== sanitize_text_field($_POST['wp_reset_confirm'])) {
1133
  add_settings_error('wp-reset', 'bad-confirm', __('<b>Invalid confirmation code.</b> Please type "reset" in the confirmation field.', 'wp-reset'), 'error');
1134
  return false;
1135
  }
1136
 
1137
  // only one action at the moment
1138
+ if (true === isset($_POST['wp_reset_confirm']) && 'reset' === sanitize_text_field($_POST['wp_reset_confirm'])) {
1139
+ $params = array(
1140
  'reactivate_theme' => '0',
1141
  'reactivate_plugins' => '0',
1142
  'reactivate_wpreset' => '0',
1143
  );
1144
+ if (isset($_POST['wpr-post-reset']['reactivate_theme'])) {
1145
+ $params['reactivate_theme'] = true;
1146
+ }
1147
+ if (isset($_POST['wpr-post-reset']['reactivate_plugins'])) {
1148
+ $params['reactivate_plugins'] = true;
1149
+ }
1150
+ if (isset($_POST['wpr-post-reset']['reactivate_wpreset'])) {
1151
+ $params['reactivate_wpreset'] = true;
1152
+ }
1153
 
1154
  $this->do_reinstall($params);
1155
  }
1165
  */
1166
  function plugin_action_links($links)
1167
  {
1168
+ $settings_link = '<a href="' . esc_url(admin_url('tools.php?page=wp-reset')) . '" title="' . esc_attr(__('Open WP Reset Tools', 'wp-reset')) . '">' . esc_html(__('Open WP Reset Tools', 'wp-reset')) . '</a>';
1169
 
1170
  array_unshift($links, $settings_link);
1171
 
1188
  }
1189
 
1190
  $support_link = '<a target="_blank" href="https://wordpress.org/support/plugin/wp-reset" title="' . __('Get help', 'wp-reset') . '">' . __('Support', 'wp-reset') . '</a>';
1191
+ $home_link = '<a target="_blank" href="' . esc_url($this->generate_web_link('plugins-table-right')) . '" title="' . __('Plugin Homepage', 'wp-reset') . '">' . __('Plugin Homepage', 'wp-reset') . '</a>';
1192
  $rate_link = '<a target="_blank" href="https://wordpress.org/support/plugin/wp-reset/reviews/#new-post" title="' . __('Rate the plugin', 'wp-reset') . '">' . __('Rate the plugin ★★★★★', 'wp-reset') . '</a>';
1193
 
1194
  $links[] = $support_link;
1229
  return $text;
1230
  }
1231
 
1232
+ $text = '<i><a href="' . esc_url($this->generate_web_link('admin_footer')) . '" title="' . esc_attr(__('Visit WP Reset page for more info', 'wp-reset')) . '" target="_blank">WP Reset</a> v' . $this->version . '. Please <a target="_blank" href="https://wordpress.org/support/plugin/wp-reset/reviews/#new-post" title="Rate the plugin">rate the plugin <span>★★★★★</span></a> to help us spread the word. Thank you from the WP Reset team!</i>';
1233
 
1234
  return $text;
1235
  } // admin_footer_text
1255
  {
1256
  global $current_user;
1257
 
1258
+ echo '<div style="padding: 15px; display: inline-block; font-size: 14px;" id="message" class="updated"><p style="font-size: 14px;">' . sprintf(__('<b>Site has been successfully reset to default settings.</b><br>User "%s" was restored with the password unchanged. Open <a href="%s">WP Reset</a> to do another reset.', 'wp-reset'), esc_html($current_user->user_login), esc_url(admin_url('tools.php?page=wp-reset'))) . '</p>';
1259
 
1260
  if (false == $this->get_dismissed_notices('rate')) {
1261
  $dismiss_url = add_query_arg(array('action' => 'wpr_dismiss_notice', 'notice' => 'rate', 'redirect' => urlencode($_SERVER['REQUEST_URI'])), admin_url('admin.php'));
1263
 
1264
  echo '<p style="font-size: 14px;">';
1265
  echo 'If WP Reset helped you please rate it so we can continue supporting it and helping others. Thank you!<br>';
1266
+ echo '<a style="margin-top: 5px;" class="button button-secondary" href="https://wordpress.org/support/plugin/wp-reset/reviews/#new-post" target="_blank">You deserve it, I\'ll rate it!</a> &nbsp; &nbsp; <a href="' . esc_url($dismiss_url) . '">I already rated it</a>';
1267
  echo '</p>';
1268
  }
1269
 
1282
  function get_snapshot_button($tool_id = '', $description = '')
1283
  {
1284
  $out = '';
1285
+ $out .= '<a data-tool-id="' . esc_attr($tool_id) . '" data-description="' . esc_attr($description) . '" class="button create-new-snapshot" href="#">Create snapshot</a>';
1286
 
1287
  return $out;
1288
  } // get_snapshot_button
1312
  }
1313
 
1314
  $out = '';
1315
+ $out .= '<h4 id="' . esc_attr($card_id) . '"><span class="card-name">' . esc_html($title);
1316
  if ($params['pro']) {
1317
+ $out .= ' - <a data-feature="' . esc_attr($card_id) . '" class="pro-feature tooltip" title="WP Reset PRO tool" href="#"><span class="pro">PRO</span> tool</a>';
1318
  }
1319
  $out .= '</span>';
1320
  $out .= '<div class="card-header-right">';
1321
  if ($params['documentation_link']) {
1322
+ $out .= '<a class="documentation-link tooltip" href="' . esc_url($this->generate_web_link('documentation_link', '/documentation/')) . '" title="' . __('Open documentation for this tool', 'wp-reset') . '" target="blank"><span class="dashicons dashicons-editor-help"></span></a>';
1323
  }
1324
  if ($params['iot_button']) {
1325
  $out .= '<a class="scrollto tooltip" href="#iot" title="Jump to Index of Tools"><span class="dashicons dashicons-screenoptions"></span></a>';
1348
  function get_tool_icons($modify_files = false, $modify_db = false, $plural = false)
1349
  {
1350
  $out = '';
1351
+ $modify_files = (bool) $modify_files;
1352
+ $modify_db = (bool) $modify_db;
1353
+ $plural = (bool) $plural;
1354
 
1355
  $out .= '<p class="tool-icons">';
1356
  $out .= '<i class="icon-doc-text-inv' . ($modify_files ? ' red' : '') . '"></i> ';
1371
  $out .= 'this tool <b>modifies the database</b> but it doesn\'t modify any files</b>';
1372
  } elseif ($modify_files && !$modify_db) {
1373
  $out .= 'this tool <b>modifies files</b> but it doesn\'t modify the database</b>';
1374
+ } else {
1375
+ $out .= 'this tool doesn\'t modify files or the database';
1376
  }
1377
  }
1378
  $out .= '</p>';
1394
  }
1395
 
1396
  echo '<div class="wrap">';
1397
+ echo '<form id="wp_reset_form" action="' . esc_url(admin_url('tools.php?page=wp-reset')) . '" method="post" autocomplete="off">';
1398
 
1399
  echo '<header>';
1400
  echo '<div class="wpr-container">';
1401
+ echo '<img id="logo-icon" src="' . esc_url($this->plugin_url) . 'img/wp-reset-logo.png" title="' . __('WP Reset', 'wp-reset') . '" alt="' . __('WP Reset', 'wp-reset') . '">';
1402
  echo '</div>';
1403
  echo '</header>';
1404
 
1405
+ echo '<div id="loading-tabs"><img class="rotating" src="' . esc_url($this->plugin_url) . 'img/wp-reset-icon.png' . '" alt="Loading. Please wait." title="Loading. Please wait."></div>';
1406
 
1407
  echo '<div id="wp-reset-tabs" class="ui-tabs" style="display: none;">';
1408
 
1409
  echo '<nav>';
1410
  echo '<div class="wpr-container">';
1411
  echo '<ul class="wpr-main-tab">';
1412
+ echo '<li><a href="#tab-reset">' . esc_html(__('Reset', 'wp-reset')) . '</a></li>';
1413
+ echo '<li><a href="#tab-tools">' . esc_html(__('Tools', 'wp-reset')) . '</a></li>';
1414
+ echo '<li><a href="#tab-snapshots">' . esc_html(__('Snapshots', 'wp-reset')) . '</a></li>';
1415
+ echo '<li><a href="#tab-collections">' . esc_html(__('Collections', 'wp-reset')) . '</a></li>';
1416
+ echo '<li><a href="#tab-support">' . esc_html(__('Support', 'wp-reset')) . '</a></li>';
1417
+ echo '<li><a href="#tab-pro">' . esc_html(__('PRO', 'wp-reset')) . '</a></li>';
1418
  echo '</ul>';
1419
  echo '</div>'; // container
1420
  echo '</nav>';
1476
  // update to PRO after activating the license
1477
  if ($this->license->is_active()) {
1478
  echo '<div class="card notice-wrapper notice-info">';
1479
+ echo '<h2>' . esc_html(__('Thank you for purchasing WP Reset PRO!', 'wp-reset')) . '</h2>';
1480
  echo '<p>Your license has been verified &amp; activated.</b><br>To start using the PRO version, please follow these steps:';
1481
  echo '<ol>';
1482
  echo '<li><a href="https://dashboard.wpreset.com/pro-download/" target="_blank">Download</a> the latest version of the PRO plugin.</li>';
1483
+ echo '<li>Go to <a href="' . esc_url(admin_url('plugin-install.php')) . '">Plugins - Add New - Upload Plugin</a> and upload the ZIP you just downloaded.</li>';
1484
  echo '<li>If asked to replace (overwrite) the free version - confirm it.</li>';
1485
  echo '<li>Activate the plugin.</li>';
1486
  echo '<li>That\'s it, no more steps.</li>';
1506
  echo '<div class="card notice-wrapper notice-info">';
1507
  echo '<h2>' . __('Please help us spread the word &amp; keep the plugin up-to-date', 'wp-reset') . '</h2>';
1508
  echo '<p>' . __('If you use &amp; enjoy WP Reset, <b>please rate it on WordPress.org</b>. It only takes a second and helps us keep the plugin maintained. Thank you!', 'wp-reset') . '</p>';
1509
+ echo '<p><a class="button-primary button" title="' . __('Rate WP Reset', 'wp-reset') . '" target="_blank" href="https://wordpress.org/support/plugin/wp-reset/reviews/#new-post">' . __('Rate the plugin ★★★★★', 'wp-reset') . '</a> <a href="#" class="wpr-dismiss-notice dismiss-notice-rate" data-notice="rate">' . __('I\'ve already rated it', 'wp-reset') . '</a></p>';
1510
  echo '</div>';
1511
  $notice_shown = true;
1512
  }
1534
  echo '<table id="reset-details" class="">';
1535
  echo '<tr>';
1536
  echo '<th>&nbsp;</th>';
1537
+ echo '<th>Options Reset<br><a data-feature="tool-options-reset" class="pro-feature" href="#"><span class="pro">PRO</span> tool</a></th>';
1538
  echo '<th nowrap>Site Reset</th>';
1539
+ echo '<th>Nuclear Reset<br><a data-feature="tool-nuclear-reset" class="pro-feature" href="#"><span class="pro">PRO</span> tool</a></th>';
1540
  echo '</tr>';
1541
+
1542
  $rows = array();
1543
+ $rows['Posts, pages & custom post types'] = array(0, 1, 1);
1544
  $rows['Comments'] = array(0, 1, 1);
1545
  $rows['Media'] = array(0, 1, 1);
1546
  $rows['Media files'] = array(0, 0, 1);
1549
  $rows['Current user - ' . $current_user->user_login] = array(0, 0, 0);
1550
  $rows['Widgets'] = array(1, 1, 1);
1551
  $rows['Transients'] = array(1, 1, 1);
1552
+ $rows['Settings &amp; options (from WP, plugins & themes)'] = array(1, 1, 1);
1553
+ $rows['Site title, WP address, site address,' . PHP_EOL . 'search engine visibility, timezone'] = array(0, 0, 0);
1554
  $rows['Site language'] = array(0, 0, 1);
1555
  $rows['Data in all default WP tables'] = array(0, 1, 1);
1556
  $rows['Custom database tables with prefix ' . $wpdb->prefix] = array(0, 1, 1);
1564
 
1565
  foreach ($rows as $tool => $opt) {
1566
  echo '<tr>';
1567
+ echo '<td>' . nl2br(esc_html($tool)) . '</td>';
1568
  if (empty($opt[0])) {
1569
  echo '<td><i class="dashicons dashicons-yes tooltip" title="Data will NOT be deleted, reset or modified"></i></td>';
1570
  } else {
1585
  echo '<tfoot>';
1586
  echo '<tr>';
1587
  echo '<th>&nbsp;</th>';
1588
+ echo '<th>Options Reset<br><a data-feature="tool-options-reset" class="pro-feature" href="#"><span class="pro">PRO</span> tool</a></th>';
1589
  echo '<th nowrap>Site Reset</th>';
1590
+ echo '<th>Nuclear Reset<br><a data-feature="tool-nuclear-reset" class="pro-feature" href="#"><span class="pro">PRO</span> tool</a></th>';
1591
  echo '</tr>';
1592
  echo '</tfoot>';
1593
  echo '</table>';
1616
  $active_plugins = get_option('active_plugins');
1617
 
1618
  // options reset
1619
+ echo '<div class="card">';
1620
  echo $this->get_card_header(__('Options Reset', 'wp-reset'), 'tool-options-reset', array('collapse_button' => true, 'pro' => true));
1621
  echo '<div class="card-body">';
1622
  echo '<p>Options table will be reset to default values meaning all WP core settings, widgets, theme settings and customizations, and plugin settings will be gone. Other content and files will not be touched including posts, pages, custom post types, comments and other data stored in separate tables. Site URL and name will be kept as well. Please see the <a href="#reset-details" class="scrollto">table above</a> for details.</p>';
1623
 
1624
  echo $this->get_tool_icons(false, true);
1625
 
1626
+ echo '<p><br><label for="reset-options-reactivate-theme"><input type="checkbox" id="reset-options-reactivate-theme" value="1"> ' . __('Reactivate current theme', 'wp-reset') . ' - ' . esc_html($theme_name) . '</label></p>';
1627
  echo '<p><label for="reset-options-reactivate-plugins"><input type="checkbox" id="reset-options-reactivate-plugins" value="1"> Reactivate ' . sizeof($active_plugins) . ' currently active plugin' . (sizeof($active_plugins) != 1 ? 's' : '') . ' (WP Reset will reactivate by default)</label></p>';
1628
 
1629
  echo '<p class="mb0"><a class="button button-delete button-pro-feature" href="#">Reset all options - <span data-feature="tool-options-reset" class="pro-feature"><span class="pro">PRO</span> tool</span></a></p>';
1633
  echo '<div class="card">';
1634
  echo $this->get_card_header(__('Site Reset', 'wp-reset'), 'tool-site-reset', array('collapse_button' => true));
1635
  echo '<div class="card-body">';
1636
+ echo '<p><label for="reactivate-theme"><input name="wpr-post-reset[reactivate_theme]" type="checkbox" id="reactivate-theme" value="1"> ' . __('Reactivate current theme', 'wp-reset') . ' - ' . esc_html($theme->get('Name')) . '</label></p>';
1637
  echo '<p><label for="reactivate-wpreset"><input name="wpr-post-reset[reactivate_wpreset]" type="checkbox" id="reactivate-wpreset" value="1" checked> ' . __('Reactivate WP Reset plugin', 'wp-reset') . '</label></p>';
1638
 
1639
  echo '<p><label for="reactivate-plugins"><input name="wpr-post-reset[reactivate_plugins]" type="checkbox" id="reactivate-plugins" value="1"> ' . __('Reactivate all currently active plugins', 'wp-reset') . '</label></p>';
1646
  echo '</div>'; // card reset
1647
 
1648
  // nuclear reset
1649
+ echo '<div class="card">';
1650
  echo $this->get_card_header(__('Nuclear Site Reset', 'wp-reset'), 'tool-nuclear-reset', array('collapse_button' => true, 'pro' => true));
1651
  echo '<div class="card-body">';
1652
+ echo '<p>All data will be deleted or reset (see the <a href="#reset-details" class="scrollto">explanation table</a> for details). All data stored in the database including custom tables with <code>' . esc_html($wpdb->prefix) . '</code> prefix, as well as all files in wp-content, themes and plugins folders. The only thing restored after reset will be your user account so you can log in again, and the basic WP settings like site URL. Please see the <a href="#reset-details" class="scrollto">table above</a> for details.</p>';
1653
 
1654
  echo $this->get_tool_icons(true, true);
1655
 
1687
  '_tool-delete-widgets' => 'Delete Widgets',
1688
  'tool-delete-themes' => 'Delete Themes',
1689
  'tool-delete-plugins' => 'Delete Plugins',
1690
+ '_tool-delete-mu-plugins-dropins' => 'Delete MU Plugins & Drop-ins',
1691
  'tool-delete-uploads' => 'Clean uploads Folder',
1692
  '_tool-delete-wp-content' => 'Clean wp-content Folder',
1693
  'tool-empty-delete-custom-tables' => 'Empty or Delete Custom Tables',
1713
 
1714
  if ($tool_id[0] == '_') {
1715
  $tool_id = ltrim($tool_id, '_');
1716
+ echo '<li><a title="Jump to ' . esc_attr($tool_name) . ' tool" class="scrollto" href="#' . esc_attr($tool_id) . '">' . esc_html($tool_name) . '</a> <a class="pro-feature" href="#" data-feature="' . esc_attr($tool_id) . '"><span class="pro">PRO</span> tool</a></li>';
1717
  } else {
1718
+ echo '<li><a title="Jump to ' . esc_attr($tool_name) . ' tool" class="scrollto" href="#' . esc_attr($tool_id) . '">' . esc_html($tool_name) . '</a></li>';
1719
  }
1720
 
1721
  if ($i == $tools_nb - 1) {
1793
  foreach ($count as $cnt) {
1794
  $tmp += (int) $cnt;
1795
  }
1796
+ echo '<option value="' . esc_attr($type->name) . '">Post type - ' . esc_html($type->label . ' (' . $tmp) . ')</option>';
1797
  } // foreach post types
1798
  foreach ($taxonomies as $tax) {
1799
+ echo '<option value="_tax_' . esc_attr($tax->name) . '">Taxonomy - ' . esc_html($tax->label . ' (' . wp_count_terms($tax->name)) . ')</option>';
1800
  } // foreach post types
1801
 
1802
  echo '</select><br>';
1822
  echo '<div class="card">';
1823
  echo $this->get_card_header(__('Delete Themes', 'wp-reset'), 'tool-delete-themes', array('iot_button' => true, 'collapse_button' => true));
1824
  echo '<div class="card-body">';
1825
+ echo '<p>' . __('All themes will be deleted. Including the currently active theme - ' . esc_html($theme->get('Name')) . '.<br><b>There is NO UNDO. WP Reset does not make any file backups.</b>', 'wp-reset') . '</p>';
1826
  echo $this->get_tool_icons(true, true);
1827
  echo '<p class="mb0"><a data-confirm-title="Are you sure you want to delete all themes?" data-btn-confirm="Delete all themes" data-text-wait="Deleting all themes. Please wait." data-text-confirm="All themes will be deleted. There is NO UNDO. WP Reset does not make any file backups." data-text-done="%n themes have been deleted." data-text-done-singular="One theme has been deleted." class="button button-delete" href="#" id="delete-themes">Delete all themes</a></p>';
1828
  echo '</div>';
1840
  echo '<div class="card default-collapsed">';
1841
  echo $this->get_card_header(__('Delete MU Plugins & Drop-ins', 'wp-reset'), 'tool-delete-mu-plugins-dropins', array('collapse_button' => true, 'iot_button' => true, 'pro' => true));
1842
  echo '<div class="card-body">';
1843
+ echo '<p>MU Plugins are located in <code>/wp-content/mu-plugins/</code> and are, as the name suggests, must-use plugins that are automatically activated by WP and can\'t be deactiavated via the <a href="' . esc_url(admin_url('plugins.php?plugin_status=mustuse')) . '" target="_blank">plugins interface</a>, although if any are used, they are listed in the "Must Use" tab.<br>';
1844
+ echo 'Drop-ins are pieces of code found in <code>/wp-content/</code> that replace default, built-in WordPress functionality. Most often used are <code>db.php</code> and <code>advanced-cache.php</code> that implement custom DB and cache functionality. They can\'t be deactivated via the <a href="' . esc_url(admin_url('plugins.php?plugin_status=dropins')) . '" target="_blank">plugins interface</a> but if any are present are listed in the "Drop-in" tab.</p>';
1845
 
1846
  if (is_multisite()) {
1847
  echo '<p class="mb0 wpmu-error">This tool is <b>not compatible</b> with WP multisite (WPMU). Using it would delete plugins for all sites in the network since they all share the same plugin files.</p>';
1858
  echo '<div class="card">';
1859
  echo $this->get_card_header(__('Clean uploads Folder', 'wp-reset'), 'tool-delete-uploads', array('iot_button' => true, 'collapse_button' => true));
1860
  echo '<div class="card-body">';
1861
+ echo '<p>' . __('All files in <code>' . esc_html($upload_dir['basedir']) . '</code> folder will be deleted. Including folders and subfolders, and files in subfolders. Files associated with <a href="' . esc_url(admin_url('upload.php')) . '">media</a> entries will be deleted too.<br><b>There is NO UNDO. WP Reset does not make any file backups.</b>', 'wp-reset') . '</p>';
1862
  echo $this->get_tool_icons(true, false);
1863
  if (false != $upload_dir['error']) {
1864
  echo '<p class="mb0"><span style="color:#dd3036;"><b>Tool is not available.</b></span> Folder is not writeable by WordPress. Please check file and folder access rights.</p>';
1886
  echo '<div class="card">';
1887
  echo $this->get_card_header(__('Empty or Delete Custom Tables', 'wp-reset'), 'tool-empty-delete-custom-tables', array('iot_button' => true, 'collapse_button' => true));
1888
  echo '<div class="card-body">';
1889
+ echo '<p>' . __('This action affects only custom tables with <code>' . esc_html($wpdb->prefix) . '</code> prefix. Core WP tables and other tables in the database that do not have that prefix will not be deleted/emptied. Deleting (dropping) tables completely removes them from the database. Emptying (truncating) removes all content from them, but keeps the structure intact.<br>Always <a href="#" class="create-new-snapshot" data-description="Before deleting custom tables">create a snapshot</a> before using this tool if you want to be able to undo its actions.</p>', 'wp-reset');
1890
  if ($custom_tables) {
1891
+ echo '<p>' . __('The following ' . esc_html(sizeof($custom_tables)) . ' custom tables are affected by this tool: ');
1892
  foreach ($custom_tables as $tbl) {
1893
+ echo '<code>' . esc_html($tbl['name']) . '</code>';
1894
  if (next($custom_tables)) {
1895
  echo ', ';
1896
  }
1902
  $custom_tables_btns = ' disabled';
1903
  }
1904
  echo $this->get_tool_icons(false, true, true);
1905
+ echo '<p class="mb0"><a data-confirm-title="Are you sure you want to empty all custom tables?" data-btn-confirm="Empty custom tables" data-text-wait="Emptying custom tables. Please wait." data-text-confirm="All custom tables with prefix <code>' . esc_attr($wpdb->prefix) . '</code> will be emptied. Always ' . esc_attr('<a href="#" class="create-new-snapshot" data-description="Before emptying custom tables">create a snapshot</a> if you want to be able to undo') . '." data-text-done="%n custom tables have been emptied." data-text-done-singular="One custom table has been emptied." class="button button-delete' . esc_attr($custom_tables_btns) . '" href="#" id="truncate-custom-tables">Empty (truncate) custom tables</a>';
1906
+ echo '<a data-confirm-title="Are you sure you want to delete all custom tables?" data-btn-confirm="Delete custom tables" data-text-wait="Deleting custom tables. Please wait." data-text-confirm="All custom tables with prefix <code>' . esc_attr($wpdb->prefix) . '</code> will be deleted. Always ' . esc_attr('<a href="#" class="create-new-snapshot" data-description="Before deleting custom tables">create a snapshot</a> if you want to be able to undo') . '." data-text-done="%n custom tables have been deleted." data-text-done-singular="One custom table has been deleted." class="button button-delete' . esc_attr($custom_tables_btns) . '" href="#" id="drop-custom-tables">Delete (drop) custom tables</a>' . $this->get_snapshot_button('drop-custom-tables', 'Before deleting custom tables') . '</p>';
1907
  echo '</div>';
1908
  echo '</div>'; // empty custom tables
1909
 
1922
  echo '<option value="">select WordPress version</option>';
1923
  foreach ($wp_versions as $version => $release_date) {
1924
  if ($release_date == 'bleeding') {
1925
+ echo '<option value="bleeding">WordPress v' . esc_html($version) . ' (Bleeding edge nightly)' . ($wp_version == $version ? ' - installed' : '') . '</option>';
1926
+ } elseif ($release_date == 'point') {
1927
+ echo '<option value="point-' . esc_attr(substr($version, 0, 3)) . '">WordPress v' . esc_html($version) . ' (Point release nightly)' . ($wp_version == $version ? ' - installed' : '') . '</option>';
1928
  } else {
1929
+ echo '<option value="' . esc_attr($version) . '">WordPress v' . esc_html($version) . ' (' . date('Y-m-d', $release_date) . ')' . ($wp_version == $version ? ' - installed' : '') . '</option>';
1930
  }
1931
  }
1932
  echo '</select></p>';
1941
  echo '<div class="card">';
1942
  echo $this->get_card_header(__('Delete .htaccess File', 'wp-reset'), 'tool-delete-htaccess', array('iot_button' => true, 'collapse_button' => true));
1943
  echo '<div class="card-body">';
1944
+ echo '<p>' . __('This action deletes the .htaccess file located in <code>' . esc_html($this->get_htaccess_path()) . '</code><br><b>There is NO UNDO. WP Reset does not make any file backups.</b></p>', 'wp-reset');
1945
 
1946
+ echo '<p>If you need to edit .htaccess, install our free <a href="' . esc_url(admin_url('plugin-install.php?tab=plugin-information&plugin=wp-htaccess-editor&TB_iframe=true&width=600&height=550')) . '" class="thickbox open-plugin-details-modal">WP Htaccess Editor</a> plugin. It automatically creates backups when you edit .htaccess as well as checks for syntax errors. To create the default .htaccess file open <a href="' . esc_url(admin_url('options-permalink.php')) . '">Settings - Permalinks</a> and re-save settings. WordPress will recreate the file.</p>';
1947
  echo $this->get_tool_icons(true, false);
1948
  echo '<p class="mb0"><a data-confirm-title="Are you sure you want to delete the .htaccess file?" data-btn-confirm="Delete .htaccess file" data-text-wait="Deleting .htaccess file. Please wait." data-text-confirm="Htaccess file will be deleted. There is NO UNDO. WP Reset does not make any file backups." data-text-done="Htaccess file has been deleted." data-text-done-singular="Htaccess file has been deleted." class="button button-delete" href="#" id="delete-htaccess">Delete .htaccess file</a></p>';
1949
 
1976
  $plugins['wp-external-links'] = array('name' => 'WP External Links', 'desc' => 'Manage all external & internal links. Control icons, nofollow, noopener, UGC, sponsored and if links open in new window or new tab.');
1977
 
1978
  echo '<div class="card" data-collection-id="1">';
1979
+ echo $this->get_card_header('Must Have WordPress Plugins', 'collection-id-1', array('collapse_button' => false));
1980
  echo '<div class="card-body"><div class="thirdx2"><p class="_mb0"></p><div class="dropdown dropdown-right">
1981
  <a class="button dropdown-toggle" href="#">Install collection</a>
1982
  <div class="dropdown-menu">
1994
  </div>
1995
  </div><p></p></div><table class="collection-table"><tbody><tr><th>Type</th><th>Name &amp; Note</th><th class="actions">Actions</th></tr>';
1996
  foreach ($plugins as $slug => $plugin) {
1997
+ echo '<tr data-slug="' . esc_attr($slug) . '"><td><span class="dashicons dashicons-admin-plugins tooltip" title="Plugin"></span><span class="dashicons dashicons-wordpress tooltip" title="Comes from the WordPress repository"></span></td><td class="collection-item-details"><span>' . esc_html($plugin['name']) . '</span><i>' . esc_html($plugin['desc']) . '</i></td><td class="textcenter"><div class="dropdown">
1998
  <a class="button dropdown-toggle" href="#">Actions</a>
1999
  <div class="dropdown-menu">
2000
  <a href="#" class="dropdown-item install-collection-item button-pro-feature">Install - <span class="pro-feature" data-feature="collections"><span class="pro">PRO</span> Feature</span></a>
2018
  echo '<div class="card">';
2019
  echo $this->get_card_header(__('Documentation', 'wp-reset'), 'support-documentation', array('collapse_button' => false));
2020
  echo '<div class="card-body">';
2021
+ echo '<p class="mb0">' . __('All tools and features are explained in detail in <a href="' . esc_url($this->generate_web_link('support-tab', '/documentation/')) . '" target="_blank">the documentation</a>. We did our best to describe how things work on both the code level and an "average user" level.', 'wp-reset') . '</p>';
2022
  echo '</div>';
2023
  echo '</div>'; // documentation
2024
 
2093
  echo '</tr>';
2094
 
2095
  $rows = array();
2096
+ $rows['Options & Nuclear Reset'] = array(false, true, true, true);
2097
  $rows['Site Reset'] = array(true, true, true, true);
2098
  $rows['9 Basic Reset Tools'] = array(true, true, true, true);
2099
  $rows['17+ PRO Reset Tools'] = array(false, true, true, true);
2101
  $rows['User Snapshots'] = array(true, true, true, true);
2102
  $rows['Automatic Snapshots'] = array(false, true, true, true);
2103
  $rows['Automatically Offload Snapshots to WP Reset Cloud, 2GB storage per site'] = array(false, true, true, true);
2104
+ $rows['Automatically Offload Snapshots to Dropbox, Google Drive & pCloud'] = array(false, true, true, true);
2105
+ $rows['Plugins & Themes Collections'] = array(false, true, true, true);
2106
  $rows['Emergency Recovery Script'] = array(false, true, true, true);
2107
  $rows['Email Support'] = array(false, true, true, true);
2108
  $rows['WP Reset Dashboard'] = array(false, true, true, true);
2110
  $rows['White-Label'] = array(false, false, false, true);
2111
  $rows['Manage Snapshots for all sites in Dashboard'] = array(false, true, true, true);
2112
  $rows['Manage Collections for all sites in Dashboard'] = array(false, true, true, true);
2113
+ $rows['Number of sites included in the license (localhosts are not counted & you can change sites)'] = array('&infin;', 1, 5, 100);
2114
+ $rows['Number of WP Reset Cloud site licenses with 2GB storage per site (localhosts are not counted & you can change sites)'] = array(0, 1, 5, 20);
2115
 
2116
  foreach ($rows as $feature => $details) {
2117
  echo '<tr>';
2118
+ echo '<td>' . esc_html($feature) . '</td>';
2119
  $details = array_reverse($details);
2120
  foreach ($details as $tmp) {
2121
  echo '<td>';
2136
  $team_lifetime = $this->generate_web_link('pricing-table', '/buy/', array('p' => 'wp-reset-pro-team-lifetime-launch'));
2137
  $personal = $this->generate_web_link('pricing-table', '/buy/', array('p' => 'wp-reset-pro-personal-launch'));
2138
  echo '<tr class="pricing"><td>Yearly Price</td>';
2139
+ echo '<td><del>&nbsp;$299/y&nbsp;</del><br><b>50% OFF</b><br>$149 <small>/y</small><br><a href="' . esc_url($agency) . '" class="button" target="_blank">BUY NOW</a></td>';
2140
+ echo '<td><del>&nbsp;$158/y&nbsp;</del><br><b>50% OFF</b><br>$79 <small>/y</small><br><a href="' . esc_url($team) . '" class="button" target="_blank">BUY NOW</a></td>';
2141
+ echo '<td><del>&nbsp;$79 <small>/y</small>&nbsp;</del><br><b>50% OFF</b><br>$39 <small>/y</small><br><a href="' . esc_url($personal) . '" class="button" target="_blank">BUY NOW</a></td>';
2142
  echo '<td>free</td>';
2143
  echo '</tr>';
2144
  echo '<tr class="pricing"><td>Lifetime Price</td>';
2145
  echo '<td><i>n/a</i></td>';
2146
+ echo '<td><del>&nbsp;$319&nbsp;</del><br><b>one-time payment<br>50% OFF</b><br>$159<br><a href="' . esc_url($team_lifetime) . '" class="button button-primary" target="_blank">BUY NOW</a></td>';
2147
  echo '<td><i>n/a</i></td>';
2148
  echo '<td>free</td>';
2149
  echo '</tr>';
2157
  echo '<div class="card-body">';
2158
 
2159
  echo '<p>License key is visible on the confirmation screen, right after purchasing. You can also find it in the confirmation email sent to the email address provided on purchase. Or use keys created with the <a href="https://dashboard.wpreset.com/licenses/" target="_blank">license manager</a>.</p>
2160
+ <p>If you don\'t have a license - <a class="scrollto" href="#pro-pricing">purchase one now</a>. In case of problems with the license please <a href="' . esc_url($this->generate_web_link('pro-tab-license', '/contact/')) . '" target="_blank">contact support</a>.</p>';
2161
 
2162
  echo '<hr>';
2163
  echo '<p><label for="wpr-license-key">License Key: </label><input class="regular-text" type="text" id="wpr-license-key" value="' . ($this->license->get_license('license_key') != 'keyless' ? esc_attr($this->license->get_license('license_key')) : '') . '" placeholder="12345678-12345678-12345678-12345678">';
2166
  if ($this->license->is_active()) {
2167
  $license_formatted = $this->license->get_license_formatted();
2168
  echo '<b style="color: #66b317;">Active</b><br>
2169
+ <label>Type: </label>' . esc_html($license_formatted['name_long']);
2170
+ echo '<br><label>Valid: </label>' . esc_html($license_formatted['valid_until']);
2171
 
2172
  echo '<p>Thank you for purchasing WP Reset PRO! <b>Your license has been verified and activated.</b>';
2173
  echo '<br>To start using the PRO version, please follow these steps:</p>';
2174
  echo '<ol>';
2175
  echo '<li><a href="https://dashboard.wpreset.com/pro-download/" target="_blank">Download</a> the latest version of the PRO plugin.</li>';
2176
+ echo '<li>Go to <a href="' . esc_url(admin_url('plugin-install.php')) . '">Plugins - Add New - Upload Plugin</a> and upload the ZIP you just downloaded.</li>';
2177
  echo '<li>If asked to replace (overwrite) the free version - confirm it.</li>';
2178
  echo '<li>Activate the plugin.</li>';
2179
  echo '<li>That\'s it, no more steps.</li>';
2181
  } else { // not active
2182
  echo '<strong style="color: #ea1919;">Inactive</strong>';
2183
  if (!empty($this->license->get_license('error'))) {
2184
+ echo '<br><label>Error: </label>' . esc_html($this->license->get_license('error'));
2185
  }
2186
  }
2187
  echo '</p>';
2233
  echo '<div class="card-body">';
2234
  echo '<p>A snapshot is a copy of all WP database tables, standard and custom ones, saved in the site\'s database. <a href="https://www.youtube.com/watch?v=xBfMmS12vMY" target="_blank">Watch a short video</a> overview and tutorial about Snapshots.</p>';
2235
 
2236
+ echo '<p>Snapshots are primarily a development tool. When using various reset tools we advise using our 1-click snapshot tool available in every tool\'s confirmation dialog. If a full backup that includes files is needed, use one of the <a href="' . esc_url(admin_url('plugin-install.php?s=backup&tab=search&type=term')) . '" target="_blank">backup plugins</a> from the repo.</p>';
2237
 
2238
  echo '<p>Use snapshots to find out what changes a plugin made to your database or to quickly restore the dev environment after testing database related changes. Restoring a snapshot does not affect other snapshots, or WP Reset settings.</p>';
2239
 
2253
  }
2254
  } // foreach
2255
 
2256
+ echo '<p class="mb0"><b>Currently used WordPress tables</b>, prefixed with <i>' . esc_html($wpdb->prefix) . '</i>, consist of ' . esc_html($tbl_core) . ' standard and ';
2257
  if ($tbl_custom) {
2258
  echo $tbl_custom . ' custom table' . ($tbl_custom == 1 ? '' : 's');
2259
  } else {
2275
  echo '<table id="wpr-snapshots">';
2276
  echo '<tr><th>Date</th><th>Description</th><th class="ss-size">Size</th><th class="ss-actions">&nbsp;</th></tr>';
2277
  foreach ($snapshots as $ss) {
2278
+ echo '<tr id="wpr-ss-' . esc_attr($ss['uid']) . '">';
2279
  if (!empty($ss['name'])) {
2280
  $name = $ss['name'];
2281
  } else {
2292
 
2293
  echo '<td>';
2294
  if (!empty($ss['name'])) {
2295
+ echo '<b>' . esc_html($ss['name']) . '</b><br>';
2296
  }
2297
  echo $ss['tbl_core'] . ' standard &amp; ';
2298
  if ($ss['tbl_custom']) {
2306
  echo '<div class="dropdown">
2307
  <a class="button dropdown-toggle" href="#">Actions</a>
2308
  <div class="dropdown-menu">';
2309
+ echo '<a data-title="Current DB tables compared to snapshot %s" data-wait-msg="Comparing. Please wait." data-name="' . esc_attr($name) . '" title="Compare snapshot to current database tables" href="#" class="ss-action compare-snapshot dropdown-item tooltip" data-ss-uid="' . esc_attr($ss['uid']) . '">Compare snapshot to current data</a>';
2310
+ echo '<a data-btn-confirm="Restore snapshot" data-text-wait="Restoring snapshot. Please wait." data-text-confirm="Are you sure you want to restore the selected snapshot? There is NO UNDO.<br>Restoring the snapshot will delete all current standard and custom tables and replace them with tables from the snapshot." data-text-done="Snapshot has been restored. Click OK to reload the page with new data." title="Restore snapshot by overwriting current database tables" href="#" class="ss-action restore-snapshot dropdown-item tooltip" data-ss-uid="' . esc_attr($ss['uid']) . '">Restore snapshot</a>';
2311
+ echo '<a data-success-msg="Snapshot export created!<br><a href=\'%s\'>Download it</a>" data-wait-msg="Exporting snapshot. Please wait." title="Download snapshot as gzipped SQL dump" href="#" class="ss-action download-snapshot dropdown-item tooltip" data-ss-uid="' . esc_attr($ss['uid']) . '">Download snapshot</a>';
2312
+ echo '<a data-btn-confirm="Delete snapshot" data-text-wait="Deleting snapshot. Please wait." data-text-confirm="Are you sure you want to delete the selected snapshot and all its data? There is NO UNDO.<br>Deleting the snapshot will not affect the active database tables in any way." data-text-done="Snapshot has been deleted." title="Permanently delete snapshot" href="#" class="ss-action delete-snapshot dropdown-item tooltip" data-ss-uid="' . esc_attr($ss['uid']) . '">Delete snapshot</a>';
2313
  echo '<a href="#" title="WP Reset PRO feature" data-feature="cloud-wpr" class="ss-action dropdown-item button-pro-feature tooltip">Upload to WP Reset Cloud - <span class="pro-feature" data-feature="cloud-wpr"><span class="pro">PRO</span> Feature</span></a>';
2314
  echo '<a href="#" title="WP Reset PRO feature" class="ss-action dropdown-item button-pro-feature tooltip" data-feature="cloud-general">Upload to Dropbox, Google Drive, or pCloud - <span class="pro-feature" data-feature="cloud-general"><span class="pro">PRO</span> Feature</span></a>';
2315
  echo '</div></div></td>';
2459
  $tbl_custom++;
2460
  }
2461
 
2462
+ $wpdb->query("OPTIMIZE TABLE {$table->Name}");
2463
+ $wpdb->query("CREATE TABLE {$uid}_{$table->Name} LIKE {$table->Name}");
2464
+ $wpdb->query("INSERT {$uid}_{$table->Name} SELECT * FROM {$table->Name}");
2465
  } // foreach
2466
  } else {
2467
  return new WP_Error(1, 'Can\'t get table status data.');
2618
  foreach ($new_tables as $table) {
2619
  $new_name = str_replace($uid . '_', '', $table);
2620
 
2621
+ $wpdb->query("CREATE TABLE {$new_name} LIKE {$table}");
2622
+ $wpdb->query("INSERT {$new_name} SELECT * FROM {$table}");
2623
  }
2624
 
2625
  wp_cache_flush();
2739
 
2740
  $out .= '<br><br>';
2741
  foreach ($in_current_only as $table) {
2742
+ $out .= '<div class="wpr-table-container in-current-only" data-table="' . esc_attr($table['basename']) . '">';
2743
  $out .= '<table>';
2744
  $out .= '<tr title="Click to show/hide more info" class="wpr-table-missing header-row">';
2745
  $out .= '<td><b>' . $table['fullname'] . '</b></td>';
2757
  } // foreach in current only
2758
 
2759
  foreach ($in_snapshot_only as $table) {
2760
+ $out .= '<div class="wpr-table-container in-snapshot-only" data-table="' . esc_attr($table['basename']) . '">';
2761
  $out .= '<table>';
2762
  $out .= '<tr title="Click to show/hide more info" class="wpr-table-missing header-row">';
2763
  $out .= '<td>table is not present in current tables</td>';
2764
+ $out .= '<td><b>' . esc_html($table['fullname']) . '</b><span class="dashicons dashicons-arrow-down-alt2"></span></td>';
2765
  $out .= '</tr>';
2766
  $out .= '<tr class="hidden">';
2767
  $out .= '<td>&nbsp;</td>';
2784
  $schema2 = str_replace($tbl_snapshot['uid'] . '_' . $tablename, $tablename, $schema2);
2785
 
2786
  if ($tbl_current['rows'] == $tbl_snapshot['rows'] && $tbl_current['schema'] == $tbl_snapshot['tmp_schema']) {
2787
+ $out3 .= '<div class="wpr-table-container identical" data-table="' . esc_attr($tablename) . '">';
2788
  $out3 .= '<table>';
2789
  $out3 .= '<tr title="Click to show/hide more info" class="wpr-table-match header-row">';
2790
  $out3 .= '<td><b>' . $tbl_current['fullname'] . '</b></td>';