PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.0.11
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.0.11
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/Chart.php +14 -1 3.0.103.0.11 View file →
@@ -493,9 +493,22 @@
493 493 $render->message = esc_html__( 'CSV file with chart data was not uploaded. Please, try again.', 'visualizer' );
494 494 }
495 495 if ( $source ) {
496 496 if ( $source->fetch() ) {
497 - $chart->post_content = $source->getData();
497 + $content = $source->getData();
498 + $populate = true;
499 + if ( is_string( $content ) && is_array( unserialize( $content ) ) ) {
500 + $json = unserialize( $content );
501 + // if source exists, so should data. if source exists but data is blank, do not populate the chart.
502 + // if we populate the data even if it is empty, the chart will show "Table has no columns".
503 + if ( array_key_exists( 'source', $json ) && ! empty( $json['source'] ) && ( ! array_key_exists( 'data', $json ) || empty( $json['data'] ) ) ) {
504 + do_action( 'themeisle_log_event', Visualizer_Plugin::NAME, sprintf( 'Not populating chart data as source exists (%s) but data is empty!', $json['source'] ), 'warn', __FILE__, __LINE__ );
505 + $populate = false;
506 + }
507 + }
508 + if ( $populate ) {
509 + $chart->post_content = $content;
510 + }
498 511 wp_update_post( $chart->to_array() );
499 512 update_post_meta( $chart->ID, Visualizer_Plugin::CF_SERIES, $source->getSeries() );
500 513 update_post_meta( $chart->ID, Visualizer_Plugin::CF_SOURCE, $source->getSourceName() );
501 514 update_post_meta( $chart->ID, Visualizer_Plugin::CF_DEFAULT_DATA, 0 );