PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.10.7
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.10.7
4.0.8 4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.2 3.1.3 3.10.0 3.10.1 3.10.10 3.10.11 3.10.12 3.10.13 3.10.14 3.10.15 3.10.2 3.10.3 All 149 releases
← All changes | classes/Visualizer/Module/Wizard.php +31 -84 4.0.33.10.7 View file →
@@ -72,9 +72,8 @@
72 72 add_action( "load-$hook", array( $this, 'visualizer_load_setup_wizard_page' ) );
73 73 }
74 74 }
75 75
76 -
77 76 /**
78 77 * Method to register the setup wizard page.
79 78 *
80 79 * @access public
@@ -168,9 +167,9 @@
168 167 * Setup wizard process.
169 168 */
170 169 public function visualizer_wizard_step_process() {
171 170 check_ajax_referer( VISUALIZER_ABSPATH, 'security' );
172 - $step = ! empty( $_POST['step'] ) ? sanitize_text_field( wp_unslash( $_POST['step'] ) ) : 1;
171 + $step = ! empty( $_POST['step'] ) ? filter_input( INPUT_POST, 'step', FILTER_SANITIZE_STRING ) : 1;
173 172 switch ( $step ) {
174 173 case 'step_2':
175 174 $this->setup_wizard_import_chart();
176 175 break;
@@ -193,9 +192,9 @@
193 192 * Step: 2 import chart.
194 193 */
195 194 private function setup_wizard_import_chart() {
196 195 // phpcs:ignore WordPress.Security.NonceVerification.Missing
197 - $chart_type = ! empty( $_POST['chart_type'] ) ? sanitize_text_field( wp_unslash( $_POST['chart_type'] ) ) : '';
196 + $chart_type = ! empty( $_POST['chart_type'] ) ? filter_input( INPUT_POST, 'chart_type', FILTER_SANITIZE_STRING ) : '';
198 197 $chart_status = Visualizer_Module_Admin::checkChartStatus( $chart_type );
199 198 if ( ! $chart_status ) {
200 199 wp_send_json(
201 200 array(
@@ -341,45 +340,8 @@
341 340 'max' => '',
342 341 'min' => '',
343 342 ),
344 343 ),
345 - 'customcss' => array(
346 - 'headerRow' => array(
347 - 'background-color' => '',
348 - 'color' => '',
349 - 'transform' => '',
350 - ),
351 - 'tableRow' => array(
352 - 'background-color' => '',
353 - 'color' => '',
354 - 'transform' => '',
355 - ),
356 - 'oddTableRow' => array(
357 - 'background-color' => '',
358 - 'color' => '',
359 - 'transform' => '',
360 - ),
361 - 'selectedTableRow' => array(
362 - 'background-color' => '',
363 - 'color' => '',
364 - 'transform' => '',
365 - ),
366 - 'hoverTableRow' => array(
367 - 'background-color' => '',
368 - 'color' => '',
369 - 'transform' => '',
370 - ),
371 - 'headerCell' => array(
372 - 'background-color' => '',
373 - 'color' => '',
374 - 'transform' => '',
375 - ),
376 - 'tableCell' => array(
377 - 'background-color' => '',
378 - 'color' => '',
379 - 'transform' => '',
380 - ),
381 - ),
382 344 )
383 345 );
384 346 $wizard_data = array(
385 347 'chart_type' => $chart_type,
@@ -386,10 +348,9 @@
386 348 'chart_id' => $chart_id,
387 349 );
388 350 $this->update_wizard_data( $wizard_data, false );
389 351 $response = array(
390 - 'success' => 1,
391 - 'chart_id' => $chart_id,
352 + 'success' => 1,
392 353 );
393 354 }
394 355 wp_send_json( $response );
395 356 exit;
@@ -417,9 +378,9 @@
417 378 */
418 379 private function setup_wizard_create_draft_page( $return_page_id = false ) {
419 380 $add_basic_shortcode = ! empty( $_POST['add_basic_shortcode'] ) ? sanitize_text_field( wp_unslash( $_POST['add_basic_shortcode'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Missing
420 381 $add_basic_shortcode = 'true' === $add_basic_shortcode ? true : false;
421 - $basic_shortcode = ! empty( $_POST['basic_shortcode'] ) ? sanitize_text_field( wp_unslash( $_POST['basic_shortcode'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Missing
382 + $basic_shortcode = ! empty( $_POST['basic_shortcode'] ) ? filter_input( INPUT_POST, 'basic_shortcode', FILTER_SANITIZE_STRING ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Missing
422 383
423 384 if ( ! $add_basic_shortcode ) {
424 385 wp_send_json(
425 386 array(
@@ -477,9 +438,9 @@
477 438 * Step: 3 Install plugin.
478 439 */
479 440 private function setup_wizard_install_plugin() {
480 441 // phpcs:ignore WordPress.Security.NonceVerification.Missing
481 - $slug = ! empty( $_POST['slug'] ) ? sanitize_text_field( wp_unslash( $_POST['slug'] ) ) : '';
442 + $slug = ! empty( $_POST['slug'] ) ? filter_input( INPUT_POST, 'slug', FILTER_SANITIZE_STRING ) : '';
482 443 if ( empty( $slug ) ) {
483 444 wp_send_json(
484 445 array(
485 446 'status' => 0,
@@ -497,12 +458,10 @@
497 458 );
498 459 }
499 460
500 461 if ( ! empty( $slug ) ) {
501 - $wizard_data = get_option( self::OPTION_NAME, array() );
502 462 require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
503 463 include_once ABSPATH . 'wp-admin/includes/plugin-install.php';
504 - require_once ABSPATH . 'wp-admin/includes/plugin.php';
505 464
506 465 $api = plugins_api(
507 466 'plugin_information',
508 467 array(
@@ -562,38 +521,13 @@
562 521
563 522 wp_send_json( $status );
564 523 }
565 524
566 - $installed_plugins = get_plugins( '/' . sanitize_key( wp_unslash( $slug ) ) );
567 - if ( ! empty( $installed_plugins ) ) {
568 - $plugin_files = array_keys( $installed_plugins );
569 - $plugin_file = sanitize_key( wp_unslash( $slug ) ) . '/' . $plugin_files[0];
570 - activate_plugin( $plugin_file );
571 - }
572 - $wizard_data_updated = false;
573 - if ( 'optimole-wp' === $slug ) {
574 - delete_transient( 'optml_fresh_install' );
575 - // Update wizard data.
576 - $wizard_data['enable_perfomance'] = true;
577 - $wizard_data_updated = true;
578 - }
579 - if ( 'otter-blocks' === $slug ) {
580 - // Update wizard data.
581 - $wizard_data['enable_otter_blocks'] = true;
582 - $wizard_data_updated = true;
583 - // Suppress Otter's post-activation redirects so the user stays in Visualizer.
584 - update_option( 'themeisle_blocks_settings_redirect', '0' );
585 - update_option( 'themeisle_blocks_settings_onboarding', '0' );
586 - }
587 - if ( 'wp-cloudflare-page-cache' === $slug ) {
588 - // Update wizard data.
589 - $wizard_data['enable_page_cache'] = true;
590 - $wizard_data_updated = true;
591 - update_option( 'swcfpc_dashboard_redirect', false );
592 - }
593 - if ( $wizard_data_updated ) {
594 - $this->update_wizard_data( $wizard_data );
595 - }
525 + activate_plugin( 'optimole-wp/optimole-wp.php' );
526 + delete_transient( 'optml_fresh_install' );
527 + // Update wizard data.
528 + $wizard_data['enable_perfomance'] = true;
529 + $this->update_wizard_data( $wizard_data );
596 530
597 531 wp_send_json(
598 532 array(
599 533 'status' => 1,
@@ -642,19 +576,18 @@
642 576 );
643 577 }
644 578
645 579 if ( $with_subscribe && is_email( $email ) ) {
646 - wp_remote_post(
580 + $request_res = wp_remote_post(
647 581 VISUALIZER_SUBSCRIBE_API,
648 582 array(
649 - 'timeout' => 5,
650 - 'blocking' => false,
651 - 'headers' => array(
583 + 'timeout' => 100,
584 + 'headers' => array(
652 585 'Content-Type' => 'application/json',
653 586 'Cache-Control' => 'no-cache',
654 587 'Accept' => 'application/json, */*;q=0.1',
655 588 ),
656 - 'body' => wp_json_encode(
589 + 'body' => wp_json_encode(
657 590 array(
658 591 'slug' => 'visualizer',
659 592 'site' => home_url(),
660 593 'email' => $email,
@@ -664,12 +597,26 @@
664 597 )
665 598 ),
666 599 )
667 600 );
601 + if ( ! is_wp_error( $request_res ) ) {
602 + $body = json_decode( wp_remote_retrieve_body( $request_res ) );
603 + if ( 'success' === $body->code ) {
604 + $this->dismissWizard( false );
605 + wp_send_json( $response );
606 + }
607 + }
608 + wp_send_json(
609 + array(
610 + 'status' => 0,
611 + 'redirect_to' => '',
612 + 'message' => '',
613 + )
614 + );
615 + } else {
616 + $this->dismissWizard( false );
617 + wp_send_json( $response );
668 618 }
669 -
670 - $this->dismissWizard( false );
671 - wp_send_json( $response );
672 619 }
673 620
674 621 /**
675 622 * Filter chart setting.