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/Dashboard/WPDA_Dashboard.php +222 -438 5.5.22 → 5.5.85 View file →
@@ -1,11 +1,12 @@
1 1 <?php
2 2
3 -// phpcs:ignore Standard.Category.SniffName.ErrorCode
3 +// phpcs:disable WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing -- verified on page
4 4 namespace WPDataAccess\Dashboard;
5 5
6 6 use WP_Data_Access_Admin;
7 7 use WPDataAccess\Data_Dictionary\WPDA_Dictionary_Lists;
8 +use WPDataAccess\Plugin_Table_Models\WPDA_App_Model;
8 9 use WPDataAccess\Plugin_Table_Models\WPDA_Design_Table_Model;
9 10 use WPDataAccess\Plugin_Table_Models\WPDA_Publisher_Model;
10 11 use WPDataAccess\Plugin_Table_Models\WPDP_Project_Model;
11 12 use WPDataAccess\Premium\WPDAPRO_Dashboard\WPDAPRO_Dashboard;
@@ -14,9 +15,9 @@
14 15 use WPDataAccess\Utilities\WPDA_Message_Box;
15 16 use WPDataAccess\WPDA;
16 17 use WPDataAccess\Connection\WPDADB;
17 18 use WPDataProjects\WPDP;
18 -use WPDataAccess\Settings\WPDA_Settings_Dashboard;
19 +use WPDataAccess\Settings\WPDA_Settings_Legacy_Dashboard;
19 20 /**
20 21 * Dashboard class
21 22 */
22 23 class WPDA_Dashboard {
@@ -174,10 +175,8 @@
174 175 * @var string|null
175 176 */
176 177 protected $message_type = null;
177 178
178 - private $current_version;
179 -
180 179 private $option_legacy_tools;
181 180
182 181 /**
183 182 * Constructor
@@ -191,9 +190,8 @@
191 190 $this->wp_nonce_save = wp_create_nonce( static::DASHBOARD_SAVE . WPDA::get_current_user_login() );
192 191 // Load Data Tables resources.
193 192 \WPDataAccess\Data_Tables\WPDA_Data_Tables::enqueue_styles_and_script();
194 193 }
195 - $this->current_version = get_user_meta( WPDA::get_current_user_id(), 'wpda_data_explorer', true );
196 194 // Start with empty array.
197 195 if ( $widget_mode ) {
198 196 update_user_meta( WPDA::get_current_user_id(), self::USER_DASHBOARD, array() );
199 197 }
@@ -219,16 +217,14 @@
219 217 */
220 218 public function dashboard() {
221 219 wp_enqueue_style( 'wpdataaccess_dashboard' );
222 220 wp_enqueue_script( 'wpdataaccess_dashboard' );
223 - if ( current_user_can( 'manage_options' ) ) {
221 + if ( WPDA::current_user_is_admin() ) {
224 222 $this->dashboard_default();
225 223 $this->dashboard_mobile();
226 224 }
227 225 if ( isset( $_REQUEST['page'] ) ) {
228 - // phpcs:ignore WordPress.Security.NonceVerification
229 226 switch ( $_REQUEST['page'] ) {
230 - // phpcs:ignore WordPress.Security.NonceVerification
231 227 case 'wpda_dashboard':
232 228 $this->toolbar();
233 229 $this->add_forms();
234 230 $this->tabs();
@@ -237,24 +233,12 @@
237 233 $this->dashboard_js();
238 234 break;
239 235 case WP_Data_Access_Admin::PAGE_MAIN:
240 236 if ( !isset( $_REQUEST['page_action'] ) ) {
241 - // phpcs:ignore WordPress.Security.NonceVerification
242 - if ( !isset( $_REQUEST['table_name'] ) ) {
243 - // phpcs:ignore WordPress.Security.NonceVerification
244 - $this->toolbar_wpda();
245 - } else {
246 - if ( !isset( $_REQUEST['action'] ) || 'new' !== $_REQUEST['action'] && 'edit' !== $_REQUEST['action'] ) {
247 - $this->toolbar_wpda_table();
248 - } else {
249 - $this->toolbar_wpda_row();
250 - }
251 - }
237 + $this->toolbar_wpda();
252 238 } elseif ( 'wpda_backup' === $_REQUEST['page_action'] && (!isset( $_REQUEST['action'] ) || 'remove' === $_REQUEST['action'] || 'update' === $_REQUEST['action'] || 'add' === $_REQUEST['action']) ) {
253 - // phpcs:ignore WordPress.Security.NonceVerification
254 239 $this->toolbar_backup();
255 240 } elseif ( 'wpda_import_csv' === $_REQUEST['page_action'] ) {
256 - // phpcs:ignore WordPress.Security.NonceVerification
257 241 $this->toolbar_import_csv();
258 242 }
259 243 break;
260 244 case WP_Data_Access_Admin::PAGE_APPS:
@@ -259,11 +243,8 @@
259 243 break;
260 244 case WP_Data_Access_Admin::PAGE_APPS:
261 245 $this->toolbar_apps();
262 246 break;
263 - case WP_Data_Access_Admin::PAGE_QUERY_BUILDER:
264 - $this->toolbar_sql();
265 - break;
266 247 case WP_Data_Access_Admin::PAGE_DESIGNER:
267 248 if ( !isset( $_REQUEST['action'] ) || 'new' !== $_REQUEST['action'] && 'edit' !== $_REQUEST['action'] ) {
268 249 $this->toolbar_designer();
269 250 }
@@ -293,9 +274,11 @@
293 274 ?>
294 275 <script>
295 276 jQuery(function() {
296 277 const iaction = "<?php
278 + // phpcs:disable WordPress.Security.ValidatedSanitizedInput.MissingUnslash
297 279 echo esc_attr( sanitize_text_field( $_GET['page_iaction'] ) );
280 + // phpcs:enable WordPress.Security.ValidatedSanitizedInput.MissingUnslash
298 281 ?>";
299 282 switch (iaction) {
300 283 case "create_new_app":
301 284 var interval = setInterval(
@@ -331,45 +314,99 @@
331 314 *
332 315 * @return string
333 316 */
334 317 protected function get_help_url() {
335 - $help_root = 'https://wpdataaccess.com/docs/';
318 + $help_url = 'https://docs.wpdataaccess.com/';
336 319 if ( isset( $_REQUEST['page'] ) ) {
337 - // phpcs:ignore WordPress.Security.NonceVerification
338 320 switch ( $_REQUEST['page'] ) {
339 - // phpcs:ignore WordPress.Security.NonceVerification
340 321 case \WP_Data_Access_Admin::PAGE_MAIN:
341 - $help_url = $help_root . 'data-explorer/data-explorer-getting-started/';
322 + $help_url = 'https://docs.explorer.wpdataaccess.com/';
342 323 break;
324 + case \WP_Data_Access_Admin::PAGE_APPS:
325 + $help_url = 'https://docs.rad.wpdataaccess.com/';
326 + break;
343 327 case \WP_Data_Access_Admin::PAGE_QUERY_BUILDER:
344 - $help_url = $help_root . 'query-builder/query-builder-getting-started/';
328 + $help_url = 'https://docs.sql.wpdataaccess.com/';
345 329 break;
346 330 case \WP_Data_Access_Admin::PAGE_DESIGNER:
347 - $help_url = $help_root . 'data-designer/data-designer-getting-started/';
331 + $help_url = 'https://docs.legacy.wpdataaccess.com/docs/data-designer-getting-started/';
348 332 break;
349 333 case \WP_Data_Access_Admin::PAGE_PUBLISHER:
350 - $help_url = $help_root . 'data-tables/data-tables-getting-started/';
334 + $help_url = 'https://docs.legacy.wpdataaccess.com/docs/data-tables-getting-started/';
351 335 break;
352 336 case \WP_Data_Access_Admin::PAGE_DASHBOARD:
353 - $help_url = $help_root . 'dashboards-and-widgets/bi-getting-started/';
337 + $help_url = 'https://docs.legacy.wpdataaccess.com/docs/bi-getting-started/';
354 338 break;
355 339 case \WP_Data_Access_Admin::PAGE_CHARTS:
356 - $help_url = $help_root . 'widgets/chart-widgets/';
340 + $help_url = 'https://docs.legacy.wpdataaccess.com/docs/chart-widgets/';
357 341 break;
358 342 case WPDP::PAGE_MAIN:
359 - $help_url = $help_root . 'data-apps/data-projects/';
343 + $help_url = 'https://docs.legacy.wpdataaccess.com/docs/data-projects/';
360 344 break;
361 345 case WPDP::PAGE_TEMPLATES:
362 - $help_url = $help_root . 'data-apps-templates/project-templates/';
346 + $help_url = 'https://docs.legacy.wpdataaccess.com/docs/project-templates/';
363 347 break;
364 348 case 'wpdataaccess':
365 - $help_url = $help_root . 'plugin-settings/getting-started/';
349 + $current_tab = ( isset( $_REQUEST['tab'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['tab'] ) ) : 'plugin' );
350 + switch ( $current_tab ) {
351 + case 'plugin':
352 + $help_url = 'https://docs.settings.wpdataaccess.com/plugin.html';
353 + break;
354 + case 'pds':
355 + $help_url = 'https://docs.settings.wpdataaccess.com/pds.html';
356 + break;
357 + case 'backend':
358 + $help_url = 'https://docs.settings.wpdataaccess.com/back-end.html';
359 + break;
360 + case 'frontend':
361 + $help_url = 'https://docs.settings.wpdataaccess.com/frond-end.html';
362 + break;
363 + case 'uninstall':
364 + $help_url = 'https://docs.settings.wpdataaccess.com/uninstall.html';
365 + break;
366 + case 'repository':
367 + $help_url = 'https://docs.settings.wpdataaccess.com/repository.html';
368 + break;
369 + case 'mail':
370 + $help_url = 'https://docs.settings.wpdataaccess.com/mail.html';
371 + break;
372 + case 'drives':
373 + $help_url = 'https://docs.settings.wpdataaccess.com/drives.html';
374 + break;
375 + case 'system':
376 + $help_url = 'https://docs.settings.wpdataaccess.com/system-info.html';
377 + break;
378 + case 'legacy':
379 + $vtab = ( isset( $_REQUEST['vtab'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['vtab'] ) ) : 'plugin' );
380 + switch ( $vtab ) {
381 + case 'backend':
382 + $help_url = 'https://docs.settings.wpdataaccess.com/legacy-tools-back-end.html';
383 + break;
384 + case 'frontend':
385 + $help_url = 'https://docs.settings.wpdataaccess.com/legacy-tools-front-end.html';
386 + break;
387 + case 'datatables':
388 + $help_url = 'https://docs.settings.wpdataaccess.com/legacy-tools-data-tables.html';
389 + break;
390 + case 'dataforms':
391 + $help_url = 'https://docs.settings.wpdataaccess.com/legacy-tools-data-forms.html';
392 + break;
393 + case 'dashboard':
394 + $help_url = 'https://docs.settings.wpdataaccess.com/legacy-tools-dashboard.html';
395 + break;
396 + case 'databackup':
397 + $help_url = 'https://docs.settings.wpdataaccess.com/legacy-tools-data-backup.html';
398 + break;
399 + case 'roles':
400 + $help_url = 'https://docs.settings.wpdataaccess.com/legacy-tools-roles.html';
401 + break;
402 + default:
403 + $help_url = 'https://docs.settings.wpdataaccess.com/legacy-tools-plugin.html';
404 + }
405 + break;
406 + }
366 407 break;
367 - default:
368 - $help_url = $help_root . 'getting-started/wp-data-access-getting-started/';
369 408 }
370 - } else {
371 - $help_url = $help_root . 'getting-started/wp-data-access-getting-started/';
372 409 }
373 410 return $help_url;
374 411 }
375 412
@@ -384,19 +421,16 @@
384 421 <div class="wpda-dashboard">
385 422 <div class="wpda-dashboard-group wpda-dashboard-group-administration">
386 423 <div class="icons">
387 424 <a class="wpda-dashboard-item wpda_tooltip_icons" href="<?php
388 - echo admin_url( 'admin.php' );
389 - // phpcs:ignore WordPress.Security.EscapeOutput
425 + echo esc_url( admin_url( 'admin.php' ) );
390 426 ?>?page=wpda_navi" title="Quick links and frequently asked questions">
391 427 <div class="fa-solid fa-house"></div>
392 428 <div class="label">Tool Guide</div>
393 429 </a>
394 430 <a class="wpda-dashboard-item wpda_tooltip_icons" href="<?php
395 - echo admin_url( 'admin.php' );
396 - // phpcs:ignore WordPress.Security.EscapeOutput
397 - ?>?page=wpda_apps" title="Build data-driven Apps with the new
398 -Table Builder, Form Builder and Chart Builder">
431 + echo esc_url( admin_url( 'admin.php' ) );
432 + ?>?page=wpda_apps" title="Data-driven Rapid Application Development">
399 433 <div class="fa-solid">
400 434 <svg xmlns="http://www.w3.org/2000/svg" height="26px" width="26px" viewBox="4 4 16 16" fill="inherit">
401 435 <path d="M4 8h4V4H4v4zm6 12h4v-4h-4v4zm-6 0h4v-4H4v4zm0-6h4v-4H4v4zm6 0h4v-4h-4v4zm6-10v4h4V4h-4zm-6 4h4V4h-4v4zm6 6h4v-4h-4v4zm0 6h4v-4h-4v4z"/>
402 436 </svg>
@@ -403,19 +437,15 @@
403 437 </div>
404 438 <div class="label">App Builder</div>
405 439 </a>
406 440 <a class="wpda-dashboard-item wpda_tooltip_icons" href="<?php
407 - echo admin_url( 'admin.php' );
408 - // phpcs:ignore WordPress.Security.EscapeOutput
409 - ?>?page=wpda" title="Data Explorer
410 -
411 -Manage local and remote data and databases">
441 + echo esc_url( admin_url( 'admin.php' ) );
442 + ?>?page=wpda" title="Manage local and remote data and databases">
412 443 <div class="fa-solid fa-database"></div>
413 444 <div class="label">Explorer</div>
414 445 </a>
415 446 <a class="wpda-dashboard-item wpda_tooltip_icons" href="<?php
416 - echo admin_url( 'admin.php' );
417 - // phpcs:ignore WordPress.Security.EscapeOutput
447 + echo esc_url( admin_url( 'admin.php' ) );
418 448 ?>?page=wpda_query_builder" title="SQL Query Builder">
419 449 <div class="fa-solid fa-code"></div>
420 450 <div class="label">SQL</div>
421 451 </a>
@@ -431,10 +461,9 @@
431 461 >
432 462 <div class="icons">
433 463 <a class="wpda-dashboard-item wpda_tooltip_icons"
434 464 href="<?php
435 - echo admin_url( 'admin.php' );
436 - // phpcs:ignore WordPress.Security.EscapeOutput
465 + echo esc_url( admin_url( 'admin.php' ) );
437 466 ?>?page=wpda_publisher"
438 467 title="OLD Table Builder
439 468
440 469 Use App Builder to access the NEW Table Builder
@@ -449,10 +478,9 @@
449 478 <div class="label">Tables</div>
450 479 </a>
451 480 <a class="wpda-dashboard-item wpda_tooltip_icons"
452 481 href="<?php
453 - echo admin_url( 'admin.php' );
454 - // phpcs:ignore WordPress.Security.EscapeOutput
482 + echo esc_url( admin_url( 'admin.php' ) );
455 483 ?>?page=wpda_wpdp"
456 484 title="OLD Form Builder
457 485
458 486 Use App Builder to access the NEW Form Builder
@@ -467,10 +495,9 @@
467 495 <div class="label">Forms</div>
468 496 </a>
469 497 <a class="wpda-dashboard-item wpda_tooltip_icons"
470 498 href="<?php
471 - echo admin_url( 'admin.php' );
472 - // phpcs:ignore WordPress.Security.EscapeOutput
499 + echo esc_url( admin_url( 'admin.php' ) );
473 500 ?>?page=wpda_templates"
474 501 title="OLD Form Templates
475 502
476 503 Customize forms using templates"
@@ -484,10 +511,9 @@
484 511 <div class="label">Templates</div>
485 512 </a>
486 513 <a class="wpda-dashboard-item wpda_tooltip_icons"
487 514 href="<?php
488 - echo admin_url( 'admin.php' );
489 - // phpcs:ignore WordPress.Security.EscapeOutput
515 + echo esc_url( admin_url( 'admin.php' ) );
490 516 ?>?page=wpda_designer"
491 517 title="Create database tables and indexes"
492 518 <?php
493 519 if ( !$this->option_legacy_tools['designer'][0] ) {
@@ -505,10 +531,9 @@
505 531 </div>
506 532 <div class="wpda-dashboard-group wpda-dashboard-group-settings">
507 533 <div class="icons">
508 534 <a class="wpda-dashboard-item wpda_tooltip_icons" href="<?php
509 - echo admin_url( 'options-general.php' );
510 - // phpcs:ignore WordPress.Security.EscapeOutput
535 + echo esc_url( admin_url( 'options-general.php' ) );
511 536 ?>?page=wpdataaccess" title="Manage plugin user interface and behavior">
512 537 <div class="fa-solid fa-cog"></div>
513 538 <div class="label">Settings</div>
514 539 </a>
@@ -515,10 +540,9 @@
515 540 <?php
516 541 if ( wpda_freemius()->is_registered() ) {
517 542 ?>
518 543 <a class="wpda-dashboard-item wpda_tooltip_icons" href="<?php
519 - echo admin_url( 'admin.php' );
520 - // phpcs:ignore WordPress.Security.EscapeOutput
544 + echo esc_url( admin_url( 'admin.php' ) );
521 545 ?>?page=<?php
522 546 echo esc_attr( WP_Data_Access_Admin::MAIN_PAGE_SLUG );
523 547 ?>-account" title="Manage your WP Data Access account">
524 548 <div class="fa-solid fa-user"></div>
@@ -531,10 +555,9 @@
531 555 <div class="fa-solid fa-hand-holding-usd"></div>
532 556 <div class="label">Pricing</div>
533 557 </a>
534 558 <a class="wpda-dashboard-item wpda_tooltip_icons" href="<?php
535 - echo admin_url( 'admin.php' );
536 - // phpcs:ignore WordPress.Security.EscapeOutput
559 + echo esc_url( admin_url( 'admin.php' ) );
537 560 ?>?page=<?php
538 561 echo esc_attr( WP_Data_Access_Admin::MAIN_PAGE_SLUG );
539 562 ?>-pricing" title="Upgrade your WP Data Access account">
540 563 <div class="fa-solid fa-gem"></div>
@@ -539,17 +562,26 @@
539 562 ?>-pricing" title="Upgrade your WP Data Access account">
540 563 <div class="fa-solid fa-gem"></div>
541 564 <div class="label">Upgrade</div>
542 565 </a>
543 - </div>
566 + <?php
567 + if ( wpda_freemius()->is_free_plan() && !wpda_freemius()->is_trial() && !wpda_freemius()->is_trial_utilized() ) {
568 + ?>
569 + <a class="wpda-dashboard-item wpda_tooltip_icons" href="https://wpdataaccess.com/order/?l=0&b=trial" title="Get your 14-day free trial" target="_blank">
570 + <div class="fa-solid fa-star"></div>
571 + <div class="label">Free Trial</div>
572 + </a>
573 + <?php
574 + }
575 + ?>
576 + </div>
544 577 <div class="subject">Plugin & User Management</div>
545 578 </div>
546 579 <div class="wpda-dashboard-group wpda-dashboard-group-support">
547 580 <div class="icons">
548 581 <a class="wpda-dashboard-item wpda_tooltip_icons" target="_blank" href="<?php
549 - echo $this->get_help_url();
550 - // phpcs:ignore WordPress.Security.EscapeOutput
551 - ?>" title="Online help and documentation">
582 + echo esc_url( $this->get_help_url() );
583 + ?>" title="Context sensitive help">
552 584 <div class="fa-solid fa-question-circle"></div>
553 585 <div class="label">Docs</div>
554 586 </a>
555 587 <a class="wpda-dashboard-item wpda_tooltip_icons" target="_blank" href="https://wordpress.org/support/plugin/wp-data-access/" title="Public support forum">
@@ -580,22 +612,18 @@
580 612 <div class="wpda_nav_title">WP Data Access</div>
581 613 </div>
582 614 <ul>
583 615 <li class="menu-item"><a href="<?php
584 - echo admin_url( 'admin.php' );
585 - // phpcs:ignore WordPress.Security.EscapeOutput
616 + echo esc_url( admin_url( 'admin.php' ) );
586 617 ?>?page=wpda"><i class="fas fa-database"></i> Explorer</a></li>
587 618 <li class="menu-item"><a href="<?php
588 - echo admin_url( 'admin.php' );
589 - // phpcs:ignore WordPress.Security.EscapeOutput
619 + echo esc_url( admin_url( 'admin.php' ) );
590 620 ?>?page=wpda_query_builder"><i class="fas fa-code"></i> SQL</a></li>
591 621 <li class="menu-item wpda-separator"><a href="<?php
592 - echo admin_url( 'admin.php' );
593 - // phpcs:ignore WordPress.Security.EscapeOutput
622 + echo esc_url( admin_url( 'admin.php' ) );
594 623 ?>?page=wpda_designer"><i class="fas fa-drafting-compass"></i> Designer</a></li>
595 624 <li class="menu-item wpda-separator"><a href="<?php
596 - echo admin_url( 'admin.php' );
597 - // phpcs:ignore WordPress.Security.EscapeOutput
625 + echo esc_url( admin_url( 'admin.php' ) );
598 626 ?>?page=wpda_apps"><span style="display: inline-block; width: 20px"><svg xmlns="http://www.w3.org/2000/svg" height="12px" width="12px" viewBox="4 4 16 16" fill="inherit">
599 627 <path d="M4 8h4V4H4v4zm6 12h4v-4h-4v4zm-6 0h4v-4H4v4zm0-6h4v-4H4v4zm6 0h4v-4h-4v4zm6-10v4h4V4h-4zm-6 4h4V4h-4v4zm6 6h4v-4h-4v4zm0 6h4v-4h-4v4z"/>
600 628 </svg></span> Apps</a></li>
601 629 <?php
@@ -602,31 +630,26 @@
602 630 ?>
603 631 <li class="menu-item <?php
604 632 echo esc_attr( $premium_separator );
605 633 ?>"><a href="<?php
606 - echo admin_url( 'admin.php' );
607 - // phpcs:ignore WordPress.Security.EscapeOutput
634 + echo esc_url( admin_url( 'admin.php' ) );
608 635 ?>?page=wpda_publisher"><i class="fas fa-address-card"></i> Tables</a></li>
609 636 <?php
610 637 ?>
611 638 <li class="menu-item"><a href="<?php
612 - echo admin_url( 'admin.php' );
613 - // phpcs:ignore WordPress.Security.EscapeOutput
639 + echo esc_url( admin_url( 'admin.php' ) );
614 640 ?>?page=wpda_wpdp"><i class="fas fa-magic"></i> Forms</a></li>
615 641 <li class="menu-item wpda-separator"><a href="<?php
616 - echo admin_url( 'admin.php' );
617 - // phpcs:ignore WordPress.Security.EscapeOutput
642 + echo esc_url( admin_url( 'admin.php' ) );
618 643 ?>?page=wpda_templates"><i class="fas fa-desktop"></i> Templates</a></li>
619 644 <li class="menu-item"><a href="<?php
620 - echo admin_url( 'options-general.php' );
621 - // phpcs:ignore WordPress.Security.EscapeOutput
645 + echo esc_url( admin_url( 'options-general.php' ) );
622 646 ?>?page=wpdataaccess"><i class="fas fa-cog"></i> Settings</a></li>
623 647 <?php
624 648 if ( wpda_freemius()->is_registered() ) {
625 649 ?>
626 650 <li class="menu-item"><a href="<?php
627 - echo admin_url( 'admin.php' );
628 - // phpcs:ignore WordPress.Security.EscapeOutput
651 + echo esc_url( admin_url( 'admin.php' ) );
629 652 ?>?page=<?php
630 653 echo esc_attr( WP_Data_Access_Admin::MAIN_PAGE_SLUG );
631 654 ?>-account"><i class="fas fa-user"></i> Account</a></li>
632 655 <?php
@@ -650,10 +673,9 @@
650 673 <?php
651 674 if ( $menufound ) {
652 675 ?>
653 676 <li class="menu-item wpda-separator"><a href="<?php
654 - echo admin_url( 'admin.php' );
655 - // phpcs:ignore WordPress.Security.EscapeOutput
677 + echo esc_url( admin_url( 'admin.php' ) );
656 678 ?>?page=<?php
657 679 echo esc_attr( WP_Data_Access_Admin::MAIN_PAGE_SLUG );
658 680 ?>-pricing"><i class="fas fa-gem"></i> Upgrade</a></li>
659 681 <?php
@@ -658,9 +680,9 @@
658 680 ?>-pricing"><i class="fas fa-gem"></i> Upgrade</a></li>
659 681 <?php
660 682 }
661 683 ?>
662 - <li class="menu-item"><a target="_blank" href="https://wpdataaccess.com/docs/getting-started/overview/"><i class="fas fa-question"></i> Online Documentation</a></li>
684 + <li class="menu-item"><a target="_blank" href="https://docs.wpdataaccess.com/"><i class="fas fa-question"></i> Online Documentation</a></li>
663 685 <li class="menu-item"><a target="_blank" href="https://wordpress.org/support/plugin/wp-data-access/"><i class="fas fa-life-ring"></i> Support Forum</a></li>
664 686 <?php
665 687 ?>
666 688 </ul>
@@ -690,9 +712,9 @@
690 712 <div id="wpda-dashboard-toolbar" class="wpda-dashboard-toolbar" style="display:none">
691 713 <div class="wpda-nowrap">
692 714 <div>
693 715 <?php
694 - if ( current_user_can( 'manage_options' ) ) {
716 + if ( WPDA::current_user_is_admin() ) {
695 717 ?>
696 718 <div>
697 719 <a href="javascript:addPanel()"
698 720 class="wpda-dashboard-item wpda_tooltip"
@@ -772,9 +794,9 @@
772 794 Update to premium to analyse, report and share your data.
773 795 </td>
774 796 <td style="white-space:nowrap">
775 797 <a href="https://wpdataaccess.com/pricing/" target="_blank" class="button button-primary">UPGRADE TO PREMIUM</a>
776 - <a href="https://wpdataaccess.com/docs/dashboards-and-widgets/getting-started/" target="_blank" class="button">READ MORE</a>
798 + <a href="https://docs.legacy.wpdataaccess.com/docs/bi-getting-started/" target="_blank" class="button">READ MORE</a>
777 799 </td>
778 800 </tr>
779 801 </table>
780 802 </div>
@@ -851,9 +873,8 @@
851 873 * @return void
852 874 */
853 875 protected function toolbar_wpda() {
854 876 $schema_name = ( isset( $_REQUEST['wpdaschema_name'] ) ? esc_attr( sanitize_text_field( wp_unslash( $_REQUEST['wpdaschema_name'] ) ) ) : '' );
855 - // phpcs:ignore WordPress.Security.NonceVerification
856 877 ?>
857 878 <form id="wpda_new_design" style="display: none" method="post" action="?page=<?php
858 879 echo esc_attr( WP_Data_Access_Admin::PAGE_DESIGNER );
859 880 ?>">
@@ -858,8 +879,11 @@
858 879 echo esc_attr( WP_Data_Access_Admin::PAGE_DESIGNER );
859 880 ?>">
860 881 <input type="hidden" name="action" value="create_table">
861 882 <input type="hidden" name="caller" value="dataexplorer">
883 + <input type="hidden" name="_wpnonce" value="<?php
884 + echo esc_attr( wp_create_nonce( "wpda-query-" . WPDA_Design_Table_Model::get_base_table_name() . "--" ) );
885 + ?>">
862 886 </form>
863 887 <form id="wpda_goto_backup" style="display: none" method="post" action="?page=<?php
864 888 echo esc_attr( WP_Data_Access_Admin::PAGE_MAIN );
865 889 ?>&page_action=wpda_backup">
@@ -871,10 +895,9 @@
871 895 <div class="wpda-nowrap">
872 896 <div>
873 897 <div>
874 898 <a href="<?php
875 - echo admin_url( 'admin.php' );
876 - // phpcs:ignore WordPress.Security.EscapeOutput
899 + echo esc_url( admin_url( 'admin.php' ) );
877 900 ?>?page=<?php
878 901 echo esc_attr( WP_Data_Access_Admin::PAGE_MAIN );
879 902 ?>&page_action=wpda_global_search"
880 903 class="wpda-dashboard-item wpda_tooltip"
@@ -897,41 +920,21 @@
897 920 </a>
898 921 </div>
899 922 </div><div>
900 923 <div>
901 - <?php
902 - if ( 'new' !== $this->current_version ) {
903 - ?>
904 - <a onclick="jQuery('#upload_file_container_multi').show();"
905 - href="javascript:void(0)"
906 - class="wpda-dashboard-item wpda_tooltip"
907 - title="Import and execute SQL script files"
908 - >
909 - <i class="fas fa-file-code"></i>
910 - <div>
911 - Import SQL files
912 - </div>
913 - </a>
914 - <?php
915 - } else {
916 - ?>
917 - <a onClick="window.ppActionEnableImport();"
918 - href="javascript:void(0)"
919 - class="wpda-dashboard-item wpda_tooltip"
920 - title="Import and execute SQL script files"
921 - >
922 - <i class="fas fa-file-code"></i>
923 - <div>
924 - Import SQL files
925 - </div>
926 - </a>
927 - <?php
928 - }
929 - ?>
924 + <a onClick="window.ppActionEnableImport();"
925 + href="javascript:void(0)"
926 + class="wpda-dashboard-item wpda_tooltip"
927 + title="Import and execute SQL script files"
928 + >
929 + <i class="fas fa-file-code"></i>
930 + <div>
931 + Import SQL files
932 + </div>
933 + </a>
930 934 </div><div>
931 935 <a href="<?php
932 - echo admin_url( 'admin.php' );
933 - // phpcs:ignore WordPress.Security.EscapeOutput
936 + echo esc_url( admin_url( 'admin.php' ) );
934 937 ?>?page=<?php
935 938 echo esc_attr( WP_Data_Access_Admin::PAGE_MAIN );
936 939 ?>&page_action=wpda_import_csv"
937 940 class="wpda-dashboard-item wpda_tooltip"
@@ -942,96 +945,53 @@
942 945 Import CSV files
943 946 </div>
944 947 </a>
945 948 </div><div>
946 - <a href="javascript:void(0)"
947 - id="wpda_toolbar_icon_go_backup"
948 - class="wpda-dashboard-item wpda_tooltip"
949 - title="Data Backup - unattended exports"
950 - >
951 - <i class="fas fa-file-archive"></i>
952 - <div>
953 - Data Backup
954 - </div>
955 - </a>
956 - </div>
957 - </div><div>
958 - <?php
959 - if ( 'new' !== $this->current_version ) {
960 - ?>
961 - <div>
962 - <a onclick="jQuery('#wpda_db_container').show(); jQuery('#local_database').focus();"
963 - href="javascript:void(0)"
964 - class="wpda-dashboard-item wpda_tooltip"
965 - title="Add remote database or create local database"
966 - >
967 - <i id="wpda_toolbar_icon_add_database" class="fas fa-database"></i>
968 - <div>
969 - Add database
970 - </div>
971 - </a>
972 - </div>
973 - <?php
974 - } else {
975 - ?>
976 - <div>
977 - <a onclick="jQuery('#wpda_manage_databases').show(); jQuery('#local_database').focus();"
978 - href="javascript:void(0)"
979 - class="wpda-dashboard-item wpda_tooltip"
980 - title="Manage remote database connections and local databases"
981 - >
982 - <i id="wpda_toolbar_icon_add_database" class="fas fa-server"></i>
983 - <div>
984 - Databases
985 - </div>
986 - </a>
987 - </div><?php
949 + <a onclick="window.ppActionEnableExport();"
950 + href="javascript:void(0)"
951 + class="wpda-dashboard-item wpda_tooltip"
952 + title="Unattended scheduled exports"
953 + >
954 + <i class="fas fa-clock"></i>
955 + <div>
956 + Export
957 + </div>
958 + </a>
959 + </div><?php
960 + $wpda_db_options_activated = get_option( 'wpda_db_options_activated' );
961 + if ( is_array( $wpda_db_options_activated ) && 0 < count( $wpda_db_options_activated ) ) {
962 + // Show old Data Backup feature only if still in use
963 + ?><div>
964 + <a href="javascript:void(0)"
965 + id="wpda_toolbar_icon_go_backup"
966 + class="wpda-dashboard-item wpda_tooltip"
967 + title="Data Backup - unattended exports"
968 + >
969 + <i class="fas fa-file-archive"></i>
970 + <div>
971 + Data Backup
972 + </div>
973 + </a>
974 + </div><?php
988 975 }
989 976 ?>
990 - <?php
977 + </div><div>
978 + <div>
979 + <a onclick="jQuery('#wpda_manage_databases').show(); jQuery('#local_database').focus();"
980 + href="javascript:void(0)"
981 + class="wpda-dashboard-item wpda_tooltip"
982 + title="Manage remote database connections and local databases"
983 + >
984 + <i id="wpda_toolbar_icon_add_database" class="fas fa-server"></i>
985 + <div>
986 + Databases
987 + </div>
988 + </a>
989 + </div><?php
991 990 ?>
992 991 </div>
993 992 </div>
994 - <div class="wpda-promotion" style="font-size: 16px">
995 - <?php
996 - if ( 'new' !== $this->current_version ) {
997 - ?>
998 - <a href="?page=<?php
999 - echo esc_attr( WP_Data_Access_Admin::PAGE_MAIN );
1000 - ?>&de=new"
1001 - style="display: flex; align-items: center; gap: 5px;"
1002 - >
1003 - <i class="fas fa-toggle-off"></i>
1004 - <span>Switch to new Data Explorer</span>
1005 - </a>
1006 - <?php
1007 - } else {
1008 - ?>
1009 - <span
1010 - style="display: flex; align-items: center; gap: 5px; white-space: nowrap;"
1011 - >
1012 - <a href="?page=<?php
1013 - echo esc_attr( WP_Data_Access_Admin::PAGE_MAIN );
1014 - ?>&de=old"
1015 - style="display: flex; align-items: center; gap: 5px; white-space: nowrap;"
1016 - >
1017 - <i class="fas fa-toggle-on"></i>
1018 - <span>Switch to old Data Explorer</span>
1019 - </a>
1020 - <span>
1021 - <a href="https://wpdataaccess.com/2024/01/26/the-new-data-explorer-wp-data-access-5-4-0/"
1022 - target="_blank"
1023 - class="wpda_tooltip"
1024 - title="Click to read more"
1025 - >
1026 - <i class="fas fa-circle-info"></i>
1027 - </a>
1028 - </span>
1029 - </span>
1030 - <?php
1031 - }
1032 - ?>
1033 - </div>
993 + <div></div>
1034 994 <?php
1035 995 //$this->get_promotions('wpda');
1036 996 ?>
1037 997 </div>
@@ -1038,111 +998,8 @@
1038 998 <?php
1039 999 }
1040 1000
1041 1001 /**
1042 - * Data Explorer table page toolbar
1043 - *
1044 - * @return void
1045 - */
1046 - protected function toolbar_wpda_table() {
1047 - ?>
1048 - <form id="wpda_new_row" style="display: none" method="post" action="?page=<?php
1049 - echo esc_attr( WP_Data_Access_Admin::PAGE_MAIN );
1050 - ?>">
1051 - <?php
1052 - if ( isset( $_REQUEST['wpdaschema_name'] ) ) {
1053 - // phpcs:ignore WordPress.Security.NonceVerification
1054 - $schema_name = esc_attr( sanitize_text_field( wp_unslash( $_REQUEST['wpdaschema_name'] ) ) );
1055 - // phpcs:ignore WordPress.Security.NonceVerification
1056 - echo "<input type='hidden' name='wpdaschema_name' value='{$schema_name}'>";
1057 - // phpcs:ignore WordPress.Security.EscapeOutput
1058 - }
1059 - ?>
1060 - <input type="hidden" id="wpda_new_row_table_name" name="table_name" value="">
1061 - <input type="hidden" name="action" value="new">
1062 - </form>
1063 - <div id="wpda-dashboard-toolbar" class="wpda-dashboard-toolbar" style="display:none">
1064 - <div class="wpda-nowrap">
1065 - <div>
1066 - <div>
1067 - <a href="javascript:void(0)"
1068 - id="wpda_toolbar_icon_add_row"
1069 - class="wpda-dashboard-item wpda_tooltip"
1070 - title="Add new row to table"
1071 - >
1072 - <i class="fas fa-plus-circle"></i>
1073 - <div>
1074 - Add row
1075 - </div>
1076 - </a>
1077 - </div><div>
1078 - <a onclick="jQuery('#upload_file_container').show()"
1079 - href="javascript:void(0)"
1080 - class="wpda-dashboard-item wpda_tooltip"
1081 - title="Allows only imports into table authors"
1082 - >
1083 - <i class="fas fa-code"></i>
1084 - <div>
1085 - Import rows
1086 - </div>
1087 - </a>
1088 - </div>
1089 - </div>
1090 - </div>
1091 - <?php
1092 - $this->get_promotions( 'table' );
1093 - ?>
1094 - </div>
1095 - <?php
1096 - }
1097 -
1098 - /**
1099 - * Data Explorer data entry form toolbar
1100 - *
1101 - * @return void
1102 - */
1103 - protected function toolbar_wpda_row() {
1104 - ?>
1105 - <form id="wpda_new_row" style="display: none" method="post" action="?page=<?php
1106 - echo esc_attr( WP_Data_Access_Admin::PAGE_MAIN );
1107 - ?>">
1108 - <?php
1109 - if ( isset( $_REQUEST['wpdaschema_name'] ) ) {
1110 - // phpcs:ignore WordPress.Security.NonceVerification
1111 - $schema_name = esc_attr( sanitize_text_field( wp_unslash( $_REQUEST['wpdaschema_name'] ) ) );
1112 - // phpcs:ignore WordPress.Security.NonceVerification
1113 - echo "<input type='hidden' name='wpdaschema_name' value='{$schema_name}'>";
1114 - // phpcs:ignore WordPress.Security.EscapeOutput
1115 - }
1116 - ?>
1117 - <input type="hidden" id="wpda_new_row_table_name" name="table_name" value="">
1118 - <input type="hidden" name="action" value="new">
1119 - </form>
1120 - <div id="wpda-dashboard-toolbar" class="wpda-dashboard-toolbar" style="display:none">
1121 - <div class="wpda-nowrap">
1122 - <div>
1123 - <div>
1124 - <a href="javascript:void(0)"
1125 - id="wpda_toolbar_icon_add_row"
1126 - class="wpda-dashboard-item wpda_tooltip"
1127 - title="Add new row to table"
1128 - >
1129 - <i class="fas fa-plus-circle"></i>
1130 - <div>
1131 - Add row
1132 - </div>
1133 - </a>
1134 - </div>
1135 - </div>
1136 - </div>
1137 - <?php
1138 - $this->get_promotions( 'row' );
1139 - ?>
1140 - </div>
1141 - <?php
1142 - }
1143 -
1144 - /**
1145 1002 * Data Backup toolbar
1146 1003 *
1147 1004 * @return void
1148 1005 */
@@ -1221,8 +1078,9 @@
1221 1078 *
1222 1079 * @return void
1223 1080 */
1224 1081 protected function toolbar_apps() {
1082 + $has_apps = WPDA_App_Model::has_any();
1225 1083 ?>
1226 1084 <div id="wpda-dashboard-toolbar" class="wpda-dashboard-toolbar" style="display:none">
1227 1085 <div class="wpda-nowrap">
1228 1086 <div>
@@ -1232,9 +1090,9 @@
1232 1090 title="Create new app"
1233 1091 >
1234 1092 <i class="fas fa-plus-circle"></i>
1235 1093 <div>
1236 - Create new app
1094 + Create New App
1237 1095 </div>
1238 1096 </a>
1239 1097 </div><div>
1240 1098 <a href="javascript:window.ppActionRenameDatabase()"
@@ -1252,14 +1110,32 @@
1252 1110 <div>
1253 1111 Rename Database
1254 1112 </div>
1255 1113 </a>
1256 - </div>
1114 + </div><?php
1115 + ?>
1257 1116 </div>
1258 1117 </div>
1259 - <div class="wpda-promotion" style="font-size: 16px">
1260 - <span>
1261 - <a href="https://wpdataaccess.com/docs/app-builder/whats-the-app-builder/"
1118 + <div class="wpda-promotion" style="display: flex; align-items: center; gap: 5px; font-size: 16px;">
1119 + <?php
1120 + if ( !$has_apps ) {
1121 + ?>
1122 + <span>
1123 + <strong>
1124 + New to the App Builder? Watch the Getting Started tutorial! 👉
1125 + </strong>
1126 + </span><?php
1127 + }
1128 + ?><span>
1129 + <a href="https://www.youtube.com/watch?v=j0MJvuMG7k8"
1130 + target="_blank"
1131 + class="wpda_tooltip"
1132 + title="App Builder Getting Started tutorial"
1133 + >
1134 + <i class="fas fab fa-square-youtube"></i>
1135 + </a>
1136 + </span><span>
1137 + <a href="https://docs.rad.wpdataaccess.com/"
1262 1138 target="_blank"
1263 1139 class="wpda_tooltip"
1264 1140 title="Online App Builder documentation"
1265 1141 >
@@ -1274,48 +1150,8 @@
1274 1150 <?php
1275 1151 }
1276 1152
1277 1153 /**
1278 - * Query Builder toolbar
1279 - *
1280 - * @return void
1281 - */
1282 - protected function toolbar_sql() {
1283 - ?>
1284 - <div id="wpda-dashboard-toolbar" class="wpda-dashboard-toolbar" style="display:none">
1285 - <div class="wpda-nowrap">
1286 - <div>
1287 - <div>
1288 - <a href="javascript:tabNew()"
1289 - class="wpda-dashboard-item wpda_tooltip"
1290 - title="Create new query"
1291 - >
1292 - <i class="fas fa-plus-circle"></i>
1293 - <div>
1294 - Create new query
1295 - </div>
1296 - </a>
1297 - </div><div>
1298 - <a href="javascript:openQuery()"
1299 - class="wpda-dashboard-item wpda_tooltip"
1300 - title="Open existing query"
1301 - >
1302 - <i class="fas fa-folder-open"></i>
1303 - <div>
1304 - Open existing query
1305 - </div>
1306 - </a>
1307 - </div>
1308 - </div>
1309 - </div>
1310 - <?php
1311 - $this->get_promotions( 'sql' );
1312 - ?>
1313 - </div>
1314 - <?php
1315 - }
1316 -
1317 - /**
1318 1154 * Data Designer toolbar
1319 1155 *
1320 1156 * @return void
1321 1157 */
@@ -1327,8 +1163,11 @@
1327 1163 <input type="hidden" name="action" value="edit">
1328 1164 <input type="hidden" name="table_name" value="<?php
1329 1165 echo esc_attr( WPDA_Design_Table_Model::get_base_table_name() );
1330 1166 ?>">
1167 + <input type="hidden" name="_wpnonce" value="<?php
1168 + echo esc_attr( wp_create_nonce( "wpda-query-" . WPDA_Design_Table_Model::get_base_table_name() . "--" ) );
1169 + ?>">
1331 1170 </form>
1332 1171 <div id="wpda-dashboard-toolbar" class="wpda-dashboard-toolbar" style="display:none">
1333 1172 <div class="wpda-nowrap">
1334 1173 <div>
@@ -1342,9 +1181,9 @@
1342 1181 Create table design
1343 1182 </div>
1344 1183 </a>
1345 1184 </div><div>
1346 - <a onclick="jQuery('#upload_file_container').show()"
1185 + <a onclick="alert('This feature has been removed. Please use the Data Explorer import feature.')"
1347 1186 href="javascript:void(0)"
1348 1187 class="wpda-dashboard-item wpda_tooltip"
1349 1188 title="Import table designs"
1350 1189 >
@@ -1390,9 +1229,9 @@
1390 1229 Create data table
1391 1230 </div>
1392 1231 </a>
1393 1232 </div><div>
1394 - <a onclick="jQuery('#upload_file_container').show()"
1233 + <a onclick="alert('This feature has been removed. Please use the Data Explorer import feature.')"
1395 1234 href="javascript:void(0)"
1396 1235 class="wpda-dashboard-item wpda_tooltip"
1397 1236 title="Import data tables"
1398 1237 >
@@ -1449,9 +1288,9 @@
1449 1288 Create project
1450 1289 </div>
1451 1290 </a>
1452 1291 </div><div>
1453 - <a onclick="jQuery('#upload_file_container_multi').show()"
1292 + <a onclick="jQuery(alert('This feature has been removed. Please use the Data Explorer import feature.')).show()"
1454 1293 href="javascript:void(0)"
1455 1294 class="wpda-dashboard-item wpda_tooltip"
1456 1295 title="Import projects"
1457 1296 >
@@ -1539,9 +1378,9 @@
1539 1378 </select>
1540 1379 <?php
1541 1380 if ( !class_exists( 'Code_Manager\\Code_Manager_Model' ) || !class_exists( 'WPDataAccess\\Premium\\WPDAPRO_Dashboard\\WPDAPRO_Widget_Project' ) ) {
1542 1381 ?>
1543 - <a href="https://wpdataaccess.com/docs/dashboards-and-widgets/getting-started/" target="_blank">
1382 + <a href="https://docs.legacy.wpdataaccess.com/docs/bi-getting-started/" target="_blank">
1544 1383 <i class="fas fa-question-circle pointer wpda_tooltip"
1545 1384 style="font-size: 170%; vertical-align: middle"
1546 1385 title="Your installation does not support all available widget types! Click to learn how to install more widget types..."></i>
1547 1386 </a>
@@ -1655,9 +1494,9 @@
1655 1494 )</option>
1656 1495 <?php
1657 1496 $rdbs = WPDADB::get_remote_databases();
1658 1497 ksort( $rdbs );
1659 - //phpcs:ignore - 8.1 proof
1498 + // phpcs:ignore -- 8.1 proof
1660 1499 foreach ( $rdbs as $key => $rdb ) {
1661 1500 ?>
1662 1501 <option value="<?php
1663 1502 echo esc_attr( $key );
@@ -1839,9 +1678,9 @@
1839 1678 // Following line requires PHP 7.
1840 1679 // $last_key = array_key_last($this->dashboard_positions[0]); .
1841 1680 $last_key = 1;
1842 1681 if ( is_array( $this->dashboard_positions ) && count( $this->dashboard_positions ) > 0 ) {
1843 - //phpcs:ignore - 8.1 proof
1682 + // phpcs:ignore -- 8.1 proof
1844 1683 foreach ( $this->dashboard_positions[0] as $key => $val ) {
1845 1684 $last_key = $key;
1846 1685 }
1847 1686 }
@@ -1932,14 +1771,14 @@
1932 1771 let wpda_wpnonce_refresh = "<?php
1933 1772 echo esc_attr( wp_create_nonce( WPDA_Widget::WIDGET_REFRESH . WPDA::get_current_user_login() ) );
1934 1773 ?>";
1935 1774 let wpda_ajaxurl = "<?php
1936 - echo admin_url( 'admin-ajax.php' );
1937 - // phpcs:ignore WordPress.Security.EscapeOutput
1775 + echo esc_url( admin_url( 'admin-ajax.php' ) );
1938 1776 ?>";
1939 1777 let wpda_databases = '<?php
1778 + // phpcs:disable WordPress.Security.EscapeOutput
1940 1779 echo $this->get_databases();
1941 - // phpcs:ignore WordPress.Security.EscapeOutput
1780 + // phpcs:enable WordPress.Security.EscapeOutput
1942 1781 ?>';
1943 1782 let wpda_shared_dashboards = <?php
1944 1783 echo json_encode( $this->shared_dashboards );
1945 1784 // phpcs:ignore
@@ -1987,21 +1826,20 @@
1987 1826 public static function save() {
1988 1827 $wp_nonce = ( isset( $_POST['wp_nonce'] ) ? sanitize_text_field( wp_unslash( $_POST['wp_nonce'] ) ) : '' );
1989 1828 if ( !wp_verify_nonce( $wp_nonce, static::DASHBOARD_SAVE . WPDA::get_current_user_login() ) ) {
1990 1829 WPDA::sent_header( 'application/json' );
1991 - echo static::msg( 'ERROR', 'Token expired, please refresh page' );
1992 - // phpcs:ignore WordPress.Security.EscapeOutput
1830 + static::msg( 'ERROR', 'Token expired, please refresh page' );
1993 1831 wp_die();
1994 1832 }
1833 + // phpcs:disable WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
1995 1834 $widgets = ( isset( $_POST['wpda_widgets'] ) ? WPDA::sanitize_text_field_array( $_POST['wpda_widgets'] ) : array() );
1996 - // phpcs:ignore WordPress.Security.ValidatedSanitizedInput
1835 + // phpcs:enable WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
1997 1836 $save = array();
1998 1837 foreach ( $widgets as $widget ) {
1999 1838 $save[$widget['widgetName']] = $widget;
2000 1839 }
2001 1840 update_user_meta( WPDA::get_current_user_id(), self::USER_DASHBOARD, $save );
2002 - echo self::msg( 'SUCCESS', 'Widget succesfully saved' );
2003 - // phpcs:ignore WordPress.Security.EscapeOutput
1841 + self::msg( 'SUCCESS', 'Widget succesfully saved' );
2004 1842 wp_die();
2005 1843 }
2006 1844
2007 1845 /**
@@ -2012,10 +1850,9 @@
2012 1850 public static function get_list() {
2013 1851 $wp_nonce = ( isset( $_POST['wpda_wpnonce'] ) ? sanitize_text_field( wp_unslash( $_POST['wpda_wpnonce'] ) ) : '' );
2014 1852 if ( !wp_verify_nonce( $wp_nonce, WPDA_Widget::WIDGET_REFRESH . WPDA::get_current_user_login() ) ) {
2015 1853 WPDA::sent_header( 'application/json' );
2016 - echo static::msg( 'ERROR', 'Token expired, please refresh page' );
2017 - // phpcs:ignore WordPress.Security.EscapeOutput
1854 + static::msg( 'ERROR', 'Token expired, please refresh page' );
2018 1855 wp_die();
2019 1856 }
2020 1857 // Placeholder: implemented in the premium version.
2021 1858 echo '';
@@ -2030,10 +1867,9 @@
2030 1867 public static function delete_widget() {
2031 1868 $wp_nonce = ( isset( $_POST['wpda_wpnonce'] ) ? sanitize_text_field( wp_unslash( $_POST['wpda_wpnonce'] ) ) : '' );
2032 1869 if ( !wp_verify_nonce( $wp_nonce, self::DASHBOARD_SAVE . WPDA::get_current_user_login() ) ) {
2033 1870 WPDA::sent_header( 'application/json' );
2034 - echo static::msg( 'ERROR', 'Token expired, please refresh page' );
2035 - // phpcs:ignore WordPress.Security.EscapeOutput
1871 + static::msg( 'ERROR', 'Token expired, please refresh page' );
2036 1872 wp_die();
2037 1873 }
2038 1874 // Placeholder: implemented in the premium version.
2039 1875 echo '';
@@ -2048,10 +1884,9 @@
2048 1884 public static function edit_chart() {
2049 1885 $wp_nonce = ( isset( $_POST['wpda_wpnonce'] ) ? sanitize_text_field( wp_unslash( $_POST['wpda_wpnonce'] ) ) : '' );
2050 1886 if ( !wp_verify_nonce( $wp_nonce, WPDA_Widget::WIDGET_REFRESH . WPDA::get_current_user_login() ) ) {
2051 1887 WPDA::sent_header( 'application/json' );
2052 - echo static::msg( 'ERROR', 'Token expired, please refresh page' );
2053 - // phpcs:ignore WordPress.Security.EscapeOutput
1888 + static::msg( 'ERROR', 'Token expired, please refresh page' );
2054 1889 wp_die();
2055 1890 }
2056 1891 // Placeholder: implemented in the premium version.
2057 1892 echo '';
@@ -2066,10 +1901,9 @@
2066 1901 public static function load_widget() {
2067 1902 $wp_nonce = ( isset( $_POST['wpda_wpnonce'] ) ? sanitize_text_field( wp_unslash( $_POST['wpda_wpnonce'] ) ) : '' );
2068 1903 if ( !wp_verify_nonce( $wp_nonce, WPDA_Widget::WIDGET_REFRESH . WPDA::get_current_user_login() ) ) {
2069 1904 WPDA::sent_header( 'application/json' );
2070 - echo static::msg( 'ERROR', 'Token expired, please refresh page' );
2071 - // phpcs:ignore WordPress.Security.EscapeOutput
1905 + static::msg( 'ERROR', 'Token expired, please refresh page' );
2072 1906 wp_die();
2073 1907 }
2074 1908 // Placeholder: implemented in the premium version.
2075 1909 echo '';
@@ -2112,13 +1946,13 @@
2112 1946 * @return false|string
2113 1947 */
2114 1948 public static function msg( $status, $msg ) {
2115 1949 $error = array(
2116 - 'status' => $status,
1950 + 'status' => esc_attr( $status ),
2117 1951 'msg' => $msg,
2118 1952 );
2119 - return json_encode( $error );
2120 - // phpcs:ignore
1953 + echo json_encode( $error );
1954 + // phpcs:ignore WordPress.Security.EscapeOutput
2121 1955 }
2122 1956
2123 1957 private function get_promotions( $tool ) {
2124 1958 switch ( $tool ) {
@@ -2126,68 +1960,16 @@
2126 1960 case 'projects':
2127 1961 case 'templates':
2128 1962 case 'charts':
2129 1963 $promotions = array(array(
2130 - 'This tool will transition to the new App Builder. Please migrate on time.' => array(null, 'fa-lightbulb'),
1964 + 'This tool will be transitioned to the new App Builder. Please migrate on time.' => array(null, 'fa-lightbulb'),
2131 1965 ));
2132 1966 break;
2133 - case 'csv':
2134 - $promotions = array(array(
2135 - 'Use the connection wizards for automated CSV synchronization.' => array('https://wpdataaccess.com/docs/remote-data-files/csv-files/', 'fa-lightbulb'),
2136 - ));
2137 - break;
2138 - case 'publisher_OLD':
2139 - $promotions = array(
2140 - array(
2141 - 'Change data table color, spacing, border radius and modal popup behaviour.' => array('https://wpdataaccess.com/data-tables-styling/premium-styling/', 'fa-palette'),
2142 - ),
2143 - array(
2144 - 'Reorder data table elements with drag and drop.' => array('https://wpdataaccess.com/docs/data-tables/extension-manager/', 'fa-star'),
2145 - ),
2146 - array(
2147 - 'Add buttons to support CSV, Excel, PDF and SQL downloads.' => array('https://wpdataaccess.com/docs/data-tables/extension-manager/', 'fa-cloud-download'),
2148 - ),
2149 - array(
2150 - 'Add user friendly Search Panes to simplify searching.' => array('https://wpdataaccess.com/docs/data-tables-interactive-filters/search-panes/', 'fa-magic'),
2151 - ),
2152 - array(
2153 - 'Use the Search Builder to add interactive searching.' => array('https://wpdataaccess.com/docs/data-tables-interactive-filters/search-builder/', 'fa-search'),
2154 - ),
2155 - array(
2156 - 'Synchronize your Google Sheets from the Data Explorer.' => array('https://wpdataaccess.com/docs/remote-data-files/public-url/#google-sheets', 'fa-database'),
2157 - )
2158 - );
2159 - break;
2160 - case 'wpda':
2161 - $promotions = array(
2162 - array(
2163 - 'Access your SQL Server tables from the Data Explorer.' => array('https://wpdataaccess.com/docs/remote-database-connections/sql-server/', 'fa-database'),
2164 - ),
2165 - array(
2166 - 'Access your PostgreSQL tables from the Data Explorer.' => array('https://wpdataaccess.com/docs/remote-database-connections/postgresql/', 'fa-database'),
2167 - ),
2168 - array(
2169 - 'Access your Oracle tables from the Data Explorer.' => array('https://wpdataaccess.com/data-explorer/remote-connection-wizard/remote-database-connections/oracle/', 'fa-database'),
2170 - ),
2171 - array(
2172 - 'Access your remote MariaDB | MySQL tables from the Data Explorer.' => array('https://wpdataaccess.com/docs/remote-database-connections/mariadb-mysql/', 'fa-database'),
2173 - ),
2174 - array(
2175 - 'Access your CSV files directly from the Data Explorer.' => array('https://wpdataaccess.com/docs/remote-data-files/csv-files/', 'fa-lightbulb'),
2176 - ),
2177 - array(
2178 - 'Access your MS Access tables from the Data Explorer.' => array('https://wpdataaccess.com/docs/remote-data-files/ms-access/', 'fa-database'),
2179 - ),
2180 - array(
2181 - 'Synchronize your Google Sheets from the Data Explorer.' => array('https://wpdataaccess.com/docs/remote-data-files/public-url/#google-sheets', 'fa-database'),
2182 - )
2183 - );
2184 - break;
2185 1967 default:
2186 1968 $promotions = array();
2187 1969 }
2188 1970 if ( count( $promotions ) > 0 ) {
2189 - //phpcs:ignore - 8.1 proof
1971 + // phpcs:ignore -- 8.1 proof
2190 1972 $promotion_index = random_int( 0, count( $promotions ) - 1 );
2191 1973 $promotion = $promotions[$promotion_index];
2192 1974 $promotion_text = key( $promotion );
2193 1975 $promotion_url = $promotion[$promotion_text][0];
@@ -2214,4 +1996,6 @@
2214 1996 }
2215 1997 }
2216 1998
2217 1999 }
2000 +
2001 +// phpcs:enable WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing