Version Description
- 2020/01/14
- security fixes - thanks to Chloe from Wordfence
- 80k installations; 761,300 downloads
Download this release
Release Info
Developer | WebFactory |
Plugin | WordPress Database Reset |
Version | 3.15 |
Comparing to | |
See all releases |
Code changes from version 3.1 to 3.15
- class-db-reset-admin.php +139 -104
- class-db-resetter.php +115 -83
- index.php +2 -0
- readme.txt +10 -5
- views/index.php +7 -3
- views/partials/notice.php +2 -2
- views/partials/security-code.php +2 -1
- views/partials/select-tables.php +1 -1
- wp-reset.php +2 -2
class-db-reset-admin.php
CHANGED
@@ -1,8 +1,9 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
if (
|
4 |
|
5 |
-
class DB_Reset_Admin
|
|
|
6 |
|
7 |
private $code;
|
8 |
private $notice_error;
|
@@ -13,111 +14,126 @@ if ( ! class_exists( 'DB_Reset_Admin' ) ) :
|
|
13 |
private $version;
|
14 |
private $wp_tables;
|
15 |
|
16 |
-
public function __construct(
|
|
|
17 |
$this->resetter = new DB_Resetter();
|
18 |
$this->version = $version;
|
19 |
|
20 |
-
$this->set_request(
|
21 |
$this->set_view_variables();
|
22 |
}
|
23 |
|
24 |
-
private function set_request(
|
|
|
25 |
$this->request = $request;
|
26 |
}
|
27 |
|
28 |
-
private function set_view_variables()
|
|
|
29 |
$this->set_code();
|
30 |
$this->set_user();
|
31 |
$this->set_wp_tables();
|
32 |
}
|
33 |
|
34 |
-
private function set_code()
|
|
|
35 |
$this->code = $this->generate_code();
|
36 |
}
|
37 |
|
38 |
-
private function set_user()
|
|
|
39 |
$this->user = $this->resetter->get_user();
|
40 |
}
|
41 |
|
42 |
-
private function set_wp_tables()
|
|
|
43 |
$this->wp_tables = $this->resetter->get_wp_tables();
|
44 |
}
|
45 |
|
46 |
-
private function generate_code(
|
47 |
-
|
|
|
48 |
}
|
49 |
|
50 |
-
public function run()
|
51 |
-
|
52 |
-
add_action(
|
53 |
-
add_action(
|
|
|
54 |
|
55 |
-
add_filter(
|
56 |
-
add_filter(
|
57 |
-
add_filter(
|
58 |
-
add_filter(
|
59 |
}
|
60 |
|
61 |
|
62 |
// additional powered by text in admin footer; only on plugin's page
|
63 |
-
static function admin_footer_text($text)
|
|
|
64 |
$current_screen = get_current_screen();
|
65 |
|
66 |
-
if (
|
67 |
return $text;
|
68 |
}
|
69 |
|
70 |
-
$text = '<i><a href="https://wordpress.org/plugins/wordpress-database-reset/" target="_blank">WP Database Reset</a> v' . DB_RESET_VERSION . ' by <a href="https://www.webfactoryltd.com/" title="' . __(
|
71 |
|
72 |
return $text;
|
73 |
} // admin_footer_text
|
74 |
|
75 |
|
76 |
// add settings link to plugins page
|
77 |
-
function plugin_action_links($links)
|
|
|
78 |
$settings_link = '<a href="' . admin_url('tools.php?page=database-reset') . '" title="' . __('Reset Database', 'wordpress-database-reset') . '">' . __('Reset Database', 'wordpress-database-reset') . '</a>';
|
79 |
|
80 |
-
array_unshift(
|
81 |
|
82 |
return $links;
|
83 |
} // plugin_action_links
|
84 |
|
85 |
|
86 |
// add links to plugin's description in plugins table
|
87 |
-
function plugin_meta_links($links, $file)
|
|
|
88 |
$support_link = '<a target="_blank" href="https://wordpress.org/support/plugin/wordpress-database-reset" title="' . __('Get help', 'wordpress-database-reset') . '">' . __('Support', 'wordpress-database-reset') . '</a>';
|
89 |
|
90 |
|
91 |
-
if (
|
92 |
$links[] = $support_link;
|
93 |
}
|
94 |
|
95 |
return $links;
|
96 |
} // plugin_meta_links
|
97 |
|
98 |
-
|
99 |
// helper function for adding plugins to fav list
|
100 |
-
function featured_plugins_tab($args)
|
101 |
-
|
|
|
102 |
|
103 |
return $args;
|
104 |
} // featured_plugins_tab
|
105 |
|
106 |
|
107 |
// add our plugins to recommended list
|
108 |
-
function plugins_api_result($res, $action, $args)
|
109 |
-
|
|
|
110 |
|
111 |
-
$res = $this->add_plugin_favs(
|
112 |
-
$res = $this->add_plugin_favs(
|
113 |
-
$res = $this->add_plugin_favs(
|
|
|
114 |
|
115 |
return $res;
|
116 |
} // plugins_api_result
|
117 |
-
|
118 |
|
119 |
-
|
120 |
-
function add_plugin_favs($plugin_slug, $res)
|
|
|
|
|
121 |
if (!empty($res->plugins) && is_array($res->plugins)) {
|
122 |
foreach ($res->plugins as $plugin) {
|
123 |
if (is_object($plugin) && !empty($plugin->slug) && $plugin->slug == $plugin_slug) {
|
@@ -126,33 +142,37 @@ if ( ! class_exists( 'DB_Reset_Admin' ) ) :
|
|
126 |
} // foreach
|
127 |
}
|
128 |
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
$plugin_info = plugins_api('plugin_information', array(
|
133 |
'slug' => $plugin_slug,
|
134 |
'is_ssl' => is_ssl(),
|
135 |
'fields' => array(
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
)
|
143 |
));
|
144 |
if (!is_wp_error($plugin_info)) {
|
145 |
-
$res->plugins[] = $plugin_info;
|
146 |
set_transient('wf-plugin-info-' . $plugin_slug, $plugin_info, DAY_IN_SECONDS * 7);
|
147 |
}
|
148 |
}
|
149 |
|
|
|
|
|
|
|
|
|
150 |
return $res;
|
151 |
-
} //
|
152 |
|
153 |
|
154 |
// auto download / install / activate WPR plugin
|
155 |
-
function install_wpr()
|
|
|
156 |
if (false === current_user_can('administrator')) {
|
157 |
wp_die('Sorry, you have to be an admin to run this action.');
|
158 |
}
|
@@ -175,7 +195,7 @@ if ( ! class_exists( 'DB_Reset_Admin' ) ) :
|
|
175 |
</style>';
|
176 |
|
177 |
echo '<div style="margin: 20px; color:#444;">';
|
178 |
-
echo 'If things are not done in a minute <a target="_parent" href="' . admin_url('plugin-install.php?s=wp-reset&tab=search&type=term') .'">install the plugin manually via Plugins page</a><br><br>';
|
179 |
echo 'Starting ...<br><br>';
|
180 |
|
181 |
wp_cache_flush();
|
@@ -202,20 +222,21 @@ if ( ! class_exists( 'DB_Reset_Admin' ) ) :
|
|
202 |
echo '<br>If you are not redirected in a few seconds - <a href="tools.php?page=wp-reset" target="_parent">click here</a>.';
|
203 |
}
|
204 |
} else {
|
205 |
-
echo 'Could not install WP Reset. You\'ll have to <a target="_parent" href="' . admin_url('plugin-install.php?s=wp-reset&tab=search&type=term') .'">download and install manually</a>.';
|
206 |
}
|
207 |
|
208 |
echo '</div>';
|
209 |
} // install_wpr
|
210 |
|
211 |
|
212 |
-
function is_plugin_installed($slug)
|
213 |
-
|
|
|
214 |
require_once ABSPATH . 'wp-admin/includes/plugin.php';
|
215 |
}
|
216 |
$all_plugins = get_plugins();
|
217 |
-
|
218 |
-
if (
|
219 |
return true;
|
220 |
} else {
|
221 |
return false;
|
@@ -223,120 +244,134 @@ if ( ! class_exists( 'DB_Reset_Admin' ) ) :
|
|
223 |
} // is_plugin_installed
|
224 |
|
225 |
|
226 |
-
public function reset()
|
227 |
-
|
|
|
228 |
try {
|
229 |
-
$this->resetter->set_reactivate(
|
230 |
-
$this->resetter->reset(
|
231 |
$this->handle_after_reset();
|
232 |
-
} catch (
|
233 |
$this->notice_error = $e->getMessage();
|
234 |
}
|
235 |
}
|
236 |
}
|
237 |
|
238 |
-
private function form_is_safe_to_submit()
|
239 |
-
|
240 |
-
|
241 |
-
|
|
|
242 |
}
|
243 |
|
244 |
-
private function handle_after_reset()
|
245 |
-
|
246 |
-
|
|
|
247 |
exit;
|
248 |
}
|
249 |
|
250 |
-
$this->notice_success = __(
|
251 |
}
|
252 |
|
253 |
-
private function assert_request_variables_not_empty()
|
254 |
-
|
255 |
-
$this->set_empty_request_key(
|
|
|
256 |
|
257 |
return true;
|
258 |
}
|
259 |
|
260 |
-
private function set_empty_request_key(
|
261 |
-
|
262 |
-
|
|
|
263 |
}
|
264 |
}
|
265 |
|
266 |
-
private function assert_correct_code()
|
267 |
-
|
268 |
-
|
269 |
-
$this->
|
|
|
|
|
|
|
270 |
return false;
|
271 |
}
|
272 |
|
273 |
return true;
|
274 |
}
|
275 |
|
276 |
-
public function add_tools_menu()
|
|
|
277 |
$plugin_page = add_management_page(
|
278 |
-
__(
|
279 |
-
__(
|
280 |
'manage_options',
|
281 |
'database-reset',
|
282 |
-
array(
|
283 |
);
|
284 |
|
285 |
-
add_action(
|
286 |
}
|
287 |
|
288 |
-
public function render()
|
289 |
-
|
|
|
290 |
}
|
291 |
|
292 |
-
public function load_assets()
|
|
|
293 |
$this->load_stylesheets();
|
294 |
$this->load_javascript();
|
295 |
}
|
296 |
|
297 |
-
private function load_stylesheets()
|
|
|
298 |
wp_enqueue_style(
|
299 |
'bsmselect',
|
300 |
-
plugins_url(
|
301 |
array(),
|
302 |
$this->version
|
303 |
);
|
304 |
|
305 |
wp_enqueue_style(
|
306 |
'database-reset',
|
307 |
-
plugins_url(
|
308 |
array('bsmselect'),
|
309 |
$this->version
|
310 |
);
|
311 |
}
|
312 |
|
313 |
-
private function load_javascript()
|
|
|
|
|
|
|
314 |
wp_enqueue_script(
|
315 |
'bsmselect',
|
316 |
-
plugins_url(
|
317 |
-
array(
|
318 |
$this->version,
|
319 |
true
|
320 |
);
|
321 |
|
322 |
wp_enqueue_script(
|
323 |
'bsmselect-compatibility',
|
324 |
-
plugins_url(
|
325 |
-
array(
|
326 |
$this->version,
|
327 |
true
|
328 |
);
|
329 |
|
330 |
wp_enqueue_script(
|
331 |
'database-reset',
|
332 |
-
plugins_url(
|
333 |
-
array(
|
334 |
$this->version,
|
335 |
true
|
336 |
);
|
337 |
|
338 |
-
|
339 |
-
wp_enqueue_style( 'wp-jquery-ui-dialog' );
|
340 |
|
341 |
wp_localize_script(
|
342 |
'database-reset',
|
@@ -345,16 +380,16 @@ if ( ! class_exists( 'DB_Reset_Admin' ) ) :
|
|
345 |
);
|
346 |
}
|
347 |
|
348 |
-
private function load_javascript_vars()
|
|
|
349 |
return array(
|
350 |
-
'confirmAlert' => __(
|
351 |
-
'selectTable' => __(
|
352 |
-
'selectOneTable' => __(
|
353 |
'wprInstallUrl' => add_query_arg(array('action' => 'install_wpr'), admin_url('admin.php')),
|
354 |
-
'wprDialogTitle' => '<img alt="WP Reset" title="WP Reset" src="' . plugins_url(
|
355 |
);
|
356 |
}
|
357 |
-
|
358 |
}
|
359 |
|
360 |
endif;
|
1 |
<?php
|
2 |
|
3 |
+
if (!class_exists('DB_Reset_Admin')) :
|
4 |
|
5 |
+
class DB_Reset_Admin
|
6 |
+
{
|
7 |
|
8 |
private $code;
|
9 |
private $notice_error;
|
14 |
private $version;
|
15 |
private $wp_tables;
|
16 |
|
17 |
+
public function __construct($version)
|
18 |
+
{
|
19 |
$this->resetter = new DB_Resetter();
|
20 |
$this->version = $version;
|
21 |
|
22 |
+
$this->set_request($_REQUEST);
|
23 |
$this->set_view_variables();
|
24 |
}
|
25 |
|
26 |
+
private function set_request(array $request)
|
27 |
+
{
|
28 |
$this->request = $request;
|
29 |
}
|
30 |
|
31 |
+
private function set_view_variables()
|
32 |
+
{
|
33 |
$this->set_code();
|
34 |
$this->set_user();
|
35 |
$this->set_wp_tables();
|
36 |
}
|
37 |
|
38 |
+
private function set_code()
|
39 |
+
{
|
40 |
$this->code = $this->generate_code();
|
41 |
}
|
42 |
|
43 |
+
private function set_user()
|
44 |
+
{
|
45 |
$this->user = $this->resetter->get_user();
|
46 |
}
|
47 |
|
48 |
+
private function set_wp_tables()
|
49 |
+
{
|
50 |
$this->wp_tables = $this->resetter->get_wp_tables();
|
51 |
}
|
52 |
|
53 |
+
private function generate_code($length = 5)
|
54 |
+
{
|
55 |
+
return strtoupper(substr(md5(time()), 1, $length));
|
56 |
}
|
57 |
|
58 |
+
public function run()
|
59 |
+
{
|
60 |
+
add_action('admin_init', array($this, 'reset'));
|
61 |
+
add_action('admin_menu', array($this, 'add_tools_menu'));
|
62 |
+
add_action('admin_action_install_wpr', array($this, 'install_wpr'));
|
63 |
|
64 |
+
add_filter('install_plugins_table_api_args_featured', array($this, 'featured_plugins_tab'));
|
65 |
+
add_filter('plugin_action_links_' . plugin_basename(DB_RESET_FILE), array($this, 'plugin_action_links'));
|
66 |
+
add_filter('plugin_row_meta', array($this, 'plugin_meta_links'), 10, 2);
|
67 |
+
add_filter('admin_footer_text', array($this, 'admin_footer_text'));
|
68 |
}
|
69 |
|
70 |
|
71 |
// additional powered by text in admin footer; only on plugin's page
|
72 |
+
static function admin_footer_text($text)
|
73 |
+
{
|
74 |
$current_screen = get_current_screen();
|
75 |
|
76 |
+
if ($current_screen->id != 'tools_page_database-reset') {
|
77 |
return $text;
|
78 |
}
|
79 |
|
80 |
+
$text = '<i><a href="https://wordpress.org/plugins/wordpress-database-reset/" target="_blank">WP Database Reset</a> v' . DB_RESET_VERSION . ' by <a href="https://www.webfactoryltd.com/" title="' . __('Visit our site to get more great plugins', 'wordpress-database-reset') . '" target="_blank">' . __('WebFactory Ltd', 'wordpress-database-reset') . '</a>. Please <a href="https://wordpress.org/support/plugin/wordpress-database-reset/reviews/#new-post" target="_blank">rate the plugin ★★★★★</a>. Thank you!</i> ' . $text;
|
81 |
|
82 |
return $text;
|
83 |
} // admin_footer_text
|
84 |
|
85 |
|
86 |
// add settings link to plugins page
|
87 |
+
function plugin_action_links($links)
|
88 |
+
{
|
89 |
$settings_link = '<a href="' . admin_url('tools.php?page=database-reset') . '" title="' . __('Reset Database', 'wordpress-database-reset') . '">' . __('Reset Database', 'wordpress-database-reset') . '</a>';
|
90 |
|
91 |
+
array_unshift($links, $settings_link);
|
92 |
|
93 |
return $links;
|
94 |
} // plugin_action_links
|
95 |
|
96 |
|
97 |
// add links to plugin's description in plugins table
|
98 |
+
function plugin_meta_links($links, $file)
|
99 |
+
{
|
100 |
$support_link = '<a target="_blank" href="https://wordpress.org/support/plugin/wordpress-database-reset" title="' . __('Get help', 'wordpress-database-reset') . '">' . __('Support', 'wordpress-database-reset') . '</a>';
|
101 |
|
102 |
|
103 |
+
if ($file == plugin_basename(DB_RESET_FILE)) {
|
104 |
$links[] = $support_link;
|
105 |
}
|
106 |
|
107 |
return $links;
|
108 |
} // plugin_meta_links
|
109 |
|
110 |
+
|
111 |
// helper function for adding plugins to fav list
|
112 |
+
function featured_plugins_tab($args)
|
113 |
+
{
|
114 |
+
add_filter('plugins_api_result', array($this, 'plugins_api_result'), 10, 3);
|
115 |
|
116 |
return $args;
|
117 |
} // featured_plugins_tab
|
118 |
|
119 |
|
120 |
// add our plugins to recommended list
|
121 |
+
function plugins_api_result($res, $action, $args)
|
122 |
+
{
|
123 |
+
remove_filter('plugins_api_result', array($this, 'plugins_api_result'), 10, 3);
|
124 |
|
125 |
+
$res = $this->add_plugin_favs('eps-301-redirects', $res);
|
126 |
+
$res = $this->add_plugin_favs('wp-htaccess-editor', $res);
|
127 |
+
$res = $this->add_plugin_favs('under-construction-page', $res);
|
128 |
+
$res = $this->add_plugin_favs('simple-author-box', $res);
|
129 |
|
130 |
return $res;
|
131 |
} // plugins_api_result
|
|
|
132 |
|
133 |
+
|
134 |
+
function add_plugin_favs($plugin_slug, $res)
|
135 |
+
{
|
136 |
+
// check if plugin is already on the list
|
137 |
if (!empty($res->plugins) && is_array($res->plugins)) {
|
138 |
foreach ($res->plugins as $plugin) {
|
139 |
if (is_object($plugin) && !empty($plugin->slug) && $plugin->slug == $plugin_slug) {
|
142 |
} // foreach
|
143 |
}
|
144 |
|
145 |
+
$plugin_info = get_transient('wf-plugin-info-' . $plugin_slug);
|
146 |
+
|
147 |
+
if (!$plugin_info) {
|
148 |
$plugin_info = plugins_api('plugin_information', array(
|
149 |
'slug' => $plugin_slug,
|
150 |
'is_ssl' => is_ssl(),
|
151 |
'fields' => array(
|
152 |
+
'banners' => true,
|
153 |
+
'reviews' => true,
|
154 |
+
'downloaded' => true,
|
155 |
+
'active_installs' => true,
|
156 |
+
'icons' => true,
|
157 |
+
'short_description' => true,
|
158 |
)
|
159 |
));
|
160 |
if (!is_wp_error($plugin_info)) {
|
|
|
161 |
set_transient('wf-plugin-info-' . $plugin_slug, $plugin_info, DAY_IN_SECONDS * 7);
|
162 |
}
|
163 |
}
|
164 |
|
165 |
+
if (!empty($res->plugins) && is_array($res->plugins) && $plugin_info && is_object($plugin_info)) {
|
166 |
+
array_unshift($res->plugins, $plugin_info);
|
167 |
+
}
|
168 |
+
|
169 |
return $res;
|
170 |
+
} // add_plugin_featured
|
171 |
|
172 |
|
173 |
// auto download / install / activate WPR plugin
|
174 |
+
function install_wpr()
|
175 |
+
{
|
176 |
if (false === current_user_can('administrator')) {
|
177 |
wp_die('Sorry, you have to be an admin to run this action.');
|
178 |
}
|
195 |
</style>';
|
196 |
|
197 |
echo '<div style="margin: 20px; color:#444;">';
|
198 |
+
echo 'If things are not done in a minute <a target="_parent" href="' . admin_url('plugin-install.php?s=wp-reset&tab=search&type=term') . '">install the plugin manually via Plugins page</a><br><br>';
|
199 |
echo 'Starting ...<br><br>';
|
200 |
|
201 |
wp_cache_flush();
|
222 |
echo '<br>If you are not redirected in a few seconds - <a href="tools.php?page=wp-reset" target="_parent">click here</a>.';
|
223 |
}
|
224 |
} else {
|
225 |
+
echo 'Could not install WP Reset. You\'ll have to <a target="_parent" href="' . admin_url('plugin-install.php?s=wp-reset&tab=search&type=term') . '">download and install manually</a>.';
|
226 |
}
|
227 |
|
228 |
echo '</div>';
|
229 |
} // install_wpr
|
230 |
|
231 |
|
232 |
+
function is_plugin_installed($slug)
|
233 |
+
{
|
234 |
+
if (!function_exists('get_plugins')) {
|
235 |
require_once ABSPATH . 'wp-admin/includes/plugin.php';
|
236 |
}
|
237 |
$all_plugins = get_plugins();
|
238 |
+
|
239 |
+
if (!empty($all_plugins[$slug])) {
|
240 |
return true;
|
241 |
} else {
|
242 |
return false;
|
244 |
} // is_plugin_installed
|
245 |
|
246 |
|
247 |
+
public function reset()
|
248 |
+
{
|
249 |
+
if ($this->form_is_safe_to_submit()) {
|
250 |
try {
|
251 |
+
$this->resetter->set_reactivate($this->request['db-reset-reactivate-theme-data']);
|
252 |
+
$this->resetter->reset($this->request['db-reset-tables']);
|
253 |
$this->handle_after_reset();
|
254 |
+
} catch (Exception $e) {
|
255 |
$this->notice_error = $e->getMessage();
|
256 |
}
|
257 |
}
|
258 |
}
|
259 |
|
260 |
+
private function form_is_safe_to_submit()
|
261 |
+
{
|
262 |
+
return isset($this->request['db-reset-code-confirm']) &&
|
263 |
+
$this->assert_request_variables_not_empty() &&
|
264 |
+
$this->assert_correct_code();
|
265 |
}
|
266 |
|
267 |
+
private function handle_after_reset()
|
268 |
+
{
|
269 |
+
if (empty($this->request['db-reset-reactivate-theme-data'])) {
|
270 |
+
wp_redirect(admin_url());
|
271 |
exit;
|
272 |
}
|
273 |
|
274 |
+
$this->notice_success = __('The selected tables were reset', 'wordpress-database-reset');
|
275 |
}
|
276 |
|
277 |
+
private function assert_request_variables_not_empty()
|
278 |
+
{
|
279 |
+
$this->set_empty_request_key('db-reset-tables', array());
|
280 |
+
$this->set_empty_request_key('db-reset-reactivate-theme-data', false);
|
281 |
|
282 |
return true;
|
283 |
}
|
284 |
|
285 |
+
private function set_empty_request_key($key, $default)
|
286 |
+
{
|
287 |
+
if (!array_key_exists($key, $this->request)) {
|
288 |
+
$this->request[$key] = $default;
|
289 |
}
|
290 |
}
|
291 |
|
292 |
+
private function assert_correct_code()
|
293 |
+
{
|
294 |
+
if (
|
295 |
+
$this->request['db-reset-code'] !==
|
296 |
+
$this->request['db-reset-code-confirm']
|
297 |
+
) {
|
298 |
+
$this->notice_error = __('You entered the wrong security code', 'wordpress-database-reset');
|
299 |
return false;
|
300 |
}
|
301 |
|
302 |
return true;
|
303 |
}
|
304 |
|
305 |
+
public function add_tools_menu()
|
306 |
+
{
|
307 |
$plugin_page = add_management_page(
|
308 |
+
__('Database Reset', 'wordpress-database-reset'),
|
309 |
+
__('Database Reset', 'wordpress-database-reset'),
|
310 |
'manage_options',
|
311 |
'database-reset',
|
312 |
+
array($this, 'render')
|
313 |
);
|
314 |
|
315 |
+
add_action('load-' . $plugin_page, array($this, 'load_assets'));
|
316 |
}
|
317 |
|
318 |
+
public function render()
|
319 |
+
{
|
320 |
+
require_once(DB_RESET_PATH . '/views/index.php');
|
321 |
}
|
322 |
|
323 |
+
public function load_assets()
|
324 |
+
{
|
325 |
$this->load_stylesheets();
|
326 |
$this->load_javascript();
|
327 |
}
|
328 |
|
329 |
+
private function load_stylesheets()
|
330 |
+
{
|
331 |
wp_enqueue_style(
|
332 |
'bsmselect',
|
333 |
+
plugins_url('assets/css/bsmselect.css', __FILE__),
|
334 |
array(),
|
335 |
$this->version
|
336 |
);
|
337 |
|
338 |
wp_enqueue_style(
|
339 |
'database-reset',
|
340 |
+
plugins_url('assets/css/database-reset.css', __FILE__),
|
341 |
array('bsmselect'),
|
342 |
$this->version
|
343 |
);
|
344 |
}
|
345 |
|
346 |
+
private function load_javascript()
|
347 |
+
{
|
348 |
+
wp_enqueue_script('jquery-ui-dialog');
|
349 |
+
|
350 |
wp_enqueue_script(
|
351 |
'bsmselect',
|
352 |
+
plugins_url('assets/js/bsmselect.js', __FILE__),
|
353 |
+
array('jquery'),
|
354 |
$this->version,
|
355 |
true
|
356 |
);
|
357 |
|
358 |
wp_enqueue_script(
|
359 |
'bsmselect-compatibility',
|
360 |
+
plugins_url('assets/js/bsmselect.compatibility.js', __FILE__),
|
361 |
+
array('bsmselect'),
|
362 |
$this->version,
|
363 |
true
|
364 |
);
|
365 |
|
366 |
wp_enqueue_script(
|
367 |
'database-reset',
|
368 |
+
plugins_url('assets/js/database-reset.js', __FILE__),
|
369 |
+
array('bsmselect', 'bsmselect-compatibility'),
|
370 |
$this->version,
|
371 |
true
|
372 |
);
|
373 |
|
374 |
+
wp_enqueue_style('wp-jquery-ui-dialog');
|
|
|
375 |
|
376 |
wp_localize_script(
|
377 |
'database-reset',
|
380 |
);
|
381 |
}
|
382 |
|
383 |
+
private function load_javascript_vars()
|
384 |
+
{
|
385 |
return array(
|
386 |
+
'confirmAlert' => __('Are you sure you want to continue? There is NO UNDO!', 'wordpress-database-reset'),
|
387 |
+
'selectTable' => __('Select Tables', 'wordpress-database-reset'),
|
388 |
+
'selectOneTable' => __('Please select at least one table to reset.', 'wordpress-database-reset'),
|
389 |
'wprInstallUrl' => add_query_arg(array('action' => 'install_wpr'), admin_url('admin.php')),
|
390 |
+
'wprDialogTitle' => '<img alt="WP Reset" title="WP Reset" src="' . plugins_url('assets/images/wp-reset-logo.png', DB_RESET_FILE) . '">',
|
391 |
);
|
392 |
}
|
|
|
393 |
}
|
394 |
|
395 |
endif;
|
class-db-resetter.php
CHANGED
@@ -1,8 +1,9 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
if (
|
4 |
|
5 |
-
class DB_Resetter
|
|
|
6 |
|
7 |
private $backup;
|
8 |
private $blog_data;
|
@@ -15,205 +16,236 @@ if ( ! class_exists( 'DB_Resetter' ) ) :
|
|
15 |
private $wp_tables;
|
16 |
private $reset_users = false;
|
17 |
|
18 |
-
public function __construct()
|
|
|
19 |
$this->set_wp_tables();
|
20 |
$this->set_user();
|
21 |
}
|
22 |
|
23 |
-
public function reset(
|
24 |
-
|
25 |
-
|
26 |
-
|
|
|
|
|
|
|
|
|
27 |
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
|
|
|
|
|
|
32 |
}
|
33 |
|
34 |
-
private function validate_selected(
|
35 |
-
|
36 |
-
|
|
|
37 |
return;
|
38 |
}
|
39 |
|
40 |
-
throw new Exception(
|
41 |
}
|
42 |
|
43 |
-
private function set_backup()
|
44 |
-
|
45 |
-
$this->
|
|
|
46 |
$this->set_user_session_tokens();
|
47 |
$this->set_blog_data();
|
48 |
|
49 |
-
if (
|
50 |
$this->set_theme_plugin_data();
|
51 |
}
|
52 |
}
|
53 |
|
54 |
-
private function set_tables_to_preserve(
|
55 |
-
|
|
|
56 |
}
|
57 |
|
58 |
-
private function back_up_tables(
|
|
|
59 |
global $wpdb;
|
60 |
$this->backup = array();
|
61 |
|
62 |
-
foreach (
|
63 |
-
$this->backup[
|
64 |
}
|
65 |
}
|
66 |
|
67 |
-
private function set_user_session_tokens()
|
68 |
-
|
|
|
69 |
$this->user_data = array(
|
70 |
-
'session_tokens' => get_user_meta(
|
71 |
);
|
72 |
}
|
73 |
}
|
74 |
|
75 |
-
private function set_blog_data()
|
|
|
76 |
$this->blog_data = array(
|
77 |
-
'name' => get_option(
|
78 |
-
'public' => get_option(
|
79 |
-
'site_url' => get_option(
|
80 |
);
|
81 |
}
|
82 |
|
83 |
-
private function should_restore_theme_plugin_data()
|
84 |
-
|
|
|
85 |
}
|
86 |
|
87 |
-
private function set_theme_plugin_data()
|
|
|
88 |
$this->theme_plugin_data = array(
|
89 |
-
'active-plugins' => get_option(
|
90 |
-
'current-theme' => get_option(
|
91 |
-
'stylesheet' => get_option(
|
92 |
-
'template' => get_option(
|
93 |
);
|
94 |
}
|
95 |
|
96 |
-
private function reinstall()
|
|
|
97 |
$this->drop_wp_tables();
|
98 |
$this->install_wp();
|
99 |
$this->update_user_settings();
|
100 |
}
|
101 |
|
102 |
-
private function drop_wp_tables()
|
|
|
103 |
global $wpdb;
|
104 |
|
105 |
-
foreach (
|
106 |
-
$wpdb->query(
|
107 |
}
|
108 |
}
|
109 |
|
110 |
-
private function install_wp()
|
|
|
111 |
return db_reset_install(
|
112 |
-
$this->blog_data[
|
113 |
$this->user->user_login,
|
114 |
$this->user->user_email,
|
115 |
-
$this->blog_data[
|
116 |
-
$this->blog_data[
|
117 |
);
|
118 |
}
|
119 |
|
120 |
-
private function update_user_settings()
|
|
|
121 |
global $wpdb;
|
122 |
|
123 |
-
$user_id = $this->reset_users? 1: $this->user->ID;
|
124 |
|
125 |
$wpdb->query(
|
126 |
$wpdb->prepare(
|
127 |
-
|
128 |
SET user_pass = '%s', user_activation_key = ''
|
129 |
WHERE ID = '%d'",
|
130 |
-
$this->user->user_pass,
|
|
|
131 |
)
|
132 |
);
|
133 |
|
134 |
-
if (
|
135 |
wp_clear_auth_cookie();
|
136 |
-
wp_set_auth_cookie(
|
137 |
}
|
138 |
}
|
139 |
|
140 |
-
private function restore_backup()
|
141 |
-
|
142 |
-
$this->
|
|
|
143 |
$this->restore_user_session_tokens();
|
144 |
$this->assert_theme_plugin_data_needs_reset();
|
145 |
}
|
146 |
|
147 |
-
private function delete_backup_table_rows(
|
|
|
148 |
global $wpdb;
|
149 |
|
150 |
-
foreach (
|
151 |
-
$wpdb->query(
|
152 |
}
|
153 |
}
|
154 |
|
155 |
-
private function restore_backup_tables(
|
|
|
156 |
global $wpdb;
|
157 |
|
158 |
-
foreach (
|
159 |
-
foreach (
|
160 |
$columns = $values = array();
|
161 |
|
162 |
-
foreach (
|
163 |
$columns[] = $column;
|
164 |
-
$values[] = esc_sql(
|
165 |
}
|
166 |
|
167 |
-
$wpdb->query(
|
168 |
}
|
169 |
}
|
170 |
}
|
171 |
|
172 |
-
private function restore_user_session_tokens()
|
173 |
-
|
|
|
174 |
}
|
175 |
|
176 |
-
private function assert_theme_plugin_data_needs_reset()
|
177 |
-
|
|
|
178 |
$this->restore_theme_plugin_data();
|
179 |
}
|
180 |
}
|
181 |
|
182 |
-
private function restore_theme_plugin_data()
|
183 |
-
|
184 |
-
update_option(
|
185 |
-
update_option(
|
|
|
186 |
|
187 |
-
if (
|
188 |
-
update_option(
|
189 |
}
|
190 |
}
|
191 |
|
192 |
-
public function set_reactivate(
|
|
|
193 |
$this->reactivate = $with_theme_plugin_data;
|
194 |
}
|
195 |
|
196 |
-
private function set_wp_tables()
|
|
|
197 |
global $wpdb;
|
198 |
$this->wp_tables = $wpdb->tables();
|
199 |
}
|
200 |
|
201 |
-
public function get_wp_tables()
|
|
|
202 |
return $this->wp_tables;
|
203 |
}
|
204 |
|
205 |
-
private function set_user()
|
|
|
206 |
global $current_user;
|
207 |
|
208 |
-
$this->user = (
|
209 |
-
|
210 |
-
|
211 |
}
|
212 |
|
213 |
-
public function get_user()
|
|
|
214 |
return $this->user;
|
215 |
}
|
216 |
-
|
217 |
}
|
218 |
|
219 |
endif;
|
1 |
<?php
|
2 |
|
3 |
+
if (!class_exists('DB_Resetter')) :
|
4 |
|
5 |
+
class DB_Resetter
|
6 |
+
{
|
7 |
|
8 |
private $backup;
|
9 |
private $blog_data;
|
16 |
private $wp_tables;
|
17 |
private $reset_users = false;
|
18 |
|
19 |
+
public function __construct()
|
20 |
+
{
|
21 |
$this->set_wp_tables();
|
22 |
$this->set_user();
|
23 |
}
|
24 |
|
25 |
+
public function reset(array $tables)
|
26 |
+
{
|
27 |
+
if (wp_verify_nonce(@$_REQUEST['submit_reset_form'], 'reset_nounce') && current_user_can('administrator')) {
|
28 |
+
// Check if current user is Admin and check the nonce
|
29 |
+
|
30 |
+
if (in_array('users', $tables)) {
|
31 |
+
$this->reset_users = true;
|
32 |
+
}
|
33 |
|
34 |
+
$this->validate_selected($tables);
|
35 |
+
$this->set_backup();
|
36 |
+
$this->reinstall();
|
37 |
+
$this->restore_backup();
|
38 |
+
} else {
|
39 |
+
throw new Exception(__('Please reload the page and try again. Double check your security code.', 'wordpress-database-reset'));
|
40 |
+
}
|
41 |
}
|
42 |
|
43 |
+
private function validate_selected(array $tables)
|
44 |
+
{
|
45 |
+
if (!empty($tables) && is_array($tables)) {
|
46 |
+
$this->selected = array_flip($tables);
|
47 |
return;
|
48 |
}
|
49 |
|
50 |
+
throw new Exception(__('You did not select any database tables', 'wordpress-database-reset'));
|
51 |
}
|
52 |
|
53 |
+
private function set_backup()
|
54 |
+
{
|
55 |
+
$this->set_tables_to_preserve($this->selected);
|
56 |
+
$this->back_up_tables($this->preserved);
|
57 |
$this->set_user_session_tokens();
|
58 |
$this->set_blog_data();
|
59 |
|
60 |
+
if ($this->should_restore_theme_plugin_data()) {
|
61 |
$this->set_theme_plugin_data();
|
62 |
}
|
63 |
}
|
64 |
|
65 |
+
private function set_tables_to_preserve(array $tables)
|
66 |
+
{
|
67 |
+
$this->preserved = array_diff_key($this->wp_tables, $tables);
|
68 |
}
|
69 |
|
70 |
+
private function back_up_tables(array $tables)
|
71 |
+
{
|
72 |
global $wpdb;
|
73 |
$this->backup = array();
|
74 |
|
75 |
+
foreach ($tables as $table) {
|
76 |
+
$this->backup[$table] = $wpdb->get_results("SELECT * FROM {$table}");
|
77 |
}
|
78 |
}
|
79 |
|
80 |
+
private function set_user_session_tokens()
|
81 |
+
{
|
82 |
+
if (get_user_meta($this->user->ID, 'session_tokens')) {
|
83 |
$this->user_data = array(
|
84 |
+
'session_tokens' => get_user_meta($this->user->ID, 'session_tokens', true)
|
85 |
);
|
86 |
}
|
87 |
}
|
88 |
|
89 |
+
private function set_blog_data()
|
90 |
+
{
|
91 |
$this->blog_data = array(
|
92 |
+
'name' => get_option('blogname'),
|
93 |
+
'public' => get_option('blog_public'),
|
94 |
+
'site_url' => get_option('siteurl')
|
95 |
);
|
96 |
}
|
97 |
|
98 |
+
private function should_restore_theme_plugin_data()
|
99 |
+
{
|
100 |
+
return ('true' === $this->reactivate);
|
101 |
}
|
102 |
|
103 |
+
private function set_theme_plugin_data()
|
104 |
+
{
|
105 |
$this->theme_plugin_data = array(
|
106 |
+
'active-plugins' => get_option('active_plugins'),
|
107 |
+
'current-theme' => get_option('current_theme'),
|
108 |
+
'stylesheet' => get_option('stylesheet'),
|
109 |
+
'template' => get_option('template')
|
110 |
);
|
111 |
}
|
112 |
|
113 |
+
private function reinstall()
|
114 |
+
{
|
115 |
$this->drop_wp_tables();
|
116 |
$this->install_wp();
|
117 |
$this->update_user_settings();
|
118 |
}
|
119 |
|
120 |
+
private function drop_wp_tables()
|
121 |
+
{
|
122 |
global $wpdb;
|
123 |
|
124 |
+
foreach ($this->wp_tables as $wp_table) {
|
125 |
+
$wpdb->query("DROP TABLE {$wp_table}");
|
126 |
}
|
127 |
}
|
128 |
|
129 |
+
private function install_wp()
|
130 |
+
{
|
131 |
return db_reset_install(
|
132 |
+
$this->blog_data['name'],
|
133 |
$this->user->user_login,
|
134 |
$this->user->user_email,
|
135 |
+
$this->blog_data['public'],
|
136 |
+
$this->blog_data['site_url']
|
137 |
);
|
138 |
}
|
139 |
|
140 |
+
private function update_user_settings()
|
141 |
+
{
|
142 |
global $wpdb;
|
143 |
|
144 |
+
$user_id = $this->reset_users ? 1 : $this->user->ID;
|
145 |
|
146 |
$wpdb->query(
|
147 |
$wpdb->prepare(
|
148 |
+
"UPDATE $wpdb->users
|
149 |
SET user_pass = '%s', user_activation_key = ''
|
150 |
WHERE ID = '%d'",
|
151 |
+
$this->user->user_pass,
|
152 |
+
$user_id
|
153 |
)
|
154 |
);
|
155 |
|
156 |
+
if ($this->reset_users) {
|
157 |
wp_clear_auth_cookie();
|
158 |
+
wp_set_auth_cookie(true);
|
159 |
}
|
160 |
}
|
161 |
|
162 |
+
private function restore_backup()
|
163 |
+
{
|
164 |
+
$this->delete_backup_table_rows($this->preserved);
|
165 |
+
$this->restore_backup_tables($this->backup);
|
166 |
$this->restore_user_session_tokens();
|
167 |
$this->assert_theme_plugin_data_needs_reset();
|
168 |
}
|
169 |
|
170 |
+
private function delete_backup_table_rows(array $tables)
|
171 |
+
{
|
172 |
global $wpdb;
|
173 |
|
174 |
+
foreach ($tables as $table) {
|
175 |
+
$wpdb->query("DELETE FROM {$table}");
|
176 |
}
|
177 |
}
|
178 |
|
179 |
+
private function restore_backup_tables(array $tables)
|
180 |
+
{
|
181 |
global $wpdb;
|
182 |
|
183 |
+
foreach ($tables as $table => $data) {
|
184 |
+
foreach ($data as $row) {
|
185 |
$columns = $values = array();
|
186 |
|
187 |
+
foreach ($row as $column => $value) {
|
188 |
$columns[] = $column;
|
189 |
+
$values[] = esc_sql($value);
|
190 |
}
|
191 |
|
192 |
+
$wpdb->query("INSERT INTO $table (" . implode(', ', $columns) . ") VALUES ('" . implode("', '", $values) . "')");
|
193 |
}
|
194 |
}
|
195 |
}
|
196 |
|
197 |
+
private function restore_user_session_tokens()
|
198 |
+
{
|
199 |
+
add_user_meta($this->user->ID, 'session_tokens', $this->user_data['session_tokens']);
|
200 |
}
|
201 |
|
202 |
+
private function assert_theme_plugin_data_needs_reset()
|
203 |
+
{
|
204 |
+
if ($this->should_restore_theme_plugin_data()) {
|
205 |
$this->restore_theme_plugin_data();
|
206 |
}
|
207 |
}
|
208 |
|
209 |
+
private function restore_theme_plugin_data()
|
210 |
+
{
|
211 |
+
update_option('active_plugins', $this->theme_plugin_data['active-plugins']);
|
212 |
+
update_option('template', $this->theme_plugin_data['template']);
|
213 |
+
update_option('stylesheet', $this->theme_plugin_data['stylesheet']);
|
214 |
|
215 |
+
if (!empty($this->theme_plugin_data['current-theme'])) {
|
216 |
+
update_option('current_theme', $this->theme_plugin_data['current-theme']);
|
217 |
}
|
218 |
}
|
219 |
|
220 |
+
public function set_reactivate($with_theme_plugin_data)
|
221 |
+
{
|
222 |
$this->reactivate = $with_theme_plugin_data;
|
223 |
}
|
224 |
|
225 |
+
private function set_wp_tables()
|
226 |
+
{
|
227 |
global $wpdb;
|
228 |
$this->wp_tables = $wpdb->tables();
|
229 |
}
|
230 |
|
231 |
+
public function get_wp_tables()
|
232 |
+
{
|
233 |
return $this->wp_tables;
|
234 |
}
|
235 |
|
236 |
+
private function set_user()
|
237 |
+
{
|
238 |
global $current_user;
|
239 |
|
240 |
+
$this->user = (0 !== $current_user->ID) ?
|
241 |
+
wp_get_current_user() :
|
242 |
+
get_userdata(1);
|
243 |
}
|
244 |
|
245 |
+
public function get_user()
|
246 |
+
{
|
247 |
return $this->user;
|
248 |
}
|
|
|
249 |
}
|
250 |
|
251 |
endif;
|
index.php
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// silence is golden
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: WebFactory, wpreset, underconstructionpage, googlemapswidget
|
|
3 |
Tags: database, reset, restore, database reset, wp reset, developer, development
|
4 |
Requires at least: 4.2
|
5 |
Requires PHP: 5.2
|
6 |
-
Tested up to: 5.
|
7 |
-
Stable tag: 3.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -12,9 +12,9 @@ Skip reinstalling WP to reset it & reset the WordPress database back to its orig
|
|
12 |
|
13 |
== Description ==
|
14 |
|
15 |
-
**
|
16 |
|
17 |
-
|
18 |
|
19 |
**Features**
|
20 |
|
@@ -57,7 +57,7 @@ Create a new post in the [WordPress Database Reset support forum](https://wordpr
|
|
57 |
* Rate the plugin - <a href="https://wordpress.org/support/plugin/wordpress-database-reset/reviews/#new-post">rate it</a>
|
58 |
|
59 |
|
60 |
-
WP Database Reset was originally developed in October 2011 by <a href="https://github.com/chrisberthe">Chris Berthe</a>. Please do not send him any support questions. If you need assistance the <a href="https://wordpress.org/support/plugin/wordpress-database-reset/">official forum</a> is the best and fastest way to get it.
|
61 |
|
62 |
|
63 |
== Screenshots ==
|
@@ -65,6 +65,11 @@ WP Database Reset was originally developed in October 2011 by <a href="https://g
|
|
65 |
|
66 |
== Changelog ==
|
67 |
|
|
|
|
|
|
|
|
|
|
|
68 |
= 3.1 =
|
69 |
* 2019/08/13
|
70 |
* WebFactory took over development
|
3 |
Tags: database, reset, restore, database reset, wp reset, developer, development
|
4 |
Requires at least: 4.2
|
5 |
Requires PHP: 5.2
|
6 |
+
Tested up to: 5.4
|
7 |
+
Stable tag: 3.15
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
12 |
|
13 |
== Description ==
|
14 |
|
15 |
+
The WordPress Database Reset plugin allows you to **reset the database** (all tables or the ones you choose) back to its default settings without having to go through the WordPress 5 minute installation or having to modify any files.
|
16 |
|
17 |
+
> Need more reset tools? To individually reset plugins, themes, transients or media? Or perhaps database snapshots so you can restore your WP site with one click if you made a mistake? Then check out our free sister plugin - <a href="https://wordpress.org/plugins/wp-reset/">WP Reset</a>.
|
18 |
|
19 |
**Features**
|
20 |
|
57 |
* Rate the plugin - <a href="https://wordpress.org/support/plugin/wordpress-database-reset/reviews/#new-post">rate it</a>
|
58 |
|
59 |
|
60 |
+
WP Database Reset was originally developed in October 2011 by <a href="https://github.com/chrisberthe">Chris Berthe</a>. Please do not send him any support questions. If you need assistance the <a href="https://wordpress.org/support/plugin/wordpress-database-reset/">official forum</a> is the best and fastest way to get it.
|
61 |
|
62 |
|
63 |
== Screenshots ==
|
65 |
|
66 |
== Changelog ==
|
67 |
|
68 |
+
= 3.15 =
|
69 |
+
* 2020/01/14
|
70 |
+
* security fixes - thanks to Chloe from Wordfence
|
71 |
+
* 80k installations; 761,300 downloads
|
72 |
+
|
73 |
= 3.1 =
|
74 |
* 2019/08/13
|
75 |
* WebFactory took over development
|
views/index.php
CHANGED
@@ -11,16 +11,20 @@
|
|
11 |
|
12 |
</div>
|
13 |
|
|
|
|
|
|
|
|
|
14 |
<div class="wrap card" id="wp-reset-ad">
|
15 |
-
<a href="#" class="open-wpr-upsell"><img src="<?php echo plugins_url( 'assets/images/wp-reset-icon.png', DB_RESET_FILE ); ?>" alt="WP Reset - used on +
|
16 |
-
<p>Need more control? Reset theme options, media files, transients or <em>.htaccess</em> file? Delete all uploads, plugins and themes? Or create database snapshots and restore them with one click? <a href="#" class="open-wpr-upsell">Install the free WP Reset plugin</a>. It's used on <b>+
|
17 |
</div>
|
18 |
|
19 |
<div id="wpr-upsell-dialog" style="display: none;" title="WP Reset">
|
20 |
<span class="ui-helper-hidden-accessible"><input type="text"/></span>
|
21 |
<div style="padding: 20px; font-size: 15px;">
|
22 |
<ul>
|
23 |
-
<li>Free plugin used on +
|
24 |
<li>Simple & easy to use with clear instructions</li>
|
25 |
<li>Use it to quickly reset any data in WordPress</li>
|
26 |
<li>Extremely usefull for cleaning demo data from themes & plugins</li>
|
11 |
|
12 |
</div>
|
13 |
|
14 |
+
<div class="wrap card">
|
15 |
+
<p>Like the plugin? Please <a href="https://wordpress.org/support/plugin/wordpress-database-reset/reviews/#new-post" target="_blank">rate it ★★★★★</a>. It's what keeps it free & maintained.<br><b>Thank you!</b></p>
|
16 |
+
</div>
|
17 |
+
|
18 |
<div class="wrap card" id="wp-reset-ad">
|
19 |
+
<a href="#" class="open-wpr-upsell"><img src="<?php echo plugins_url( 'assets/images/wp-reset-icon.png', DB_RESET_FILE ); ?>" alt="WP Reset - used on +200,000 sites" title="WP Reset - used on +200,000 sites"></a>
|
20 |
+
<p>Need more control? Reset theme options, media files, transients or <em>.htaccess</em> file? Delete all uploads, plugins and themes? Or create database snapshots and restore them with one click? <a href="#" class="open-wpr-upsell">Install the free WP Reset plugin</a>. It's used on <b>+200,000 sites daily</b>!</p>
|
21 |
</div>
|
22 |
|
23 |
<div id="wpr-upsell-dialog" style="display: none;" title="WP Reset">
|
24 |
<span class="ui-helper-hidden-accessible"><input type="text"/></span>
|
25 |
<div style="padding: 20px; font-size: 15px;">
|
26 |
<ul>
|
27 |
+
<li>Free plugin used on +200,000 sites</li>
|
28 |
<li>Simple & easy to use with clear instructions</li>
|
29 |
<li>Use it to quickly reset any data in WordPress</li>
|
30 |
<li>Extremely usefull for cleaning demo data from themes & plugins</li>
|
views/partials/notice.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
</div>
|
5 |
<?php elseif ( $this->notice_error ) : ?>
|
6 |
<div class="error notice is-dismissible">
|
7 |
-
<p><strong><?php echo $this->notice_error
|
8 |
</div>
|
9 |
<?php endif ?>
|
10 |
|
@@ -12,4 +12,4 @@
|
|
12 |
<div class="notice-info notice is-dismissible" id="rate-plugin-notice" style="display: none;">
|
13 |
<p><strong>Please <a href="https://wordpress.org/support/plugin/wordpress-database-reset/reviews/#new-post" target="_blank">rate the plugin ★★★★★</a>. It's what keeps it free & maintained. Thank you!</strong></p>
|
14 |
</div>
|
15 |
-
<?php endif ?>
|
4 |
</div>
|
5 |
<?php elseif ( $this->notice_error ) : ?>
|
6 |
<div class="error notice is-dismissible">
|
7 |
+
<p><strong><?php echo $this->notice_error; ?></strong></p>
|
8 |
</div>
|
9 |
<?php endif ?>
|
10 |
|
12 |
<div class="notice-info notice is-dismissible" id="rate-plugin-notice" style="display: none;">
|
13 |
<p><strong>Please <a href="https://wordpress.org/support/plugin/wordpress-database-reset/reviews/#new-post" target="_blank">rate the plugin ★★★★★</a>. It's what keeps it free & maintained. Thank you!</strong></p>
|
14 |
</div>
|
15 |
+
<?php endif ?>
|
views/partials/security-code.php
CHANGED
@@ -1,7 +1,8 @@
|
|
1 |
<p>
|
2 |
-
<b>3.</b> <?php _e(
|
3 |
<span id="security-code"><?php echo $this->code ?></span>
|
4 |
</p>
|
5 |
|
6 |
<input type="hidden" name="db-reset-code" value="<?php echo $this->code ?>" />
|
7 |
<input type="text" name="db-reset-code-confirm" id="db-reset-code-confirm" value="" placeholder="" />
|
|
1 |
<p>
|
2 |
+
<b>3.</b> <?php _e('Enter the security code into the text box below', 'wordpress-database-reset') ?>:
|
3 |
<span id="security-code"><?php echo $this->code ?></span>
|
4 |
</p>
|
5 |
|
6 |
<input type="hidden" name="db-reset-code" value="<?php echo $this->code ?>" />
|
7 |
<input type="text" name="db-reset-code-confirm" id="db-reset-code-confirm" value="" placeholder="" />
|
8 |
+
<?php wp_nonce_field('reset_nounce', 'submit_reset_form'); ?>
|
views/partials/select-tables.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<p>
|
2 |
-
<b>1.</b> The plugin DOES NOT create backups. Please create
|
3 |
</p>
|
4 |
|
5 |
<p><b>2.</b> <?php _e( 'Select the database table(s) you would like to reset', 'wordpress-database-reset' ) ?>:</p>
|
1 |
<p>
|
2 |
+
<b>1.</b> The plugin DOES NOT create backups. Please create a backup manually or install the <a class="open-wpr-upsell" href="#">free WP Reset plugin</a> which has snapshots that wlll enable you to undo a reset. If something is not clear open a ticket on the official <a target="_blank" href="https://wordpress.org/support/plugin/wordpress-database-reset/">support forum</a>. All tickets are answered within a few hours.
|
3 |
</p>
|
4 |
|
5 |
<p><b>2.</b> <?php _e( 'Select the database table(s) you would like to reset', 'wordpress-database-reset' ) ?>:</p>
|
wp-reset.php
CHANGED
@@ -3,14 +3,14 @@
|
|
3 |
Plugin Name: WP Database Reset
|
4 |
Plugin URI: https://wordpress.org/plugins/wordpress-database-reset/
|
5 |
Description: Reset all or some WP database tables back to their original state.
|
6 |
-
Version: 3.
|
7 |
Author: WebFactory Ltd
|
8 |
Author URI: https://www.webfactoryltd.com/
|
9 |
License: GNU General Public License
|
10 |
Text-domain: wordpress-database-reset
|
11 |
*/
|
12 |
|
13 |
-
define( 'DB_RESET_VERSION', '3.
|
14 |
define( 'DB_RESET_PATH', dirname( __FILE__ ) );
|
15 |
define( 'DB_RESET_NAME', basename( DB_RESET_PATH ) );
|
16 |
define( 'DB_RESET_FILE', __FILE__ );
|
3 |
Plugin Name: WP Database Reset
|
4 |
Plugin URI: https://wordpress.org/plugins/wordpress-database-reset/
|
5 |
Description: Reset all or some WP database tables back to their original state.
|
6 |
+
Version: 3.15
|
7 |
Author: WebFactory Ltd
|
8 |
Author URI: https://www.webfactoryltd.com/
|
9 |
License: GNU General Public License
|
10 |
Text-domain: wordpress-database-reset
|
11 |
*/
|
12 |
|
13 |
+
define( 'DB_RESET_VERSION', '3.15' );
|
14 |
define( 'DB_RESET_PATH', dirname( __FILE__ ) );
|
15 |
define( 'DB_RESET_NAME', basename( DB_RESET_PATH ) );
|
16 |
define( 'DB_RESET_FILE', __FILE__ );
|