PluginProbe
WP Data Access – App Builder for Tables, Forms, Charts, Maps & Dashboards / 5.5.32
WP Data Access – App Builder for Tables, Forms, Charts, Maps & Dashboards v5.5.32
5.5.84 5.5.83 5.5.82 5.5.81 5.5.80 5.5.79 5.5.77 5.5.76 5.5.75 5.5.73 5.5.72 5.5.22 5.5.23 5.5.29 5.5.3 5.5.31 5.5.32 5.5.34 5.5.35 5.5.36 5.5.37 5.5.4 5.5.40 5.5.41 5.5.42 All 160 releases
wp-data-access / WPDataAccess / Settings / WPDA_Settings_Uninstall.php

WPDA_Settings_Uninstall.php in WP Data Access – App Builder for Tables, Forms, Charts, Maps & Dashboards 5.5.32, at WPDataAccess/Settings/WPDA_Settings_Uninstall.php

117 lines 3.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace WPDataAccess\Settings {
4
5 use WPDataAccess\Utilities\WPDA_Message_Box;
6 use WPDataAccess\WPDA;
7
8 class WPDA_Settings_Uninstall extends WPDA_Settings {
9
10 /**
11 * Add uninstall tab content
12 *
13 * See class documentation for flow explanation.
14 *
15 * @since 1.0.0
16 */
17 protected function add_content() {
18
19 if ( isset( $_REQUEST['action'] ) ) {
20 $action = sanitize_text_field( wp_unslash( $_REQUEST['action'] ) ); // input var okay.
21
22 // Security check.
23 $wp_nonce = isset( $_REQUEST['_wpnonce'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['_wpnonce'] ) ) : ''; // input var okay.
24 if ( ! wp_verify_nonce( $wp_nonce, 'wpda-uninstall-settings-' . WPDA::get_current_user_login() ) ) {
25 wp_die( __( 'ERROR: Not authorized', 'wp-data-access' ) );
26 }
27
28 if ( 'save' === $action ) {
29
30 // Save changes.
31 WPDA::set_option(
32 WPDA::OPTION_WPDA_UNINSTALL_TABLES,
33 isset( $_REQUEST['delete_tables'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['delete_tables'] ) ) : 'off' // input var okay.
34 );
35
36 WPDA::set_option(
37 WPDA::OPTION_WPDA_UNINSTALL_OPTIONS,
38 isset( $_REQUEST['delete_options'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['delete_options'] ) ) : 'off' // input var okay.
39 );
40
41 } elseif ( 'setdefaults' === $action ) {
42
43 // Set back to default values.
44 WPDA::set_option( WPDA::OPTION_WPDA_UNINSTALL_TABLES );
45 WPDA::set_option( WPDA::OPTION_WPDA_UNINSTALL_OPTIONS );
46
47 }
48
49 $msg = new WPDA_Message_Box(
50 array(
51 'message_text' => __( 'Settings saved', 'wp-data-access' ),
52 )
53 );
54 $msg->box();
55
56 }
57
58 $delete_tables = WPDA::get_option( WPDA::OPTION_WPDA_UNINSTALL_TABLES );
59 $delete_options = WPDA::get_option( WPDA::OPTION_WPDA_UNINSTALL_OPTIONS );
60
61 ?>
62
63 <form id="wpda_settings_uninstall" method="post"
64 action="?page=<?php echo esc_attr( $this->page ); ?>&tab=uninstall">
65 <table class="wpda-table-settings">
66 <tr>
67 <th>
68 <?php echo __( 'On Plugin Uninstall', 'wp-data-access' ); ?>
69 </th>
70 <td>
71 <label>
72 <input type="checkbox" name="delete_plugin" style="margin-right: 0" checked
73 disabled="disabled">
74 <?php echo __( 'Delete plugin', 'wp-data-access' ); ?>
75 </label>
76 <br/>
77 <label>
78 <input type="checkbox" name="delete_tables"
79 style="margin-right: 0" <?php echo 'on' === $delete_tables ? 'checked' : ''; ?>>
80 <?php echo __( 'Delete plugin tables (all data will be lost)', 'wp-data-access' ); ?>
81 </label>
82 <br/>
83 <label>
84 <input type="checkbox" name="delete_options"
85 style="margin-right: 0" <?php echo 'on' === $delete_options ? 'checked' : ''; ?>>
86 <?php echo __( 'Delete plugin settings (all settings will be lost)', 'wp-data-access' ); ?>
87 </label>
88 </td>
89 </tr>
90 </table>
91 <div class="wpda-table-settings-button">
92 <input type="hidden" name="action" value="save"/>
93 <button type="submit" class="button button-primary">
94 <i class="fas fa-check wpda_icon_on_button"></i>
95 <?php echo __( 'Save Uninstall Settings', 'wp-data-access' ); ?>
96 </button>
97 <a href="javascript:void(0)"
98 onclick="if (confirm('<?php echo __( 'Reset to defaults?', 'wp-data-access' ); ?>')) {
99 jQuery('input[name=\'action\']').val('setdefaults');
100 jQuery('#wpda_settings_uninstall').trigger('submit');
101 }"
102 class="button button-secondary">
103 <i class="fas fa-times-circle wpda_icon_on_button"></i>
104 <?php echo __( 'Reset Uninstall Settings To Defaults', 'wp-data-access' ); ?>
105 </a>
106 </div>
107 <?php wp_nonce_field( 'wpda-uninstall-settings-' . WPDA::get_current_user_login(), '_wpnonce', false ); ?>
108 </form>
109
110 <?php
111
112 }
113
114 }
115
116 }
117