| @@ -79,16 +79,8 @@ | ||
| 79 | 79 | } else { |
| 80 | 80 | $version = $this->version; |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - if ( ! wp_script_is( 'visualizer-datatables', 'registered' ) ) { | |
| 84 | - wp_register_script( 'visualizer-datatables', VISUALIZER_ABSURL . 'js/lib/datatables.min.js', array( 'jquery-ui-core' ), Visualizer_Plugin::VERSION ); | |
| 85 | - } | |
| 86 | - | |
| 87 | - if ( ! wp_style_is( 'visualizer-datatables', 'registered' ) ) { | |
| 88 | - wp_register_style( 'visualizer-datatables', VISUALIZER_ABSURL . 'css/lib/datatables.min.css', array(), Visualizer_Plugin::VERSION ); | |
| 89 | - } | |
| 90 | - | |
| 91 | 83 | // Enqueue the bundled block JS file |
| 92 | 84 | wp_enqueue_script( 'handsontable', $handsontableJS ); |
| 93 | 85 | wp_enqueue_script( 'visualizer-gutenberg-block', $blockPath, array( 'wp-api', 'handsontable', 'visualizer-datatables', 'moment' ), $version, true ); |
| 94 | 86 | |
| @@ -104,15 +96,14 @@ | ||
| 104 | 96 | $table_col_mapping = Visualizer_Source_Query_Params::get_all_db_tables_column_mapping( null, false ); |
| 105 | 97 | |
| 106 | 98 | $translation_array = array( |
| 107 | 99 | 'isPro' => $type, |
| 108 | - 'proTeaser' => tsdk_utmify( Visualizer_Plugin::PRO_TEASER_URL, 'blockupsell'), | |
| 100 | + 'proTeaser' => Visualizer_Plugin::PRO_TEASER_URL, | |
| 109 | 101 | 'absurl' => VISUALIZER_ABSURL, |
| 110 | 102 | 'charts' => Visualizer_Module_Admin::_getChartTypesLocalized(), |
| 111 | 103 | 'adminPage' => menu_page_url( 'visualizer', false ), |
| 112 | 104 | 'sqlTable' => $table_col_mapping, |
| 113 | 105 | 'chartsPerPage' => defined( 'TI_CYPRESS_TESTING' ) ? 20 : 6, |
| 114 | - 'proFeaturesLocked' => Visualizer_Module_Admin::proFeaturesLocked(), | |
| 115 | 106 | ); |
| 116 | 107 | wp_localize_script( 'visualizer-gutenberg-block', 'visualizerLocalize', $translation_array ); |
| 117 | 108 | |
| 118 | 109 | // Enqueue frontend and editor block styles |
| @@ -384,12 +375,8 @@ | ||
| 384 | 375 | if ( ! empty( $serie['role'] ) ) { |
| 385 | 376 | // this series is some kind of annotation, so let's collect its index. |
| 386 | 377 | // the index will be +1 because the X axis value is index 0, which is being ignored. |
| 387 | 378 | $annotations[ 'role' . ( intval( $index ) + 1 ) ] = $serie['role']; |
| 388 | - | |
| 389 | - if ( isset( $data['visualizer-series'][ intval( $index ) + 1 ] ) ) { | |
| 390 | - $data['visualizer-series'][ intval( $index ) + 1 ]['role'] = $serie['role']; | |
| 391 | - } | |
| 392 | 379 | } |
| 393 | 380 | } |
| 394 | 381 | } |
| 395 | 382 | if ( ! empty( $annotations ) ) { |
| @@ -600,21 +587,16 @@ | ||
| 600 | 587 | delete_post_meta( $data['id'], Visualizer_Plugin::CF_CHART_URL ); |
| 601 | 588 | apply_filters( 'visualizer_pro_remove_schedule', $data['id'] ); |
| 602 | 589 | } |
| 603 | 590 | |
| 604 | - // let's check if this is not an external db chart | |
| 605 | - // as there is no support for that in the block editor interface | |
| 606 | - $external_params = get_post_meta( $data['id'], Visualizer_Plugin::CF_REMOTE_DB_PARAMS, true ); | |
| 607 | - if ( empty( $external_params ) ) { | |
| 608 | - if ( $source_type === 'Visualizer_Source_Query' ) { | |
| 609 | - $db_schedule = intval( $data['visualizer-db-schedule'] ); | |
| 610 | - $db_query = $data['visualizer-db-query']; | |
| 611 | - update_post_meta( $data['id'], Visualizer_Plugin::CF_DB_SCHEDULE, $db_schedule ); | |
| 612 | - update_post_meta( $data['id'], Visualizer_Plugin::CF_DB_QUERY, stripslashes( $db_query ) ); | |
| 613 | - } else { | |
| 614 | - delete_post_meta( $data['id'], Visualizer_Plugin::CF_DB_SCHEDULE ); | |
| 615 | - delete_post_meta( $data['id'], Visualizer_Plugin::CF_DB_QUERY ); | |
| 616 | - } | |
| 591 | + if ( $source_type === 'Visualizer_Source_Query' ) { | |
| 592 | + $db_schedule = intval( $data['visualizer-db-schedule'] ); | |
| 593 | + $db_query = $data['visualizer-db-query']; | |
| 594 | + update_post_meta( $data['id'], Visualizer_Plugin::CF_DB_SCHEDULE, $db_schedule ); | |
| 595 | + update_post_meta( $data['id'], Visualizer_Plugin::CF_DB_QUERY, stripslashes( $db_query ) ); | |
| 596 | + } else { | |
| 597 | + delete_post_meta( $data['id'], Visualizer_Plugin::CF_DB_SCHEDULE ); | |
| 598 | + delete_post_meta( $data['id'], Visualizer_Plugin::CF_DB_QUERY ); | |
| 617 | 599 | } |
| 618 | 600 | |
| 619 | 601 | if ( $source_type === 'Visualizer_Source_Json' ) { |
| 620 | 602 | $json_schedule = intval( $data['visualizer-json-schedule'] ); |
| @@ -659,14 +641,8 @@ | ||
| 659 | 641 | ); |
| 660 | 642 | |
| 661 | 643 | wp_update_post( $chart ); |
| 662 | 644 | |
| 663 | - // Clear existing chart cache. | |
| 664 | - $cache_key = Visualizer_Plugin::CF_CHART_CACHE . '_' . $data['id']; | |
| 665 | - if ( get_transient( $cache_key ) ) { | |
| 666 | - delete_transient( $cache_key ); | |
| 667 | - } | |
| 668 | - | |
| 669 | 645 | $revisions = wp_get_post_revisions( $data['id'], array( 'order' => 'ASC' ) ); |
| 670 | 646 | |
| 671 | 647 | if ( count( $revisions ) > 1 ) { |
| 672 | 648 | $revision_ids = array_keys( $revisions ); |
| @@ -749,14 +725,10 @@ | ||
| 749 | 725 | if ( ! current_user_can( 'edit_posts' ) ) { |
| 750 | 726 | return false; |
| 751 | 727 | } |
| 752 | 728 | |
| 753 | - $remote_data = false; | |
| 754 | - if ( isset( $data['url'] ) && function_exists( 'wp_http_validate_url' ) ) { | |
| 755 | - $remote_data = wp_http_validate_url( $data['url'] ); | |
| 756 | - } | |
| 757 | - if ( false !== $remote_data && ! is_wp_error( $remote_data ) ) { | |
| 758 | - $source = new Visualizer_Source_Csv_Remote( $remote_data ); | |
| 729 | + if ( $data['url'] && ! is_wp_error( $data['url'] ) && filter_var( $data['url'], FILTER_VALIDATE_URL ) ) { | |
| 730 | + $source = new Visualizer_Source_Csv_Remote( $data['url'] ); | |
| 759 | 731 | if ( $source->fetch() ) { |
| 760 | 732 | $temp = $source->getData(); |
| 761 | 733 | if ( is_string( $temp ) && is_array( unserialize( $temp ) ) ) { |
| 762 | 734 | $content['series'] = $source->getSeries(); |