PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.10.3
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.10.3
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 +34 -94 4.0.53.10.3 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(
@@ -212,15 +211,14 @@
212 211 'success' => 2,
213 212 'message' => __( 'Something went wrong while importing the chart', 'visualizer' ),
214 213 );
215 214
216 - $data = $source->getData();
217 215 $args = array(
218 216 'post_type' => Visualizer_Plugin::CPT_VISUALIZER,
219 217 'post_title' => 'Visualization',
220 218 'post_author' => get_current_user_id(),
221 219 'post_status' => 'publish',
222 - 'post_content' => $data,
220 + 'post_content' => $source->getData(),
223 221 );
224 222 $chart_id = wp_insert_post( $args );
225 223
226 224 if ( $chart_id && ! is_wp_error( $chart_id ) ) {
@@ -233,12 +231,10 @@
233 231 update_post_meta( $chart_id, Visualizer_Plugin::CF_SOURCE, $source->getSourceName() );
234 232 update_post_meta( $chart_id, Visualizer_Plugin::CF_SERIES, $series );
235 233 update_post_meta( $chart_id, Visualizer_Plugin::CF_CHART_LIBRARY, '' );
236 234
237 - $data = maybe_unserialize( $data );
238 235 $setting_series = array();
239 - $setting_slices = array();
240 - foreach ( $data as $s ) {
236 + foreach ( $series as $s ) {
241 237 $setting_series[] = array(
242 238 'visibleInLegend' => '',
243 239 'lineWidth' => '',
244 240 'pointSize' => '',
@@ -246,12 +242,8 @@
246 242 'curveType' => '',
247 243 'color' => '',
248 244 'role' => '',
249 245 );
250 - $setting_slices[] = array(
251 - 'offset' => 0,
252 - 'color' => '',
253 - );
254 246 }
255 247 update_post_meta(
256 248 $chart_id,
257 249 Visualizer_Plugin::CF_SETTINGS,
@@ -296,9 +288,9 @@
296 288 'height' => '',
297 289 ),
298 290 'focusTarget' => 'datum',
299 291 'series' => $setting_series,
300 - 'slices' => $setting_slices,
292 + 'slices' => array(),
301 293 'vAxis' => array(
302 294 'title' => '',
303 295 'textPosition' => '',
304 296 'direction' => 1,
@@ -341,45 +333,8 @@
341 333 'max' => '',
342 334 'min' => '',
343 335 ),
344 336 ),
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 337 )
383 338 );
384 339 $wizard_data = array(
385 340 'chart_type' => $chart_type,
@@ -386,10 +341,9 @@
386 341 'chart_id' => $chart_id,
387 342 );
388 343 $this->update_wizard_data( $wizard_data, false );
389 344 $response = array(
390 - 'success' => 1,
391 - 'chart_id' => $chart_id,
345 + 'success' => 1,
392 346 );
393 347 }
394 348 wp_send_json( $response );
395 349 exit;
@@ -417,9 +371,9 @@
417 371 */
418 372 private function setup_wizard_create_draft_page( $return_page_id = false ) {
419 373 $add_basic_shortcode = ! empty( $_POST['add_basic_shortcode'] ) ? sanitize_text_field( wp_unslash( $_POST['add_basic_shortcode'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Missing
420 374 $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
375 + $basic_shortcode = ! empty( $_POST['basic_shortcode'] ) ? filter_input( INPUT_POST, 'basic_shortcode', FILTER_SANITIZE_STRING ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Missing
422 376
423 377 if ( ! $add_basic_shortcode ) {
424 378 wp_send_json(
425 379 array(
@@ -477,9 +431,9 @@
477 431 * Step: 3 Install plugin.
478 432 */
479 433 private function setup_wizard_install_plugin() {
480 434 // phpcs:ignore WordPress.Security.NonceVerification.Missing
481 - $slug = ! empty( $_POST['slug'] ) ? sanitize_text_field( wp_unslash( $_POST['slug'] ) ) : '';
435 + $slug = ! empty( $_POST['slug'] ) ? filter_input( INPUT_POST, 'slug', FILTER_SANITIZE_STRING ) : '';
482 436 if ( empty( $slug ) ) {
483 437 wp_send_json(
484 438 array(
485 439 'status' => 0,
@@ -497,12 +451,10 @@
497 451 );
498 452 }
499 453
500 454 if ( ! empty( $slug ) ) {
501 - $wizard_data = get_option( self::OPTION_NAME, array() );
502 455 require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
503 456 include_once ABSPATH . 'wp-admin/includes/plugin-install.php';
504 - require_once ABSPATH . 'wp-admin/includes/plugin.php';
505 457
506 458 $api = plugins_api(
507 459 'plugin_information',
508 460 array(
@@ -562,38 +514,13 @@
562 514
563 515 wp_send_json( $status );
564 516 }
565 517
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 - }
518 + activate_plugin( 'optimole-wp/optimole-wp.php' );
519 + delete_transient( 'optml_fresh_install' );
520 + // Update wizard data.
521 + $wizard_data['enable_perfomance'] = true;
522 + $this->update_wizard_data( $wizard_data );
596 523
597 524 wp_send_json(
598 525 array(
599 526 'status' => 1,
@@ -642,19 +569,18 @@
642 569 );
643 570 }
644 571
645 572 if ( $with_subscribe && is_email( $email ) ) {
646 - wp_remote_post(
573 + $request_res = wp_remote_post(
647 574 VISUALIZER_SUBSCRIBE_API,
648 575 array(
649 - 'timeout' => 5,
650 - 'blocking' => false,
651 - 'headers' => array(
576 + 'timeout' => 100,
577 + 'headers' => array(
652 578 'Content-Type' => 'application/json',
653 579 'Cache-Control' => 'no-cache',
654 580 'Accept' => 'application/json, */*;q=0.1',
655 581 ),
656 - 'body' => wp_json_encode(
582 + 'body' => wp_json_encode(
657 583 array(
658 584 'slug' => 'visualizer',
659 585 'site' => home_url(),
660 586 'email' => $email,
@@ -664,12 +590,26 @@
664 590 )
665 591 ),
666 592 )
667 593 );
594 + if ( ! is_wp_error( $request_res ) ) {
595 + $body = json_decode( wp_remote_retrieve_body( $request_res ) );
596 + if ( 'success' === $body->code ) {
597 + $this->dismissWizard( false );
598 + wp_send_json( $response );
599 + }
600 + }
601 + wp_send_json(
602 + array(
603 + 'status' => 0,
604 + 'redirect_to' => '',
605 + 'message' => '',
606 + )
607 + );
608 + } else {
609 + $this->dismissWizard( false );
610 + wp_send_json( $response );
668 611 }
669 -
670 - $this->dismissWizard( false );
671 - wp_send_json( $response );
672 612 }
673 613
674 614 /**
675 615 * Filter chart setting.