| @@ -66,9 +66,9 @@ | ||
| 66 | 66 | /** |
| 67 | 67 | * Enqueue front end and editor JavaScript and CSS |
| 68 | 68 | */ |
| 69 | 69 | public function enqueue_gutenberg_scripts() { |
| 70 | - global $wp_version, $pagenow; | |
| 70 | + global $wp_version; | |
| 71 | 71 | |
| 72 | 72 | $blockPath = VISUALIZER_ABSURL . 'classes/Visualizer/Gutenberg/build/block.js'; |
| 73 | 73 | $handsontableJS = VISUALIZER_ABSURL . 'classes/Visualizer/Gutenberg/build/handsontable.js'; |
| 74 | 74 | $stylePath = VISUALIZER_ABSURL . 'classes/Visualizer/Gutenberg/build/block.css'; |
| @@ -104,16 +104,14 @@ | ||
| 104 | 104 | $table_col_mapping = Visualizer_Source_Query_Params::get_all_db_tables_column_mapping( null, false ); |
| 105 | 105 | |
| 106 | 106 | $translation_array = array( |
| 107 | 107 | 'isPro' => $type, |
| 108 | - 'proTeaser' => tsdk_utmify( Visualizer_Plugin::PRO_TEASER_URL, 'blockupsell'), | |
| 108 | + 'proTeaser' => Visualizer_Plugin::PRO_TEASER_URL, | |
| 109 | 109 | 'absurl' => VISUALIZER_ABSURL, |
| 110 | 110 | 'charts' => Visualizer_Module_Admin::_getChartTypesLocalized(), |
| 111 | 111 | 'adminPage' => menu_page_url( 'visualizer', false ), |
| 112 | 112 | 'sqlTable' => $table_col_mapping, |
| 113 | 113 | 'chartsPerPage' => defined( 'TI_CYPRESS_TESTING' ) ? 20 : 6, |
| 114 | - 'proFeaturesLocked' => Visualizer_Module_Admin::proFeaturesLocked(), | |
| 115 | - 'isFullSiteEditor' => 'site-editor.php' === $pagenow, | |
| 116 | 114 | ); |
| 117 | 115 | wp_localize_script( 'visualizer-gutenberg-block', 'visualizerLocalize', $translation_array ); |
| 118 | 116 | |
| 119 | 117 | // Enqueue frontend and editor block styles |
| @@ -351,11 +349,9 @@ | ||
| 351 | 349 | $data['visualizer-default-data'] = get_post_meta( $post_id, Visualizer_Plugin::CF_DEFAULT_DATA, true ); |
| 352 | 350 | |
| 353 | 351 | // faetch and update settings |
| 354 | 352 | $data['visualizer-settings'] = get_post_meta( $post_id, Visualizer_Plugin::CF_SETTINGS, true ); |
| 355 | - if ( empty( $data['visualizer-settings']['pagination'] ) ) { | |
| 356 | - $data['visualizer-settings']['pageSize'] = ''; | |
| 357 | - } | |
| 353 | + | |
| 358 | 354 | // handle series filter hooks |
| 359 | 355 | $data['visualizer-series'] = apply_filters( Visualizer_Plugin::FILTER_GET_CHART_SERIES, get_post_meta( $post_id, Visualizer_Plugin::CF_SERIES, true ), $post_id, $data['visualizer-chart-type'] ); |
| 360 | 356 | |
| 361 | 357 | // handle settings filter hooks |
| @@ -369,12 +365,8 @@ | ||
| 369 | 365 | if ( in_array( $data['visualizer-chart-type'], array( 'tabular' ), true ) ) { |
| 370 | 366 | $data['visualizer-data'] = $this->format_chart_data( $data['visualizer-data'], $data['visualizer-series'] ); |
| 371 | 367 | } |
| 372 | 368 | |
| 373 | - if ( ! isset( $data['visualizer-settings']['hAxis']['format'] ) ) { | |
| 374 | - $data['visualizer-settings']['hAxis']['format'] = ''; | |
| 375 | - } | |
| 376 | - | |
| 377 | 369 | $data['visualizer-data-exploded'] = ''; |
| 378 | 370 | // handle annotations for google charts |
| 379 | 371 | if ( 'GoogleCharts' === $library ) { |
| 380 | 372 | // this will contain the data of both axis. |
| @@ -666,14 +658,8 @@ | ||
| 666 | 658 | ); |
| 667 | 659 | |
| 668 | 660 | wp_update_post( $chart ); |
| 669 | 661 | |
| 670 | - // Clear existing chart cache. | |
| 671 | - $cache_key = Visualizer_Plugin::CF_CHART_CACHE . '_' . $data['id']; | |
| 672 | - if ( get_transient( $cache_key ) ) { | |
| 673 | - delete_transient( $cache_key ); | |
| 674 | - } | |
| 675 | - | |
| 676 | 662 | $revisions = wp_get_post_revisions( $data['id'], array( 'order' => 'ASC' ) ); |
| 677 | 663 | |
| 678 | 664 | if ( count( $revisions ) > 1 ) { |
| 679 | 665 | $revision_ids = array_keys( $revisions ); |
| @@ -756,14 +742,10 @@ | ||
| 756 | 742 | if ( ! current_user_can( 'edit_posts' ) ) { |
| 757 | 743 | return false; |
| 758 | 744 | } |
| 759 | 745 | |
| 760 | - $remote_data = false; | |
| 761 | - if ( isset( $data['url'] ) && function_exists( 'wp_http_validate_url' ) ) { | |
| 762 | - $remote_data = wp_http_validate_url( $data['url'] ); | |
| 763 | - } | |
| 764 | - if ( false !== $remote_data && ! is_wp_error( $remote_data ) ) { | |
| 765 | - $source = new Visualizer_Source_Csv_Remote( $remote_data ); | |
| 746 | + if ( $data['url'] && ! is_wp_error( $data['url'] ) && filter_var( $data['url'], FILTER_VALIDATE_URL ) ) { | |
| 747 | + $source = new Visualizer_Source_Csv_Remote( $data['url'] ); | |
| 766 | 748 | if ( $source->fetch() ) { |
| 767 | 749 | $temp = $source->getData(); |
| 768 | 750 | if ( is_string( $temp ) && is_array( unserialize( $temp ) ) ) { |
| 769 | 751 | $content['series'] = $source->getSeries(); |