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 | public/class-wp-data-access-public.php +143 -214 5.5.29 → 5.5.85 View file →
@@ -5,14 +5,14 @@
5 5 *
6 6 * @package plugin\public
7 7 */
8 8 use WPDataAccess\API\WPDA_API;
9 -use WPDataAccess\Data_Apps\WPDA_Apps;
10 9 use WPDataAccess\Data_Dictionary\WPDA_Dictionary_Exist;
11 10 use WPDataAccess\Data_Tables\WPDA_Data_Tables;
12 11 use WPDataAccess\List_Table\WPDA_List_View;
12 +use WPDataAccess\Premium\WPDAPRO_Data_Publisher\WPDAPRO_Data_Publisher_Init;
13 +use WPDataAccess\Utilities\WPDA_Add_App_To_Menu;
13 14 use WPDataAccess\WPDA;
14 -use WPDataAccess\Premium\WPDAPRO_Data_Publisher\WPDAPRO_Data_Publisher_Init;
15 15 /**
16 16 * Class WP_Data_Access_Public
17 17 *
18 18 * Defines public specific functionality for plugin WP Data Access.
@@ -19,8 +19,9 @@
19 19 *
20 20 * @author Peter Schulz
21 21 * @since 1.0.0
22 22 */
23 +// phpcs:disable WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing -- verified on page
23 24 class WP_Data_Access_Public {
24 25 /**
25 26 * Add stylesheets to front-end
26 27 *
@@ -110,10 +111,10 @@
110 111 );
111 112 // SAVING SPACE - According to the plugin guidelines it is allowed to include external fonts:
112 113 // https://developer.wordpress.org/plugins/wordpress-org/detailed-plugin-guidelines/#8-plugins-may-not-send-executable-code-via-third-party-systems .
113 114 // Load fontawesome icons.
115 + // phpcs:disable WordPress.WP.EnqueuedResourceParameters.MissingVersion
114 116 wp_register_style(
115 - // phpcs:ignore WordPress.WP.EnqueuedResourceParameters
116 117 'wpda_fontawesome_icons',
117 118 WPDA::CDN_FONTAWESOME . 'all.min.css',
118 119 array(),
119 120 null,
@@ -229,9 +230,9 @@
229 230 // Toolbar only available on public pages.
230 231 return;
231 232 }
232 233 // Add Apps.
233 - $apps = new WPDA_Apps();
234 + $apps = new WPDA_Add_App_To_Menu();
234 235 $apps->add_apps_to_menu();
235 236 }
236 237
237 238 /**
@@ -254,16 +255,17 @@
254 255 *
255 256 * @since 1.0.0
256 257 */
257 258 public function register_shortcodes() {
258 - add_shortcode( 'wpda_apps', array($this, 'wpda_apps') );
259 259 add_shortcode( 'wpda_app', array($this, 'wpda_app') );
260 + add_shortcode( 'wpda_app_builder', array($this, 'wpda_app_builder') );
260 261 add_shortcode( 'wpda_data_explorer', array($this, 'wpda_data_explorer') );
262 + add_shortcode( 'wpda_query_builder', array($this, 'wpda_query_builder') );
261 263 add_shortcode( 'wpdataaccess', array($this, 'wpdataaccess') );
262 264 add_shortcode( 'wpdadiehard', array($this, 'wpdadiehard') );
263 265 }
264 266
265 - public function wpda_apps( $atts ) {
267 + public function wpda_app_builder( $atts ) {
266 268 $editing = WPDA::is_editing_post();
267 269 if ( false !== $editing ) {
268 270 // Prevent errors when user is editing a post.
269 271 return $editing;
@@ -273,9 +275,9 @@
273 275 $wp_atts = shortcode_atts( array(
274 276 'feedback' => false,
275 277 ), $atts );
276 278 ob_start();
277 - $apps = new WPDataAccess\Data_Apps\WPDA_Apps_List($wp_atts);
279 + $apps = new WPDataAccess\Data_Apps\WPDA_App_Builder($wp_atts);
278 280 $apps->show();
279 281 return ob_get_clean();
280 282 }
281 283
@@ -286,9 +288,9 @@
286 288 return $editing;
287 289 }
288 290 if ( isset( $_POST['is_fb_preview'], $_GET['et_pb_preview'] ) && 'true' === $_POST['is_fb_preview'] && 'true' === $_GET['et_pb_preview'] ) {
289 291 // Divi Visual Builder preview not working!
290 - // Styles are not properly loaded into the Divi Visual Builder.
292 + // Dynamic resources are not properly loaded into the Divi Visual Builder.
291 293 ob_start();
292 294 ?>
293 295 <div style="width: 100%; border: 1px solid #ccc; padding: 50px; display: grid; gap: 20px; background-color: rgb(249,249,249); border-radius: 5px;">
294 296 <div>
@@ -303,14 +305,23 @@
303 305 $wp_atts = shortcode_atts( array(
304 306 'app_id' => null,
305 307 'feedback' => false,
306 308 'builders' => true,
309 + 'hidetitlebar' => false,
310 + 'fullscreen' => false,
307 311 'filter_field_name' => null,
308 312 'filter_field_value' => null,
309 313 ), $atts );
310 - $shortcode_args = array_diff( $atts, $wp_atts );
314 + $shortcode_params = array();
315 + foreach ( $atts as $key => $value ) {
316 + if ( !key_exists( $key, $wp_atts ) ) {
317 + $shortcode_params[$key] = $value;
318 + }
319 + }
320 + $shortcode_params['pwa'] = false;
321 + // Shortcode not allowed to use parameter pwa
311 322 ob_start();
312 - $app = new WPDataAccess\Data_Apps\WPDA_App_Container($wp_atts, $shortcode_args);
323 + $app = new WPDataAccess\Data_Apps\WPDA_App_Container($wp_atts, $shortcode_params);
313 324 $app->show();
314 325 return ob_get_clean();
315 326 }
316 327
@@ -325,13 +336,30 @@
325 336 $wp_atts = shortcode_atts( array(
326 337 'feedback' => false,
327 338 ), $atts );
328 339 ob_start();
329 - $explorer = new WPDataAccess\Data_Apps\WPDA_Explorer_Container($wp_atts);
340 + $explorer = new WPDataAccess\Data_Apps\WPDA_Data_Explorer($wp_atts);
330 341 $explorer->show();
331 342 return ob_get_clean();
332 343 }
333 344
345 + public function wpda_query_builder( $atts ) {
346 + $editing = WPDA::is_editing_post();
347 + if ( false !== $editing ) {
348 + // Prevent errors when user is editing a post.
349 + return $editing;
350 + }
351 + $atts = array_change_key_case( (array) $atts, CASE_LOWER );
352 + //phpcs:ignore - 8.1 proof
353 + $wp_atts = shortcode_atts( array(
354 + 'feedback' => false,
355 + ), $atts );
356 + ob_start();
357 + $qb = new WPDataAccess\Data_Apps\WPDA_Query_Builder($wp_atts);
358 + $qb->show();
359 + return ob_get_clean();
360 + }
361 +
334 362 /**
335 363 * Implementation of shortcode 'wpdataaccess'
336 364 *
337 365 * Checks the values entered on validity (as far as possible) and builds the table based on the given table name,
@@ -424,26 +452,14 @@
424 452 global $wpdb;
425 453 $atts = array_change_key_case( (array) $atts, CASE_LOWER );
426 454 //phpcs:ignore - 8.1 proof
427 455 $wp_atts = shortcode_atts( array(
428 - 'project_id' => '',
429 - 'page_id' => '',
430 - 'schema_name' => $wpdb->dbname,
431 - 'table_name' => '',
432 - 'title' => '',
433 - 'subtitle' => '',
434 - 'bulk_actions_enabled' => false,
435 - 'search_box_enabled' => false,
436 - 'bulk_export_enabled' => false,
437 - 'show_view_link' => 'on',
438 - 'allow_insert' => 'off',
439 - 'allow_update' => 'off',
440 - 'allow_delete' => 'off',
441 - 'allow_import' => 'off',
456 + 'project_id' => '',
457 + 'page_id' => '',
442 458 ), $atts );
443 - if ( '' === $wp_atts['project_id'] && '' === $wp_atts['page_id'] && '' === $wp_atts['table_name'] ) {
444 - // Either a Data Project page (project_id and page_id) or a table name must be provided.
445 - return __( 'ERROR: Missing argument(s) [(project_id and page_id) or table_name]', 'wp-data-access' );
459 + if ( '' === $wp_atts['project_id'] && '' === $wp_atts['page_id'] ) {
460 + // Dashboard menu feature was removed. Parameter table_name no longer valid.
461 + return __( 'ERROR: Missing argument(s) [project_id and page_id]', 'wp-data-access' );
446 462 }
447 463 // Sanitize database values.
448 464 $wp_atts['project_id'] = sanitize_text_field( wp_unslash( $wp_atts['project_id'] ) );
449 465 // input var okay.
@@ -448,46 +464,8 @@
448 464 $wp_atts['project_id'] = sanitize_text_field( wp_unslash( $wp_atts['project_id'] ) );
449 465 // input var okay.
450 466 $wp_atts['page_id'] = sanitize_text_field( wp_unslash( $wp_atts['page_id'] ) );
451 467 // input var okay.
452 - $wp_atts['schema_name'] = sanitize_text_field( wp_unslash( $wp_atts['schema_name'] ) );
453 - // input var okay.
454 - $wp_atts['table_name'] = sanitize_text_field( wp_unslash( $wp_atts['table_name'] ) );
455 - // input var okay.
456 - // Set default parameter values.
457 - $bulk_actions_enabled = false;
458 - $search_box_enabled = false;
459 - $bulk_export_enabled = false;
460 - $show_view_link = 'on';
461 - $allow_insert = 'off';
462 - $allow_update = 'off';
463 - $allow_delete = 'off';
464 - $allow_import = 'off';
465 - // Check arguments.
466 - if ( 'true' === $wp_atts['bulk_actions_enabled'] ) {
467 - $bulk_actions_enabled = true;
468 - }
469 - if ( 'true' === $wp_atts['search_box_enabled'] ) {
470 - $search_box_enabled = true;
471 - }
472 - if ( 'true' === $wp_atts['bulk_export_enabled'] ) {
473 - $bulk_export_enabled = true;
474 - }
475 - if ( 'false' === $wp_atts['show_view_link'] ) {
476 - $show_view_link = 'off';
477 - }
478 - if ( 'true' === $wp_atts['allow_insert'] ) {
479 - $allow_insert = 'on';
480 - }
481 - if ( 'true' === $wp_atts['allow_update'] ) {
482 - $allow_update = 'on';
483 - }
484 - if ( 'true' === $wp_atts['allow_delete'] ) {
485 - $allow_delete = 'on';
486 - }
487 - if ( 'true' === $wp_atts['allow_import'] ) {
488 - $allow_import = 'on';
489 - }
490 468 $default_where = '';
491 469 if ( isset( $atts['filter_field_name'] ) && isset( $atts['filter_field_value'] ) ) {
492 470 $filter_field_name = str_replace( '`', '', sanitize_text_field( wp_unslash( $atts['filter_field_name'] ) ) );
493 471 // input var okay.
@@ -499,41 +477,15 @@
499 477 //phpcs:ignore - 8.1 proof
500 478 if ( count( $filter_field_name_array ) === count( $filter_field_value_array ) ) {
501 479 //phpcs:ignore - 8.1 proof
502 480 // Add filter to where clause.
481 + // phpcs:disable Generic.CodeAnalysis.ForLoopWithTestFunctionCall, Squiz.PHP.DisallowSizeFunctionsInLoops, WordPress.DB.PreparedSQLPlaceholders
503 482 for ($i = 0; $i < count( $filter_field_name_array ); $i++) {
504 - // phpcs:ignore Generic.CodeAnalysis.ForLoopWithTestFunctionCall, Squiz.PHP.DisallowSizeFunctionsInLoops
505 - $default_where .= (( '' === $default_where ? '' : ' and ' )) . $wpdb->prepare(
506 - ' `%1s` like %s ',
507 - // phpcs:ignore WordPress.DB.PreparedSQLPlaceholders
508 - array(WPDA::remove_backticks( $filter_field_name_array[$i] ), $filter_field_value_array[$i])
509 - );
483 + $default_where .= (( '' === $default_where ? '' : ' and ' )) . $wpdb->prepare( ' `%1s` like %s ', array(WPDA::remove_backticks( $filter_field_name_array[$i] ), $filter_field_value_array[$i]) );
510 484 }
485 + // phpcs:enable Generic.CodeAnalysis.ForLoopWithTestFunctionCall, Squiz.PHP.DisallowSizeFunctionsInLoops, WordPress.DB.PreparedSQLPlaceholders
511 486 }
512 487 }
513 - // Is this a Data Projects page or a table administration page?
514 - if ( '' !== $wp_atts['project_id'] && '' !== $wp_atts['page_id'] ) {
515 - // phpcs:ignore Generic.CodeAnalysis.EmptyStatement
516 - // Request for Data Projects page (check is performed in WPDP_List_Page).
517 - } else {
518 - // Request for table administration page.
519 - // Check schema name.
520 - if ( 'sys' === $wp_atts['schema_name'] || 'mysql' === $wp_atts['schema_name'] || 'information_schema' === $wp_atts['schema_name'] ) {
521 - // No access to MySQL databases (meta data)!
522 - return __( 'ERROR: No access to MySQL meta data', 'wp-data-access' );
523 - }
524 - // Check database table name.
525 - if ( '' === $wp_atts['table_name'] ) {
526 - // Table name must be provided! No database administration in the public area!
527 - return __( 'ERROR: Missing argument [table_name]', 'wp-data-access' );
528 - }
529 - // Check if table exists (to prevent sql injection) and access is granted.
530 - $wpda_dictionary_checks = new WPDA_Dictionary_Exist($wp_atts['schema_name'], $wp_atts['table_name']);
531 - if ( !$wpda_dictionary_checks->table_exists( true, false ) ) {
532 - // Table not found.
533 - return '<p>' . __( 'ERROR: Invalid table name or not authorized', 'wp-data-access' ) . '</p>';
534 - }
535 - }
536 488 // Make sure user has access to necessary (fake) classes and functions in the frontend.
537 489 require_once plugin_dir_path( __DIR__ ) . 'wp-data-access-diehard.php';
538 490 // Make sure all style and JS is available.
539 491 wp_enqueue_script( 'wpda_admin_scripts' );
@@ -560,134 +512,109 @@
560 512 do_action( 'wpda_wpdadiehard_prepare' );
561 513 ob_start();
562 514 // Set page argument to allow public access.
563 515 $_REQUEST['page'] = 'diehard';
564 - if ( '' !== $wp_atts['project_id'] && '' !== $wp_atts['page_id'] ) {
565 - // Show Data Projects page (check is performed in WPDP_List_Page).
566 - // Get page values.
567 - $project_page = $wpdb->get_results( $wpdb->prepare( "\n select * from {$wpdb->prefix}wpda_project_page\n where project_id = %d\n and page_id = %d\n \t", array($wp_atts['project_id'], $wp_atts['page_id']) ), 'ARRAY_A' );
568 - // db call ok; no-cache ok.
569 - if ( 0 === $wpdb->num_rows ) {
570 - // This should never happen as it was already tested before.
571 - return __( 'ERROR: Data Project page not found [need a valid project_id and page_id]', 'wp-data-access' );
572 - }
573 - if ( 'off' !== WPDA::get_option( WPDA::OPTION_WPDA_USE_ROLES_IN_SHORTCODE ) ) {
574 - // Check if user has role.
575 - $user_roles = WPDA::get_current_user_roles();
576 - if ( false === $user_roles ) {
577 - // Cannot determine the user role(s). Not able to show project menus.
578 - return __( 'ERROR: No access [could not determine user role]', 'wp-data-access' );
516 + // Show Data Projects page (check is performed in WPDP_List_Page).
517 + // Get page values.
518 + // phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- plugin table
519 + $project_page = $wpdb->get_results( $wpdb->prepare( "\n select * from {$wpdb->prefix}wpda_project_page\n where project_id = %d\n and page_id = %d\n \t", array($wp_atts['project_id'], $wp_atts['page_id']) ), 'ARRAY_A' );
520 + // db call ok; no-cache ok.
521 + // phpcs:enable WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
522 + if ( 0 === $wpdb->num_rows ) {
523 + // This should never happen as it was already tested before.
524 + return __( 'ERROR: Data Project page not found [need a valid project_id and page_id]', 'wp-data-access' );
525 + }
526 + // Check if user has role.
527 + $user_roles = WPDA::get_current_user_roles();
528 + if ( false === $user_roles ) {
529 + // Cannot determine the user role(s). Not able to show project menus.
530 + return __( 'ERROR: No access [could not determine user role]', 'wp-data-access' );
531 + }
532 + $user_has_role = in_array( 'administrator', $user_roles, true );
533 + if ( !$user_has_role && '' !== $project_page[0]['page_role'] && null !== $project_page[0]['page_role'] ) {
534 + $user_role_array = explode( ',', $project_page[0]['page_role'] );
535 + foreach ( $user_role_array as $user_role_array_item ) {
536 + $user_has_role = in_array( $user_role_array_item, $user_roles, true );
537 + if ( $user_has_role ) {
538 + break;
579 539 }
580 - $user_has_role = false;
581 - if ( '' === $project_page[0]['page_role'] || null === $project_page[0]['page_role'] ) {
582 - $user_has_role = in_array( 'administrator', $user_roles, true );
583 - //phpcs:ignore - 8.1 proof
584 - } else {
585 - $user_role_array = explode( ',', $project_page[0]['page_role'] );
586 - //phpcs:ignore - 8.1 proof
587 - foreach ( $user_role_array as $user_role_array_item ) {
588 - $user_has_role = in_array( $user_role_array_item, $user_roles, true );
589 - //phpcs:ignore - 8.1 proof
590 - if ( $user_has_role ) {
591 - break;
592 - }
593 - }
594 - }
595 - if ( !$user_has_role ) {
596 - return __( 'ERROR: No access [missing role]', 'wp-data-access' );
597 - }
598 540 }
599 - // Determine plugin classes to be used.
600 - if ( 'static' === $project_page[0]['page_type'] ) {
601 - return '';
602 - } elseif ( 'table' === $project_page[0]['page_type'] ) {
603 - $list_view_class = 'WPDataProjects\\List_Table\\WPDP_List_View';
604 - $list_table_class = 'WPDataProjects\\List_Table\\WPDP_List_Table';
605 - $edit_form_class = 'WPDataProjects\\Simple_Form\\WPDP_Simple_Form';
541 + }
542 + if ( !$user_has_role ) {
543 + return __( 'ERROR: No access [missing role]', 'wp-data-access' );
544 + }
545 + // Determine plugin classes to be used.
546 + if ( 'static' === $project_page[0]['page_type'] ) {
547 + return '';
548 + } elseif ( 'table' === $project_page[0]['page_type'] ) {
549 + $list_view_class = 'WPDataProjects\\List_Table\\WPDP_List_View';
550 + $list_table_class = 'WPDataProjects\\List_Table\\WPDP_List_Table';
551 + $edit_form_class = 'WPDataProjects\\Simple_Form\\WPDP_Simple_Form';
552 + } else {
553 + $list_view_class = 'WPDataProjects\\Parent_Child\\WPDP_Parent_List_View';
554 + $list_table_class = 'WPDataProjects\\Parent_Child\\WPDP_Parent_List_Table';
555 + $edit_form_class = 'WPDataProjects\\Parent_Child\\WPDP_Parent_Form';
556 + }
557 + if ( null !== $project_page[0]['page_where'] && '' !== $project_page[0]['page_where'] ) {
558 + if ( 'where' === substr( str_replace( ' ', '', $project_page[0]['page_where'] ), 0, 5 ) ) {
559 + $where_clause = " {$project_page[0]['page_where']}";
606 560 } else {
607 - $list_view_class = 'WPDataProjects\\Parent_Child\\WPDP_Parent_List_View';
608 - $list_table_class = 'WPDataProjects\\Parent_Child\\WPDP_Parent_List_Table';
609 - $edit_form_class = 'WPDataProjects\\Parent_Child\\WPDP_Parent_Form';
561 + $where_clause = " where {$project_page[0]['page_where']} ";
610 562 }
611 - if ( null !== $project_page[0]['page_where'] && '' !== $project_page[0]['page_where'] ) {
612 - if ( 'where' === substr( str_replace( ' ', '', $project_page[0]['page_where'] ), 0, 5 ) ) {
613 - $where_clause = " {$project_page[0]['page_where']}";
614 - } else {
615 - $where_clause = " where {$project_page[0]['page_where']} ";
616 - }
617 - $where_clause = WPDA::substitute_environment_vars( $where_clause );
563 + $where_clause = WPDA::substitute_environment_vars( $where_clause );
564 + } else {
565 + $where_clause = '';
566 + }
567 + if ( '' === $default_where ) {
568 + $default_where = $where_clause;
569 + } else {
570 + if ( '' === $where_clause ) {
571 + $default_where = " where {$default_where} ";
618 572 } else {
619 - $where_clause = '';
573 + $default_where = " {$where_clause} and {$default_where} ";
620 574 }
621 - if ( '' === $default_where ) {
622 - $default_where = $where_clause;
623 - } else {
624 - if ( '' === $where_clause ) {
625 - $default_where = " where {$default_where} ";
626 - } else {
627 - $default_where = " {$where_clause} and {$default_where} ";
628 - }
629 - }
630 - $default_orderby = $project_page[0]['page_orderby'];
631 - // Prepare arguments.
632 - $args = array(
633 - 'page_hook_suffix' => 'WPDA_WPDP',
634 - 'wpdaschema_name' => $project_page[0]['page_schema_name'],
635 - 'table_name' => $project_page[0]['page_table_name'],
636 - 'list_table_class' => $list_table_class,
637 - 'edit_form_class' => $edit_form_class,
638 - 'project_id' => $wp_atts['project_id'],
639 - 'page_id' => $wp_atts['page_id'],
640 - 'default_where' => $default_where,
641 - 'where_clause' => $default_where,
642 - 'orderby_clause' => $default_orderby,
643 - );
644 - if ( 'view' === $project_page[0]['page_mode'] ) {
645 - $args['allow_update'] = 'off';
646 - $args['allow_import'] = 'off';
647 - }
648 - if ( 'no' === $project_page[0]['page_allow_insert'] ) {
649 - $args['allow_insert'] = 'off';
650 - $args['allow_import'] = 'off';
651 - }
652 - if ( 'no' === $project_page[0]['page_allow_delete'] ) {
653 - $args['allow_delete'] = 'off';
654 - }
655 - if ( 'only' === $project_page[0]['page_allow_insert'] ) {
656 - $args['action'] = 'new';
657 - $args['allow_insert'] = 'only';
658 - $args['allow_update'] = 'off';
659 - $args['allow_import'] = 'off';
660 - $args['allow_delete'] = 'off';
661 - }
662 - if ( 'no' === $project_page[0]['page_allow_import'] ) {
663 - $args['allow_import'] = 'off';
664 - }
665 - if ( 'no' === $project_page[0]['page_allow_bulk'] ) {
666 - $args['bulk_actions_enabled'] = false;
667 - }
668 - // Show page.
669 - $project_page_view = new $list_view_class($args);
670 - $project_page_view->show();
671 - } else {
672 - // Show table administration page.
673 - $media_manager = new WPDA_List_View(array(
674 - 'wpdaschema_name' => $wp_atts['schema_name'],
675 - 'table_name' => $wp_atts['table_name'],
676 - 'title' => $wp_atts['title'],
677 - 'subtitle' => $wp_atts['subtitle'],
678 - 'bulk_actions_enabled' => $bulk_actions_enabled,
679 - 'search_box_enabled' => $search_box_enabled,
680 - 'bulk_export_enabled' => $bulk_export_enabled,
681 - 'show_view_link' => $show_view_link,
682 - 'allow_insert' => $allow_insert,
683 - 'allow_update' => $allow_update,
684 - 'allow_delete' => $allow_delete,
685 - 'allow_import' => $allow_import,
686 - 'default_where' => $default_where,
687 - ));
688 - $media_manager->show();
689 575 }
576 + $default_orderby = $project_page[0]['page_orderby'];
577 + // Prepare arguments.
578 + $args = array(
579 + 'page_hook_suffix' => 'WPDA_WPDP',
580 + 'wpdaschema_name' => $project_page[0]['page_schema_name'],
581 + 'table_name' => $project_page[0]['page_table_name'],
582 + 'list_table_class' => $list_table_class,
583 + 'edit_form_class' => $edit_form_class,
584 + 'project_id' => $wp_atts['project_id'],
585 + 'page_id' => $wp_atts['page_id'],
586 + 'default_where' => $default_where,
587 + 'where_clause' => $default_where,
588 + 'orderby_clause' => $default_orderby,
589 + );
590 + if ( 'view' === $project_page[0]['page_mode'] ) {
591 + $args['allow_update'] = 'off';
592 + $args['allow_import'] = 'off';
593 + }
594 + if ( 'no' === $project_page[0]['page_allow_insert'] ) {
595 + $args['allow_insert'] = 'off';
596 + $args['allow_import'] = 'off';
597 + }
598 + if ( 'no' === $project_page[0]['page_allow_delete'] ) {
599 + $args['allow_delete'] = 'off';
600 + }
601 + if ( 'only' === $project_page[0]['page_allow_insert'] ) {
602 + $args['action'] = 'new';
603 + $args['allow_insert'] = 'only';
604 + $args['allow_update'] = 'off';
605 + $args['allow_import'] = 'off';
606 + $args['allow_delete'] = 'off';
607 + }
608 + if ( 'no' === $project_page[0]['page_allow_import'] ) {
609 + $args['allow_import'] = 'off';
610 + }
611 + if ( 'no' === $project_page[0]['page_allow_bulk'] ) {
612 + $args['bulk_actions_enabled'] = false;
613 + }
614 + // Show page.
615 + $project_page_view = new $list_view_class($args);
616 + $project_page_view->show();
690 617 ?>
691 618 <script type='text/javascript'>
692 619 // JS variable commonL10n is used in loaded scripts, copied from wp_default_scripts for responsive support
693 620 /* <![CDATA[ */
@@ -727,4 +654,6 @@
727 654 return ob_get_clean();
728 655 }
729 656
730 657 }
658 +
659 +// phpcs:enable WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing