PluginProbe
WP Data Access – App Builder for Tables, Forms, Charts, Maps & Dashboards / 5.5.85
WP Data Access – App Builder for Tables, Forms, Charts, Maps & Dashboards v5.5.85
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 5.5.41 All 161 releases
← All changes | WPDataAccess/Settings/WPDA_Settings_BackEnd.php +16 -289 5.5.29 → 5.5.85 View file →
@@ -8,10 +8,8 @@
8 8 use WPDataAccess\WPDA;
9 9
10 10 class WPDA_Settings_BackEnd extends WPDA_Settings {
11 11
12 - const WPNONCE_BACKEND_SETTING = 'WPDA_BACKEND_SETTINGS';
13 -
14 12 /**
15 13 * Add back-end tab content
16 14 *
17 15 * See class documentation for flow explanation.
@@ -33,9 +31,9 @@
33 31
34 32 // Security check.
35 33 $wp_nonce = isset( $_REQUEST['_wpnonce'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['_wpnonce'] ) ) : ''; // input var okay.
36 34 if ( ! wp_verify_nonce( $wp_nonce, 'wpda-back-end-settings' ) ) {
37 - wp_die( __( 'ERROR: Not authorized', 'wp-data-access' ) );
35 + wp_die( esc_attr__( 'ERROR: Not authorized', 'wp-data-access' ) );
38 36 }
39 37
40 38 if ( 'save' === $action ) {
41 39 // Save options.
@@ -72,9 +70,9 @@
72 70 // Add existing table to list.
73 71 $table_access_selected_new_value_checked[ $key ] = $value;
74 72 } else {
75 73 // An invalid table name was provided. Might be an sql injection attack or an invalid state.
76 - wp_die( __( 'ERROR: Invalid table name', 'wp-data-access' ) );
74 + wp_die( esc_attr__( 'ERROR: Invalid table name', 'wp-data-access' ) );
77 75 }
78 76 }
79 77 } else {
80 78 $table_access_selected_new_value_checked = '';
@@ -90,79 +88,8 @@
90 88 $table_access_selected_new_value_checked
91 89 );
92 90 }
93 91
94 - WPDA::set_option(
95 - WPDA::OPTION_BE_VIEW_LINK,
96 - isset( $_REQUEST['view_link'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['view_link'] ) ) : 'off' // input var okay.
97 - );
98 -
99 - WPDA::set_option(
100 - WPDA::OPTION_BE_ALLOW_INSERT,
101 - isset( $_REQUEST['allow_insert'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['allow_insert'] ) ) : 'off' // input var okay.
102 - );
103 - WPDA::set_option(
104 - WPDA::OPTION_BE_ALLOW_UPDATE,
105 - isset( $_REQUEST['allow_update'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['allow_update'] ) ) : 'off' // input var okay.
106 - );
107 - WPDA::set_option(
108 - WPDA::OPTION_BE_ALLOW_DELETE,
109 - isset( $_REQUEST['allow_delete'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['allow_delete'] ) ) : 'off' // input var okay.
110 - );
111 -
112 - WPDA::set_option(
113 - WPDA::OPTION_BE_EXPORT_ROWS,
114 - isset( $_REQUEST['export_rows'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['export_rows'] ) ) : 'off' // input var okay.
115 - );
116 - WPDA::set_option(
117 - WPDA::OPTION_BE_EXPORT_VARIABLE_PREFIX,
118 - isset( $_REQUEST['export_variable_rows'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['export_variable_rows'] ) ) : 'off' // input var okay.
119 - );
120 -
121 - WPDA::set_option(
122 - WPDA::OPTION_BE_ALLOW_IMPORTS,
123 - isset( $_REQUEST['allow_imports'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['allow_imports'] ) ) : 'off' // input var okay.
124 - );
125 -
126 - WPDA::set_option(
127 - WPDA::OPTION_BE_CONFIRM_EXPORT,
128 - isset( $_REQUEST['confirm_export'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['confirm_export'] ) ) : 'off' // input var okay.
129 - );
130 - WPDA::set_option(
131 - WPDA::OPTION_BE_CONFIRM_VIEW,
132 - isset( $_REQUEST['confirm_view'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['confirm_view'] ) ) : 'off' // input var okay.
133 - );
134 -
135 - WPDA::set_option(
136 - WPDA::OPTION_BE_PAGINATION,
137 - isset( $_REQUEST['pagination'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['pagination'] ) ) : null // input var okay.
138 - );
139 -
140 - WPDA::set_option(
141 - WPDA::OPTION_BE_REMEMBER_SEARCH,
142 - isset( $_REQUEST['remember_search'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['remember_search'] ) ) : 'off' // input var okay.
143 - );
144 -
145 - WPDA::set_option(
146 - WPDA::OPTION_BE_INNODB_COUNT,
147 - isset( $_REQUEST['innodb_count'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['innodb_count'] ) ) : 100000 // input var okay.
148 - );
149 -
150 - WPDA::set_option(
151 - WPDA::OPTION_BE_DESIGN_MODE,
152 - isset( $_REQUEST['design_mode'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['design_mode'] ) ) : 'basic' // input var okay.
153 - );
154 -
155 - WPDA::set_option(
156 - WPDA::OPTION_BE_TEXT_WRAP_SWITCH,
157 - isset( $_REQUEST['text_wrap_switch'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['text_wrap_switch'] ) ) : 'off' // input var okay.
158 - );
159 -
160 - WPDA::set_option(
161 - WPDA::OPTION_BE_TEXT_WRAP,
162 - isset( $_REQUEST['text_wrap'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['text_wrap'] ) ) : 400 // input var okay.
163 - );
164 -
165 92 if (
166 93 isset( $_REQUEST['wpda_default_user'] ) &&
167 94 isset( $_REQUEST['wpda_default_database'] ) &&
168 95 '' !== $_REQUEST['wpda_default_user'] &&
@@ -177,13 +104,8 @@
177 104
178 105 $default_databases[ $wpda_default_user ] = $wpda_default_database;
179 106 update_option( 'wpda_default_database', $default_databases );
180 107 }
181 -
182 - WPDA::set_option(
183 - WPDA::OPTION_BE_HIDE_BUTTON_ICONS,
184 - isset( $_REQUEST['hide_button_icons'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['hide_button_icons'] ) ) : 'off' // input var okay.
185 - );
186 108 } elseif ( 'setdefaults' === $action ) {
187 109 // Set all back-end settings back to default.
188 110 if ( $is_wp_database ) {
189 111 WPDA::set_option( WPDA::OPTION_BE_TABLE_ACCESS );
@@ -198,25 +120,9 @@
198 120 ''
199 121 );
200 122 }
201 123 update_option( 'wpda_hide_manage_link', array() );
202 - WPDA::set_option( WPDA::OPTION_BE_VIEW_LINK );
203 - WPDA::set_option( WPDA::OPTION_BE_ALLOW_INSERT );
204 - WPDA::set_option( WPDA::OPTION_BE_ALLOW_UPDATE );
205 - WPDA::set_option( WPDA::OPTION_BE_ALLOW_DELETE );
206 - WPDA::set_option( WPDA::OPTION_BE_EXPORT_ROWS );
207 - WPDA::set_option( WPDA::OPTION_BE_EXPORT_VARIABLE_PREFIX );
208 - WPDA::set_option( WPDA::OPTION_BE_ALLOW_IMPORTS );
209 - WPDA::set_option( WPDA::OPTION_BE_CONFIRM_EXPORT );
210 - WPDA::set_option( WPDA::OPTION_BE_CONFIRM_VIEW );
211 - WPDA::set_option( WPDA::OPTION_BE_PAGINATION );
212 - WPDA::set_option( WPDA::OPTION_BE_REMEMBER_SEARCH );
213 - WPDA::set_option( WPDA::OPTION_BE_INNODB_COUNT );
214 - WPDA::set_option( WPDA::OPTION_BE_DESIGN_MODE );
215 - WPDA::set_option( WPDA::OPTION_BE_TEXT_WRAP_SWITCH );
216 - WPDA::set_option( WPDA::OPTION_BE_TEXT_WRAP );
217 124 update_option( 'wpda_default_database', array() );
218 - WPDA::set_option( WPDA::OPTION_BE_HIDE_BUTTON_ICONS );
219 125 } elseif ( 'delete_default_user_database' === $action ) {
220 126 if ( isset( $_REQUEST['wpda_default_database_delete'] ) ) {
221 127 $delete_user_id = sanitize_text_field( wp_unslash( $_REQUEST['wpda_default_database_delete'] ) ); // input var okay.
222 128
@@ -260,45 +166,19 @@
260 166 }
261 167
262 168 $wpda_hide_manage_link = get_option( 'wpda_hide_manage_link' );
263 169 if ( is_array( $wpda_hide_manage_link ) ) {
264 - $wpda_hide_manage_list = array_flip( $wpda_hide_manage_link ); //phpcs:ignore - 8.1 proof
170 + $wpda_hide_manage_list = array_flip( $wpda_hide_manage_link ); // phpcs:ignore -- 8.1 proof
265 171 } else {
266 172 $wpda_hide_manage_list = array();
267 173 }
174 + ?>
268 175
269 - $view_link = WPDA::get_option( WPDA::OPTION_BE_VIEW_LINK );
270 -
271 - $allow_insert = WPDA::get_option( WPDA::OPTION_BE_ALLOW_INSERT );
272 - $allow_update = WPDA::get_option( WPDA::OPTION_BE_ALLOW_UPDATE );
273 - $allow_delete = WPDA::get_option( WPDA::OPTION_BE_ALLOW_DELETE );
274 -
275 - $export_rows = WPDA::get_option( WPDA::OPTION_BE_EXPORT_ROWS );
276 - $export_variable_rows = WPDA::get_option( WPDA::OPTION_BE_EXPORT_VARIABLE_PREFIX );
277 -
278 - $allow_imports = WPDA::get_option( WPDA::OPTION_BE_ALLOW_IMPORTS );
279 -
280 - $confirm_export = WPDA::get_option( WPDA::OPTION_BE_CONFIRM_EXPORT );
281 - $confirm_view = WPDA::get_option( WPDA::OPTION_BE_CONFIRM_VIEW );
282 -
283 - $pagination = WPDA::get_option( WPDA::OPTION_BE_PAGINATION );
284 -
285 - $remember_search = WPDA::get_option( WPDA::OPTION_BE_REMEMBER_SEARCH );
286 -
287 - $innodb_count = WPDA::get_option( WPDA::OPTION_BE_INNODB_COUNT );
288 -
289 - $design_mode = WPDA::get_option( WPDA::OPTION_BE_DESIGN_MODE );
290 -
291 - $text_wrap_switch = WPDA::get_option( WPDA::OPTION_BE_TEXT_WRAP_SWITCH );
292 - $text_wrap = WPDA::get_option( WPDA::OPTION_BE_TEXT_WRAP );
293 -
294 - $hide_button_icons = WPDA::get_option( WPDA::OPTION_BE_HIDE_BUTTON_ICONS );
295 - ?>
296 176 <form id="wpda_settings_backend" method="post"
297 177 action="?page=<?php echo esc_attr( $this->page ); ?>&tab=backend">
298 178 <table class="wpda-table-settings">
299 179 <tr>
300 - <th><?php echo __( 'Table access', 'wp-data-access' ); ?></th>
180 + <th><?php esc_html_e( 'Table access', 'wp-data-access' ); ?></th>
301 181 <td>
302 182 <select name="database" id="schema_name">
303 183 <?php
304 184 $schema_names = WPDA_Dictionary_Lists::get_db_schemas();
@@ -314,9 +194,9 @@
314 194 type="radio"
315 195 name="table_access"
316 196 value="show"
317 197 <?php echo 'show' === $table_access ? 'checked' : ''; ?>
318 - ><?php echo $is_wp_database ? __( 'Show WordPress tables', 'wp-data-access' ) : __( 'Show all tables', 'wp-data-access' ); ?>
198 + ><?php echo $is_wp_database ? esc_attr__( 'Show WordPress tables', 'wp-data-access' ) : esc_attr__( 'Show all tables', 'wp-data-access' ); ?>
319 199 </label>
320 200 <br/>
321 201 <?php
322 202 if ( $is_wp_database ) {
@@ -326,9 +206,9 @@
326 206 type="radio"
327 207 name="table_access"
328 208 value="hide"
329 209 <?php echo 'hide' === $table_access ? 'checked' : ''; ?>
330 - ><?php echo __( 'Hide WordPress tables', 'wp-data-access' ); ?>
210 + ><?php esc_html_e( 'Hide WordPress tables', 'wp-data-access' ); ?>
331 211 </label>
332 212 <br/>
333 213 <?php
334 214 }
@@ -338,9 +218,9 @@
338 218 type="radio"
339 219 name="table_access"
340 220 value="select"
341 221 <?php echo 'select' === $table_access ? 'checked' : ''; ?>
342 - ><?php echo __( 'Show only selected tables', 'wp-data-access' ); ?>
222 + ><?php esc_html_e( 'Show only selected tables', 'wp-data-access' ); ?>
343 223 </label>
344 224 <div id="tables_selected" <?php echo 'select' === $table_access ? '' : 'style="display:none"'; ?>>
345 225 <br/>
346 226 <select name="table_access_selected[]" multiple size="10">
@@ -371,9 +251,9 @@
371 251 </script>
372 252 </td>
373 253 </tr>
374 254 <tr>
375 - <th><?php echo __( 'Restrict table management', 'wp-data-access' ); ?></th>
255 + <th><?php esc_html_e( 'Restrict table management', 'wp-data-access' ); ?></th>
376 256 <td>
377 257 <select name="wpda_hide_manage_link[]" multiple="true">
378 258 <?php
379 259 foreach ( get_users( array( 'role' => 'administrator' ) ) as $user ) {
@@ -400,154 +280,10 @@
400 280 </div>
401 281 </td>
402 282 </tr>
403 283 <tr>
404 - <th><?php echo __( 'Row access', 'wp-data-access' ); ?></th>
284 + <th><?php esc_html_e( 'Default database', 'wp-data-access' ); ?></th>
405 285 <td>
406 - <label>
407 - <input
408 - type="checkbox"
409 - name="view_link"
410 - <?php echo 'on' === $view_link ? 'checked' : ''; ?>
411 - ><?php echo __( 'Add view link to list table', 'wp-data-access' ); ?>
412 - </label>
413 - </td>
414 - </tr>
415 - <tr>
416 - <th scope="row"><?php echo __( 'Allow transactions?', 'wp-data-access' ); ?></th>
417 - <td>
418 - <label>
419 - <input type="checkbox" name="allow_insert"
420 - <?php echo 'on' === $allow_insert ? 'checked' : ''; ?> /><?php echo __( 'Allow insert', 'wp-data-access' ); ?>
421 - </label>
422 - <br/>
423 - <label>
424 - <input type="checkbox" name="allow_update"
425 - <?php echo 'on' === $allow_update ? 'checked' : ''; ?> /><?php echo __( 'Allow update', 'wp-data-access' ); ?>
426 - </label>
427 - <br/>
428 - <label>
429 - <input type="checkbox" name="allow_delete"
430 - <?php echo 'on' === $allow_delete ? 'checked' : ''; ?> /><?php echo __( 'Allow delete', 'wp-data-access' ); ?>
431 - </label>
432 - </td>
433 - </tr>
434 - <tr>
435 - <th scope="row"><?php echo __( 'Allow exports?', 'wp-data-access' ); ?></th>
436 - <td>
437 - <label>
438 - <input type="checkbox" name="export_rows"
439 - <?php echo 'on' === $export_rows ? 'checked' : ''; ?> /><?php echo __( 'Allow row export', 'wp-data-access' ); ?>
440 - </label>
441 - <br/>
442 - <label>
443 - <input type="checkbox" name="export_variable_rows"
444 - <?php echo 'on' === $export_variable_rows ? 'checked' : ''; ?> /><?php echo __( 'Export with variable WP prefix', 'wp-data-access' ); ?>
445 - </label>
446 - </td>
447 - </tr>
448 - <tr>
449 - <th scope="row"><?php echo __( 'Allow imports?', 'wp-data-access' ); ?></th>
450 - <td>
451 - <label>
452 - <input type="checkbox" name="allow_imports"
453 - <?php echo 'on' === $allow_imports ? 'checked' : ''; ?> /><?php echo __( 'Allow to import scripts from Data Explorer table pages', 'wp-data-access' ); ?>
454 - </label>
455 - </td>
456 - </tr>
457 - <tr>
458 - <th><?php echo __( 'Ask for confirmation?', 'wp-data-access' ); ?></th>
459 - <td>
460 - <label>
461 - <input type="checkbox" name="confirm_export"
462 - <?php echo 'on' === $confirm_export ? 'checked' : ''; ?> /><?php echo __( 'When starting export', 'wp-data-access' ); ?>
463 - </label>
464 - <br/>
465 - <label>
466 - <input type="checkbox" name="confirm_view"
467 - <?php echo 'on' === $confirm_view ? 'checked' : ''; ?> /><?php echo __( 'When viewing non WPDA table', 'wp-data-access' ); ?>
468 - </label>
469 - </td>
470 - </tr>
471 - <tr>
472 - <th><?php echo __( 'Default pagination value', 'wp-data-access' ); ?></th>
473 - <td>
474 - <input
475 - type="number" step="1" min="1" max="999" name="pagination" maxlength="3"
476 - value="<?php echo esc_attr( $pagination ); ?>">
477 - </td>
478 - </tr>
479 - <tr>
480 - <th><?php echo __( 'Search box', 'wp-data-access' ); ?></th>
481 - <td>
482 - <label>
483 - <input
484 - type="checkbox"
485 - name="remember_search" <?php echo 'on' === $remember_search ? 'checked' : ''; ?>
486 - ><?php echo __( 'Remember last search', 'wp-data-access' ); ?>
487 - </label>
488 - </td>
489 - </tr>
490 - <tr>
491 - <th><?php echo __( 'Max row count', 'wp-data-access' ); ?></th>
492 - <td>
493 - <input
494 - type="number" step="1" min="1" max="999999" name="innodb_count" maxlength="3"
495 - value="<?php echo esc_attr( $innodb_count ); ?>">
496 - <p>
497 - <strong>This works for InnoDB tables and views only!</strong>
498 - </p>
499 - <p>
500 - The real row count is shown for other table types.
501 - </p>
502 - <p>
503 - <strong>BEHAVIOUR</strong><br/>
504 - IF estimated row count > max row count:<br/>
505 - &nbsp;&nbsp;&nbsp;&nbsp;use estimated row count<br/>
506 - ELSE<br/>
507 - &nbsp;&nbsp;&nbsp;&nbsp;user real row count
508 - </p>
509 - <p>
510 - Showing the estimated row count instead of the real row count <strong>improves performance</strong>
511 - for <strong>large tables and views</strong>.
512 - An estimated row count is <strong>less accurate</strong> than a real row count.
513 - </p>
514 - <p>
515 - This option can be changed for InnoDB tables and views in the Data Explorer:<br/>
516 - WP Data Access > Data Explorer > YOUR TABLE > Manage > Settings > Table Settings > Row count
517 - </p>
518 - </td>
519 - </tr>
520 - <tr>
521 - <th><?php echo __( 'Default designer mode', 'wp-data-access' ); ?></th>
522 - <td>
523 - <select name="design_mode">
524 - <option value="basic" <?php echo 'basic' === $design_mode ? 'selected' : ''; ?>>Basic
525 - </option>
526 - <option value="advanced" <?php echo 'advanced' === $design_mode ? 'selected' : ''; ?>>
527 - Advanced
528 - </option>
529 - </select>
530 - </td>
531 - </tr>
532 - <tr>
533 - <th><?php echo __( 'Content wrap', 'wp-data-access' ); ?></th>
534 - <td>
535 - <label>
536 - <input
537 - type="checkbox"
538 - name="text_wrap_switch" <?php echo 'on' === $text_wrap_switch ? 'checked' : ''; ?>
539 - ><?php echo __( 'No content wrap', 'wp-data-access' ); ?>
540 - </label>
541 - <br/>
542 - <input
543 - type="number" step="1" min="1" max="999999" name="text_wrap" maxlength="3"
544 - value="<?php echo esc_attr( $text_wrap ); ?>">
545 - </td>
546 - </tr>
547 - <tr>
548 - <th><?php echo __( 'Default database', 'wp-data-access' ); ?></th>
549 - <td>
550 286 <div>
551 287 <?php
552 288 $users = array();
553 289 foreach ( get_users() as $user ) {
@@ -581,9 +317,9 @@
581 317 }
582 318 ?>
583 319 </div>
584 320 <?php
585 - if ( count( $default_databases ) > 0 ) {//phpcs:ignore - 8.1 proof
321 + if ( count( $default_databases ) > 0 ) { // phpcs:ignore -- 8.1 proof
586 322 echo '<br/>';
587 323 }
588 324 ?>
589 325 <div>
@@ -617,38 +353,28 @@
617 353 </div>
618 354 </div>
619 355 </td>
620 356 </tr>
621 - <tr>
622 - <th><?php echo __( 'Hide button icons', 'wp-data-access' ); ?></th>
623 - <td>
624 - <label>
625 - <input
626 - type="checkbox"
627 - name="hide_button_icons" <?php echo 'on' === $hide_button_icons ? 'checked' : ''; ?>
628 - ><?php echo __( 'Hide icons on admin buttons', 'wp-data-access' ); ?>
629 - </label>
630 - </td>
631 - </tr>
632 357 </table>
633 358 <div class="wpda-table-settings-button">
634 359 <input type="hidden" name="action" value="save"/>
635 360 <button type="submit" class="button button-primary">
636 361 <i class="fas fa-check wpda_icon_on_button"></i>
637 - <?php echo __( 'Save Back-end Settings', 'wp-data-access' ); ?>
362 + <?php esc_html_e( 'Save Back-end Settings', 'wp-data-access' ); ?>
638 363 </button>
639 364 <a href="javascript:void(0)"
640 - onclick="if (confirm('<?php echo __( 'Reset to defaults?', 'wp-data-access' ); ?>')) {
365 + onclick="if (confirm('<?php esc_html_e( 'Reset to defaults?', 'wp-data-access' ); ?>')) {
641 366 jQuery('input[name=&quot;action&quot;]').val('setdefaults');
642 367 jQuery('#wpda_settings_backend').trigger('submit')
643 368 }"
644 369 class="button">
645 370 <i class="fas fa-times-circle wpda_icon_on_button"></i>
646 - <?php echo __( 'Reset Back-end Settings To Defaults', 'wp-data-access' ); ?>
371 + <?php esc_html_e( 'Reset Back-end Settings To Defaults', 'wp-data-access' ); ?>
647 372 </a>
648 373 </div>
649 374 <?php wp_nonce_field( 'wpda-back-end-settings', '_wpnonce', false ); ?>
650 375 </form>
376 +
651 377 <form id="delete_default_user_database_form"
652 378 method="post"
653 379 action="?page=<?php echo esc_attr( $this->page ); ?>&tab=backend"
654 380 style="display:none">
@@ -655,8 +381,9 @@
655 381 <input type="hidden" name="wpda_default_database_delete" id="wpda_default_database_delete" value=""/>
656 382 <input type="hidden" name="action" value="delete_default_user_database"/>
657 383 <?php wp_nonce_field( 'wpda-back-end-settings', '_wpnonce', false ); ?>
658 384 </form>
385 +
659 386 <?php
660 387 }
661 388
662 389 }