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 +379 -477 5.5.4 → 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,9 +175,9 @@
174 175 * @var string|null
175 176 */
176 177 protected $message_type = null;
177 178
178 - private $current_version;
179 + private $option_legacy_tools;
179 180
180 181 /**
181 182 * Constructor
182 183 *
@@ -189,13 +190,13 @@
189 190 $this->wp_nonce_save = wp_create_nonce( static::DASHBOARD_SAVE . WPDA::get_current_user_login() );
190 191 // Load Data Tables resources.
191 192 \WPDataAccess\Data_Tables\WPDA_Data_Tables::enqueue_styles_and_script();
192 193 }
193 - $this->current_version = get_user_meta( WPDA::get_current_user_id(), 'wpda_data_explorer', true );
194 194 // Start with empty array.
195 195 if ( $widget_mode ) {
196 196 update_user_meta( WPDA::get_current_user_id(), self::USER_DASHBOARD, array() );
197 197 }
198 + $this->option_legacy_tools = WPDA::get_option( WPDA::OPTION_PLUGIN_LEGACY_TOOLS );
198 199 }
199 200
200 201 /**
201 202 * Add dashboard
@@ -216,16 +217,14 @@
216 217 */
217 218 public function dashboard() {
218 219 wp_enqueue_style( 'wpdataaccess_dashboard' );
219 220 wp_enqueue_script( 'wpdataaccess_dashboard' );
220 - if ( current_user_can( 'manage_options' ) ) {
221 + if ( WPDA::current_user_is_admin() ) {
221 222 $this->dashboard_default();
222 223 $this->dashboard_mobile();
223 224 }
224 225 if ( isset( $_REQUEST['page'] ) ) {
225 - // phpcs:ignore WordPress.Security.NonceVerification
226 226 switch ( $_REQUEST['page'] ) {
227 - // phpcs:ignore WordPress.Security.NonceVerification
228 227 case 'wpda_dashboard':
229 228 $this->toolbar();
230 229 $this->add_forms();
231 230 $this->tabs();
@@ -234,24 +233,12 @@
234 233 $this->dashboard_js();
235 234 break;
236 235 case WP_Data_Access_Admin::PAGE_MAIN:
237 236 if ( !isset( $_REQUEST['page_action'] ) ) {
238 - // phpcs:ignore WordPress.Security.NonceVerification
239 - if ( !isset( $_REQUEST['table_name'] ) ) {
240 - // phpcs:ignore WordPress.Security.NonceVerification
241 - $this->toolbar_wpda();
242 - } else {
243 - if ( !isset( $_REQUEST['action'] ) || 'new' !== $_REQUEST['action'] && 'edit' !== $_REQUEST['action'] ) {
244 - $this->toolbar_wpda_table();
245 - } else {
246 - $this->toolbar_wpda_row();
247 - }
248 - }
237 + $this->toolbar_wpda();
249 238 } elseif ( 'wpda_backup' === $_REQUEST['page_action'] && (!isset( $_REQUEST['action'] ) || 'remove' === $_REQUEST['action'] || 'update' === $_REQUEST['action'] || 'add' === $_REQUEST['action']) ) {
250 - // phpcs:ignore WordPress.Security.NonceVerification
251 239 $this->toolbar_backup();
252 240 } elseif ( 'wpda_import_csv' === $_REQUEST['page_action'] ) {
253 - // phpcs:ignore WordPress.Security.NonceVerification
254 241 $this->toolbar_import_csv();
255 242 }
256 243 break;
257 244 case WP_Data_Access_Admin::PAGE_APPS:
@@ -256,11 +243,8 @@
256 243 break;
257 244 case WP_Data_Access_Admin::PAGE_APPS:
258 245 $this->toolbar_apps();
259 246 break;
260 - case WP_Data_Access_Admin::PAGE_QUERY_BUILDER:
261 - $this->toolbar_sql();
262 - break;
263 247 case WP_Data_Access_Admin::PAGE_DESIGNER:
264 248 if ( !isset( $_REQUEST['action'] ) || 'new' !== $_REQUEST['action'] && 'edit' !== $_REQUEST['action'] ) {
265 249 $this->toolbar_designer();
266 250 }
@@ -284,8 +268,46 @@
284 268 }
285 269 break;
286 270 }
287 271 }
272 + if ( isset( $_GET['page_iaction'] ) ) {
273 + // Perform interactive action to auto start user selected feature.
274 + ?>
275 + <script>
276 + jQuery(function() {
277 + const iaction = "<?php
278 + // phpcs:disable WordPress.Security.ValidatedSanitizedInput.MissingUnslash
279 + echo esc_attr( sanitize_text_field( $_GET['page_iaction'] ) );
280 + // phpcs:enable WordPress.Security.ValidatedSanitizedInput.MissingUnslash
281 + ?>";
282 + switch (iaction) {
283 + case "create_new_app":
284 + var interval = setInterval(
285 + function() {
286 + if (window.ppActionCreateApp !== undefined) {
287 + window.ppActionCreateApp();
288 + clearInterval(interval);
289 + }
290 + }, 100);
291 + break;
292 + case "wpda_import_sql":
293 + var interval = setInterval(
294 + function() {
295 + if (window.ppActionEnableImport !== undefined) {
296 + window.ppActionEnableImport();
297 + clearInterval(interval);
298 + }
299 + }, 100);
300 + break;
301 + case "manage_databases":
302 + jQuery('#wpda_manage_databases').show();
303 + jQuery('#local_database').focus();
304 + break;
305 + }
306 + });
307 + </script>
308 + <?php
309 + }
288 310 }
289 311
290 312 /**
291 313 * Get correct help url for current page
@@ -292,45 +314,99 @@
292 314 *
293 315 * @return string
294 316 */
295 317 protected function get_help_url() {
296 - $help_root = 'https://wpdataaccess.com/docs/';
318 + $help_url = 'https://docs.wpdataaccess.com/';
297 319 if ( isset( $_REQUEST['page'] ) ) {
298 - // phpcs:ignore WordPress.Security.NonceVerification
299 320 switch ( $_REQUEST['page'] ) {
300 - // phpcs:ignore WordPress.Security.NonceVerification
301 321 case \WP_Data_Access_Admin::PAGE_MAIN:
302 - $help_url = $help_root . 'data-explorer/data-explorer-getting-started/';
322 + $help_url = 'https://docs.explorer.wpdataaccess.com/';
303 323 break;
324 + case \WP_Data_Access_Admin::PAGE_APPS:
325 + $help_url = 'https://docs.rad.wpdataaccess.com/';
326 + break;
304 327 case \WP_Data_Access_Admin::PAGE_QUERY_BUILDER:
305 - $help_url = $help_root . 'query-builder/query-builder-getting-started/';
328 + $help_url = 'https://docs.sql.wpdataaccess.com/';
306 329 break;
307 330 case \WP_Data_Access_Admin::PAGE_DESIGNER:
308 - $help_url = $help_root . 'data-designer/data-designer-getting-started/';
331 + $help_url = 'https://docs.legacy.wpdataaccess.com/docs/data-designer-getting-started/';
309 332 break;
310 333 case \WP_Data_Access_Admin::PAGE_PUBLISHER:
311 - $help_url = $help_root . 'data-tables/data-tables-getting-started/';
334 + $help_url = 'https://docs.legacy.wpdataaccess.com/docs/data-tables-getting-started/';
312 335 break;
313 336 case \WP_Data_Access_Admin::PAGE_DASHBOARD:
314 - $help_url = $help_root . 'dashboards-and-widgets/bi-getting-started/';
337 + $help_url = 'https://docs.legacy.wpdataaccess.com/docs/bi-getting-started/';
315 338 break;
316 339 case \WP_Data_Access_Admin::PAGE_CHARTS:
317 - $help_url = $help_root . 'widgets/chart-widgets/';
340 + $help_url = 'https://docs.legacy.wpdataaccess.com/docs/chart-widgets/';
318 341 break;
319 342 case WPDP::PAGE_MAIN:
320 - $help_url = $help_root . 'data-apps/data-projects/';
343 + $help_url = 'https://docs.legacy.wpdataaccess.com/docs/data-projects/';
321 344 break;
322 345 case WPDP::PAGE_TEMPLATES:
323 - $help_url = $help_root . 'data-apps-templates/project-templates/';
346 + $help_url = 'https://docs.legacy.wpdataaccess.com/docs/project-templates/';
324 347 break;
325 348 case 'wpdataaccess':
326 - $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 + }
327 407 break;
328 - default:
329 - $help_url = $help_root . 'getting-started/wp-data-access-getting-started/';
330 408 }
331 - } else {
332 - $help_url = $help_root . 'getting-started/wp-data-access-getting-started/';
333 409 }
334 410 return $help_url;
335 411 }
336 412
@@ -345,90 +421,119 @@
345 421 <div class="wpda-dashboard">
346 422 <div class="wpda-dashboard-group wpda-dashboard-group-administration">
347 423 <div class="icons">
348 424 <a class="wpda-dashboard-item wpda_tooltip_icons" href="<?php
349 - echo admin_url( 'admin.php' );
350 - // phpcs:ignore WordPress.Security.EscapeOutput
425 + echo esc_url( admin_url( 'admin.php' ) );
426 + ?>?page=wpda_navi" title="Quick links and frequently asked questions">
427 + <div class="fa-solid fa-house"></div>
428 + <div class="label">Tool Guide</div>
429 + </a>
430 + <a class="wpda-dashboard-item wpda_tooltip_icons" href="<?php
431 + echo esc_url( admin_url( 'admin.php' ) );
432 + ?>?page=wpda_apps" title="Data-driven Rapid Application Development">
433 + <div class="fa-solid">
434 + <svg xmlns="http://www.w3.org/2000/svg" height="26px" width="26px" viewBox="4 4 16 16" fill="inherit">
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"/>
436 + </svg>
437 + </div>
438 + <div class="label">App Builder</div>
439 + </a>
440 + <a class="wpda-dashboard-item wpda_tooltip_icons" href="<?php
441 + echo esc_url( admin_url( 'admin.php' ) );
351 442 ?>?page=wpda" title="Manage local and remote data and databases">
352 443 <div class="fa-solid fa-database"></div>
353 444 <div class="label">Explorer</div>
354 445 </a>
355 446 <a class="wpda-dashboard-item wpda_tooltip_icons" href="<?php
356 - echo admin_url( 'admin.php' );
357 - // phpcs:ignore WordPress.Security.EscapeOutput
358 - ?>?page=wpda_query_builder" title="Query builder">
447 + echo esc_url( admin_url( 'admin.php' ) );
448 + ?>?page=wpda_query_builder" title="SQL Query Builder">
359 449 <div class="fa-solid fa-code"></div>
360 450 <div class="label">SQL</div>
361 451 </a>
362 - <a class="wpda-dashboard-item wpda_tooltip_icons" href="<?php
363 - echo admin_url( 'admin.php' );
364 - // phpcs:ignore WordPress.Security.EscapeOutput
365 - ?>?page=wpda_designer" title="Create database tables and indexes">
366 - <div class="fa-solid fa-drafting-compass"></div>
367 - <div class="label">Designer</div>
368 - </a>
369 452 </div>
370 - <div class="subject">Data(base) Administration</div>
453 + <div class="subject">Data(base) Administration & App Development</div>
371 454 </div>
372 - <div class="wpda-dashboard-group wpda-dashboard-group-apps">
455 + <div class="wpda-dashboard-group wpda-dashboard-group-projects"
456 + <?php
457 + if ( !$this->option_legacy_tools['tables'][0] && !$this->option_legacy_tools['forms'][0] && !$this->option_legacy_tools['templates'][0] && !$this->option_legacy_tools['designer'][0] && !$this->option_legacy_tools['dashboards'][0] && !$this->option_legacy_tools['charts'][0] ) {
458 + echo 'style="display: none"';
459 + }
460 + ?>
461 + >
373 462 <div class="icons">
374 - <a class="wpda-dashboard-item wpda_tooltip_icons" href="<?php
375 - echo admin_url( 'admin.php' );
376 - // phpcs:ignore WordPress.Security.EscapeOutput
377 - ?>?page=wpda_apps" title="App Builder
463 + <a class="wpda-dashboard-item wpda_tooltip_icons"
464 + href="<?php
465 + echo esc_url( admin_url( 'admin.php' ) );
466 + ?>?page=wpda_publisher"
467 + title="OLD Table Builder
378 468
379 -Build data driven Apps with
380 -the new Table and Form Builders">
381 - <div class="fa-solid">
382 - <svg xmlns="http://www.w3.org/2000/svg" height="26px" width="26px" viewBox="4 4 16 16" fill="inherit">
383 - <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"/>
384 - </svg>
385 - </div>
386 - <div class="label">Apps</div>
387 - </a>
388 - </div>
389 - <div class="subject" style="color: red; font-weight: bold">NEW</div>
390 - </div>
391 - <div class="wpda-dashboard-group wpda-dashboard-group-publisher">
392 - <div class="icons">
393 - <?php
469 +Use App Builder to access the NEW Table Builder
470 +"
471 + <?php
472 + if ( !$this->option_legacy_tools['tables'][0] ) {
473 + echo 'style="display: none"';
474 + }
394 475 ?>
395 - <a class="wpda-dashboard-item wpda_tooltip_icons" href="<?php
396 - echo admin_url( 'admin.php' );
397 - // phpcs:ignore WordPress.Security.EscapeOutput
398 - ?>?page=wpda_publisher" title="Table Builder">
476 + >
399 477 <div class="fa-solid fa-table"></div>
400 478 <div class="label">Tables</div>
401 479 </a>
402 - <?php
480 + <a class="wpda-dashboard-item wpda_tooltip_icons"
481 + href="<?php
482 + echo esc_url( admin_url( 'admin.php' ) );
483 + ?>?page=wpda_wpdp"
484 + title="OLD Form Builder
485 +
486 +Use App Builder to access the NEW Form Builder
487 +"
488 + <?php
489 + if ( !$this->option_legacy_tools['forms'][0] ) {
490 + echo 'style="display: none"';
491 + }
403 492 ?>
404 - </div>
405 - <div class="subject">Publishing</div>
406 - </div>
407 - <div class="wpda-dashboard-group wpda-dashboard-group-projects">
408 - <div class="icons">
409 - <a class="wpda-dashboard-item wpda_tooltip_icons" href="<?php
410 - echo admin_url( 'admin.php' );
411 - // phpcs:ignore WordPress.Security.EscapeOutput
412 - ?>?page=wpda_wpdp" title="Form Builder">
493 + >
413 494 <div class="fa-solid fa-wand-magic-sparkles"></div>
414 495 <div class="label">Forms</div>
415 496 </a>
416 - <a class="wpda-dashboard-item wpda_tooltip_icons" href="<?php
417 - echo admin_url( 'admin.php' );
418 - // phpcs:ignore WordPress.Security.EscapeOutput
419 - ?>?page=wpda_templates" title="Customize forms using templates">
497 + <a class="wpda-dashboard-item wpda_tooltip_icons"
498 + href="<?php
499 + echo esc_url( admin_url( 'admin.php' ) );
500 + ?>?page=wpda_templates"
501 + title="OLD Form Templates
502 +
503 +Customize forms using templates"
504 + <?php
505 + if ( !$this->option_legacy_tools['templates'][0] ) {
506 + echo 'style="display: none"';
507 + }
508 + ?>
509 + >
420 510 <div class="fa-solid fa-desktop"></div>
421 511 <div class="label">Templates</div>
422 512 </a>
513 + <a class="wpda-dashboard-item wpda_tooltip_icons"
514 + href="<?php
515 + echo esc_url( admin_url( 'admin.php' ) );
516 + ?>?page=wpda_designer"
517 + title="Create database tables and indexes"
518 + <?php
519 + if ( !$this->option_legacy_tools['designer'][0] ) {
520 + echo 'style="display: none"';
521 + }
522 + ?>
523 + >
524 + <div class="fa-solid fa-drafting-compass"></div>
525 + <div class="label">Designer</div>
526 + </a>
527 + <?php
528 + ?>
423 529 </div>
424 - <div class="subject">Data Entry</div>
530 + <div class="subject">Legacy Tools</div>
425 531 </div>
426 532 <div class="wpda-dashboard-group wpda-dashboard-group-settings">
427 533 <div class="icons">
428 534 <a class="wpda-dashboard-item wpda_tooltip_icons" href="<?php
429 - echo admin_url( 'options-general.php' );
430 - // phpcs:ignore WordPress.Security.EscapeOutput
535 + echo esc_url( admin_url( 'options-general.php' ) );
431 536 ?>?page=wpdataaccess" title="Manage plugin user interface and behavior">
432 537 <div class="fa-solid fa-cog"></div>
433 538 <div class="label">Settings</div>
434 539 </a>
@@ -435,11 +540,12 @@
435 540 <?php
436 541 if ( wpda_freemius()->is_registered() ) {
437 542 ?>
438 543 <a class="wpda-dashboard-item wpda_tooltip_icons" href="<?php
439 - echo admin_url( 'admin.php' );
440 - // phpcs:ignore WordPress.Security.EscapeOutput
441 - ?>?page=wpda-account" title="Manage your WP Data Access account">
544 + echo esc_url( admin_url( 'admin.php' ) );
545 + ?>?page=<?php
546 + echo esc_attr( WP_Data_Access_Admin::MAIN_PAGE_SLUG );
547 + ?>-account" title="Manage your WP Data Access account">
442 548 <div class="fa-solid fa-user"></div>
443 549 <div class="label">Account</div>
444 550 </a>
445 551 <?php
@@ -449,23 +555,33 @@
449 555 <div class="fa-solid fa-hand-holding-usd"></div>
450 556 <div class="label">Pricing</div>
451 557 </a>
452 558 <a class="wpda-dashboard-item wpda_tooltip_icons" href="<?php
453 - echo admin_url( 'admin.php' );
454 - // phpcs:ignore WordPress.Security.EscapeOutput
455 - ?>?page=wpda-pricing" title="Upgrade your WP Data Access account">
559 + echo esc_url( admin_url( 'admin.php' ) );
560 + ?>?page=<?php
561 + echo esc_attr( WP_Data_Access_Admin::MAIN_PAGE_SLUG );
562 + ?>-pricing" title="Upgrade your WP Data Access account">
456 563 <div class="fa-solid fa-gem"></div>
457 564 <div class="label">Upgrade</div>
458 565 </a>
459 - </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>
460 577 <div class="subject">Plugin & User Management</div>
461 578 </div>
462 579 <div class="wpda-dashboard-group wpda-dashboard-group-support">
463 580 <div class="icons">
464 581 <a class="wpda-dashboard-item wpda_tooltip_icons" target="_blank" href="<?php
465 - echo $this->get_help_url();
466 - // phpcs:ignore WordPress.Security.EscapeOutput
467 - ?>" title="Online help and documentation">
582 + echo esc_url( $this->get_help_url() );
583 + ?>" title="Context sensitive help">
468 584 <div class="fa-solid fa-question-circle"></div>
469 585 <div class="label">Docs</div>
470 586 </a>
471 587 <a class="wpda-dashboard-item wpda_tooltip_icons" target="_blank" href="https://wordpress.org/support/plugin/wp-data-access/" title="Public support forum">
@@ -473,12 +589,8 @@
473 589 <div class="label">Forum</div>
474 590 </a>
475 591 <?php
476 592 ?>
477 - <a class="wpda-dashboard-item wpda_tooltip_icons" target="_blank" href="https://wpdataaccess.com/docs/getting-started/whats-new/" title="What's new?">
478 - <div class="fa-solid fa-info-circle"></div>
479 - <div class="label">News</div>
480 - </a>
481 593 </div>
482 594 <div class="subject">Help</div>
483 595 </div>
484 596 </div>
@@ -500,22 +612,18 @@
500 612 <div class="wpda_nav_title">WP Data Access</div>
501 613 </div>
502 614 <ul>
503 615 <li class="menu-item"><a href="<?php
504 - echo admin_url( 'admin.php' );
505 - // phpcs:ignore WordPress.Security.EscapeOutput
616 + echo esc_url( admin_url( 'admin.php' ) );
506 617 ?>?page=wpda"><i class="fas fa-database"></i> Explorer</a></li>
507 618 <li class="menu-item"><a href="<?php
508 - echo admin_url( 'admin.php' );
509 - // phpcs:ignore WordPress.Security.EscapeOutput
619 + echo esc_url( admin_url( 'admin.php' ) );
510 620 ?>?page=wpda_query_builder"><i class="fas fa-code"></i> SQL</a></li>
511 621 <li class="menu-item wpda-separator"><a href="<?php
512 - echo admin_url( 'admin.php' );
513 - // phpcs:ignore WordPress.Security.EscapeOutput
622 + echo esc_url( admin_url( 'admin.php' ) );
514 623 ?>?page=wpda_designer"><i class="fas fa-drafting-compass"></i> Designer</a></li>
515 624 <li class="menu-item wpda-separator"><a href="<?php
516 - echo admin_url( 'admin.php' );
517 - // phpcs:ignore WordPress.Security.EscapeOutput
625 + echo esc_url( admin_url( 'admin.php' ) );
518 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">
519 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"/>
520 628 </svg></span> Apps</a></li>
521 629 <?php
@@ -522,32 +630,29 @@
522 630 ?>
523 631 <li class="menu-item <?php
524 632 echo esc_attr( $premium_separator );
525 633 ?>"><a href="<?php
526 - echo admin_url( 'admin.php' );
527 - // phpcs:ignore WordPress.Security.EscapeOutput
634 + echo esc_url( admin_url( 'admin.php' ) );
528 635 ?>?page=wpda_publisher"><i class="fas fa-address-card"></i> Tables</a></li>
529 636 <?php
530 637 ?>
531 638 <li class="menu-item"><a href="<?php
532 - echo admin_url( 'admin.php' );
533 - // phpcs:ignore WordPress.Security.EscapeOutput
639 + echo esc_url( admin_url( 'admin.php' ) );
534 640 ?>?page=wpda_wpdp"><i class="fas fa-magic"></i> Forms</a></li>
535 641 <li class="menu-item wpda-separator"><a href="<?php
536 - echo admin_url( 'admin.php' );
537 - // phpcs:ignore WordPress.Security.EscapeOutput
642 + echo esc_url( admin_url( 'admin.php' ) );
538 643 ?>?page=wpda_templates"><i class="fas fa-desktop"></i> Templates</a></li>
539 644 <li class="menu-item"><a href="<?php
540 - echo admin_url( 'options-general.php' );
541 - // phpcs:ignore WordPress.Security.EscapeOutput
645 + echo esc_url( admin_url( 'options-general.php' ) );
542 646 ?>?page=wpdataaccess"><i class="fas fa-cog"></i> Settings</a></li>
543 647 <?php
544 648 if ( wpda_freemius()->is_registered() ) {
545 649 ?>
546 650 <li class="menu-item"><a href="<?php
547 - echo admin_url( 'admin.php' );
548 - // phpcs:ignore WordPress.Security.EscapeOutput
549 - ?>?page=wpda-account"><i class="fas fa-user"></i> Account</a></li>
651 + echo esc_url( admin_url( 'admin.php' ) );
652 + ?>?page=<?php
653 + echo esc_attr( WP_Data_Access_Admin::MAIN_PAGE_SLUG );
654 + ?>-account"><i class="fas fa-user"></i> Account</a></li>
550 655 <?php
551 656 }
552 657 ?>
553 658 <?php
@@ -554,9 +659,9 @@
554 659 $menufound = false;
555 660 global $submenu;
556 661 if ( isset( $submenu[WPDA::get_option( WP_Data_Access_Admin::PAGE_MAIN )] ) ) {
557 662 foreach ( $submenu[WPDA::get_option( WP_Data_Access_Admin::PAGE_MAIN )] as $pluginmenu ) {
558 - if ( 'wpda-pricing' === $pluginmenu[2] ) {
663 + if ( WP_Data_Access_Admin::MAIN_PAGE_SLUG . '-pricing' === $pluginmenu[2] ) {
559 664 $menufound = true;
560 665 break;
561 666 }
562 667 }
@@ -568,15 +673,16 @@
568 673 <?php
569 674 if ( $menufound ) {
570 675 ?>
571 676 <li class="menu-item wpda-separator"><a href="<?php
572 - echo admin_url( 'admin.php' );
573 - // phpcs:ignore WordPress.Security.EscapeOutput
574 - ?>?page=wpda-pricing"><i class="fas fa-gem"></i> Upgrade</a></li>
677 + echo esc_url( admin_url( 'admin.php' ) );
678 + ?>?page=<?php
679 + echo esc_attr( WP_Data_Access_Admin::MAIN_PAGE_SLUG );
680 + ?>-pricing"><i class="fas fa-gem"></i> Upgrade</a></li>
575 681 <?php
576 682 }
577 683 ?>
578 - <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>
579 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>
580 686 <?php
581 687 ?>
582 688 </ul>
@@ -606,9 +712,9 @@
606 712 <div id="wpda-dashboard-toolbar" class="wpda-dashboard-toolbar" style="display:none">
607 713 <div class="wpda-nowrap">
608 714 <div>
609 715 <?php
610 - if ( current_user_can( 'manage_options' ) ) {
716 + if ( WPDA::current_user_is_admin() ) {
611 717 ?>
612 718 <div>
613 719 <a href="javascript:addPanel()"
614 720 class="wpda-dashboard-item wpda_tooltip"
@@ -688,9 +794,9 @@
688 794 Update to premium to analyse, report and share your data.
689 795 </td>
690 796 <td style="white-space:nowrap">
691 797 <a href="https://wpdataaccess.com/pricing/" target="_blank" class="button button-primary">UPGRADE TO PREMIUM</a>
692 - <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>
693 799 </td>
694 800 </tr>
695 801 </table>
696 802 </div>
@@ -767,9 +873,8 @@
767 873 * @return void
768 874 */
769 875 protected function toolbar_wpda() {
770 876 $schema_name = ( isset( $_REQUEST['wpdaschema_name'] ) ? esc_attr( sanitize_text_field( wp_unslash( $_REQUEST['wpdaschema_name'] ) ) ) : '' );
771 - // phpcs:ignore WordPress.Security.NonceVerification
772 877 ?>
773 878 <form id="wpda_new_design" style="display: none" method="post" action="?page=<?php
774 879 echo esc_attr( WP_Data_Access_Admin::PAGE_DESIGNER );
775 880 ?>">
@@ -774,8 +879,11 @@
774 879 echo esc_attr( WP_Data_Access_Admin::PAGE_DESIGNER );
775 880 ?>">
776 881 <input type="hidden" name="action" value="create_table">
777 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 + ?>">
778 886 </form>
779 887 <form id="wpda_goto_backup" style="display: none" method="post" action="?page=<?php
780 888 echo esc_attr( WP_Data_Access_Admin::PAGE_MAIN );
781 889 ?>&page_action=wpda_backup">
@@ -787,10 +895,9 @@
787 895 <div class="wpda-nowrap">
788 896 <div>
789 897 <div>
790 898 <a href="<?php
791 - echo admin_url( 'admin.php' );
792 - // phpcs:ignore WordPress.Security.EscapeOutput
899 + echo esc_url( admin_url( 'admin.php' ) );
793 900 ?>?page=<?php
794 901 echo esc_attr( WP_Data_Access_Admin::PAGE_MAIN );
795 902 ?>&page_action=wpda_global_search"
796 903 class="wpda-dashboard-item wpda_tooltip"
@@ -813,41 +920,21 @@
813 920 </a>
814 921 </div>
815 922 </div><div>
816 923 <div>
817 - <?php
818 - if ( 'new' !== $this->current_version ) {
819 - ?>
820 - <a onclick="jQuery('#upload_file_container_multi').show();"
821 - href="javascript:void(0)"
822 - class="wpda-dashboard-item wpda_tooltip"
823 - title="Import and execute SQL script files"
824 - >
825 - <i class="fas fa-file-code"></i>
826 - <div>
827 - Import SQL files
828 - </div>
829 - </a>
830 - <?php
831 - } else {
832 - ?>
833 - <a onClick="window.ppActionEnableImport();"
834 - href="javascript:void(0)"
835 - class="wpda-dashboard-item wpda_tooltip"
836 - title="Import and execute SQL script files"
837 - >
838 - <i class="fas fa-file-code"></i>
839 - <div>
840 - Import SQL files
841 - </div>
842 - </a>
843 - <?php
844 - }
845 - ?>
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>
846 934 </div><div>
847 935 <a href="<?php
848 - echo admin_url( 'admin.php' );
849 - // phpcs:ignore WordPress.Security.EscapeOutput
936 + echo esc_url( admin_url( 'admin.php' ) );
850 937 ?>?page=<?php
851 938 echo esc_attr( WP_Data_Access_Admin::PAGE_MAIN );
852 939 ?>&page_action=wpda_import_csv"
853 940 class="wpda-dashboard-item wpda_tooltip"
@@ -858,96 +945,53 @@
858 945 Import CSV files
859 946 </div>
860 947 </a>
861 948 </div><div>
862 - <a href="javascript:void(0)"
863 - id="wpda_toolbar_icon_go_backup"
864 - class="wpda-dashboard-item wpda_tooltip"
865 - title="Data Backup - unattended exports"
866 - >
867 - <i class="fas fa-file-archive"></i>
868 - <div>
869 - Data Backup
870 - </div>
871 - </a>
872 - </div>
873 - </div><div>
874 - <?php
875 - if ( 'new' !== $this->current_version ) {
876 - ?>
877 - <div>
878 - <a onclick="jQuery('#wpda_db_container').show(); jQuery('#local_database').focus();"
879 - href="javascript:void(0)"
880 - class="wpda-dashboard-item wpda_tooltip"
881 - title="Add remote database or create local database"
882 - >
883 - <i id="wpda_toolbar_icon_add_database" class="fas fa-database"></i>
884 - <div>
885 - Add database
886 - </div>
887 - </a>
888 - </div>
889 - <?php
890 - } else {
891 - ?>
892 - <div>
893 - <a onclick="jQuery('#wpda_manage_databases').show(); jQuery('#local_database').focus();"
894 - href="javascript:void(0)"
895 - class="wpda-dashboard-item wpda_tooltip"
896 - title="Manage remote database connections and local databases"
897 - >
898 - <i id="wpda_toolbar_icon_add_database" class="fas fa-server"></i>
899 - <div>
900 - Databases
901 - </div>
902 - </a>
903 - </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
904 975 }
905 976 ?>
906 - <?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
907 990 ?>
908 991 </div>
909 992 </div>
910 - <div class="wpda-promotion" style="font-size: 16px">
911 - <?php
912 - if ( 'new' !== $this->current_version ) {
913 - ?>
914 - <a href="?page=<?php
915 - echo esc_attr( WP_Data_Access_Admin::PAGE_MAIN );
916 - ?>&de=new"
917 - style="display: flex; align-items: center; gap: 5px;"
918 - >
919 - <i class="fas fa-toggle-off"></i>
920 - <span>Switch to new Data Explorer</span>
921 - </a>
922 - <?php
923 - } else {
924 - ?>
925 - <span
926 - style="display: flex; align-items: center; gap: 5px; white-space: nowrap;"
927 - >
928 - <a href="?page=<?php
929 - echo esc_attr( WP_Data_Access_Admin::PAGE_MAIN );
930 - ?>&de=old"
931 - style="display: flex; align-items: center; gap: 5px; white-space: nowrap;"
932 - >
933 - <i class="fas fa-toggle-on"></i>
934 - <span>Switch to old Data Explorer</span>
935 - </a>
936 - <span>
937 - <a href="https://wpdataaccess.com/2024/01/26/the-new-data-explorer-wp-data-access-5-4-0/"
938 - target="_blank"
939 - class="wpda_tooltip"
940 - title="Click to read more"
941 - >
942 - <i class="fas fa-circle-info"></i>
943 - </a>
944 - </span>
945 - </span>
946 - <?php
947 - }
948 - ?>
949 - </div>
993 + <div></div>
950 994 <?php
951 995 //$this->get_promotions('wpda');
952 996 ?>
953 997 </div>
@@ -954,111 +998,8 @@
954 998 <?php
955 999 }
956 1000
957 1001 /**
958 - * Data Explorer table page toolbar
959 - *
960 - * @return void
961 - */
962 - protected function toolbar_wpda_table() {
963 - ?>
964 - <form id="wpda_new_row" style="display: none" method="post" action="?page=<?php
965 - echo esc_attr( WP_Data_Access_Admin::PAGE_MAIN );
966 - ?>">
967 - <?php
968 - if ( isset( $_REQUEST['wpdaschema_name'] ) ) {
969 - // phpcs:ignore WordPress.Security.NonceVerification
970 - $schema_name = esc_attr( sanitize_text_field( wp_unslash( $_REQUEST['wpdaschema_name'] ) ) );
971 - // phpcs:ignore WordPress.Security.NonceVerification
972 - echo "<input type='hidden' name='wpdaschema_name' value='{$schema_name}'>";
973 - // phpcs:ignore WordPress.Security.EscapeOutput
974 - }
975 - ?>
976 - <input type="hidden" id="wpda_new_row_table_name" name="table_name" value="">
977 - <input type="hidden" name="action" value="new">
978 - </form>
979 - <div id="wpda-dashboard-toolbar" class="wpda-dashboard-toolbar" style="display:none">
980 - <div class="wpda-nowrap">
981 - <div>
982 - <div>
983 - <a href="javascript:void(0)"
984 - id="wpda_toolbar_icon_add_row"
985 - class="wpda-dashboard-item wpda_tooltip"
986 - title="Add new row to table"
987 - >
988 - <i class="fas fa-plus-circle"></i>
989 - <div>
990 - Add row
991 - </div>
992 - </a>
993 - </div><div>
994 - <a onclick="jQuery('#upload_file_container').show()"
995 - href="javascript:void(0)"
996 - class="wpda-dashboard-item wpda_tooltip"
997 - title="Allows only imports into table authors"
998 - >
999 - <i class="fas fa-code"></i>
1000 - <div>
1001 - Import rows
1002 - </div>
1003 - </a>
1004 - </div>
1005 - </div>
1006 - </div>
1007 - <?php
1008 - $this->get_promotions( 'table' );
1009 - ?>
1010 - </div>
1011 - <?php
1012 - }
1013 -
1014 - /**
1015 - * Data Explorer data entry form toolbar
1016 - *
1017 - * @return void
1018 - */
1019 - protected function toolbar_wpda_row() {
1020 - ?>
1021 - <form id="wpda_new_row" style="display: none" method="post" action="?page=<?php
1022 - echo esc_attr( WP_Data_Access_Admin::PAGE_MAIN );
1023 - ?>">
1024 - <?php
1025 - if ( isset( $_REQUEST['wpdaschema_name'] ) ) {
1026 - // phpcs:ignore WordPress.Security.NonceVerification
1027 - $schema_name = esc_attr( sanitize_text_field( wp_unslash( $_REQUEST['wpdaschema_name'] ) ) );
1028 - // phpcs:ignore WordPress.Security.NonceVerification
1029 - echo "<input type='hidden' name='wpdaschema_name' value='{$schema_name}'>";
1030 - // phpcs:ignore WordPress.Security.EscapeOutput
1031 - }
1032 - ?>
1033 - <input type="hidden" id="wpda_new_row_table_name" name="table_name" value="">
1034 - <input type="hidden" name="action" value="new">
1035 - </form>
1036 - <div id="wpda-dashboard-toolbar" class="wpda-dashboard-toolbar" style="display:none">
1037 - <div class="wpda-nowrap">
1038 - <div>
1039 - <div>
1040 - <a href="javascript:void(0)"
1041 - id="wpda_toolbar_icon_add_row"
1042 - class="wpda-dashboard-item wpda_tooltip"
1043 - title="Add new row to table"
1044 - >
1045 - <i class="fas fa-plus-circle"></i>
1046 - <div>
1047 - Add row
1048 - </div>
1049 - </a>
1050 - </div>
1051 - </div>
1052 - </div>
1053 - <?php
1054 - $this->get_promotions( 'row' );
1055 - ?>
1056 - </div>
1057 - <?php
1058 - }
1059 -
1060 - /**
1061 1002 * Data Backup toolbar
1062 1003 *
1063 1004 * @return void
1064 1005 */
@@ -1068,8 +1009,11 @@
1068 1009 echo esc_attr( WP_Data_Access_Admin::PAGE_MAIN );
1069 1010 ?>&page_action=wpda_backup">
1070 1011 <input type="hidden" id="wpda_new_backup_wpdaschema_name" name="wpdaschema_name" value="">
1071 1012 <input type="hidden" name="action" value="new">
1013 + <input type="hidden" name="wp_nonce" value="<?php
1014 + echo esc_attr( wp_create_nonce( 'wpda-backup-' . WPDA::get_current_user_login() ) );
1015 + ?>"/>
1072 1016 </form>
1073 1017 <div id="wpda-dashboard-toolbar" class="wpda-dashboard-toolbar" style="display:none">
1074 1018 <div class="wpda-nowrap">
1075 1019 <div>
@@ -1134,8 +1078,9 @@
1134 1078 *
1135 1079 * @return void
1136 1080 */
1137 1081 protected function toolbar_apps() {
1082 + $has_apps = WPDA_App_Model::has_any();
1138 1083 ?>
1139 1084 <div id="wpda-dashboard-toolbar" class="wpda-dashboard-toolbar" style="display:none">
1140 1085 <div class="wpda-nowrap">
1141 1086 <div>
@@ -1145,20 +1090,55 @@
1145 1090 title="Create new app"
1146 1091 >
1147 1092 <i class="fas fa-plus-circle"></i>
1148 1093 <div>
1149 - Create new app
1094 + Create New App
1150 1095 </div>
1151 1096 </a>
1152 - </div>
1097 + </div><div>
1098 + <a href="javascript:window.ppActionRenameDatabase()"
1099 + class="wpda-dashboard-item wpda_tooltip wpda-rename-database"
1100 + title="Rename Database"
1101 + >
1102 + <svg stroke="currentColor" fill="none" stroke-width="2" viewBox="0 2 24 24" stroke-linecap="round" stroke-linejoin="round" height="32px" width="32px" xmlns="http://www.w3.org/2000/svg">
1103 + <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
1104 + <path d="M4 6c0 1.657 3.582 3 8 3s8 -1.343 8 -3s-3.582 -3 -8 -3s-8 1.343 -8 3"></path>
1105 + <path d="M4 6v6c0 1.657 3.582 3 8 3c.478 0 .947 -.016 1.402 -.046"></path>
1106 + <path d="M20 12v-6"></path>
1107 + <path d="M4 12v6c0 1.526 3.04 2.786 6.972 2.975"></path>
1108 + <path d="M18.42 15.61a2.1 2.1 0 0 1 2.97 2.97l-3.39 3.42h-3v-3l3.42 -3.39z"></path>
1109 + </svg>
1110 + <div>
1111 + Rename Database
1112 + </div>
1113 + </a>
1114 + </div><?php
1115 + ?>
1153 1116 </div>
1154 1117 </div>
1155 - <div class="wpda-promotion" style="font-size: 16px">
1156 - <span>
1157 - <a href="https://wpdataaccess.com/2024/04/15/the-app-builder-wp-data-access-5-5/"
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/"
1158 1138 target="_blank"
1159 1139 class="wpda_tooltip"
1160 - title="Click to read introduction to apps"
1140 + title="Online App Builder documentation"
1161 1141 >
1162 1142 <i class="fas fa-circle-info"></i>
1163 1143 </a>
1164 1144 </span>
@@ -1170,48 +1150,8 @@
1170 1150 <?php
1171 1151 }
1172 1152
1173 1153 /**
1174 - * Query Builder toolbar
1175 - *
1176 - * @return void
1177 - */
1178 - protected function toolbar_sql() {
1179 - ?>
1180 - <div id="wpda-dashboard-toolbar" class="wpda-dashboard-toolbar" style="display:none">
1181 - <div class="wpda-nowrap">
1182 - <div>
1183 - <div>
1184 - <a href="javascript:tabNew()"
1185 - class="wpda-dashboard-item wpda_tooltip"
1186 - title="Create new query"
1187 - >
1188 - <i class="fas fa-plus-circle"></i>
1189 - <div>
1190 - Create new query
1191 - </div>
1192 - </a>
1193 - </div><div>
1194 - <a href="javascript:openQuery()"
1195 - class="wpda-dashboard-item wpda_tooltip"
1196 - title="Open existing query"
1197 - >
1198 - <i class="fas fa-folder-open"></i>
1199 - <div>
1200 - Open existing query
1201 - </div>
1202 - </a>
1203 - </div>
1204 - </div>
1205 - </div>
1206 - <?php
1207 - $this->get_promotions( 'sql' );
1208 - ?>
1209 - </div>
1210 - <?php
1211 - }
1212 -
1213 - /**
1214 1154 * Data Designer toolbar
1215 1155 *
1216 1156 * @return void
1217 1157 */
@@ -1223,8 +1163,11 @@
1223 1163 <input type="hidden" name="action" value="edit">
1224 1164 <input type="hidden" name="table_name" value="<?php
1225 1165 echo esc_attr( WPDA_Design_Table_Model::get_base_table_name() );
1226 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 + ?>">
1227 1170 </form>
1228 1171 <div id="wpda-dashboard-toolbar" class="wpda-dashboard-toolbar" style="display:none">
1229 1172 <div class="wpda-nowrap">
1230 1173 <div>
@@ -1238,9 +1181,9 @@
1238 1181 Create table design
1239 1182 </div>
1240 1183 </a>
1241 1184 </div><div>
1242 - <a onclick="jQuery('#upload_file_container').show()"
1185 + <a onclick="alert('This feature has been removed. Please use the Data Explorer import feature.')"
1243 1186 href="javascript:void(0)"
1244 1187 class="wpda-dashboard-item wpda_tooltip"
1245 1188 title="Import table designs"
1246 1189 >
@@ -1286,9 +1229,9 @@
1286 1229 Create data table
1287 1230 </div>
1288 1231 </a>
1289 1232 </div><div>
1290 - <a onclick="jQuery('#upload_file_container').show()"
1233 + <a onclick="alert('This feature has been removed. Please use the Data Explorer import feature.')"
1291 1234 href="javascript:void(0)"
1292 1235 class="wpda-dashboard-item wpda_tooltip"
1293 1236 title="Import data tables"
1294 1237 >
@@ -1345,9 +1288,9 @@
1345 1288 Create project
1346 1289 </div>
1347 1290 </a>
1348 1291 </div><div>
1349 - <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()"
1350 1293 href="javascript:void(0)"
1351 1294 class="wpda-dashboard-item wpda_tooltip"
1352 1295 title="Import projects"
1353 1296 >
@@ -1435,9 +1378,9 @@
1435 1378 </select>
1436 1379 <?php
1437 1380 if ( !class_exists( 'Code_Manager\\Code_Manager_Model' ) || !class_exists( 'WPDataAccess\\Premium\\WPDAPRO_Dashboard\\WPDAPRO_Widget_Project' ) ) {
1438 1381 ?>
1439 - <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">
1440 1383 <i class="fas fa-question-circle pointer wpda_tooltip"
1441 1384 style="font-size: 170%; vertical-align: middle"
1442 1385 title="Your installation does not support all available widget types! Click to learn how to install more widget types..."></i>
1443 1386 </a>
@@ -1551,9 +1494,9 @@
1551 1494 )</option>
1552 1495 <?php
1553 1496 $rdbs = WPDADB::get_remote_databases();
1554 1497 ksort( $rdbs );
1555 - //phpcs:ignore - 8.1 proof
1498 + // phpcs:ignore -- 8.1 proof
1556 1499 foreach ( $rdbs as $key => $rdb ) {
1557 1500 ?>
1558 1501 <option value="<?php
1559 1502 echo esc_attr( $key );
@@ -1735,9 +1678,9 @@
1735 1678 // Following line requires PHP 7.
1736 1679 // $last_key = array_key_last($this->dashboard_positions[0]); .
1737 1680 $last_key = 1;
1738 1681 if ( is_array( $this->dashboard_positions ) && count( $this->dashboard_positions ) > 0 ) {
1739 - //phpcs:ignore - 8.1 proof
1682 + // phpcs:ignore -- 8.1 proof
1740 1683 foreach ( $this->dashboard_positions[0] as $key => $val ) {
1741 1684 $last_key = $key;
1742 1685 }
1743 1686 }
@@ -1828,14 +1771,14 @@
1828 1771 let wpda_wpnonce_refresh = "<?php
1829 1772 echo esc_attr( wp_create_nonce( WPDA_Widget::WIDGET_REFRESH . WPDA::get_current_user_login() ) );
1830 1773 ?>";
1831 1774 let wpda_ajaxurl = "<?php
1832 - echo admin_url( 'admin-ajax.php' );
1833 - // phpcs:ignore WordPress.Security.EscapeOutput
1775 + echo esc_url( admin_url( 'admin-ajax.php' ) );
1834 1776 ?>";
1835 1777 let wpda_databases = '<?php
1778 + // phpcs:disable WordPress.Security.EscapeOutput
1836 1779 echo $this->get_databases();
1837 - // phpcs:ignore WordPress.Security.EscapeOutput
1780 + // phpcs:enable WordPress.Security.EscapeOutput
1838 1781 ?>';
1839 1782 let wpda_shared_dashboards = <?php
1840 1783 echo json_encode( $this->shared_dashboards );
1841 1784 // phpcs:ignore
@@ -1883,21 +1826,20 @@
1883 1826 public static function save() {
1884 1827 $wp_nonce = ( isset( $_POST['wp_nonce'] ) ? sanitize_text_field( wp_unslash( $_POST['wp_nonce'] ) ) : '' );
1885 1828 if ( !wp_verify_nonce( $wp_nonce, static::DASHBOARD_SAVE . WPDA::get_current_user_login() ) ) {
1886 1829 WPDA::sent_header( 'application/json' );
1887 - echo static::msg( 'ERROR', 'Token expired, please refresh page' );
1888 - // phpcs:ignore WordPress.Security.EscapeOutput
1830 + static::msg( 'ERROR', 'Token expired, please refresh page' );
1889 1831 wp_die();
1890 1832 }
1833 + // phpcs:disable WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
1891 1834 $widgets = ( isset( $_POST['wpda_widgets'] ) ? WPDA::sanitize_text_field_array( $_POST['wpda_widgets'] ) : array() );
1892 - // phpcs:ignore WordPress.Security.ValidatedSanitizedInput
1835 + // phpcs:enable WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
1893 1836 $save = array();
1894 1837 foreach ( $widgets as $widget ) {
1895 1838 $save[$widget['widgetName']] = $widget;
1896 1839 }
1897 1840 update_user_meta( WPDA::get_current_user_id(), self::USER_DASHBOARD, $save );
1898 - echo self::msg( 'SUCCESS', 'Widget succesfully saved' );
1899 - // phpcs:ignore WordPress.Security.EscapeOutput
1841 + self::msg( 'SUCCESS', 'Widget succesfully saved' );
1900 1842 wp_die();
1901 1843 }
1902 1844
1903 1845 /**
@@ -1908,10 +1850,9 @@
1908 1850 public static function get_list() {
1909 1851 $wp_nonce = ( isset( $_POST['wpda_wpnonce'] ) ? sanitize_text_field( wp_unslash( $_POST['wpda_wpnonce'] ) ) : '' );
1910 1852 if ( !wp_verify_nonce( $wp_nonce, WPDA_Widget::WIDGET_REFRESH . WPDA::get_current_user_login() ) ) {
1911 1853 WPDA::sent_header( 'application/json' );
1912 - echo static::msg( 'ERROR', 'Token expired, please refresh page' );
1913 - // phpcs:ignore WordPress.Security.EscapeOutput
1854 + static::msg( 'ERROR', 'Token expired, please refresh page' );
1914 1855 wp_die();
1915 1856 }
1916 1857 // Placeholder: implemented in the premium version.
1917 1858 echo '';
@@ -1926,10 +1867,9 @@
1926 1867 public static function delete_widget() {
1927 1868 $wp_nonce = ( isset( $_POST['wpda_wpnonce'] ) ? sanitize_text_field( wp_unslash( $_POST['wpda_wpnonce'] ) ) : '' );
1928 1869 if ( !wp_verify_nonce( $wp_nonce, self::DASHBOARD_SAVE . WPDA::get_current_user_login() ) ) {
1929 1870 WPDA::sent_header( 'application/json' );
1930 - echo static::msg( 'ERROR', 'Token expired, please refresh page' );
1931 - // phpcs:ignore WordPress.Security.EscapeOutput
1871 + static::msg( 'ERROR', 'Token expired, please refresh page' );
1932 1872 wp_die();
1933 1873 }
1934 1874 // Placeholder: implemented in the premium version.
1935 1875 echo '';
@@ -1944,10 +1884,9 @@
1944 1884 public static function edit_chart() {
1945 1885 $wp_nonce = ( isset( $_POST['wpda_wpnonce'] ) ? sanitize_text_field( wp_unslash( $_POST['wpda_wpnonce'] ) ) : '' );
1946 1886 if ( !wp_verify_nonce( $wp_nonce, WPDA_Widget::WIDGET_REFRESH . WPDA::get_current_user_login() ) ) {
1947 1887 WPDA::sent_header( 'application/json' );
1948 - echo static::msg( 'ERROR', 'Token expired, please refresh page' );
1949 - // phpcs:ignore WordPress.Security.EscapeOutput
1888 + static::msg( 'ERROR', 'Token expired, please refresh page' );
1950 1889 wp_die();
1951 1890 }
1952 1891 // Placeholder: implemented in the premium version.
1953 1892 echo '';
@@ -1962,10 +1901,9 @@
1962 1901 public static function load_widget() {
1963 1902 $wp_nonce = ( isset( $_POST['wpda_wpnonce'] ) ? sanitize_text_field( wp_unslash( $_POST['wpda_wpnonce'] ) ) : '' );
1964 1903 if ( !wp_verify_nonce( $wp_nonce, WPDA_Widget::WIDGET_REFRESH . WPDA::get_current_user_login() ) ) {
1965 1904 WPDA::sent_header( 'application/json' );
1966 - echo static::msg( 'ERROR', 'Token expired, please refresh page' );
1967 - // phpcs:ignore WordPress.Security.EscapeOutput
1905 + static::msg( 'ERROR', 'Token expired, please refresh page' );
1968 1906 wp_die();
1969 1907 }
1970 1908 // Placeholder: implemented in the premium version.
1971 1909 echo '';
@@ -2008,74 +1946,30 @@
2008 1946 * @return false|string
2009 1947 */
2010 1948 public static function msg( $status, $msg ) {
2011 1949 $error = array(
2012 - 'status' => $status,
1950 + 'status' => esc_attr( $status ),
2013 1951 'msg' => $msg,
2014 1952 );
2015 - return json_encode( $error );
2016 - // phpcs:ignore
1953 + echo json_encode( $error );
1954 + // phpcs:ignore WordPress.Security.EscapeOutput
2017 1955 }
2018 1956
2019 1957 private function get_promotions( $tool ) {
2020 1958 switch ( $tool ) {
2021 - case 'csv':
1959 + case 'publisher':
1960 + case 'projects':
1961 + case 'templates':
1962 + case 'charts':
2022 1963 $promotions = array(array(
2023 - 'Use the connection wizards for fully automated CSV synchronization.' => array('https://wpdataaccess.com/docs/remote-data-files/csv-files/', 'fa-lightbulb'),
1964 + 'This tool will be transitioned to the new App Builder. Please migrate on time.' => array(null, 'fa-lightbulb'),
2024 1965 ));
2025 1966 break;
2026 - case 'publisher':
2027 - $promotions = array(
2028 - array(
2029 - 'Change data table color, spacing, border radius and modal popup behaviour.' => array('https://wpdataaccess.com/data-tables-styling/premium-styling/', 'fa-palette'),
2030 - ),
2031 - array(
2032 - 'Reorder data table elements with drag and drop.' => array('https://wpdataaccess.com/docs/data-tables/extension-manager/', 'fa-star'),
2033 - ),
2034 - array(
2035 - 'Add buttons to support CSV, Excel, PDF and SQL downloads.' => array('https://wpdataaccess.com/docs/data-tables/extension-manager/', 'fa-cloud-download'),
2036 - ),
2037 - array(
2038 - 'Add user friendly Search Panes to simplify searching.' => array('https://wpdataaccess.com/docs/data-tables-interactive-filters/search-panes/', 'fa-magic'),
2039 - ),
2040 - array(
2041 - 'Use the Search Builder to add interactive searching.' => array('https://wpdataaccess.com/docs/data-tables-interactive-filters/search-builder/', 'fa-search'),
2042 - ),
2043 - array(
2044 - 'Synchronize your Google Sheets from the Data Explorer.' => array('https://wpdataaccess.com/docs/remote-data-files/public-url/#google-sheets', 'fa-database'),
2045 - )
2046 - );
2047 - break;
2048 - case 'wpda':
2049 - $promotions = array(
2050 - array(
2051 - 'Access your SQL Server tables from the Data Explorer.' => array('https://wpdataaccess.com/docs/remote-database-connections/sql-server/', 'fa-database'),
2052 - ),
2053 - array(
2054 - 'Access your PostgreSQL tables from the Data Explorer.' => array('https://wpdataaccess.com/docs/remote-database-connections/postgresql/', 'fa-database'),
2055 - ),
2056 - array(
2057 - 'Access your Oracle tables from the Data Explorer.' => array('https://wpdataaccess.com/data-explorer/remote-connection-wizard/remote-database-connections/oracle/', 'fa-database'),
2058 - ),
2059 - array(
2060 - 'Access your remote MariaDB | MySQL tables from the Data Explorer.' => array('https://wpdataaccess.com/docs/remote-database-connections/mariadb-mysql/', 'fa-database'),
2061 - ),
2062 - array(
2063 - 'Access your CSV files directly from the Data Explorer.' => array('https://wpdataaccess.com/docs/remote-data-files/csv-files/', 'fa-lightbulb'),
2064 - ),
2065 - array(
2066 - 'Access your MS Access tables from the Data Explorer.' => array('https://wpdataaccess.com/docs/remote-data-files/ms-access/', 'fa-database'),
2067 - ),
2068 - array(
2069 - 'Synchronize your Google Sheets from the Data Explorer.' => array('https://wpdataaccess.com/docs/remote-data-files/public-url/#google-sheets', 'fa-database'),
2070 - )
2071 - );
2072 - break;
2073 1967 default:
2074 1968 $promotions = array();
2075 1969 }
2076 1970 if ( count( $promotions ) > 0 ) {
2077 - //phpcs:ignore - 8.1 proof
1971 + // phpcs:ignore -- 8.1 proof
2078 1972 $promotion_index = random_int( 0, count( $promotions ) - 1 );
2079 1973 $promotion = $promotions[$promotion_index];
2080 1974 $promotion_text = key( $promotion );
2081 1975 $promotion_url = $promotion[$promotion_text][0];
@@ -2087,11 +1981,17 @@
2087 1981 ?>"></i></span>
2088 1982 <?php
2089 1983 echo esc_attr( $promotion_text );
2090 1984 ?>
2091 - <a href="<?php
2092 - echo esc_url( $promotion_url );
2093 - ?>" target="_blank">Read more...</a>
1985 + <?php
1986 + if ( null !== $promotion_url ) {
1987 + ?>
1988 + <a href="<?php
1989 + echo esc_url( $promotion_url );
1990 + ?>" target="_blank">Read more...</a>
1991 + <?php
1992 + }
1993 + ?>
2094 1994 </div>
2095 1995 <?php
2096 1996 }
2097 1997 }
@@ -2096,4 +1996,6 @@
2096 1996 }
2097 1997 }
2098 1998
2099 1999 }
2000 +
2001 +// phpcs:enable WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing