Version Description
- Some changes to CSS style
- Changing a direct text to _e() for localization
- Test the plugin with WP 5.1
Download this release
Release Info
Developer | symptote |
Plugin | Advanced WordPress Reset |
Version | 1.1.0 |
Comparing to | |
See all releases |
Code changes from version 1.0.1 to 1.1.0
- README.txt +7 -2
- advanced-wp-reset.php +52 -7
- css/admin.css +1 -1
- includes/functions.php +13 -3
- includes/reset.php +4 -3
- includes/sidebar.php +3 -7
README.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: symptote
|
|
3 |
Donate Link: http://www.sigmaplugin.com/donation
|
4 |
Tags: database, reset database, reset, clean, restore
|
5 |
Requires at least: 4.0
|
6 |
-
Tested up to:
|
7 |
-
Stable tag: 1.0
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -43,6 +43,11 @@ This section describes how to install the plugin and get it working.
|
|
43 |
|
44 |
== Changelog ==
|
45 |
|
|
|
|
|
|
|
|
|
|
|
46 |
= 1.0.1 =
|
47 |
* The plugin is now Reactivated after the reset
|
48 |
* Adding "Successful Reset" message
|
3 |
Donate Link: http://www.sigmaplugin.com/donation
|
4 |
Tags: database, reset database, reset, clean, restore
|
5 |
Requires at least: 4.0
|
6 |
+
Tested up to: 5.1
|
7 |
+
Stable tag: 1.1.0
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
43 |
|
44 |
== Changelog ==
|
45 |
|
46 |
+
= 1.1.0 =
|
47 |
+
* Some changes to CSS style
|
48 |
+
* Changing a direct text to _e() for localization
|
49 |
+
* Test the plugin with WP 5.1
|
50 |
+
|
51 |
= 1.0.1 =
|
52 |
* The plugin is now Reactivated after the reset
|
53 |
* Adding "Successful Reset" message
|
advanced-wp-reset.php
CHANGED
@@ -5,7 +5,7 @@ if (!defined('ABSPATH') || !is_main_site()) return;
|
|
5 |
Plugin Name: Advanced WordPress Reset
|
6 |
Plugin URI: http://sigmaplugin.com/downloads/advanced-wordpress-reset
|
7 |
Description: Reset your WordPress database back to its first original status, just like if you make a fresh installation.
|
8 |
-
Version: 1.0
|
9 |
Author: Younes JFR.
|
10 |
Author URI: http://www.sigmaplugin.com
|
11 |
Contributors: symptote
|
@@ -18,7 +18,7 @@ License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
|
18 |
/********************************************************************
|
19 |
* Define common constants
|
20 |
********************************************************************/
|
21 |
-
if (!defined("DBR_PLUGIN_VERSION")) define("DBR_PLUGIN_VERSION", "1.
|
22 |
if (!defined("DBR_PLUGIN_DIR_PATH")) define("DBR_PLUGIN_DIR_PATH", plugins_url('' , __FILE__));
|
23 |
if (!defined("DBR_PLUGIN_BASENAME")) define("DBR_PLUGIN_BASENAME", plugin_basename(__FILE__));
|
24 |
|
@@ -64,6 +64,51 @@ function DBR_activate_plugin(){
|
|
64 |
// Anything to do on activation? Maybe later...
|
65 |
}
|
66 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
/********************************************************************
|
68 |
* Deactivation of the plugin
|
69 |
********************************************************************/
|
@@ -88,11 +133,11 @@ function DBR_main_page_callback(){
|
|
88 |
_e('You do not have sufficient permissions to access this page.','advanced-wp-reset');
|
89 |
die();
|
90 |
}
|
91 |
-
if(array_key_exists('reset-db', $_GET)){
|
92 |
-
echo '<div id="DBR_message" class="updated notice is-dismissible"><p>';
|
93 |
-
_e('Your database has been reset successfully!','advanced-wp-reset');
|
94 |
-
echo '</p></div>';
|
95 |
-
}
|
96 |
?>
|
97 |
<div class="wrap">
|
98 |
<h2>Advanced WordPress Reset</h2>
|
5 |
Plugin Name: Advanced WordPress Reset
|
6 |
Plugin URI: http://sigmaplugin.com/downloads/advanced-wordpress-reset
|
7 |
Description: Reset your WordPress database back to its first original status, just like if you make a fresh installation.
|
8 |
+
Version: 1.1.0
|
9 |
Author: Younes JFR.
|
10 |
Author URI: http://www.sigmaplugin.com
|
11 |
Contributors: symptote
|
18 |
/********************************************************************
|
19 |
* Define common constants
|
20 |
********************************************************************/
|
21 |
+
if (!defined("DBR_PLUGIN_VERSION")) define("DBR_PLUGIN_VERSION", "1.1.0");
|
22 |
if (!defined("DBR_PLUGIN_DIR_PATH")) define("DBR_PLUGIN_DIR_PATH", plugins_url('' , __FILE__));
|
23 |
if (!defined("DBR_PLUGIN_BASENAME")) define("DBR_PLUGIN_BASENAME", plugin_basename(__FILE__));
|
24 |
|
64 |
// Anything to do on activation? Maybe later...
|
65 |
}
|
66 |
|
67 |
+
/********************************************************************
|
68 |
+
* Add rating box to the top of wordpress admin panel
|
69 |
+
********************************************************************/
|
70 |
+
$aDBc_upload_dir = wp_upload_dir();
|
71 |
+
$aDBc_file_path = str_replace('\\' ,'/', $aDBc_upload_dir['basedir']) . "/DBR.txt";
|
72 |
+
if(isset($_GET['DBR_rate']) && $_GET['DBR_rate'] == "0"){
|
73 |
+
$handle = fopen($aDBc_file_path, "w");
|
74 |
+
if($handle){
|
75 |
+
fwrite($handle, "0");
|
76 |
+
}
|
77 |
+
}else{
|
78 |
+
if(file_exists($aDBc_file_path)){
|
79 |
+
$content = file_get_contents($aDBc_file_path);
|
80 |
+
if($content == "1"){
|
81 |
+
add_action('admin_notices', 'DBR_show_rate_box');
|
82 |
+
}
|
83 |
+
}
|
84 |
+
}
|
85 |
+
function DBR_show_rate_box(){
|
86 |
+
$aDBc_new_URI = $_SERVER['REQUEST_URI'];
|
87 |
+
$aDBc_new_URI = add_query_arg('DBR_rate', "0", $aDBc_new_URI);
|
88 |
+
$style_botton = "background: #f0f5fa;padding: 4px !important;text-decoration: none;margin-right:10px;border-radius: 5px;-moz-border-radius: 5px;-webkit-border-radius: 5px; box-shadow: 0 0 0 1px #5b9dd9, 0 0 2px 1px rgba(30,140,190,.8); ";
|
89 |
+
?>
|
90 |
+
<div style="padding:15px !important;" class="updated DBR-top-main-msg">
|
91 |
+
<span style="font-size:16px;color:green;font-weight:bold;"><?php _e('Awesome!', 'advanced-wp-reset'); ?></span>
|
92 |
+
<p style="font-size:14px;line-height:30px">
|
93 |
+
<?php _e('The plugin "Advanced DB Reset" just helped you reset your database to a fresh installation with success!', 'advanced-wp-reset'); ?>
|
94 |
+
<br/>
|
95 |
+
<?php _e('Could you please kindly help the plugin in your turn by giving it 5 stars rating? (Thank you in advance)', 'advanced-wp-reset'); ?>
|
96 |
+
<div style="font-size:14px;margin-top:10px">
|
97 |
+
<a style="<?php echo $style_botton ?>" target="_blank" href="https://wordpress.org/support/plugin/advanced-wp-reset/reviews/?filter=5">
|
98 |
+
<?php _e('Ok, you deserved it', 'advanced-wp-reset'); ?></a>
|
99 |
+
<form method="post" action="" style="display:inline">
|
100 |
+
<input type="hidden" name="dont_show_rate" value=""/>
|
101 |
+
<a style="<?php echo $style_botton ?>" href="<?php echo $aDBc_new_URI; ?>"><?php _e('I already did', 'advanced-wp-reset'); ?></a>
|
102 |
+
<a style="<?php echo $style_botton ?>" href="<?php echo $aDBc_new_URI; ?>"><?php _e('Please don\'t show this again', 'advanced-wp-reset'); ?></a>
|
103 |
+
</form>
|
104 |
+
</div>
|
105 |
+
</p>
|
106 |
+
</div>
|
107 |
+
<?php
|
108 |
+
}
|
109 |
+
|
110 |
+
|
111 |
+
|
112 |
/********************************************************************
|
113 |
* Deactivation of the plugin
|
114 |
********************************************************************/
|
133 |
_e('You do not have sufficient permissions to access this page.','advanced-wp-reset');
|
134 |
die();
|
135 |
}
|
136 |
+
//if(array_key_exists('reset-db', $_GET)){
|
137 |
+
//echo '<div id="DBR_message" class="updated notice is-dismissible"><p>';
|
138 |
+
//_e('Your database has been reset successfully!','advanced-wp-reset');
|
139 |
+
//echo '</p></div>';
|
140 |
+
//}
|
141 |
?>
|
142 |
<div class="wrap">
|
143 |
<h2>Advanced WordPress Reset</h2>
|
css/admin.css
CHANGED
@@ -47,7 +47,7 @@ html {
|
|
47 |
.DBR-sidebar {
|
48 |
float: right;
|
49 |
border: 1px solid #ccc;
|
50 |
-
background: #
|
51 |
margin-right: -260px;
|
52 |
width: 240px;
|
53 |
border-radius: 5px 5px 0 0;
|
47 |
.DBR-sidebar {
|
48 |
float: right;
|
49 |
border: 1px solid #ccc;
|
50 |
+
background: #fff;
|
51 |
margin-right: -260px;
|
52 |
width: 240px;
|
53 |
border-radius: 5px 5px 0 0;
|
includes/functions.php
CHANGED
@@ -35,14 +35,24 @@ function DBR_wp_reset(){
|
|
35 |
if ( $get_user_meta( $user_id, $wpdb->prefix . 'default_password_nag' ) ){
|
36 |
$update_user_meta( $user_id, $wpdb->prefix . 'default_password_nag', false );
|
37 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
// Reactivate the plugin
|
39 |
@activate_plugin(DBR_PLUGIN_BASENAME);
|
40 |
// Clear all cookies associated with authentication
|
41 |
-
wp_clear_auth_cookie();
|
42 |
// Set the authentication cookies based User ID
|
43 |
-
wp_set_auth_cookie( $user_id );
|
44 |
// Redirect user to admin pannel
|
45 |
-
wp_redirect( admin_url()."tools.php?page=advanced_wp_reset&reset-db=done");
|
46 |
}
|
47 |
|
48 |
?>
|
35 |
if ( $get_user_meta( $user_id, $wpdb->prefix . 'default_password_nag' ) ){
|
36 |
$update_user_meta( $user_id, $wpdb->prefix . 'default_password_nag', false );
|
37 |
}
|
38 |
+
// Add a small file to invite users rate the plugin
|
39 |
+
$aDBc_upload_dir = wp_upload_dir();
|
40 |
+
$aDBc_file_path = str_replace('\\' ,'/', $aDBc_upload_dir['basedir']) . "/DBR.txt";
|
41 |
+
if(!file_exists($aDBc_file_path)){
|
42 |
+
$handle = fopen($aDBc_file_path, "w");
|
43 |
+
if($handle){
|
44 |
+
fwrite($handle, "1");
|
45 |
+
}
|
46 |
+
}
|
47 |
+
|
48 |
// Reactivate the plugin
|
49 |
@activate_plugin(DBR_PLUGIN_BASENAME);
|
50 |
// Clear all cookies associated with authentication
|
51 |
+
//wp_clear_auth_cookie();
|
52 |
// Set the authentication cookies based User ID
|
53 |
+
//wp_set_auth_cookie( $user_id );
|
54 |
// Redirect user to admin pannel
|
55 |
+
//wp_redirect( admin_url()."tools.php?page=advanced_wp_reset&reset-db=done");
|
56 |
}
|
57 |
|
58 |
?>
|
includes/reset.php
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
// Test if the user has clicked on reset button
|
4 |
if(isset($_POST['DBR_reset_button'])){
|
5 |
if($_POST['DBR_reset_comfirmation'] == 'reset'){
|
@@ -20,7 +19,9 @@ $DBR_admin = get_user_by('login', 'admin');
|
|
20 |
$DBR_admin_exists = 1;
|
21 |
if (!isset($DBR_admin->user_login ) || $DBR_admin->user_level < 10 ){
|
22 |
$DBR_admin_exists = 0;
|
23 |
-
}
|
|
|
|
|
24 |
|
25 |
<div class="DBR-box-warning">
|
26 |
<span style="color:red"><strong><?php _e('WARNING:','advanced-wp-reset'); ?></strong></span>
|
@@ -57,7 +58,7 @@ if (!isset($DBR_admin->user_login ) || $DBR_admin->user_level < 10 ){
|
|
57 |
<?php wp_nonce_field('DBR_sample_nonce', 'DBR_sample_nonce'); ?>
|
58 |
<input id="DBR_reset_comfirmation" type="text" name="DBR_reset_comfirmation" value="" style="width:150px"/>
|
59 |
<p class="submit">
|
60 |
-
<input id="DBR_reset_button" name="DBR_reset_button" type="submit" class="button-primary DBR-button-reset" value="Reset database"/>
|
61 |
</p>
|
62 |
</form>
|
63 |
|
1 |
<?php
|
|
|
2 |
// Test if the user has clicked on reset button
|
3 |
if(isset($_POST['DBR_reset_button'])){
|
4 |
if($_POST['DBR_reset_comfirmation'] == 'reset'){
|
19 |
$DBR_admin_exists = 1;
|
20 |
if (!isset($DBR_admin->user_login ) || $DBR_admin->user_level < 10 ){
|
21 |
$DBR_admin_exists = 0;
|
22 |
+
}
|
23 |
+
|
24 |
+
?>
|
25 |
|
26 |
<div class="DBR-box-warning">
|
27 |
<span style="color:red"><strong><?php _e('WARNING:','advanced-wp-reset'); ?></strong></span>
|
58 |
<?php wp_nonce_field('DBR_sample_nonce', 'DBR_sample_nonce'); ?>
|
59 |
<input id="DBR_reset_comfirmation" type="text" name="DBR_reset_comfirmation" value="" style="width:150px"/>
|
60 |
<p class="submit">
|
61 |
+
<input id="DBR_reset_button" name="DBR_reset_button" type="submit" class="button-primary DBR-button-reset" value="<?php _e("Reset database","advanced-wp-reset"); ?>"/>
|
62 |
</p>
|
63 |
</form>
|
64 |
|
includes/sidebar.php
CHANGED
@@ -1,19 +1,15 @@
|
|
1 |
<div>
|
2 |
<h2>Advanced WP Reset <?php echo DBR_PLUGIN_VERSION; ?></h2>
|
3 |
-
|
4 |
-
<br/><a href="http://www.sigmaplugin.com/donation" target="_blank">
|
5 |
-
<p class="DBR-donation-gif"></p>
|
6 |
-
</a>
|
7 |
</div>
|
8 |
|
9 |
-
<br/>
|
10 |
|
11 |
<div class="DBR-grey-row">
|
12 |
<div class="DBR-float-left">
|
13 |
<span class="DBR-row-text"><?php _e('Please rate us', 'advanced-wp-reset'); ?></span>
|
14 |
</div>
|
15 |
<div class="DBR-float-right">
|
16 |
-
<a href="https://wordpress.org/support/
|
17 |
<p class="DBR-support-us"></p>
|
18 |
</a>
|
19 |
</div>
|
@@ -24,7 +20,7 @@
|
|
24 |
<span class="DBR-row-text"><?php _e('Having issues?', 'advanced-wp-reset'); ?></span>
|
25 |
</div>
|
26 |
<div class="DBR-float-right">
|
27 |
-
<a class="DBR-sidebar-link" href="https://wordpress.org/support/plugin/advanced-
|
28 |
<?php echo __('Create a ticket', 'advanced-wp-reset'); ?>
|
29 |
</a>
|
30 |
</div>
|
1 |
<div>
|
2 |
<h2>Advanced WP Reset <?php echo DBR_PLUGIN_VERSION; ?></h2>
|
3 |
+
|
|
|
|
|
|
|
4 |
</div>
|
5 |
|
|
|
6 |
|
7 |
<div class="DBR-grey-row">
|
8 |
<div class="DBR-float-left">
|
9 |
<span class="DBR-row-text"><?php _e('Please rate us', 'advanced-wp-reset'); ?></span>
|
10 |
</div>
|
11 |
<div class="DBR-float-right">
|
12 |
+
<a href="https://wordpress.org/support/plugin/advanced-wp-reset/reviews/?filter=5#new-post" target="_blank">
|
13 |
<p class="DBR-support-us"></p>
|
14 |
</a>
|
15 |
</div>
|
20 |
<span class="DBR-row-text"><?php _e('Having issues?', 'advanced-wp-reset'); ?></span>
|
21 |
</div>
|
22 |
<div class="DBR-float-right">
|
23 |
+
<a class="DBR-sidebar-link" href="https://wordpress.org/support/plugin/advanced-wp-reset/" target="_blank">
|
24 |
<?php echo __('Create a ticket', 'advanced-wp-reset'); ?>
|
25 |
</a>
|
26 |
</div>
|