PluginProbe
WP Data Access – App Builder for Tables, Forms, Charts, Maps & Dashboards / 5.5.84
WP Data Access – App Builder for Tables, Forms, Charts, Maps & Dashboards v5.5.84
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
← All changes | WPDataAccess/List_Table/WPDA_List_View.php +149 -203 5.5.765.5.84 View file →
@@ -111,10 +111,8 @@
111 111 protected $edit_form_class;
112 112
113 113 /**
114 114 * Reference to list table
115 - *
116 - * @var WPDA_List_Table|WPDA_List_Table_Menu
117 115 */
118 116 protected $wpda_list_table;
119 117
120 118 /**
@@ -307,11 +305,11 @@
307 305
308 306 $this->schema_name = $args['wpdaschema_name'];
309 307 if ( '' === $this->schema_name ) {
310 308 // No pre defined schema_name!
311 - if ( isset( $_REQUEST['wpdaschema_name'] ) ) {
309 + if ( isset( $_REQUEST['wpdaschema_name'] ) ) { // phpcs:ignore
312 310 // Get schema name from URL.
313 - $this->schema_name = sanitize_text_field( wp_unslash( $_REQUEST['wpdaschema_name'] ) ); // input var okay.
311 + $this->schema_name = sanitize_text_field( wp_unslash( $_REQUEST['wpdaschema_name'] ) ); // phpcs:ignore
314 312 }
315 313 }
316 314
317 315 $this->table_name = $args['table_name'];
@@ -316,12 +314,12 @@
316 314
317 315 $this->table_name = $args['table_name'];
318 316 if ( '' === $this->table_name ) {
319 317 // No pre defined table_name!
320 - if ( isset( $_REQUEST['table_name'] ) ) {
318 + if ( isset( $_REQUEST['table_name'] ) ) { // phpcs:ignore
321 319 // Get table name from URL. (later we'll check if the table exists in the WordPress database to
322 320 // protect ourselves against SQL injection).
323 - $this->table_name = sanitize_text_field( wp_unslash( $_REQUEST['table_name'] ) ); // input var okay.
321 + $this->table_name = sanitize_text_field( wp_unslash( $_REQUEST['table_name'] ) ); // phpcs:ignore
324 322 }
325 323 }
326 324
327 325 $this->page_hook_suffix = $args['page_hook_suffix'];
@@ -344,10 +342,10 @@
344 342
345 343 if ( isset( $args['action'] ) ) {
346 344 $this->action = $args['action'];
347 345 } else {
348 - if ( isset( $_REQUEST['action'] ) ) {
349 - $this->action = sanitize_text_field( wp_unslash( $_REQUEST['action'] ) ); // input var okay; sanitization okay.
346 + if ( isset( $_REQUEST['action'] ) ) { // phpcs:ignore
347 + $this->action = sanitize_text_field( wp_unslash( $_REQUEST['action'] ) ); // phpcs:ignore
350 348 }
351 349 }
352 350
353 351 if ( false !== $this->page_hook_suffix ) {
@@ -352,18 +350,14 @@
352 350
353 351 if ( false !== $this->page_hook_suffix ) {
354 352 if (
355 353 is_admin() &&
356 - ! isset( $_REQUEST['page_action'] ) &&
354 + ! isset( $_REQUEST['page_action'] ) && // phpcs:ignore
357 355 (
358 - ! ( 'new' === $this->action ||
359 - 'edit' === $this->action ||
360 - 'view' === $this->action ||
361 - 'user_menu' === $this->action
362 - )
356 + ! ( 'new' === $this->action || 'edit' === $this->action || 'view' === $this->action || 'user_menu' === $this->action ) // phpcs:ignore
363 357 )
364 358 ) {
365 - $page_action = isset( $_REQUEST['page_action'] ) ? 'defined' : '';
359 + $page_action = isset( $_REQUEST['page_action'] ) ? 'defined' : ''; // phpcs:ignore
366 360 if ( $page_action === '' ) {
367 361 // Add screen options.
368 362 add_action( 'load-' . $this->page_hook_suffix, array( $this, 'page_screen_options' ) );
369 363 }
@@ -494,9 +488,9 @@
494 488 );
495 489
496 490 $form->prepare_form();
497 491
498 - if ( isset( $_POST['postaction'] ) && 'list' === $_POST['postaction'] ) {
492 + if ( isset( $_POST['postaction'] ) && 'list' === $_POST['postaction'] ) { // phpcs:ignore
499 493 // Jump back to list after pressing SUBMIT > LIST
500 494 $this->display_list_table();
501 495 } else {
502 496 $form->show();
@@ -513,33 +507,15 @@
513 507
514 508 /**
515 509 * Display list table
516 510 *
517 - * There are two type of list tables here:
518 - * + List of tables in the WordPress database schema
519 - * + List of rows in a specific table
520 - *
521 511 * A list of tables in the WordPress database schema is in fact a list of rows as well. The MySQL base table
522 512 * (which is in fact a view) used to show this information is 'information_schema.tables'. The list of tables
523 513 * contains a link to a list table for every table.
524 514 *
525 - * The list of rows is provided by class {@see WPDA_List_Table}. WPDA_List_Table extends WordPress class
526 - * WP_List_Table.
527 - *
528 - * The list of tables is provided by class {@see WPDA_List_Table_Menu}. WPDA_List_Table_Menu extends class
529 - * WPDA_List_Table.
530 - *
531 515 * @since 1.0.0
532 - *
533 - * @see WPDA_List_Table
534 - * @see WPDA_List_Table_Menu
535 516 */
536 517 protected function display_list_table() {
537 - if ( '' === $this->table_name ) {
538 - // List all tables in the database.
539 - $this->list_table_class = 'WPDataAccess\\List_Table\\WPDA_List_Table_Menu';
540 - }
541 -
542 518 $args = array(
543 519 'wpdaschema_name' => $this->schema_name,
544 520 'table_name' => $this->table_name,
545 521 'wpda_list_columns' => $this->wpda_list_columns,
@@ -587,10 +563,10 @@
587 563 *
588 564 * @since 1.0.0
589 565 */
590 566 public function page_screen_options() {
591 - if ( isset( $_REQUEST['child_tab'] ) ) {
592 - $this->child_request = sanitize_text_field( wp_unslash( $_REQUEST['child_tab'] ) ); // input var okay; sanitization okay.
567 + if ( isset( $_REQUEST['child_tab'] ) ) { // phpcs:ignore
568 + $this->child_request = sanitize_text_field( wp_unslash( $_REQUEST['child_tab'] ) ); // phpcs:ignore
593 569 }
594 570
595 571 if ( false !== $this->child_request ) {
596 572 $table_name = str_replace( '.', '_', $this->schema_name . $this->child_request );
@@ -607,168 +583,143 @@
607 583 $this->set_screen_option();
608 584 $screen = get_current_screen();
609 585
610 586 if ( is_object( $screen ) && $screen->id === $this->page_hook_suffix ) {
611 - if ( '' === $this->table_name ) {
612 - // The WordPress Database Table List doesn't have a table_name at this stage. Use the base table
613 - // defined in WPDA_List_Table_Menu instead.
614 - $table_name = str_replace( '.', '_', WPDA_List_Table::LIST_BASE_TABLE );
615 - // Set default column display values for repository tables if screen options is activated
616 - // for the first time
617 - if ( is_admin() &&
618 - false === get_user_option( self::HIDDENCOLUMNS_PREFIX . get_current_screen()->id . $table_name )
619 - ) {
620 - $hidden = array(
621 - 'create_time',
622 - 'data_size',
623 - 'index_size',
624 - 'overhead',
625 - 'table_collation',
626 - );
587 + // Set default column display values for repository tables if screen options is activated
588 + // for the first time
589 + if ( WPDA_Design_Table_Model::get_base_table_name() === $this->table_name ) {
590 + if ( is_admin() &&
591 + false === get_user_option( self::HIDDENCOLUMNS_PREFIX . get_current_screen()->id . $table_name )
592 + ) {
593 + $hidden = array(
594 + 'wpda_table_design',
595 + );
627 596
628 - update_user_meta(
629 - get_current_user_id(),
630 - self::HIDDENCOLUMNS_PREFIX . get_current_screen()->id . $table_name,
631 - $hidden
632 - );
633 - }
634 - } else {
635 - // Set default column display values for repository tables if screen options is activated
636 - // for the first time
637 - if ( WPDA_Design_Table_Model::get_base_table_name() === $this->table_name ) {
638 - if ( is_admin() &&
639 - false === get_user_option( self::HIDDENCOLUMNS_PREFIX . get_current_screen()->id . $table_name )
640 - ) {
641 - $hidden = array(
642 - 'wpda_table_design',
643 - );
597 + update_user_meta(
598 + get_current_user_id(),
599 + self::HIDDENCOLUMNS_PREFIX . get_current_screen()->id . $table_name,
600 + $hidden
601 + );
602 + }
603 + } elseif ( WPDA_Publisher_Model::get_base_table_name() === $this->table_name ) {
604 + if ( is_admin() &&
605 + false === get_user_option( self::HIDDENCOLUMNS_PREFIX . get_current_screen()->id . $table_name )
606 + ) {
607 + $hidden = array(
608 + 'pub_table_name',
609 + 'pub_column_names',
610 + 'pub_sort_icons',
611 + 'pub_styles',
612 + 'pub_style_premium',
613 + 'pub_style_user',
614 + 'pub_style_color',
615 + 'pub_style_space',
616 + 'pub_style_corner',
617 + 'pub_style_modal_width',
618 + 'pub_responsive_popup_title',
619 + 'pub_responsive_cols',
620 + 'pub_responsive_type',
621 + 'pub_responsive_modal_hyperlinks',
622 + 'pub_responsive_icon',
623 + 'pub_flat_scrollx',
624 + 'pub_format',
625 + 'pub_default_where',
626 + 'pub_default_orderby',
627 + 'pub_table_options_searching',
628 + 'pub_table_options_ordering',
629 + 'pub_table_options_paging',
630 + 'pub_table_options_advanced',
631 + 'pub_table_options_serverside',
632 + 'pub_table_options_nl2br',
633 + 'pub_show_advanced_settings',
634 + 'pub_extentions',
635 + 'pub_query',
636 + 'pub_cpt',
637 + 'pub_cpt_fields',
638 + 'pub_cpt_query',
639 + 'pub_cpt_format',
640 + );
644 641
645 - update_user_meta(
646 - get_current_user_id(),
647 - self::HIDDENCOLUMNS_PREFIX . get_current_screen()->id . $table_name,
648 - $hidden
649 - );
650 - }
651 - } elseif ( WPDA_Publisher_Model::get_base_table_name() === $this->table_name ) {
652 - if ( is_admin() &&
653 - false === get_user_option( self::HIDDENCOLUMNS_PREFIX . get_current_screen()->id . $table_name )
654 - ) {
655 - $hidden = array(
656 - 'pub_table_name',
657 - 'pub_column_names',
658 - 'pub_sort_icons',
659 - 'pub_styles',
660 - 'pub_style_premium',
661 - 'pub_style_user',
662 - 'pub_style_color',
663 - 'pub_style_space',
664 - 'pub_style_corner',
665 - 'pub_style_modal_width',
666 - 'pub_responsive_popup_title',
667 - 'pub_responsive_cols',
668 - 'pub_responsive_type',
669 - 'pub_responsive_modal_hyperlinks',
670 - 'pub_responsive_icon',
671 - 'pub_flat_scrollx',
672 - 'pub_format',
673 - 'pub_default_where',
674 - 'pub_default_orderby',
675 - 'pub_table_options_searching',
676 - 'pub_table_options_ordering',
677 - 'pub_table_options_paging',
678 - 'pub_table_options_advanced',
679 - 'pub_table_options_serverside',
680 - 'pub_table_options_nl2br',
681 - 'pub_show_advanced_settings',
682 - 'pub_extentions',
683 - 'pub_query',
684 - 'pub_cpt',
685 - 'pub_cpt_fields',
686 - 'pub_cpt_query',
687 - 'pub_cpt_format',
688 - );
642 + update_user_meta(
643 + get_current_user_id(),
644 + self::HIDDENCOLUMNS_PREFIX . get_current_screen()->id . $table_name,
645 + $hidden
646 + );
647 + }
648 + } elseif ( WPDP_Project_Model::get_base_table_name() === $this->table_name ) {
649 + if ( is_admin() &&
650 + false === get_user_option( self::HIDDENCOLUMNS_PREFIX . get_current_screen()->id . $table_name )
651 + ) {
652 + $hidden = array(
653 + 'project_description',
654 + 'project_sequence',
655 + );
689 656
690 - update_user_meta(
691 - get_current_user_id(),
692 - self::HIDDENCOLUMNS_PREFIX . get_current_screen()->id . $table_name,
693 - $hidden
694 - );
695 - }
696 - } elseif ( WPDP_Project_Model::get_base_table_name() === $this->table_name ) {
697 - if ( is_admin() &&
698 - false === get_user_option( self::HIDDENCOLUMNS_PREFIX . get_current_screen()->id . $table_name )
699 - ) {
700 - $hidden = array(
701 - 'project_description',
702 - 'project_sequence',
703 - );
657 + update_user_meta(
658 + get_current_user_id(),
659 + self::HIDDENCOLUMNS_PREFIX . get_current_screen()->id . $table_name,
660 + $hidden
661 + );
704 662
705 - update_user_meta(
706 - get_current_user_id(),
707 - self::HIDDENCOLUMNS_PREFIX . get_current_screen()->id . $table_name,
708 - $hidden
709 - );
663 + // Set default columns for project pages
664 + if ( false === get_user_option( self::HIDDENCOLUMNS_PREFIX . get_current_screen()->id . WPDP_Page_Model::get_base_table_name() ) ) {
665 + $hidden = array(
666 + 'project_id',
667 + 'page_schema_name',
668 + 'page_setname',
669 + 'page_allow_insert',
670 + 'page_allow_delete',
671 + 'page_allow_import',
672 + 'page_allow_bulk',
673 + 'page_allow_full_export',
674 + 'page_content',
675 + 'page_title',
676 + 'page_subtitle',
677 + 'page_where',
678 + 'page_orderby',
679 + 'page_sequence',
680 + );
710 681
711 - // Set default columns for project pages
712 - if ( false === get_user_option( self::HIDDENCOLUMNS_PREFIX . get_current_screen()->id . WPDP_Page_Model::get_base_table_name() ) ) {
713 - $hidden = array(
714 - 'project_id',
715 - 'page_schema_name',
716 - 'page_setname',
717 - 'page_allow_insert',
718 - 'page_allow_delete',
719 - 'page_allow_import',
720 - 'page_allow_bulk',
721 - 'page_allow_full_export',
722 - 'page_content',
723 - 'page_title',
724 - 'page_subtitle',
725 - 'page_where',
726 - 'page_orderby',
727 - 'page_sequence',
728 - );
682 + update_user_meta(
683 + get_current_user_id(),
684 + self::HIDDENCOLUMNS_PREFIX . get_current_screen()->id . WPDP_Page_Model::get_base_table_name(),
685 + $hidden
686 + );
687 + }
688 + }
689 + } elseif ( WPDP_Project_Design_Table_Model::get_base_table_name() === $this->table_name ) {
690 + if ( is_admin() &&
691 + false === get_user_option( self::HIDDENCOLUMNS_PREFIX . get_current_screen()->id . $table_name )
692 + ) {
693 + $hidden = array();
729 694
730 - update_user_meta(
731 - get_current_user_id(),
732 - self::HIDDENCOLUMNS_PREFIX . get_current_screen()->id . WPDP_Page_Model::get_base_table_name(),
733 - $hidden
734 - );
735 - }
736 - }
737 - } elseif ( WPDP_Project_Design_Table_Model::get_base_table_name() === $this->table_name ) {
738 - if ( is_admin() &&
739 - false === get_user_option( self::HIDDENCOLUMNS_PREFIX . get_current_screen()->id . $table_name )
740 - ) {
741 - $hidden = array();
695 + update_user_meta(
696 + get_current_user_id(),
697 + self::HIDDENCOLUMNS_PREFIX . get_current_screen()->id . $table_name,
698 + $hidden
699 + );
700 + }
701 + } elseif ( WPDA_CSV_Uploads_Model::get_base_table_name() === $this->table_name ) {
702 + if ( is_admin() &&
703 + false === get_user_option( self::HIDDENCOLUMNS_PREFIX . get_current_screen()->id . $table_name )
704 + ) {
705 + $hidden = array(
706 + 'csv_real_file_name',
707 + 'csv_mapping',
708 + 'csv_encoding',
709 + );
742 710
743 - update_user_meta(
744 - get_current_user_id(),
745 - self::HIDDENCOLUMNS_PREFIX . get_current_screen()->id . $table_name,
746 - $hidden
747 - );
748 - }
749 - } elseif ( WPDA_CSV_Uploads_Model::get_base_table_name() === $this->table_name ) {
750 - if ( is_admin() &&
751 - false === get_user_option( self::HIDDENCOLUMNS_PREFIX . get_current_screen()->id . $table_name )
752 - ) {
753 - $hidden = array(
754 - 'csv_real_file_name',
755 - 'csv_mapping',
756 - 'csv_encoding',
757 - );
711 + update_user_meta(
712 + get_current_user_id(),
713 + self::HIDDENCOLUMNS_PREFIX . get_current_screen()->id . $table_name,
714 + $hidden
715 + );
716 + }
717 + }
758 718
759 - update_user_meta(
760 - get_current_user_id(),
761 - self::HIDDENCOLUMNS_PREFIX . get_current_screen()->id . $table_name,
762 - $hidden
763 - );
764 - }
765 - }
719 + // Allow external user to store defaults through action hook wpda_default_screen_option.
720 + do_action( 'wpda_default_screen_option', $this->table_name, $table_name );
766 721
767 - // Allow external user to store defaults through action hook wpda_default_screen_option.
768 - do_action( 'wpda_default_screen_option', $this->table_name, $table_name );
769 - }
770 -
771 722 // Add column selection
772 723 if ( false !== $this->child_request ) {
773 724 if ( WPDP_Page_Model::get_base_table_name() === $this->child_request ) {
774 725 $cols = WPDP_Project_Page_List::column_headers_labels();
@@ -777,11 +728,11 @@
777 728 self::HIDDENCOLUMNS_PREFIX . get_current_screen()->id . WPDP_Page_Model::get_base_table_name()
778 729 );
779 730 } else {
780 731 $setname = 'default';
781 - if ( isset( $_REQUEST['page'] ) ) {
782 - $ids = explode( '_', sanitize_text_field( wp_unslash( $_REQUEST['page'] ) ) );//phpcs:ignore - 8.1 proof
783 - if ( 4 === count( $ids ) ) {//phpcs:ignore - 8.1 proof
732 + if ( isset( $_REQUEST['page'] ) ) { // phpcs:ignore
733 + $ids = explode( '_', sanitize_text_field( wp_unslash( $_REQUEST['page'] ) ) ); // phpcs:ignore
734 + if ( 4 === count( $ids ) ) { // phpcs:ignore -- 8.1 proof
784 735 $proj_id = $ids[2];
785 736 $page_id = $ids[3];
786 737 $project = new WPDP_Project( $proj_id, $page_id );
787 738 if ( null !== $project->get_project() ) {
@@ -835,11 +786,9 @@
835 786 * @return array
836 787 * @since 1.0.0
837 788 */
838 789 public function get_column_headers() {
839 - if ( '' === $this->table_name ) {
840 - return WPDA_List_Table_Menu::column_headers_labels();
841 - } elseif ( WPDA_Design_Table_Model::get_base_table_name() === $this->table_name ) {
790 + if ( WPDA_Design_Table_Model::get_base_table_name() === $this->table_name ) {
842 791 return WPDA_Design_Table_List_Table::column_headers_labels();
843 792 } elseif ( WPDA_Publisher_Model::get_base_table_name() === $this->table_name ) {
844 793 return WPDA_Publisher_List_Table::column_headers_labels();
845 794 } elseif ( WPDP_Project_Model::get_base_table_name() === $this->table_name ) {
@@ -875,20 +824,17 @@
875 824 $screen = get_current_screen();
876 825 if (
877 826 is_object( $screen ) &&
878 827 $screen->id === $this->page_hook_suffix &&
879 - isset( $_REQUEST['screenoptionnonce'] )
828 + isset( $_REQUEST['screenoptionnonce'] ) // phpcs:ignore
880 829 ) {
881 830 // check_admin_referer( 'screen-options-nonce', 'screenoptionnonce' );
882 831
883 - if (
884 - isset( $_REQUEST['wp_screen_options']['option'] ) &&
885 - isset( $_REQUEST['wp_screen_options']['value'] )
886 - ) {
832 + if ( isset( $_REQUEST['wp_screen_options']['option'] ) && isset( $_REQUEST['wp_screen_options']['value'] ) ) { // phpcs:ignore
887 833 update_user_meta(
888 834 WPDA::get_current_user_id(),
889 - sanitize_text_field( wp_unslash( $_REQUEST['wp_screen_options']['option'] ) ),
890 - sanitize_text_field( wp_unslash( $_REQUEST['wp_screen_options']['value'] ) ) // input var okay.
835 + sanitize_text_field( wp_unslash( $_REQUEST['wp_screen_options']['option'] ) ), // phpcs:ignore
836 + sanitize_text_field( wp_unslash( $_REQUEST['wp_screen_options']['value'] ) ) // phpcs:ignore
891 837 );
892 838 }
893 839
894 840 if ( false !== $this->child_request ) {
@@ -914,10 +860,10 @@
914 860 }
915 861
916 862 $cols_hidden = array();
917 863 foreach ( $cols as $col => $label ) {
918 - if ( isset( $_REQUEST[ $col . '-hide-setting' ] ) && 'HIDE' === $_REQUEST[ $col . '-hide-setting' ] ) {
919 - array_push( $cols_hidden, $col );//phpcs:ignore - 8.1 proof
864 + if ( isset( $_REQUEST[ $col . '-hide-setting' ] ) && 'HIDE' === $_REQUEST[ $col . '-hide-setting' ] ) { // phpcs:ignore
865 + array_push( $cols_hidden, $col ); // phpcs:ignore -- 8.1 proof
920 866 }
921 867 }
922 868
923 869 if ( false !== $this->child_request && WPDP_Page_Model::get_base_table_name() === $this->child_request ) {
@@ -939,9 +885,9 @@
939 885 public function show_screen_options( $status, $args ) {
940 886 ob_start();
941 887 ?>
942 888 <fieldset class="metabox-prefs">
943 - <legend><?php echo __( 'Columns' ); // phpcs:ignore WordPress.Security.EscapeOutput ?></legend>
889 + <legend><?php esc_html_e( 'Columns', 'wp-data-access' ); ?></legend>
944 890 <?php
945 891 $screen = get_current_screen();
946 892 foreach ( $screen->get_options() as $screen_option ) {
947 893 if ( self::HIDDENCOLUMNS_PREFIX === substr( $screen_option['option'], 0, 26 ) &&