| @@ -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 ); |
| @@ -368,9 +346,8 @@ | ||
| 368 | 346 | $chart = apply_filters( 'visualizer_schedule_refresh_chart', $chart, $chart->ID, false ); |
| 369 | 347 | |
| 370 | 348 | // Get and update settings. |
| 371 | 349 | $settings = $chart_data['settings']; |
| 372 | - $settings = ! empty( $settings ) ? $settings : array(); | |
| 373 | 350 | if ( empty( $settings['height'] ) ) { |
| 374 | 351 | $settings['height'] = '400'; |
| 375 | 352 | } |
| 376 | 353 | |
| @@ -661,11 +638,10 @@ | ||
| 661 | 638 | |
| 662 | 639 | // Get chart by ID. |
| 663 | 640 | $chart = get_post( $chart_id ); |
| 664 | 641 | 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 ); | |
| 642 | + $settings = get_post_meta( $chart->ID, Visualizer_Plugin::CF_SETTINGS, true ); | |
| 643 | + $series = get_post_meta( $chart->ID, Visualizer_Plugin::CF_SERIES, true ); | |
| 668 | 644 | |
| 669 | 645 | if ( isset( $settings['series'] ) && ! ( count( $settings['series'] ) - count( $series ) > 1 ) ) { |
| 670 | 646 | $diff_total_series = abs( count( $settings['series'] ) - count( $series ) ); |
| 671 | 647 | if ( $diff_total_series ) { |
| @@ -674,14 +650,13 @@ | ||
| 674 | 650 | } |
| 675 | 651 | } |
| 676 | 652 | } |
| 677 | 653 | $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, | |
| 654 | + 'chart' => $chart, | |
| 655 | + 'type' => get_post_meta( $chart->ID, Visualizer_Plugin::CF_CHART_TYPE, true ), | |
| 656 | + 'settings' => $settings, | |
| 657 | + 'series' => $series, | |
| 658 | + 'chart_image' => get_post_meta( $chart->ID, Visualizer_Plugin::CF_CHART_IMAGE, true ), | |
| 684 | 659 | ); |
| 685 | 660 | |
| 686 | 661 | // Put the results in a transient. Expire after 12 hours. |
| 687 | 662 | set_transient( $cache_key, $chart_data, apply_filters( Visualizer_Plugin::FILTER_HANDLE_CACHE_EXPIRATION_TIME, 12 * HOUR_IN_SECONDS ) ); |