| @@ -63,9 +63,8 @@ | ||
| 63 | 63 | |
| 64 | 64 | $this->_addAction( 'wp_print_footer_scripts', 'printFooterScripts' ); |
| 65 | 65 | $this->_addAction( 'wp_enqueue_scripts', 'enqueueScripts' ); |
| 66 | 66 | $this->_addAction( 'load-index.php', 'enqueueScripts' ); |
| 67 | - $this->_addAction( 'load-visualizer_page_visualizer-setup-wizard', 'enqueueScripts' ); | |
| 68 | 67 | $this->_addAction( 'visualizer_enqueue_scripts', 'enqueueScripts' ); |
| 69 | 68 | $this->_addFilter( 'visualizer_get_language', 'getLanguage' ); |
| 70 | 69 | $this->_addShortcode( 'visualizer', 'renderChart' ); |
| 71 | 70 | |
| @@ -305,25 +304,8 @@ | ||
| 305 | 304 | ), |
| 306 | 305 | $atts |
| 307 | 306 | ); |
| 308 | 307 | |
| 309 | - $atts['id'] = (int) $atts['id']; | |
| 310 | - $atts['class'] = esc_attr( $atts['class'] ); | |
| 311 | - $atts['lazy'] = esc_attr( $atts['lazy'] ); | |
| 312 | - $atts['use_image'] = esc_attr( $atts['use_image'] ); | |
| 313 | - | |
| 314 | - global $sitepress; | |
| 315 | - if ( Visualizer_Module::is_pro() && ( function_exists( 'icl_get_languages' ) && $sitepress instanceof \SitePress ) ) { | |
| 316 | - global $sitepress; | |
| 317 | - $locale = icl_get_current_language(); | |
| 318 | - $locale = strtolower( str_replace( '_', '-', $locale ) ); | |
| 319 | - $trid = $sitepress->get_element_trid( $atts['id'], 'post_' . Visualizer_Plugin::CPT_VISUALIZER ); | |
| 320 | - $translations = $sitepress->get_element_translations( $trid ); | |
| 321 | - if ( isset( $translations[ $locale ] ) && is_object( $translations[ $locale ] ) ) { | |
| 322 | - $atts['id'] = $translations[ $locale ]->element_id; | |
| 323 | - } | |
| 324 | - } | |
| 325 | - | |
| 326 | 308 | $chart_data = $this->getChartData( Visualizer_Plugin::CF_CHART_CACHE, $atts['id'] ); |
| 327 | 309 | // if empty chart does not exists, then return empty string. |
| 328 | 310 | if ( ! $chart_data ) { |
| 329 | 311 | return ''; |
| @@ -336,12 +318,8 @@ | ||
| 336 | 318 | if ( ! apply_filters( 'visualizer_pro_show_chart', true, $atts['id'] ) ) { |
| 337 | 319 | return ''; |
| 338 | 320 | } |
| 339 | 321 | |
| 340 | - if ( ! is_admin() && ! empty( $chart_data['is_woocommerce_report'] ) ) { | |
| 341 | - return ''; | |
| 342 | - } | |
| 343 | - | |
| 344 | 322 | // in case revisions exist. |
| 345 | 323 | // phpcs:ignore WordPress.CodeAnalysis.AssignmentInCondition.Found |
| 346 | 324 | if ( true === ( $revisions = $this->undoRevisions( $chart->ID, true ) ) ) { |
| 347 | 325 | $chart = get_post( $chart->ID ); |
| @@ -362,15 +340,12 @@ | ||
| 362 | 340 | if ( ctype_digit( $atts['lazy'] ) ) { |
| 363 | 341 | $attributes['data-lazy-limit'] = $atts['lazy']; |
| 364 | 342 | } |
| 365 | 343 | |
| 366 | - $attributes = apply_filters( 'visualizer_container_attributes', $attributes, $chart->ID ); | |
| 367 | - | |
| 368 | 344 | $chart = apply_filters( 'visualizer_schedule_refresh_chart', $chart, $chart->ID, false ); |
| 369 | 345 | |
| 370 | 346 | // Get and update settings. |
| 371 | 347 | $settings = $chart_data['settings']; |
| 372 | - $settings = ! empty( $settings ) ? $settings : array(); | |
| 373 | 348 | if ( empty( $settings['height'] ) ) { |
| 374 | 349 | $settings['height'] = '400'; |
| 375 | 350 | } |
| 376 | 351 | |
| @@ -417,21 +392,8 @@ | ||
| 417 | 392 | if ( isset( $settings['chart-img'] ) ) { |
| 418 | 393 | unset( $settings['chart-img'] ); |
| 419 | 394 | } |
| 420 | 395 | |
| 421 | - $enable_controls = false; | |
| 422 | - if ( isset( $settings['controls'] ) && ! empty( $settings['controls']['controlType'] ) ) { | |
| 423 | - $column_index = $settings['controls']['filterColumnIndex']; | |
| 424 | - $column_label = $settings['controls']['filterColumnLabel']; | |
| 425 | - if ( 'false' !== $column_index || 'false' !== $column_label ) { | |
| 426 | - $enable_controls = true; | |
| 427 | - } | |
| 428 | - } | |
| 429 | - | |
| 430 | - if ( ! $enable_controls ) { | |
| 431 | - unset( $settings['controls'] ); | |
| 432 | - } | |
| 433 | - | |
| 434 | 396 | // add chart to the array |
| 435 | 397 | $this->_charts[ $id ] = array( |
| 436 | 398 | 'type' => $type, |
| 437 | 399 | 'series' => $series, |
| @@ -509,17 +471,11 @@ | ||
| 509 | 471 | ); |
| 510 | 472 | } |
| 511 | 473 | $count++; |
| 512 | 474 | } |
| 513 | - $prefix = 'C' . 'h' . 'a' . 'rt'; | |
| 514 | - if ( $type === 'tabular' ) { | |
| 515 | - $prefix = 'T' . 'a' . 'bl' . 'e'; | |
| 516 | - } | |
| 517 | - if ( Visualizer_Module::is_pro() && $enable_controls ) { | |
| 518 | - $actions_div .= '<div id="control_wrapper_' . $id . '"></div>'; | |
| 519 | - } | |
| 475 | + | |
| 520 | 476 | // return placeholder div |
| 521 | - return '<div class="' . $container_class . '" id="chart_wrapper_' . $id . '">' . $actions_div . '<div id="' . $id . '"' . $this->getHtmlAttributes( $attributes ) . '></div>' . $this->addSchema( $chart->ID ) . '</div>'; | |
| 477 | + return '<div class="' . $container_class . '">' . $actions_div . '<div id="' . $id . '"' . $this->getHtmlAttributes( $attributes ) . '></div>' . $this->addSchema( $chart->ID ) . '</div>'; | |
| 522 | 478 | } |
| 523 | 479 | |
| 524 | 480 | /** |
| 525 | 481 | * Converts the array of attributes to a string of HTML attributes. |
| @@ -661,11 +617,10 @@ | ||
| 661 | 617 | |
| 662 | 618 | // Get chart by ID. |
| 663 | 619 | $chart = get_post( $chart_id ); |
| 664 | 620 | if ( $chart && Visualizer_Plugin::CPT_VISUALIZER === $chart->post_type ) { |
| 665 | - $settings = get_post_meta( $chart->ID, Visualizer_Plugin::CF_SETTINGS, true ); | |
| 666 | - $series = get_post_meta( $chart->ID, Visualizer_Plugin::CF_SERIES, true ); | |
| 667 | - $is_woocommerce_report = get_post_meta( $chart->ID, Visualizer_Plugin::CF_IS_WOOCOMMERCE_SOURCE, true ); | |
| 621 | + $settings = get_post_meta( $chart->ID, Visualizer_Plugin::CF_SETTINGS, true ); | |
| 622 | + $series = get_post_meta( $chart->ID, Visualizer_Plugin::CF_SERIES, true ); | |
| 668 | 623 | |
| 669 | 624 | if ( isset( $settings['series'] ) && ! ( count( $settings['series'] ) - count( $series ) > 1 ) ) { |
| 670 | 625 | $diff_total_series = abs( count( $settings['series'] ) - count( $series ) ); |
| 671 | 626 | if ( $diff_total_series ) { |
| @@ -674,14 +629,13 @@ | ||
| 674 | 629 | } |
| 675 | 630 | } |
| 676 | 631 | } |
| 677 | 632 | $chart_data = array( |
| 678 | - 'chart' => $chart, | |
| 679 | - 'type' => get_post_meta( $chart->ID, Visualizer_Plugin::CF_CHART_TYPE, true ), | |
| 680 | - 'settings' => $settings, | |
| 681 | - 'series' => $series, | |
| 682 | - 'chart_image' => get_post_meta( $chart->ID, Visualizer_Plugin::CF_CHART_IMAGE, true ), | |
| 683 | - 'is_woocommerce_report' => $is_woocommerce_report, | |
| 633 | + 'chart' => $chart, | |
| 634 | + 'type' => get_post_meta( $chart->ID, Visualizer_Plugin::CF_CHART_TYPE, true ), | |
| 635 | + 'settings' => $settings, | |
| 636 | + 'series' => $series, | |
| 637 | + 'chart_image' => get_post_meta( $chart->ID, Visualizer_Plugin::CF_CHART_IMAGE, true ), | |
| 684 | 638 | ); |
| 685 | 639 | |
| 686 | 640 | // Put the results in a transient. Expire after 12 hours. |
| 687 | 641 | set_transient( $cache_key, $chart_data, apply_filters( Visualizer_Plugin::FILTER_HANDLE_CACHE_EXPIRATION_TIME, 12 * HOUR_IN_SECONDS ) ); |