PluginProbe
WP Data Access – App Builder for Tables, Forms, Charts, Maps & Dashboards / 5.5.34
WP Data Access – App Builder for Tables, Forms, Charts, Maps & Dashboards v5.5.34
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_DataForms.php

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

101 lines 3.6 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_DataForms extends WPDA_Settings {
9
10 /**
11 * Add data forms tab content
12 *
13 * See class documentation for flow explanation.
14 *
15 * @since 4.0.0
16 */
17 protected function add_content() {
18 if ( isset( $_REQUEST['action'] ) ) {
19 $action = sanitize_text_field( wp_unslash( $_REQUEST['action'] ) ); // input var okay.
20
21 // Security check.
22 $wp_nonce = isset( $_REQUEST['_wpnonce'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['_wpnonce'] ) ) : ''; // input var okay.
23 if ( ! wp_verify_nonce( $wp_nonce, 'wpda-forms-settings-' . WPDA::get_current_user_login() ) ) {
24 wp_die( __( 'ERROR: Not authorized', 'wp-data-access' ) );
25 }
26
27 if ( 'save' === $action ) {
28 WPDA::set_option(
29 WPDA::OPTION_PLUGIN_WPDADATAFORMS_ALLOW_ANONYMOUS_ACCESS,
30 isset( $_REQUEST['allow_anonymous_access'] ) ? 'on' : 'off'
31 );
32 } elseif ( 'setdefaults' === $action ) {
33 // Set all data table settings back to default.
34 WPDA::set_option( WPDA::OPTION_PLUGIN_WPDADATAFORMS_ALLOW_ANONYMOUS_ACCESS );
35 }
36
37 $msg = new WPDA_Message_Box(
38 array(
39 'message_text' => __( 'Settings saved', 'wp-data-access' ),
40 )
41 );
42 $msg->box();
43 }
44
45 $allow_anonymous_access = WPDA::get_option( WPDA::OPTION_PLUGIN_WPDADATAFORMS_ALLOW_ANONYMOUS_ACCESS );
46 ?>
47 <form id="wpda_settings_forms" method="post"
48 action="?page=<?php echo esc_attr( $this->page ); ?>&tab=dataforms">
49 <table class="wpda-table-settings">
50 <tr>
51 <th><?php echo __( 'Allow anonymous access', 'wp-data-access' ); ?></th>
52 <td>
53 <label>
54 <input type="checkbox" name="allow_anonymous_access" <?php echo 'on' === $allow_anonymous_access ? 'checked' : ''; ?>/>Enabled
55 </label>
56 </td>
57 </tr>
58 <tr>
59 <th><?php echo __( 'Default jQuery UI theme', 'wp-data-access' ); ?></th>
60 <td>
61 <a href="<?php echo admin_url( 'options-general.php' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>?page=wpdataaccess&tab=frontend">
62 Change default jQuery UI theme
63 </a> (used to style <strong>Data Forms</strong>)
64 </td>
65 </tr>
66 <tr>
67 <th><span class="dashicons dashicons-info" style="float:right;font-size:300%;"></span></th>
68 <td>
69 <span class="dashicons dashicons-yes"></span>
70 <?php echo __( 'Data Forms are styled according to the default jQuery UI theme', 'wp-data-access' ); ?>
71 <br/>
72 <span class="dashicons dashicons-yes"></span>
73 <?php echo __( 'Individual styling per shortcode will be added later', 'wp-data-access' ); ?>
74 </td>
75 </tr>
76 </table>
77 <div class="wpda-table-settings-button">
78 <input type="hidden" name="action" value="save"/>
79 <button type="submit" class="button button-primary">
80 <i class="fas fa-check wpda_icon_on_button"></i>
81 <?php echo __( 'Save Data Forms Settings', 'wp-data-access' ); ?>
82 </button>
83 <a href="javascript:void(0)"
84 onclick="if (confirm('<?php echo __( 'Reset to defaults?', 'wp-data-access' ); ?>')) {
85 jQuery('input[name=&quot;action&quot;]').val('setdefaults');
86 jQuery('#wpda_settings_forms').trigger('submit')
87 }"
88 class="button">
89 <i class="fas fa-times-circle wpda_icon_on_button"></i>
90 <?php echo __( 'Reset Data Forms Settings To Defaults', 'wp-data-access' ); ?>
91 </a>
92 </div>
93 <?php wp_nonce_field( 'wpda-forms-settings-' . WPDA::get_current_user_login(), '_wpnonce', false ); ?>
94 </form>
95 <?php
96 }
97
98 }
99
100 }
101