| @@ -214,11 +214,12 @@ | ||
| 214 | 214 | |
| 215 | 215 | $chart = get_post( $chart_id ); |
| 216 | 216 | |
| 217 | 217 | $source = new Visualizer_Source_Json( $params ); |
| 218 | + update_post_meta( $chart->ID, Visualizer_Plugin::CF_EDITABLE_TABLE, true ); | |
| 218 | 219 | $source->fetchFromEditableTable(); |
| 219 | 220 | |
| 220 | - $content = $source->getData(); | |
| 221 | + $content = $source->getData( get_post_meta( $chart->ID, Visualizer_Plugin::CF_EDITABLE_TABLE, true ) ); | |
| 221 | 222 | $chart->post_content = $content; |
| 222 | 223 | wp_update_post( $chart->to_array() ); |
| 223 | 224 | update_post_meta( $chart->ID, Visualizer_Plugin::CF_SERIES, $source->getSeries() ); |
| 224 | 225 | update_post_meta( $chart->ID, Visualizer_Plugin::CF_SOURCE, $source->getSourceName() ); |
| @@ -265,9 +266,9 @@ | ||
| 265 | 266 | delete_post_meta( $chart_id, Visualizer_Plugin::CF_CHART_SCHEDULE ); |
| 266 | 267 | |
| 267 | 268 | $render = new Visualizer_Render_Page_Update(); |
| 268 | 269 | $render->id = $chart->ID; |
| 269 | - $render->data = json_encode( $source->getRawData() ); | |
| 270 | + $render->data = json_encode( $source->getRawData( get_post_meta( $chart_id, Visualizer_Plugin::CF_EDITABLE_TABLE, true ) ) ); | |
| 270 | 271 | $render->series = json_encode( $source->getSeries() ); |
| 271 | 272 | $render->render(); |
| 272 | 273 | |
| 273 | 274 | defined( 'WP_TESTS_DOMAIN' ) ? wp_die() : exit(); |
| @@ -497,9 +498,9 @@ | ||
| 497 | 498 | 'post_type' => Visualizer_Plugin::CPT_VISUALIZER, |
| 498 | 499 | 'post_title' => 'Visualization', |
| 499 | 500 | 'post_author' => get_current_user_id(), |
| 500 | 501 | 'post_status' => 'auto-draft', |
| 501 | - 'post_content' => $source->getData(), | |
| 502 | + 'post_content' => $source->getData( get_post_meta( $chart_id, Visualizer_Plugin::CF_EDITABLE_TABLE, true ) ), | |
| 502 | 503 | ) |
| 503 | 504 | ); |
| 504 | 505 | if ( $chart_id && ! is_wp_error( $chart_id ) ) { |
| 505 | 506 | add_post_meta( $chart_id, Visualizer_Plugin::CF_CHART_TYPE, $default_type ); |
| @@ -850,9 +851,9 @@ | ||
| 850 | 851 | // if the chart has default data, update it with appropriate default data for new type |
| 851 | 852 | if ( filter_var( get_post_meta( $this->_chart->ID, Visualizer_Plugin::CF_DEFAULT_DATA, true ), FILTER_VALIDATE_BOOLEAN ) ) { |
| 852 | 853 | $source = new Visualizer_Source_Csv( VISUALIZER_ABSPATH . DIRECTORY_SEPARATOR . 'samples' . DIRECTORY_SEPARATOR . $type . '.csv' ); |
| 853 | 854 | $source->fetch(); |
| 854 | - $this->_chart->post_content = $source->getData(); | |
| 855 | + $this->_chart->post_content = $source->getData( get_post_meta( $this->_chart->ID, Visualizer_Plugin::CF_EDITABLE_TABLE, true ) ); | |
| 855 | 856 | wp_update_post( $this->_chart->to_array() ); |
| 856 | 857 | update_post_meta( $this->_chart->ID, Visualizer_Plugin::CF_SERIES, $source->getSeries() ); |
| 857 | 858 | } |
| 858 | 859 | |
| @@ -1086,9 +1087,9 @@ | ||
| 1086 | 1087 | do_action( 'themeisle_log_event', Visualizer_Plugin::NAME, sprintf( 'Uploaded data for chart %d with source %s', $chart_id, print_r( $source, true ) ), 'debug', __FILE__, __LINE__ ); |
| 1087 | 1088 | |
| 1088 | 1089 | if ( $source ) { |
| 1089 | 1090 | if ( $source->fetch() ) { |
| 1090 | - $content = $source->getData(); | |
| 1091 | + $content = $source->getData( get_post_meta( $chart_id, Visualizer_Plugin::CF_EDITABLE_TABLE, true ) ); | |
| 1091 | 1092 | $populate = true; |
| 1092 | 1093 | if ( is_string( $content ) && is_array( unserialize( $content ) ) ) { |
| 1093 | 1094 | $json = unserialize( $content ); |
| 1094 | 1095 | // if source exists, so should data. if source exists but data is blank, do not populate the chart. |
| @@ -1113,9 +1114,9 @@ | ||
| 1113 | 1114 | |
| 1114 | 1115 | $settings = get_post_meta( $chart->ID, Visualizer_Plugin::CF_SETTINGS, true ); |
| 1115 | 1116 | |
| 1116 | 1117 | $render->id = $chart->ID; |
| 1117 | - $render->data = json_encode( $source->getRawData() ); | |
| 1118 | + $render->data = json_encode( $source->getRawData( get_post_meta( $chart->ID, Visualizer_Plugin::CF_EDITABLE_TABLE, true ) ) ); | |
| 1118 | 1119 | $render->series = json_encode( $source->getSeries() ); |
| 1119 | 1120 | $render->settings = json_encode( $settings ); |
| 1120 | 1121 | } else { |
| 1121 | 1122 | $error = $source->get_error(); |
| @@ -1348,12 +1349,12 @@ | ||
| 1348 | 1349 | |
| 1349 | 1350 | wp_update_post( |
| 1350 | 1351 | array( |
| 1351 | 1352 | 'ID' => $chart_id, |
| 1352 | - 'post_content' => $source->getData(), | |
| 1353 | + 'post_content' => $source->getData( get_post_meta( $chart_id, Visualizer_Plugin::CF_EDITABLE_TABLE, true ) ), | |
| 1353 | 1354 | ) |
| 1354 | 1355 | ); |
| 1355 | - $render->data = json_encode( $source->getRawData() ); | |
| 1356 | + $render->data = json_encode( $source->getRawData( get_post_meta( $chart_id, Visualizer_Plugin::CF_EDITABLE_TABLE, true ) ) ); | |
| 1356 | 1357 | $render->series = json_encode( $source->getSeries() ); |
| 1357 | 1358 | $render->id = $chart_id; |
| 1358 | 1359 | } else { |
| 1359 | 1360 | $render->message = $error; |