WordPress Database Reset - Version 3.22

Version Description

  • 2022/11/22
  • minor security fixes
Download this release

Release Info

Developer WebFactory
Plugin Icon 128x128 WordPress Database Reset
Version 3.22
Comparing to
See all releases

Code changes from version 3.21 to 3.22

class-db-reset-admin.php CHANGED
@@ -220,7 +220,7 @@ if (!class_exists('DB_Reset_Admin')) :
220
  private function handle_after_reset()
221
  {
222
  if (empty($this->request['db-reset-reactivate-theme-data'])) {
223
- wp_redirect(admin_url());
224
  exit;
225
  }
226
 
220
  private function handle_after_reset()
221
  {
222
  if (empty($this->request['db-reset-reactivate-theme-data'])) {
223
+ wp_safe_redirect(admin_url());
224
  exit;
225
  }
226
 
class-db-resetter.php CHANGED
@@ -73,7 +73,8 @@ if (!class_exists('DB_Resetter')) :
73
  $this->backup = array();
74
 
75
  foreach ($tables as $table) {
76
- $this->backup[$table] = $wpdb->get_results("SELECT * FROM {$table}");
 
77
  }
78
  }
79
 
@@ -147,8 +148,8 @@ if (!class_exists('DB_Resetter')) :
147
  $wpdb->query(
148
  $wpdb->prepare(
149
  "UPDATE $wpdb->users
150
- SET user_pass = '%s', user_activation_key = ''
151
- WHERE ID = '%d'",
152
  $this->user->user_pass,
153
  $user_id
154
  )
@@ -181,7 +182,8 @@ if (!class_exists('DB_Resetter')) :
181
  global $wpdb;
182
 
183
  foreach ($tables as $table) {
184
- $wpdb->query("DELETE FROM {$table}");
 
185
  }
186
  }
187
 
@@ -191,14 +193,13 @@ if (!class_exists('DB_Resetter')) :
191
 
192
  foreach ($tables as $table => $data) {
193
  foreach ($data as $row) {
194
- $columns = $values = array();
195
 
196
  foreach ($row as $column => $value) {
197
- $columns[] = $column;
198
- $values[] = esc_sql($value);
199
  }
200
 
201
- $wpdb->query("INSERT INTO $table (" . implode(', ', $columns) . ") VALUES ('" . implode("', '", $values) . "')");
202
  }
203
  }
204
  }
73
  $this->backup = array();
74
 
75
  foreach ($tables as $table) {
76
+ $wpdb->wp_database_reset_table = $table;
77
+ $this->backup[$table] = $wpdb->get_results("SELECT * FROM {$wpdb->wp_database_reset_table}");
78
  }
79
  }
80
 
148
  $wpdb->query(
149
  $wpdb->prepare(
150
  "UPDATE $wpdb->users
151
+ SET user_pass = %s, user_activation_key = ''
152
+ WHERE ID = %d",
153
  $this->user->user_pass,
154
  $user_id
155
  )
182
  global $wpdb;
183
 
184
  foreach ($tables as $table) {
185
+ $wpdb->wp_database_reset_table = $table;
186
+ $wpdb->query("DELETE FROM {$wpdb->wp_database_reset_table}");
187
  }
188
  }
189
 
193
 
194
  foreach ($tables as $table => $data) {
195
  foreach ($data as $row) {
196
+ $data = array();
197
 
198
  foreach ($row as $column => $value) {
199
+ $data[$column] = $value;
 
200
  }
201
 
202
+ $wpdb->insert( $table, $data );
203
  }
204
  }
205
  }
lib/helpers.php CHANGED
@@ -43,7 +43,7 @@ function db_reset_activation_checks() {
43
  */
44
  function db_reset_cancel_activation( $message ) {
45
  deactivate_plugins( __FILE__ );
46
- wp_die( $message );
47
  }
48
 
49
  // Ewww. Still need it though.
43
  */
44
  function db_reset_cancel_activation( $message ) {
45
  deactivate_plugins( __FILE__ );
46
+ wp_die( esc_html($message) );
47
  }
48
 
49
  // Ewww. Still need it though.
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: database, reset, restore, database reset, wp reset, reset wp, developer, d
4
  Requires at least: 4.2
5
  Requires PHP: 5.2
6
  Tested up to: 6.1
7
- Stable tag: 3.21
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -64,6 +64,9 @@ WP Database Reset was originally developed in October 2011 by <a href="https://g
64
  1. The WP Database Reset plugin page
65
 
66
  == Changelog ==
 
 
 
67
 
68
  = 3.21 =
69
  * 2021/07/29
4
  Requires at least: 4.2
5
  Requires PHP: 5.2
6
  Tested up to: 6.1
7
+ Stable tag: 3.22
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
64
  1. The WP Database Reset plugin page
65
 
66
  == Changelog ==
67
+ = 3.22 =
68
+ * 2022/11/22
69
+ * minor security fixes
70
 
71
  = 3.21 =
72
  * 2021/07/29
views/index.php CHANGED
@@ -1,11 +1,11 @@
1
  <div class="wrap card" id="wp-reset-ad">
2
  <h1>This plugin is being replaced by WP Reset</h1>
3
- <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 +300,000 sites" title="WP Reset - used on +300,000 sites"></a>
4
  <p>We're phasing out support &amp; development for this plugin because we built the free <a href="#" class="open-wpr-upsell">WP Reset</a> plugin that has a lot more functions, automatic backups when you do resets and it is <b>used by over 300,000 sites</b> daily.<br><br><a href="#" class="open-wpr-upsell button button-primary">Install the free WP Reset plugin from the WP repository</a></p>
5
  </div>
6
 
7
  <div class="wrap card">
8
- <h1><?php _e( 'Database Reset', 'wordpress-database-reset' ) ?></h1>
9
 
10
  <?php include( 'partials/notice.php' ) ?>
11
 
@@ -36,6 +36,6 @@
36
 
37
  <div class="wrap card" id="wp-reset-ad">
38
  <h1>This plugin is being replaced by WP Reset</h1>
39
- <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 +300,000 sites" title="WP Reset - used on +300,000 sites"></a>
40
  <p>We're phasing out support &amp; development for this plugin because we built the free <a href="#" class="open-wpr-upsell">WP Reset</a> plugin that has a lot more functions, automatic backups when you do resets and it is <b>used by over 300,000 sites</b> daily.<br><br><a href="#" class="open-wpr-upsell button button-primary">Install the free WP Reset plugin from the WP repository</a></p>
41
  </div>
1
  <div class="wrap card" id="wp-reset-ad">
2
  <h1>This plugin is being replaced by WP Reset</h1>
3
+ <a href="#" class="open-wpr-upsell"><img src="<?php echo esc_url(plugins_url( 'assets/images/wp-reset-icon.png', DB_RESET_FILE )); ?>" alt="WP Reset - used on +300,000 sites" title="WP Reset - used on +300,000 sites"></a>
4
  <p>We're phasing out support &amp; development for this plugin because we built the free <a href="#" class="open-wpr-upsell">WP Reset</a> plugin that has a lot more functions, automatic backups when you do resets and it is <b>used by over 300,000 sites</b> daily.<br><br><a href="#" class="open-wpr-upsell button button-primary">Install the free WP Reset plugin from the WP repository</a></p>
5
  </div>
6
 
7
  <div class="wrap card">
8
+ <h1><?php esc_html_e( 'Database Reset', 'wordpress-database-reset' ) ?></h1>
9
 
10
  <?php include( 'partials/notice.php' ) ?>
11
 
36
 
37
  <div class="wrap card" id="wp-reset-ad">
38
  <h1>This plugin is being replaced by WP Reset</h1>
39
+ <a href="#" class="open-wpr-upsell"><img src="<?php echo esc_url(plugins_url( 'assets/images/wp-reset-icon.png', DB_RESET_FILE )); ?>" alt="WP Reset - used on +300,000 sites" title="WP Reset - used on +300,000 sites"></a>
40
  <p>We're phasing out support &amp; development for this plugin because we built the free <a href="#" class="open-wpr-upsell">WP Reset</a> plugin that has a lot more functions, automatic backups when you do resets and it is <b>used by over 300,000 sites</b> daily.<br><br><a href="#" class="open-wpr-upsell button button-primary">Install the free WP Reset plugin from the WP repository</a></p>
41
  </div>
views/partials/notice.php CHANGED
@@ -1,10 +1,10 @@
1
  <?php if ( $this->notice_success ) : ?>
2
  <div class="updated notice is-dismissible">
3
- <p><strong><?php echo $this->notice_success ?>.</strong></p>
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
 
1
  <?php if ( $this->notice_success ) : ?>
2
  <div class="updated notice is-dismissible">
3
+ <p><strong><?php echo esc_html($this->notice_success); ?>.</strong></p>
4
  </div>
5
  <?php elseif ( $this->notice_error ) : ?>
6
  <div class="error notice is-dismissible">
7
+ <p><strong><?php echo esc_html($this->notice_error); ?></strong></p>
8
  </div>
9
  <?php endif ?>
10
 
views/partials/security-code.php CHANGED
@@ -1,8 +1,8 @@
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'); ?>
1
  <p>
2
+ <b>3.</b> <?php esc_html_e('Enter the security code into the text box below', 'wordpress-database-reset') ?>:
3
+ <span id="security-code"><?php echo esc_html($this->code); ?></span>
4
  </p>
5
 
6
+ <input type="hidden" name="db-reset-code" value="<?php echo esc_attr($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
@@ -2,13 +2,13 @@
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>
6
 
7
  <div id="select-container">
8
- <a href='#' id="select-all"><?php _e( 'Select All Tables', 'wordpress-database-reset' ) ?></a>
9
  <select id="wp-tables" multiple="multiple" name="db-reset-tables[]">
10
  <?php foreach ( $this->wp_tables as $key => $value ) : ?>
11
- <option value="<?php echo $key ?>"><?php echo $key ?></option>
12
  <?php endforeach ?>
13
  </select>
14
  </div>
@@ -16,12 +16,12 @@
16
  <p id="reactivate" style="display: none;">&bull;
17
  <label for="db-reset-reactivate-theme-data">
18
  <input type="checkbox" name="db-reset-reactivate-theme-data" id="db-reset-reactivate-theme-data" checked="checked" value="true" />
19
- <em><?php _e( 'You selected the options table. Reactivate current theme and plugins after reset?', 'wordpress-database-reset' ) ?></em>
20
  </label>
21
  </p>
22
 
23
  <p id="disclaimer" style="display: none;">&bull;
24
- <em><?php printf( __( 'You selected the users table. Only the <strong><u>%s</u></strong> user will be restored', 'wordpress-database-reset' ), $this->user->user_login ) ?>.</em>
25
  </p>
26
 
27
  <hr>
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 esc_html_e( 'Select the database table(s) you would like to reset', 'wordpress-database-reset' ) ?>:</p>
6
 
7
  <div id="select-container">
8
+ <a href='#' id="select-all"><?php esc_html_e( 'Select All Tables', 'wordpress-database-reset' ) ?></a>
9
  <select id="wp-tables" multiple="multiple" name="db-reset-tables[]">
10
  <?php foreach ( $this->wp_tables as $key => $value ) : ?>
11
+ <option value="<?php echo esc_attr($key); ?>"><?php echo esc_attr($key); ?></option>
12
  <?php endforeach ?>
13
  </select>
14
  </div>
16
  <p id="reactivate" style="display: none;">&bull;
17
  <label for="db-reset-reactivate-theme-data">
18
  <input type="checkbox" name="db-reset-reactivate-theme-data" id="db-reset-reactivate-theme-data" checked="checked" value="true" />
19
+ <em><?php esc_html_e( 'You selected the options table. Reactivate current theme and plugins after reset?', 'wordpress-database-reset' ) ?></em>
20
  </label>
21
  </p>
22
 
23
  <p id="disclaimer" style="display: none;">&bull;
24
+ <em><?php printf( __( 'You selected the users table. Only the <strong><u>%s</u></strong> user will be restored', 'wordpress-database-reset' ), esc_attr($this->user->user_login) ) ?>.</em>
25
  </p>
26
 
27
  <hr>
views/partials/submit-button.php CHANGED
@@ -1,4 +1,4 @@
1
  <p>
2
- <input type="submit" name="db-reset-submit" value="<?php _e( 'Reset Tables', 'wordpress-database-reset' ) ?>" id="db-reset-submit" class="button-primary" disabled />
3
- <img src="<?php echo plugins_url( 'assets/images/spinner.gif', dirname( __DIR__ ) ) ?>" alt="loader" id="loader" style="display: none" />
4
  </p>
1
  <p>
2
+ <input type="submit" name="db-reset-submit" value="<?php esc_html_e( 'Reset Tables', 'wordpress-database-reset' ) ?>" id="db-reset-submit" class="button-primary" disabled />
3
+ <img src="<?php echo esc_url(plugins_url( 'assets/images/spinner.gif', dirname( __DIR__ ) )); ?>" alt="loader" id="loader" style="display: none" />
4
  </p>
wf-flyout/config.php CHANGED
@@ -12,6 +12,7 @@ $config['menu_accent_color'] = '#dd3036';
12
  $config['custom_css'] = '#wf-flyout .wff-menu-item .dashicons.dashicons-universal-access { font-size: 30px; padding: 0px 10px 0px 0; } #wf-flyout .ucp-icon .wff-icon img { max-width: 70%; } #wf-flyout .ucp-icon .wff-icon { line-height: 57px; }';
13
 
14
  $config['menu_items'] = array(
 
15
  array('href' => 'https://wpreset.com/?ref=wff-dbreset', 'target' => '_blank', 'label' => 'Get WP Reset PRO with 50% off', 'icon' => 'wp-reset.png'),
16
  array('href' => 'https://underconstructionpage.com/?ref=wff-dbreset&coupon=welcome', 'target' => '_blank', 'label' => 'Create the perfect Under Construction Page', 'icon' => 'ucp.png', 'class' => 'ucp-icon'),
17
  array('href' => 'https://wpsticky.com/?ref=wff-dbreset', 'target' => '_blank', 'label' => 'Make a menu sticky with WP Sticky', 'icon' => 'dashicons-admin-post'),
12
  $config['custom_css'] = '#wf-flyout .wff-menu-item .dashicons.dashicons-universal-access { font-size: 30px; padding: 0px 10px 0px 0; } #wf-flyout .ucp-icon .wff-icon img { max-width: 70%; } #wf-flyout .ucp-icon .wff-icon { line-height: 57px; }';
13
 
14
  $config['menu_items'] = array(
15
+ array('href' => 'https://wpforcessl.com/?ref=wff-dbreset', 'label' => 'Fix all SSL problems &amp; monitor site in real-time', 'icon' => 'wp-ssl.png', 'class' => 'wpfssl-icon'),
16
  array('href' => 'https://wpreset.com/?ref=wff-dbreset', 'target' => '_blank', 'label' => 'Get WP Reset PRO with 50% off', 'icon' => 'wp-reset.png'),
17
  array('href' => 'https://underconstructionpage.com/?ref=wff-dbreset&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-dbreset', 'target' => '_blank', 'label' => 'Make a menu sticky with WP Sticky', 'icon' => 'dashicons-admin-post'),
wf-flyout/icons/wp-ssl.png ADDED
Binary file
wf-flyout/wf-flyout.php CHANGED
@@ -7,161 +7,463 @@
7
 
8
 
9
  if (false == class_exists('wf_flyout')) {
10
- class wf_flyout
11
- {
12
- var $ver = 1.0;
13
- var $plugin_file = '';
14
- var $plugin_slug = '';
15
- var $config = array();
16
-
17
-
18
- function __construct($plugin_file)
19
- {
20
- $this->plugin_file = $plugin_file;
21
- $this->plugin_slug = basename(dirname($plugin_file));
22
- $this->load_config();
23
-
24
- if (!is_admin()) {
25
- return;
26
- } else {
27
- add_action('admin_init', array($this, 'init'));
28
- }
29
- } // __construct
30
-
31
-
32
- function load_config()
33
- {
34
- $config = array();
35
- require_once plugin_dir_path($this->plugin_file) . 'wf-flyout/config.php';
36
-
37
- $defaults = array(
38
- 'plugin_screen' => '',
39
- 'icon_border' => '#0000ff',
40
- 'icon_right' => '40px',
41
- 'icon_bottom' => '40px',
42
- 'icon_image' => '',
43
- 'icon_padding' => '2px',
44
- 'icon_size' => '55px',
45
- 'menu_accent_color' => '#ca4a1f',
46
- 'custom_css' => '',
47
- 'menu_items' => array(),
48
- );
49
-
50
- $config = array_merge($defaults, $config);
51
- if (!is_array($config['plugin_screen'])) {
52
- $config['plugin_screen'] = array($config['plugin_screen']);
53
- }
54
-
55
- $this->config = $config;
56
- } // load_config
57
-
58
-
59
- function is_plugin_screen()
60
- {
61
- $screen = get_current_screen();
62
-
63
- if (in_array($screen->id, $this->config['plugin_screen'])) {
64
- return true;
65
- } else {
66
- return false;
67
- }
68
- } // is_plugin_screen
69
-
70
-
71
- function init()
72
- {
73
- add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'));
74
- add_action('admin_head', array($this, 'admin_head'));
75
- add_action('admin_footer', array($this, 'admin_footer'));
76
- } // init
77
-
78
-
79
- function admin_enqueue_scripts()
80
  {
81
- if (false === $this->is_plugin_screen()) {
82
- return;
83
- }
84
-
85
- wp_enqueue_style('wf_flyout', plugin_dir_url($this->plugin_file) . 'wf-flyout/wf-flyout.css', array(), $this->ver);
86
- wp_enqueue_script('wf_flyout', plugin_dir_url($this->plugin_file) . 'wf-flyout/wf-flyout.js', array(), $this->ver, true);;
87
- } // admin_enqueue_scripts
88
-
89
-
90
- function admin_head()
91
- {
92
- if (false === $this->is_plugin_screen()) {
93
- return;
94
- }
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;
116
- } // admin_head
117
-
118
-
119
- function admin_footer()
120
- {
121
- if (false === $this->is_plugin_screen()) {
122
- return;
123
- }
124
-
125
- $out = '';
126
- $icons_url = plugin_dir_url($this->plugin_file) . 'wf-flyout/icons/';
127
- $default_link_item = array('class' => '', 'href' => '#', 'target' => '_blank', 'label' => '', 'icon' => '');
128
-
129
- $out .= '<div id="wff-overlay"></div>';
130
-
131
- $out .= '<div id="wf-flyout">';
132
-
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
-
140
- $out .= '<div id="wff-menu">';
141
- $i = 0;
142
- foreach (array_reverse($this->config['menu_items']) as $item) {
143
- $i++;
144
- $item = array_merge($default_link_item, $item);
145
-
146
- if (!empty($item['icon']) && substr($item['icon'], 0, 9) != 'dashicons') {
147
- $item['class'] .= ' wff-custom-icon';
148
- $item['class'] = trim($item['class']);
149
- }
150
-
151
- $out .= '<a 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
160
- $out .= '</div>'; // #wff-menu
161
-
162
- $out .= '</div>'; // #wf-flyout
163
-
164
- echo $out;
165
- } // admin_footer
166
- } // wf_flyout
167
  } // if class exists
7
 
8
 
9
  if (false == class_exists('wf_flyout')) {
10
+ class wf_flyout
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  {
12
+ var $ver = 1.0;
13
+ var $plugin_file = '';
14
+ var $plugin_slug = '';
15
+ var $config = array();
16
+
17
+
18
+ function __construct($plugin_file)
19
+ {
20
+ $this->plugin_file = $plugin_file;
21
+ $this->plugin_slug = basename(dirname($plugin_file));
22
+ $this->load_config();
23
+
24
+ if (!is_admin()) {
25
+ return;
26
+ } else {
27
+ add_action('admin_init', array($this, 'init'));
28
+ }
29
+ } // __construct
30
+
31
+
32
+ function load_config()
33
+ {
34
+ $config = array();
35
+ require_once plugin_dir_path($this->plugin_file) . 'wf-flyout/config.php';
36
+
37
+ $defaults = array(
38
+ 'plugin_screen' => '',
39
+ 'icon_border' => '#0000ff',
40
+ 'icon_right' => '40px',
41
+ 'icon_bottom' => '40px',
42
+ 'icon_image' => '',
43
+ 'icon_padding' => '2px',
44
+ 'icon_size' => '55px',
45
+ 'menu_accent_color' => '#ca4a1f',
46
+ 'custom_css' => '',
47
+ 'menu_items' => array(),
48
+ );
49
+
50
+ $config = array_merge($defaults, $config);
51
+ if (!is_array($config['plugin_screen'])) {
52
+ $config['plugin_screen'] = array($config['plugin_screen']);
53
+ }
54
+
55
+ $this->config = $config;
56
+ } // load_config
57
+
58
+
59
+ function is_plugin_screen()
60
+ {
61
+ $screen = get_current_screen();
62
+
63
+ if (in_array($screen->id, $this->config['plugin_screen'])) {
64
+ return true;
65
+ } else {
66
+ return false;
67
+ }
68
+ } // is_plugin_screen
69
+
70
+
71
+ function init()
72
+ {
73
+ add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'));
74
+ add_action('admin_head', array($this, 'admin_head'));
75
+ add_action('admin_footer', array($this, 'admin_footer'));
76
+ } // init
77
+
78
+
79
+ function admin_enqueue_scripts()
80
+ {
81
+ if (false === $this->is_plugin_screen()) {
82
+ return;
83
+ }
84
+
85
+ wp_enqueue_style('wf_flyout', plugin_dir_url($this->plugin_file) . 'wf-flyout/wf-flyout.css', array(), $this->ver);
86
+ wp_enqueue_script('wf_flyout', plugin_dir_url($this->plugin_file) . 'wf-flyout/wf-flyout.js', array(), $this->ver, true);;
87
+ } // admin_enqueue_scripts
88
+
89
+
90
+ function admin_head()
91
+ {
92
+ if (false === $this->is_plugin_screen()) {
93
+ return;
94
+ }
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
+ self::wp_kses_wf($out);
116
+ } // admin_head
117
+
118
+
119
+ function admin_footer()
120
+ {
121
+ if (false === $this->is_plugin_screen()) {
122
+ return;
123
+ }
124
+
125
+ $out = '';
126
+ $icons_url = plugin_dir_url($this->plugin_file) . 'wf-flyout/icons/';
127
+ $default_link_item = array('class' => '', 'href' => '#', 'target' => '_blank', 'label' => '', 'icon' => '');
128
+
129
+ $out .= '<div id="wff-overlay"></div>';
130
+
131
+ $out .= '<div id="wf-flyout">';
132
+
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
+
140
+ $out .= '<div id="wff-menu">';
141
+ $i = 0;
142
+ foreach (array_reverse($this->config['menu_items']) as $item) {
143
+ $i++;
144
+ $item = array_merge($default_link_item, $item);
145
+
146
+ if (!empty($item['icon']) && substr($item['icon'], 0, 9) != 'dashicons') {
147
+ $item['class'] .= ' wff-custom-icon';
148
+ $item['class'] = trim($item['class']);
149
+ }
150
+
151
+ $out .= '<a 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
160
+ $out .= '</div>'; // #wff-menu
161
+
162
+ $out .= '</div>'; // #wf-flyout
163
+
164
+ self::wp_kses_wf($out);
165
+ } // admin_footer
166
+
167
+ public function wp_kses_wf($html)
168
+ {
169
+ add_filter('safe_style_css', function ($styles) {
170
+ $styles_wf = array(
171
+ 'text-align',
172
+ 'margin',
173
+ 'color',
174
+ 'float',
175
+ 'border',
176
+ 'background',
177
+ 'background-color',
178
+ 'border-bottom',
179
+ 'border-bottom-color',
180
+ 'border-bottom-style',
181
+ 'border-bottom-width',
182
+ 'border-collapse',
183
+ 'border-color',
184
+ 'border-left',
185
+ 'border-left-color',
186
+ 'border-left-style',
187
+ 'border-left-width',
188
+ 'border-right',
189
+ 'border-right-color',
190
+ 'border-right-style',
191
+ 'border-right-width',
192
+ 'border-spacing',
193
+ 'border-style',
194
+ 'border-top',
195
+ 'border-top-color',
196
+ 'border-top-style',
197
+ 'border-top-width',
198
+ 'border-width',
199
+ 'caption-side',
200
+ 'clear',
201
+ 'cursor',
202
+ 'direction',
203
+ 'font',
204
+ 'font-family',
205
+ 'font-size',
206
+ 'font-style',
207
+ 'font-variant',
208
+ 'font-weight',
209
+ 'height',
210
+ 'letter-spacing',
211
+ 'line-height',
212
+ 'margin-bottom',
213
+ 'margin-left',
214
+ 'margin-right',
215
+ 'margin-top',
216
+ 'overflow',
217
+ 'padding',
218
+ 'padding-bottom',
219
+ 'padding-left',
220
+ 'padding-right',
221
+ 'padding-top',
222
+ 'text-decoration',
223
+ 'text-indent',
224
+ 'vertical-align',
225
+ 'width',
226
+ 'display',
227
+ );
228
+
229
+ foreach ($styles_wf as $style_wf) {
230
+ $styles[] = $style_wf;
231
+ }
232
+ return $styles;
233
+ });
234
+
235
+ $allowed_tags = wp_kses_allowed_html('post');
236
+ $allowed_tags['input'] = array(
237
+ 'type' => true,
238
+ 'style' => true,
239
+ 'class' => true,
240
+ 'id' => true,
241
+ 'checked' => true,
242
+ 'disabled' => true,
243
+ 'name' => true,
244
+ 'size' => true,
245
+ 'placeholder' => true,
246
+ 'value' => true,
247
+ 'data-*' => true,
248
+ 'size' => true,
249
+ 'disabled' => true
250
+ );
251
+
252
+ $allowed_tags['textarea'] = array(
253
+ 'type' => true,
254
+ 'style' => true,
255
+ 'class' => true,
256
+ 'id' => true,
257
+ 'checked' => true,
258
+ 'disabled' => true,
259
+ 'name' => true,
260
+ 'size' => true,
261
+ 'placeholder' => true,
262
+ 'value' => true,
263
+ 'data-*' => true,
264
+ 'cols' => true,
265
+ 'rows' => true,
266
+ 'disabled' => true,
267
+ 'autocomplete' => true
268
+ );
269
+
270
+ $allowed_tags['select'] = array(
271
+ 'type' => true,
272
+ 'style' => true,
273
+ 'class' => true,
274
+ 'id' => true,
275
+ 'checked' => true,
276
+ 'disabled' => true,
277
+ 'name' => true,
278
+ 'size' => true,
279
+ 'placeholder' => true,
280
+ 'value' => true,
281
+ 'data-*' => true,
282
+ 'multiple' => true,
283
+ 'disabled' => true
284
+ );
285
+
286
+ $allowed_tags['option'] = array(
287
+ 'type' => true,
288
+ 'style' => true,
289
+ 'class' => true,
290
+ 'id' => true,
291
+ 'checked' => true,
292
+ 'disabled' => true,
293
+ 'name' => true,
294
+ 'size' => true,
295
+ 'placeholder' => true,
296
+ 'value' => true,
297
+ 'selected' => true,
298
+ 'data-*' => true
299
+ );
300
+ $allowed_tags['optgroup'] = array(
301
+ 'type' => true,
302
+ 'style' => true,
303
+ 'class' => true,
304
+ 'id' => true,
305
+ 'checked' => true,
306
+ 'disabled' => true,
307
+ 'name' => true,
308
+ 'size' => true,
309
+ 'placeholder' => true,
310
+ 'value' => true,
311
+ 'selected' => true,
312
+ 'data-*' => true,
313
+ 'label' => true
314
+ );
315
+
316
+ $allowed_tags['a'] = array(
317
+ 'href' => true,
318
+ 'data-*' => true,
319
+ 'class' => true,
320
+ 'style' => true,
321
+ 'id' => true,
322
+ 'target' => true,
323
+ 'data-*' => true,
324
+ 'role' => true,
325
+ 'aria-controls' => true,
326
+ 'aria-selected' => true,
327
+ 'disabled' => true
328
+ );
329
+
330
+ $allowed_tags['div'] = array(
331
+ 'style' => true,
332
+ 'class' => true,
333
+ 'id' => true,
334
+ 'data-*' => true,
335
+ 'role' => true,
336
+ 'aria-labelledby' => true,
337
+ 'value' => true,
338
+ 'aria-modal' => true,
339
+ 'tabindex' => true
340
+ );
341
+
342
+ $allowed_tags['li'] = array(
343
+ 'style' => true,
344
+ 'class' => true,
345
+ 'id' => true,
346
+ 'data-*' => true,
347
+ 'role' => true,
348
+ 'aria-labelledby' => true,
349
+ 'value' => true,
350
+ 'aria-modal' => true,
351
+ 'tabindex' => true
352
+ );
353
+
354
+ $allowed_tags['span'] = array(
355
+ 'style' => true,
356
+ 'class' => true,
357
+ 'id' => true,
358
+ 'data-*' => true,
359
+ 'aria-hidden' => true
360
+ );
361
+
362
+ $allowed_tags['style'] = array(
363
+ 'class' => true,
364
+ 'id' => true,
365
+ 'type' => true
366
+ );
367
+
368
+ $allowed_tags['fieldset'] = array(
369
+ 'class' => true,
370
+ 'id' => true,
371
+ 'type' => true
372
+ );
373
+
374
+ $allowed_tags['link'] = array(
375
+ 'class' => true,
376
+ 'id' => true,
377
+ 'type' => true,
378
+ 'rel' => true,
379
+ 'href' => true,
380
+ 'media' => true
381
+ );
382
+
383
+ $allowed_tags['form'] = array(
384
+ 'style' => true,
385
+ 'class' => true,
386
+ 'id' => true,
387
+ 'method' => true,
388
+ 'action' => true,
389
+ 'data-*' => true
390
+ );
391
+
392
+ $allowed_tags['script'] = array(
393
+ 'class' => true,
394
+ 'id' => true,
395
+ 'type' => true,
396
+ 'src' => true
397
+ );
398
+
399
+ echo wp_kses($html, $allowed_tags);
400
+
401
+ add_filter('safe_style_css', function ($styles) {
402
+ $styles_wf = array(
403
+ 'text-align',
404
+ 'margin',
405
+ 'color',
406
+ 'float',
407
+ 'border',
408
+ 'background',
409
+ 'background-color',
410
+ 'border-bottom',
411
+ 'border-bottom-color',
412
+ 'border-bottom-style',
413
+ 'border-bottom-width',
414
+ 'border-collapse',
415
+ 'border-color',
416
+ 'border-left',
417
+ 'border-left-color',
418
+ 'border-left-style',
419
+ 'border-left-width',
420
+ 'border-right',
421
+ 'border-right-color',
422
+ 'border-right-style',
423
+ 'border-right-width',
424
+ 'border-spacing',
425
+ 'border-style',
426
+ 'border-top',
427
+ 'border-top-color',
428
+ 'border-top-style',
429
+ 'border-top-width',
430
+ 'border-width',
431
+ 'caption-side',
432
+ 'clear',
433
+ 'cursor',
434
+ 'direction',
435
+ 'font',
436
+ 'font-family',
437
+ 'font-size',
438
+ 'font-style',
439
+ 'font-variant',
440
+ 'font-weight',
441
+ 'height',
442
+ 'letter-spacing',
443
+ 'line-height',
444
+ 'margin-bottom',
445
+ 'margin-left',
446
+ 'margin-right',
447
+ 'margin-top',
448
+ 'overflow',
449
+ 'padding',
450
+ 'padding-bottom',
451
+ 'padding-left',
452
+ 'padding-right',
453
+ 'padding-top',
454
+ 'text-decoration',
455
+ 'text-indent',
456
+ 'vertical-align',
457
+ 'width'
458
+ );
459
+
460
+ foreach ($styles_wf as $style_wf) {
461
+ if (($key = array_search($style_wf, $styles)) !== false) {
462
+ unset($styles[$key]);
463
+ }
464
+ }
465
+ return $styles;
466
+ });
467
  }
468
+ } // wf_flyout
 
 
 
 
 
 
 
 
469
  } // if class exists
wp-reset.php CHANGED
@@ -3,7 +3,8 @@
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.21
 
7
  Author: WebFactory Ltd
8
  Author URI: https://www.webfactoryltd.com/
9
  License: GNU General Public License
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.22
7
+ Tested up to: 6.1
8
  Author: WebFactory Ltd
9
  Author URI: https://www.webfactoryltd.com/
10
  License: GNU General Public License