Version Description
Download this release
Release Info
Developer | WebFactory |
Plugin | WP Reset – Fastest WordPress Reset Plugin |
Version | 1.11 |
Comparing to | |
See all releases |
Code changes from version 1.0 to 1.11
- readme.txt +88 -0
- wp-reset.php +221 -111
readme.txt
ADDED
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== WP Reset - Fastest WordPress Reset Plugin ===
|
2 |
+
Tags: wordpress reset, reset wordpress, reset database, reset wordpress database, reset, restart wordpress, clean wordpress, default wp, default wordpress, reset wp, wp reset, developer
|
3 |
+
Contributors: WebFactory
|
4 |
+
Requires at least: 4.0
|
5 |
+
Requires PHP: 5.2
|
6 |
+
Tested up to: 4.9
|
7 |
+
Stable tag: 1.11
|
8 |
+
License: GPLv2 or later
|
9 |
+
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
+
|
11 |
+
WordPress Reset resets any WordPress site to the default values without modifying any files. It deletes all customizations and content. Safe to use.
|
12 |
+
|
13 |
+
== Description ==
|
14 |
+
|
15 |
+
WP Reset quickly resets the site's database to the default installation values without modifying any files. It deletes all customizations and content. WP Reset is fast and safe to use. It has multiple fail-safe mechanisms so you can never excidentaly lose data. WP Reset is extremely helpful for plugin and theme developers. Access it through the "Tools" menu.
|
16 |
+
|
17 |
+
|
18 |
+
**Please read carefully before proceeding to understand what WP Reset does.**
|
19 |
+
|
20 |
+
#### Resetting will delete:
|
21 |
+
|
22 |
+
* all posts, pages, custom post types, comments, media entries, users
|
23 |
+
* all default WP database tables
|
24 |
+
* all custom database tables that have the same prefix "ins01_" as default tables in this installation
|
25 |
+
|
26 |
+
#### Resetting will not delete or modify:
|
27 |
+
|
28 |
+
* media files - they'll remain in the _wp-uploads_ folder but will no longer be listed under Media
|
29 |
+
* no files are touched; plugins, themes, uploads - everything stays
|
30 |
+
* site title, WordPress address, site address, site language and search engine visibility settings
|
31 |
+
* currently logged in user will be restored with the current password
|
32 |
+
|
33 |
+
#### What happens when I click the Reset button?
|
34 |
+
|
35 |
+
* you will have to confirm the action one more time because there is NO UNDO
|
36 |
+
* everything will be reset; see bullets above for details
|
37 |
+
* site title, WordPress address, site address, site language, search engine visibility settings as well as the current user will be restored
|
38 |
+
* you will be logged out, automatically logged in and taken to the admin dashboard
|
39 |
+
* WP Reset plugin will be reactivated
|
40 |
+
|
41 |
+
|
42 |
+
== Installation ==
|
43 |
+
|
44 |
+
Follow the usual routine;
|
45 |
+
|
46 |
+
1. Open WordPress admin, go to Plugins, click Add New
|
47 |
+
2. Enter "wp reset" in search and hit Enter
|
48 |
+
3. Plugin will show up as the first on the list, click "Install Now"
|
49 |
+
4. Activate & open plugin's settings page located under the Tools menu
|
50 |
+
|
51 |
+
Or if needed, upload manually;
|
52 |
+
|
53 |
+
1. Download the plugin.
|
54 |
+
2. Unzip it and upload to _/wp-content/plugins/_
|
55 |
+
3. Open WordPress admin - Plugins and click "Activate" next to the plugin
|
56 |
+
4. Activate & open plugin's settings page located under the Tools menu
|
57 |
+
|
58 |
+
|
59 |
+
== Screenshots ==
|
60 |
+
|
61 |
+
1. WP Reset admin page
|
62 |
+
|
63 |
+
|
64 |
+
== Changelog ==
|
65 |
+
|
66 |
+
= 1.1 =
|
67 |
+
* 2018/05/09
|
68 |
+
* WebFactory took over development
|
69 |
+
* numerous bug fixes and improvements
|
70 |
+
* 30,000 installations; 199,000 downloads
|
71 |
+
|
72 |
+
= 1.0 =
|
73 |
+
* 2016/05/16
|
74 |
+
* Initial release
|
75 |
+
|
76 |
+
== Frequently Asked Questions ==
|
77 |
+
|
78 |
+
= How can I log in after resetting? =
|
79 |
+
|
80 |
+
Use the same username and password you used while doing the reset. Only one user will be restored after resetting. The one you used at that time.
|
81 |
+
|
82 |
+
= Will any files be deleted or modified? =
|
83 |
+
|
84 |
+
No. All files are left untouched.
|
85 |
+
|
86 |
+
= Will I have to reconfigure wp-config.php? =
|
87 |
+
|
88 |
+
Absolutely not. No reconfiguration is needed. No files are modified.
|
wp-reset.php
CHANGED
@@ -1,53 +1,72 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
-
Plugin Name: WP Reset
|
4 |
-
Plugin URI: https://
|
5 |
-
Description:
|
6 |
-
Version: 1.
|
7 |
-
Author:
|
8 |
-
Author URI: https://
|
9 |
-
Text Domain:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
*/
|
11 |
|
|
|
12 |
if ( ! defined( 'ABSPATH' ) ){
|
13 |
-
exit;
|
14 |
-
}
|
15 |
|
16 |
-
if ( is_admin() ) {
|
17 |
|
18 |
define( 'REACTIVATE_THE_WP_RESET', true );
|
19 |
|
|
|
|
|
|
|
20 |
class WPReset {
|
21 |
-
|
22 |
-
|
23 |
-
|
|
|
|
|
24 |
add_action( 'admin_init', array( &$this, 'admin_init' ) );
|
25 |
-
add_filter( 'favorite_actions', array( &$this, 'action_favorite' ), 100 );
|
26 |
add_action( 'wp_before_admin_bar_render', array( &$this, 'link_admin_bar' ) );
|
27 |
-
|
28 |
-
|
|
|
|
|
|
|
29 |
// Checks wp_reset post value and performs an installation.
|
30 |
function admin_init() {
|
31 |
-
global $current_user;
|
|
|
|
|
|
|
|
|
32 |
|
33 |
-
$
|
34 |
-
$wp_reset_confirm = ( isset( $_POST['wp_reset_confirm'] ) && $_POST['wp_reset_confirm'] == 'wp-reset' ) ? true : false;
|
35 |
$valid_nonce = ( isset( $_POST['_wpnonce'] ) && wp_verify_nonce( $_POST['_wpnonce'], 'wp_reset' ) ) ? true : false;
|
36 |
|
37 |
-
if ( $
|
38 |
-
require_once
|
39 |
|
40 |
$blogname = get_option( 'blogname' );
|
41 |
-
$admin_email = get_option( 'admin_email' );
|
42 |
$blog_public = get_option( 'blog_public' );
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
if ( empty( $user->user_level ) || $user->user_level < 10 )
|
48 |
-
$user = $current_user;
|
49 |
-
|
50 |
-
global $wpdb;
|
51 |
|
52 |
$prefix = str_replace( '_', '\_', $wpdb->prefix );
|
53 |
$tables = $wpdb->get_col( "SHOW TABLES LIKE '{$prefix}%'" );
|
@@ -55,53 +74,92 @@ class WPReset {
|
|
55 |
$wpdb->query( "DROP TABLE $table" );
|
56 |
}
|
57 |
|
58 |
-
$result = wp_install( $blogname, $
|
59 |
-
|
60 |
|
61 |
-
$query = $wpdb->prepare( "UPDATE $wpdb->users SET user_pass =
|
62 |
$wpdb->query( $query );
|
63 |
|
64 |
-
|
65 |
-
|
|
|
|
|
|
|
66 |
|
67 |
-
if (
|
68 |
-
|
69 |
|
70 |
-
if ( $get_user_meta( $user_id, $wpdb->prefix . 'default_password_nag' ) )
|
71 |
-
$update_user_meta( $user_id, $wpdb->prefix . 'default_password_nag', false );
|
72 |
|
73 |
-
|
74 |
if ( defined( 'REACTIVATE_THE_WP_RESET' ) && REACTIVATE_THE_WP_RESET === true )
|
75 |
@activate_plugin( plugin_basename( __FILE__ ) );
|
76 |
-
|
77 |
|
78 |
wp_clear_auth_cookie();
|
79 |
-
|
80 |
wp_set_auth_cookie( $user_id );
|
81 |
|
82 |
-
wp_redirect( admin_url()."?wp-reset=wp-reset" );
|
83 |
exit();
|
84 |
}
|
85 |
|
86 |
if ( array_key_exists( 'wp-reset', $_GET ) && stristr( $_SERVER['HTTP_REFERER'], 'wp-reset' ) )
|
87 |
-
add_action( 'admin_notices', array( &$this, '
|
88 |
-
}
|
89 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
// admin_menu action hook operations & Add the settings page
|
91 |
-
function
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
|
103 |
function link_admin_bar() {
|
104 |
global $wp_admin_bar;
|
|
|
|
|
|
|
|
|
|
|
105 |
$wp_admin_bar->add_menu(
|
106 |
array(
|
107 |
'parent' => 'site-name',
|
@@ -110,79 +168,131 @@ class WPReset {
|
|
110 |
'href' => admin_url( 'tools.php?page=wp-reset' )
|
111 |
)
|
112 |
);
|
113 |
-
}
|
114 |
-
|
|
|
115 |
// Inform the user that WordPress has been successfully reset
|
116 |
-
function
|
117 |
-
$
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
|
|
|
|
122 |
function admin_script() {
|
123 |
-
|
124 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
|
126 |
function footer_script() {
|
127 |
?>
|
128 |
<script type="text/javascript">
|
129 |
-
jQuery('#wp_reset_submit').click(function(){
|
130 |
-
if ( jQuery('#wp_reset_confirm').val() == '
|
131 |
-
|
132 |
-
|
133 |
if ( reset ) {
|
134 |
jQuery('#wp_reset_form').submit();
|
135 |
} else {
|
136 |
-
jQuery('#wp_reset').val('false');
|
137 |
return false;
|
138 |
}
|
139 |
} else {
|
140 |
-
alert(
|
141 |
return false;
|
142 |
}
|
143 |
});
|
144 |
-
</script>
|
145 |
<?php
|
146 |
-
}
|
|
|
147 |
|
148 |
// add_option_page callback operations
|
149 |
function admin_page() {
|
150 |
-
global $current_user;
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
185 |
|
186 |
$WPReset = new WPReset();
|
187 |
|
188 |
-
|
|
|
|
1 |
<?php
|
2 |
/*
|
3 |
+
Plugin Name: WP Reset
|
4 |
+
Plugin URI: https://wordpress.org/plugins/wp-reset/
|
5 |
+
Description: Reset the site to default installation values without modifying any files. Deletes all customizations and content.
|
6 |
+
Version: 1.11
|
7 |
+
Author: WebFactory Ltd
|
8 |
+
Author URI: https://www.webfactoryltd.com/
|
9 |
+
Text Domain: wp-reset
|
10 |
+
|
11 |
+
Copyright 2015 - 2018 Web factory Ltd (email: wpreset@webfactoryltd.com)
|
12 |
+
|
13 |
+
This program is free software; you can redistribute it and/or modify
|
14 |
+
it under the terms of the GNU General Public License, version 2, as
|
15 |
+
published by the Free Software Foundation.
|
16 |
+
|
17 |
+
This program is distributed in the hope that it will be useful,
|
18 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
19 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
20 |
+
GNU General Public License for more details.
|
21 |
+
|
22 |
+
You should have received a copy of the GNU General Public License
|
23 |
+
along with this program; if not, write to the Free Software
|
24 |
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
25 |
*/
|
26 |
|
27 |
+
|
28 |
if ( ! defined( 'ABSPATH' ) ){
|
29 |
+
exit;
|
30 |
+
}
|
31 |
|
|
|
32 |
|
33 |
define( 'REACTIVATE_THE_WP_RESET', true );
|
34 |
|
35 |
+
|
36 |
+
if ( is_admin() ) {
|
37 |
+
|
38 |
class WPReset {
|
39 |
+
static $version = 1.11;
|
40 |
+
|
41 |
+
|
42 |
+
function __construct() {
|
43 |
+
add_action( 'admin_menu', array( &$this, 'add_tools_page' ) );
|
44 |
add_action( 'admin_init', array( &$this, 'admin_init' ) );
|
|
|
45 |
add_action( 'wp_before_admin_bar_render', array( &$this, 'link_admin_bar' ) );
|
46 |
+
add_filter( 'admin_footer_text', array( &$this, 'admin_footer_text') );
|
47 |
+
add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), array(&$this, 'plugin_action_links') );
|
48 |
+
} // WPReset
|
49 |
+
|
50 |
+
|
51 |
// Checks wp_reset post value and performs an installation.
|
52 |
function admin_init() {
|
53 |
+
global $current_user, $wpdb;
|
54 |
+
|
55 |
+
if ( !current_user_can('administrator') ) {
|
56 |
+
return;
|
57 |
+
}
|
58 |
|
59 |
+
$wp_reset_confirm = ( isset( $_POST['wp_reset_confirm'] ) && $_POST['wp_reset_confirm'] == 'reset' ) ? true : false;
|
|
|
60 |
$valid_nonce = ( isset( $_POST['_wpnonce'] ) && wp_verify_nonce( $_POST['_wpnonce'], 'wp_reset' ) ) ? true : false;
|
61 |
|
62 |
+
if ( $wp_reset_confirm && $valid_nonce ) {
|
63 |
+
@require_once ABSPATH . '/wp-admin/includes/upgrade.php';
|
64 |
|
65 |
$blogname = get_option( 'blogname' );
|
|
|
66 |
$blog_public = get_option( 'blog_public' );
|
67 |
+
$wplang = get_option( 'wplang' );
|
68 |
+
$siteurl = get_option ( 'siteurl' );
|
69 |
+
$home = get_option ( 'home' );
|
|
|
|
|
|
|
|
|
|
|
70 |
|
71 |
$prefix = str_replace( '_', '\_', $wpdb->prefix );
|
72 |
$tables = $wpdb->get_col( "SHOW TABLES LIKE '{$prefix}%'" );
|
74 |
$wpdb->query( "DROP TABLE $table" );
|
75 |
}
|
76 |
|
77 |
+
$result = wp_install( $blogname, $current_user->user_login, $current_user->user_email, $blog_public, '', '', $wplang);
|
78 |
+
$user_id = $result['user_id'];
|
79 |
|
80 |
+
$query = $wpdb->prepare( "UPDATE {$wpdb->users} SET user_pass = %s, user_activation_key = '' WHERE ID = %d LIMIT 1", array($current_user->user_pass, $user_id));
|
81 |
$wpdb->query( $query );
|
82 |
|
83 |
+
update_option('siteurl', $siteurl);
|
84 |
+
update_option('home', $home);
|
85 |
+
|
86 |
+
if ( get_user_meta( $user_id, 'default_password_nag' ) )
|
87 |
+
update_user_meta( $user_id, 'default_password_nag', false );
|
88 |
|
89 |
+
if ( get_user_meta( $user_id, $wpdb->prefix . 'default_password_nag' ) )
|
90 |
+
update_user_meta( $user_id, $wpdb->prefix . 'default_password_nag', false );
|
91 |
|
|
|
|
|
92 |
|
|
|
93 |
if ( defined( 'REACTIVATE_THE_WP_RESET' ) && REACTIVATE_THE_WP_RESET === true )
|
94 |
@activate_plugin( plugin_basename( __FILE__ ) );
|
95 |
+
|
96 |
|
97 |
wp_clear_auth_cookie();
|
|
|
98 |
wp_set_auth_cookie( $user_id );
|
99 |
|
100 |
+
wp_redirect( admin_url() . "?wp-reset=wp-reset" );
|
101 |
exit();
|
102 |
}
|
103 |
|
104 |
if ( array_key_exists( 'wp-reset', $_GET ) && stristr( $_SERVER['HTTP_REFERER'], 'wp-reset' ) )
|
105 |
+
add_action( 'admin_notices', array( &$this, 'successfully_reset' ) );
|
106 |
+
} // admin_init
|
107 |
+
|
108 |
+
|
109 |
+
// add settings link to plugins page
|
110 |
+
static function plugin_action_links($links) {
|
111 |
+
$settings_link = '<a href="' . admin_url('tools.php?page=wp-reset') . '" title="' . __('Reset WordPress', 'wp-reset') . '">' . __('Reset WordPress', 'wp-reset') . '</a>';
|
112 |
+
|
113 |
+
array_unshift($links, $settings_link);
|
114 |
+
|
115 |
+
return $links;
|
116 |
+
} // plugin_action_links
|
117 |
+
|
118 |
+
|
119 |
+
// test if we're on plugin's page
|
120 |
+
function is_plugin_page() {
|
121 |
+
$current_screen = get_current_screen();
|
122 |
+
|
123 |
+
if ($current_screen->id == 'tools_page_wp-reset') {
|
124 |
+
return true;
|
125 |
+
} else {
|
126 |
+
return false;
|
127 |
+
}
|
128 |
+
} // is_plugin_page
|
129 |
+
|
130 |
+
|
131 |
+
// additional powered by text in admin footer; only on UCP page
|
132 |
+
function admin_footer_text($text) {
|
133 |
+
if (!$this->is_plugin_page()) {
|
134 |
+
return $text;
|
135 |
+
}
|
136 |
+
|
137 |
+
$text = '<i><a href="https://wordpress.org/plugins/wp-reset/" title="' . __('Visit WP Reset page for more info', 'wp-reset') . '" target="_blank">WP Reset</a> v' . self::$version . ' by <a href="https://www.webfactoryltd.com/" title="' . __('Visit our site to get more great plugins', 'wp-reset'). '" target="_blank">WebFactory Ltd</a>.</i> '. $text;
|
138 |
+
|
139 |
+
return $text;
|
140 |
+
} // admin_footer_text
|
141 |
+
|
142 |
+
|
143 |
// admin_menu action hook operations & Add the settings page
|
144 |
+
function add_tools_page() {
|
145 |
+
$hook = add_management_page( 'WP Reset', 'WP Reset', 'administrator', 'wp-reset', array( &$this, 'admin_page' ) );
|
146 |
+
add_action( "admin_print_scripts-{$hook}", array( &$this, 'admin_script' ) );
|
147 |
+
add_action( "admin_footer-{$hook}", array( &$this, 'footer_script' ) );
|
148 |
+
} // add_tools_page
|
149 |
+
|
150 |
+
|
151 |
+
function load_textdomain() {
|
152 |
+
load_plugin_textdomain( 'wp-reset' );
|
153 |
+
} // load_textdomain
|
154 |
+
|
155 |
|
156 |
function link_admin_bar() {
|
157 |
global $wp_admin_bar;
|
158 |
+
|
159 |
+
if (!current_user_can('administrator')) {
|
160 |
+
return;
|
161 |
+
}
|
162 |
+
|
163 |
$wp_admin_bar->add_menu(
|
164 |
array(
|
165 |
'parent' => 'site-name',
|
168 |
'href' => admin_url( 'tools.php?page=wp-reset' )
|
169 |
)
|
170 |
);
|
171 |
+
} // link_admin_bar
|
172 |
+
|
173 |
+
|
174 |
// Inform the user that WordPress has been successfully reset
|
175 |
+
function successfully_reset() {
|
176 |
+
global $current_user;
|
177 |
+
|
178 |
+
echo '<div id="message" class="updated fade"><p>' . sprintf( __( '<b>Site has been reset</b> to default settings. User "%s" was restored with the password unchanged.', 'wp-reset' ), $current_user->user_login ) . '</p></div>';
|
179 |
+
|
180 |
+
} // successfully_reset
|
181 |
+
|
182 |
+
|
183 |
function admin_script() {
|
184 |
+
$localize = array('invalid_confirmation' => __('Invalid confirmation. Please type "reset" in the confirmation field.', 'wp-reset'),
|
185 |
+
'confirm1' => __('Clicking "OK" will reset your site to default values. All content will be lost. There is NO UNDO.', 'wp-reset'),
|
186 |
+
'confirm2' => __('Click "Cancel" to abort.', 'wp-reset'));
|
187 |
+
|
188 |
+
wp_enqueue_script( 'jquery' );
|
189 |
+
wp_localize_script('jquery', 'wp_reset', $localize);
|
190 |
+
} // admin_script
|
191 |
+
|
192 |
|
193 |
function footer_script() {
|
194 |
?>
|
195 |
<script type="text/javascript">
|
196 |
+
jQuery('#wp_reset_submit').click(function(e) {
|
197 |
+
if ( jQuery('#wp_reset_confirm').val() == 'reset' ) {
|
198 |
+
message = wp_reset.confirm1 + '\n' + wp_reset.confirm2;
|
199 |
+
reset = confirm(message);
|
200 |
if ( reset ) {
|
201 |
jQuery('#wp_reset_form').submit();
|
202 |
} else {
|
|
|
203 |
return false;
|
204 |
}
|
205 |
} else {
|
206 |
+
alert(wp_reset.invalid_confirmation);
|
207 |
return false;
|
208 |
}
|
209 |
});
|
210 |
+
</script>
|
211 |
<?php
|
212 |
+
} // footer_script
|
213 |
+
|
214 |
|
215 |
// add_option_page callback operations
|
216 |
function admin_page() {
|
217 |
+
global $current_user, $wpdb;
|
218 |
+
|
219 |
+
if (!current_user_can('administrator')) {
|
220 |
+
return;
|
221 |
+
}
|
222 |
+
|
223 |
+
if ( isset( $_POST['wp_reset_confirm'] ) && $_POST['wp_reset_confirm'] != 'reset' ) {
|
224 |
+
echo '<div class="error fade"><p>' . __('<b>Invalid confirmation code.</b> Please type "reset" in the confirmation field.', 'wp-reset') . '</p></div>';
|
225 |
+
} elseif ( isset( $_POST['_wpnonce'] ) && !wp_verify_nonce( $_POST['_wpnonce'], 'wp_reset' ) ) {
|
226 |
+
echo '<div class="error fade"><p>' . __('Something went wrong. Please refresh the page and try again.', 'wp-reset') . '</strong></p></div>';
|
227 |
+
}
|
228 |
+
|
229 |
+
?>
|
230 |
+
<style type="text/css">
|
231 |
+
.plain-list {
|
232 |
+
margin-top: 5px;
|
233 |
+
list-style-type: circle;
|
234 |
+
list-style-position: inside;
|
235 |
+
}
|
236 |
+
.plain-list li {
|
237 |
+
text-indent: -18px;
|
238 |
+
padding-left: 23px;
|
239 |
+
line-height: 23px;
|
240 |
+
margin: 0;
|
241 |
+
}
|
242 |
+
.red {
|
243 |
+
color: red;
|
244 |
+
}
|
245 |
+
.green {
|
246 |
+
color: green;
|
247 |
+
}
|
248 |
+
</style>
|
249 |
+
<?php
|
250 |
+
echo '<div class="wrap">';
|
251 |
+
echo '<h1>WP Reset</h1>';
|
252 |
+
|
253 |
+
echo '<div class="card">';
|
254 |
+
echo '<h2>' . __('Please read carefully before proceeding. There is NO UNDO!', 'wp-reset') . '</h2>';
|
255 |
+
echo '<b class="red">' . __('Resetting will delete:', 'wp-reset') . '</b>';
|
256 |
+
echo '<ul class="plain-list">';
|
257 |
+
echo '<li>' . __('all posts, pages, custom post types, comments, media entries, users', 'wp-reset') . '</li>';
|
258 |
+
echo '<li>' . __('all default WP database tables', 'wp-reset') . '</li>';
|
259 |
+
echo '<li>' . sprintf(__('all custom database tables that have the same prefix "%s" as default tables in this installation', 'wp-reset'), $wpdb->prefix) . '</li>';
|
260 |
+
echo '</ul>';
|
261 |
+
|
262 |
+
echo '<b class="green">' . __('Resetting will not delete:', 'wp-reset') . '</b>';
|
263 |
+
echo '<ul class="plain-list">';
|
264 |
+
echo '<li>' . __('media files - they\'ll remain in the <i>wp-uploads</i> folder but will no longer be listed under Media', 'wp-reset') . '</li>';
|
265 |
+
echo '<li>' . __('no files are touched; plugins, themes, uploads - everything stays', 'wp-reset') . '</li>';
|
266 |
+
echo '<li>' . __('site title, WordPress address, site address, site language and search engine visibility settings', 'wp-reset') . '</li>';
|
267 |
+
echo '<li>' . sprintf(__('logged in user "%s" will be restored with the current password', 'wp-reset'), $current_user->user_login) . '</li>';
|
268 |
+
echo '</ul>';
|
269 |
+
|
270 |
+
echo '<b>' . __('What happens when I click the Reset button?', 'wp-reset') . '</b>';
|
271 |
+
echo '<ul class="plain-list">';
|
272 |
+
echo '<li>' . __('you will have to confirm the action one more time because there is NO UNDO', 'wp-reset') . '</li>';
|
273 |
+
echo '<li>' . __('everything will be reset; see bullets above for details', 'wp-reset') . '</li>';
|
274 |
+
echo '<li>' . __('site title, WordPress address, site address, site language, search engine visibility and current user will be restored', 'wp-reset') . '</li>';
|
275 |
+
echo '<li>' . __('you will be logged out, automatically logged in and taken to the admin dashboard', 'wp-reset') . '</li>';
|
276 |
+
echo '<li>' . __('WP Reset plugin will be reactivated', 'wp-reset') . '</li>';
|
277 |
+
echo '</ul>';
|
278 |
+
echo '</div>';
|
279 |
+
|
280 |
+
echo '<div class="card">';
|
281 |
+
echo '<h2>' . __('Reset', 'wp-reset') . '</h2>';
|
282 |
+
echo '<p>' . __('Type <b>reset</b> in the confirmation field to confirm the reset and then click the "Reset WordPress" button. <b>There is NO UNDO. No backups are made by this plugin.</b>', 'wp-reset') . '</p>';
|
283 |
+
echo '<p>' . sprintf(__('While doing work on your site we recommend installing the free <a href="%s" target="_blank">UnderConstructionPage</a> plugin. It helps with SEO and builds trust with visitors.', 'wp-reset'), 'https://wordpress.org/plugins/under-construction-page/') . '</p>';
|
284 |
+
echo '<form id="wp_reset_form" action="" method="post" autocomplete="off">';
|
285 |
+
wp_nonce_field( 'wp_reset' );
|
286 |
+
echo '<input id="wp_reset_confirm" type="text" name="wp_reset_confirm" placeholder="' . esc_attr__('Type in "reset"', 'wp-reset'). '" value="" autocomplete="off"> ';
|
287 |
+
echo '<input id="wp_reset_submit" type="submit" name="submit" class="button-primary" value="' . __('Reset WordPress', 'wp-reset') . '">';
|
288 |
+
echo '</form>';
|
289 |
+
echo '</div>';
|
290 |
+
echo '</div>';
|
291 |
+
} // admin_page
|
292 |
+
} // WPReset class
|
293 |
|
294 |
$WPReset = new WPReset();
|
295 |
|
296 |
+
add_action( 'plugins_loaded', array(&$WPReset, 'load_textdomain' ) );
|
297 |
+
|
298 |
+
} // is_admin
|