PluginProbe
WP Data Access – App Builder for Tables, Forms, Dashboards, Charts & Maps / 5.5.87
WP Data Access – App Builder for Tables, Forms, Dashboards, Charts & Maps v5.5.87
5.5.87 5.5.85 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 All 162 releases
wp-data-access / WPDataAccess / Settings / WPDA_Settings_Legacy_FrontEnd.php

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

122 lines 4.5 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 class WPDA_Settings_Legacy_FrontEnd extends WPDA_Settings_Legacy_Page {
8 /**
9 * Available UI themes
10 */
11 const UI_THEMES = array(
12 'ui-darkness',
13 'ui-lightness',
14 'swanky-purse',
15 'sunny',
16 'start',
17 'smoothness',
18 'black-tie',
19 'blitzer',
20 'cupertino',
21 'dark-hive',
22 'dot-luv',
23 'eggplant',
24 'excite-bike',
25 'flick',
26 'hot-sneaks',
27 'humanity',
28 'le-frog',
29 'mint-choc',
30 'overcast',
31 'pepper-grinder',
32 'redmond',
33 'south-street',
34 'trontastic',
35 'vader'
36 );
37
38 public function show() {
39 if ( isset( $_REQUEST['action'] ) ) {
40 $action = sanitize_text_field( wp_unslash( $_REQUEST['action'] ) );
41 // input var okay.
42 // Security check.
43 $wp_nonce = ( isset( $_REQUEST['_wpnonce'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['_wpnonce'] ) ) : '' );
44 // input var okay.
45 if ( !wp_verify_nonce( $wp_nonce, 'wpda-front-end-settings-' . WPDA::get_current_user_login() ) ) {
46 wp_die( esc_attr__( 'ERROR: Not authorized', 'wp-data-access' ) );
47 }
48 if ( 'save' === $action ) {
49 WPDA::set_option( WPDA::OPTION_FE_PAGINATION, ( isset( $_REQUEST['pagination'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['pagination'] ) ) : null ) );
50 if ( isset( $_REQUEST['ui_theme'] ) ) {
51 WPDA::set_option( WPDA::WPDA_DT_UI_THEME_DEFAULT, sanitize_text_field( wp_unslash( $_REQUEST['ui_theme'] ) ) );
52 }
53 } elseif ( 'setdefaults' === $action ) {
54 // Set all front-end settings back to default
55 WPDA::set_option( WPDA::OPTION_FE_PAGINATION );
56 WPDA::set_option( WPDA::WPDA_DT_UI_THEME_DEFAULT );
57 }
58 $msg = new WPDA_Message_Box(array(
59 'message_text' => __( 'Settings saved', 'wp-data-access' ),
60 ));
61 $msg->box();
62 }
63 // Get options
64 $pagination = WPDA::get_option( WPDA::OPTION_FE_PAGINATION );
65 $ui_theme_default = WPDA::get_option( WPDA::WPDA_DT_UI_THEME_DEFAULT );
66 ?>
67
68 <form id="wpda_settings_frontend" method="post"
69 action="?page=<?php
70 echo esc_attr( $this->page );
71 ?>&tab=legacy&vtab=frontend">
72 <table class="wpda-table-settings">
73 <tr style="border-top: 1px solid #ccc">
74 <th><?php
75 esc_html_e( 'Default pagination value', 'wp-data-access' );
76 ?></th>
77 <td>
78 <input
79 type="number" step="1" min="1" max="999" name="pagination" maxlength="3"
80 value="<?php
81 echo esc_attr( $pagination );
82 ?>">
83 <div style="padding-top:10px">
84 Only for shortcode <strong>wpdadiehard</strong>
85 </div>
86 </td>
87 </tr>
88 <?php
89 ?>
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
96 esc_html_e( 'Save Front-end Settings', 'wp-data-access' );
97 ?>
98 </button>
99 <a href="javascript:void(0)"
100 onclick="if (confirm('<?php
101 esc_html_e( 'Reset to defaults?', 'wp-data-access' );
102 ?>')) {
103 jQuery('input[name=&quot;action&quot;]').val('setdefaults');
104 jQuery('#wpda_settings_frontend').trigger('submit')
105 }"
106 class="button">
107 <i class="fas fa-times-circle wpda_icon_on_button"></i>
108 <?php
109 esc_html_e( 'Reset Front-end Settings To Defaults', 'wp-data-access' );
110 ?>
111 </a>
112 </div>
113 <?php
114 wp_nonce_field( 'wpda-front-end-settings-' . WPDA::get_current_user_login(), '_wpnonce', false );
115 ?>
116 </form>
117
118 <?php
119 }
120
121 }
122