PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.4.3
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.4.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.php +27 -1 3.4.23.4.3 View file →
@@ -189,9 +189,9 @@
189 189 if ( $success ) {
190 190 $settings = get_post_meta( $chart_id, Visualizer_Plugin::CF_SETTINGS, true );
191 191 $rows = array();
192 192 $series = get_post_meta( $chart_id, Visualizer_Plugin::CF_SERIES, true );
193 - $data = unserialize( $chart->post_content );
193 + $data = self::get_chart_data( $chart, $type, false );
194 194 if ( ! empty( $series ) ) {
195 195 $row = array();
196 196 foreach ( $series as $array ) {
197 197 $row[] = $array['label'];
@@ -697,5 +697,31 @@
697 697 return array( 'schedule-chart', 'chart-permissions' );
698 698 }
699 699 }
700 700
701 + /**
702 + * Gets the chart content after common manipulations.
703 + */
704 + public static function get_chart_data( $chart, $type, $run_filter = true ) {
705 + // change HTML entities
706 + $data = unserialize( html_entity_decode( $chart->post_content ) );
707 + $altered = array();
708 + foreach ( $data as $index => $array ) {
709 + if ( ! is_array( $index ) && is_array( $array ) ) {
710 + foreach ( $array as &$datum ) {
711 + if ( is_string( $datum ) ) {
712 + $datum = stripslashes( $datum );
713 + }
714 + }
715 + $altered[ $index ] = $array;
716 + }
717 + }
718 + // if something goes wrong and the end result is empty, be safe and use the original data
719 + if ( empty( $altered ) ) {
720 + $altered = $data;
721 + }
722 + if ( $run_filter ) {
723 + return apply_filters( Visualizer_Plugin::FILTER_GET_CHART_DATA, $altered, $chart->ID, $type );
724 + }
725 + return $altered;
726 + }
701 727 }