diff --git a/.releaserc.yml b/.releaserc.yml index 452d33c5b..13632e357 100644 --- a/.releaserc.yml +++ b/.releaserc.yml @@ -15,6 +15,7 @@ plugins: - - "semantic-release-slack-bot" - notifyOnSuccess: false notifyOnFail: false + markdownReleaseNotes: true branchesConfig: - pattern: master notifyOnSuccess: true diff --git a/CHANGELOG.md b/CHANGELOG.md index 4667685ea..cf1390f1b 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,38 +1,49 @@ -#### [Version 3.5.0](https://github.com/Codeinwp/visualizer/compare/v3.4.11...v3.5.0) (2021-04-28) +##### [Version 3.5.1](https://github.com/Codeinwp/visualizer/compare/v3.5.0...v3.5.1) (2021-05-25) -- Permissions tab disappears after a user modifies a chart's data [#728](https://github.com/Codeinwp/visualizer/issues/728) -- Conflict with Edit Flow plugin -- Improve compatibility with Ninja Forms -- Fix for color for Minor Grid Lines not working - -#### Features -- Add support for key:value header to access JSON endpoints -- Option to download CSV data of the chart without the row with series type - -### v3.4.11 - 2021-02-16 - **Changes:** - * Development - - ### v3.4.10 - 2020-12-09 - **Changes:** - * [Fix] Compatibility with Composer 2.0 - - ### v3.4.9 - 2020-11-26 - **Changes:** - * [Fix] Pie chart slices offset problem in the Gutenberg editor -* [Fix] Warning is thrown when remote file is used as source -* [Fix] Bubble chart legend position not working in the Gutenberg editor - - ### v3.4.8 - 2020-09-29 - **Changes:** - * [Fix] Option to edit charts imported from JSON +- Fix compatibility with 3rd party plugins which use the same js library as Visualizer [#801](https://github.com/Codeinwp/visualizer/issues/801) +- Fix fatal error when a new chart is created on PHP 8 [#795](https://github.com/Codeinwp/visualizer/issues/795) +- Chart doesn't get refreshed automatically when the JSON endpoint is used as the data source - ### v3.4.7 - 2020-09-21 - **Changes:** - * - [Fix] Import from JSON: Reordering columns only reorders the label, not the associated data -* - [Fix] numberFormat option doesn't apply in Bar charts when using annotations -* - [Fix] Google GEO chart is not rendering if 3rd data column is added +#### Features: +- Adds option to add schema.org Dataset for license and creator [#794](https://github.com/Codeinwp/visualizer/issues/794) + +#### [Version 3.5.0](https://github.com/Codeinwp/visualizer/compare/v3.4.11...v3.5.0) (2021-04-28) + +#### Fixes + +- Permissions tab disappears after a user modifies a chart's data +- Conflict with Edit Flow plugin +- Improve compatibility with Ninja Forms +- Fix for color for Minor Grid Lines not working + +#### Features +- Add support for key:value header to access JSON endpoints +- Option to download CSV data of the chart without the row with series type + +### v3.4.11 - 2021-02-16 + **Changes:** + * Development + + ### v3.4.10 - 2020-12-09 + **Changes:** + * [Fix] Compatibility with Composer 2.0 + + ### v3.4.9 - 2020-11-26 + **Changes:** + * [Fix] Pie chart slices offset problem in the Gutenberg editor +* [Fix] Warning is thrown when remote file is used as source +* [Fix] Bubble chart legend position not working in the Gutenberg editor + + ### v3.4.8 - 2020-09-29 + **Changes:** + * [Fix] Option to edit charts imported from JSON + + ### v3.4.7 - 2020-09-21 + **Changes:** + * - [Fix] Import from JSON: Reordering columns only reorders the label, not the associated data +* - [Fix] numberFormat option doesn't apply in Bar charts when using annotations +* - [Fix] Google GEO chart is not rendering if 3rd data column is added ### v3.4.6 - 2020-08-11 **Changes:** diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 000000000..36b5b5b16 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,13 @@ +## Releasing + +This repository uses conventional [changelog commit](https://github.com/Codeinwp/conventional-changelog-simple-preset) messages to trigger release + +How to release a new version: + +- Clone the master branch +- Do your changes +- Send a PR to master and merge it using the following subject message + - `release: ` - for patch release + - `release(minor): ` - for minor release + - `release(major): ` - for major release + The release notes will inherit the body of the commit message which triggered the release. For more details check the [simple-preset](https://github.com/Codeinwp/conventional-changelog-simple-preset) that we use. \ No newline at end of file diff --git a/classes/Visualizer/Module/Chart.php b/classes/Visualizer/Module/Chart.php index fccff6b73..52820e1d0 100644 --- a/classes/Visualizer/Module/Chart.php +++ b/classes/Visualizer/Module/Chart.php @@ -139,6 +139,10 @@ public function setJsonSchedule() { if ( -1 < $time ) { add_post_meta( $chart_id, Visualizer_Plugin::CF_JSON_SCHEDULE, $time ); + // Update schedules. + $schedules = get_option( Visualizer_Plugin::CF_JSON_SCHEDULE, array() ); + $schedules[ $chart_id ] = time() + $time * HOUR_IN_SECONDS; + update_option( Visualizer_Plugin::CF_JSON_SCHEDULE, $schedules ); } wp_send_json_success(); } diff --git a/classes/Visualizer/Module/Frontend.php b/classes/Visualizer/Module/Frontend.php index fb48bcde7..8a7d794fd 100644 --- a/classes/Visualizer/Module/Frontend.php +++ b/classes/Visualizer/Module/Frontend.php @@ -484,13 +484,48 @@ private function addSchema( $id ) { return ''; } + $license = ''; + if ( isset( $settings['license'] ) && ! empty( $settings['license'] ) ) { + $license = $settings['license']; + if ( is_array( $license ) ) { + $license = $settings['license']['text']; + } + } + $license = apply_filters( 'visualizer_schema_license', $license, $id ); + if ( empty( $license ) ) { + if ( $show_errors ) { + return ""; + } + return ''; + } + + $creator = ''; + if ( isset( $settings['creator'] ) && ! empty( $settings['creator'] ) ) { + $creator = $settings['creator']; + if ( is_array( $creator ) ) { + $creator = $settings['creator']['text']; + } + } + $creator = apply_filters( 'visualizer_schema_creator', $creator, $id ); + if ( empty( $creator ) ) { + if ( $show_errors ) { + return ""; + } + return ''; + } + $schema = apply_filters( 'visualizer_schema', '{ "@context":"https://schema.org/", "@type":"Dataset", "name":"' . esc_html( $title ) . '", - "description":"' . esc_html( $desc ) . '" + "description":"' . esc_html( $desc ) . '", + "license": "' . esc_html( $license ) . '", + "creator": { + "@type": "Person", + "name": "' . esc_html( $creator ) . '" + } }', $id ); diff --git a/classes/Visualizer/Plugin.php b/classes/Visualizer/Plugin.php index 62b4f3877..a4f1b8481 100644 --- a/classes/Visualizer/Plugin.php +++ b/classes/Visualizer/Plugin.php @@ -28,7 +28,7 @@ class Visualizer_Plugin { const NAME = 'visualizer'; - const VERSION = '3.5.0'; + const VERSION = '3.5.1'; // custom post types const CPT_VISUALIZER = 'visualizer'; diff --git a/classes/Visualizer/Render/Sidebar/ChartJS.php b/classes/Visualizer/Render/Sidebar/ChartJS.php index 50c2c98f6..d122d0090 100644 --- a/classes/Visualizer/Render/Sidebar/ChartJS.php +++ b/classes/Visualizer/Render/Sidebar/ChartJS.php @@ -296,6 +296,20 @@ protected function _renderGeneralSettings() { $this->_renderAnimationSettings(); + self::_renderSectionStart( esc_html__( 'License & Creator', 'visualizer' ), false ); + self::_renderTextItem( + esc_html__( 'License', 'visualizer' ), + 'license', + $this->license, + '' + ); + self::_renderTextItem( + esc_html__( 'Creator', 'visualizer' ), + 'creator', + $this->creator, + '' + ); + self::_renderSectionEnd(); self::_renderGroupEnd(); } diff --git a/classes/Visualizer/Render/Sidebar/Google.php b/classes/Visualizer/Render/Sidebar/Google.php index af55567a2..4c2983bad 100644 --- a/classes/Visualizer/Render/Sidebar/Google.php +++ b/classes/Visualizer/Render/Sidebar/Google.php @@ -208,7 +208,7 @@ protected function _renderGeneralSettings() { self::_renderSelectItem( esc_html__( 'Position', 'visualizer' ), 'legend[position]', - $this->legend['position'], + isset( $this->legend['position'] ) ? $this->legend['position'] : '', $this->_legendPositions, esc_html__( 'Determines where to place the legend, compared to the chart area.', 'visualizer' ) ); @@ -216,7 +216,7 @@ protected function _renderGeneralSettings() { self::_renderSelectItem( esc_html__( 'Alignment', 'visualizer' ), 'legend[alignment]', - $this->legend['alignment'], + isset( $this->legend['alignment'] ) ? $this->legend['alignment'] : '', $this->_alignments, esc_html__( 'Determines the alignment of the legend.', 'visualizer' ) ); @@ -234,7 +234,20 @@ protected function _renderGeneralSettings() { self::_renderSectionEnd(); $this->_renderAnimationSettings(); - + self::_renderSectionStart( esc_html__( 'License & Creator', 'visualizer' ), false ); + self::_renderTextItem( + esc_html__( 'License', 'visualizer' ), + 'license', + $this->license, + '' + ); + self::_renderTextItem( + esc_html__( 'Creator', 'visualizer' ), + 'creator', + $this->creator, + '' + ); + self::_renderSectionEnd(); do_action( 'visualizer_chart_settings', get_class( $this ), $this->_data, 'general', array( 'generic' => true ) ); self::_renderGroupEnd(); @@ -393,10 +406,12 @@ protected function _renderViewSettings() { echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'; - echo ''; + $chartarea_left = isset( $this->chartArea['left'] ) ? $this->chartArea['left'] : ''; + echo ''; echo ''; - echo ''; + $chartarea_top = isset( $this->chartArea['top'] ) ? $this->chartArea['top'] : ''; + echo ''; echo '
'; diff --git a/classes/Visualizer/Render/Sidebar/Type/GoogleCharts/Gauge.php b/classes/Visualizer/Render/Sidebar/Type/GoogleCharts/Gauge.php index 77d38aa26..d283bf039 100644 --- a/classes/Visualizer/Render/Sidebar/Type/GoogleCharts/Gauge.php +++ b/classes/Visualizer/Render/Sidebar/Type/GoogleCharts/Gauge.php @@ -78,6 +78,28 @@ protected function _renderGeneralSettings() { $this->title, esc_html__( 'Text to display in the back-end admin area.', 'visualizer' ) ); + + self::_renderTextAreaItem( + esc_html__( 'Chart Description', 'visualizer' ), + 'description', + $this->description, + sprintf( esc_html__( 'Description to display in the structured data schema as explained %1$shere%2$s', 'visualizer' ), '', '' ) + ); + self::_renderSectionEnd(); + + self::_renderSectionStart( esc_html__( 'License & Creator', 'visualizer' ), false ); + self::_renderTextItem( + esc_html__( 'License', 'visualizer' ), + 'license', + $this->license, + '' + ); + self::_renderTextItem( + esc_html__( 'Creator', 'visualizer' ), + 'creator', + $this->creator, + '' + ); self::_renderSectionEnd(); self::_renderGroupEnd(); diff --git a/classes/Visualizer/Render/Sidebar/Type/GoogleCharts/Geo.php b/classes/Visualizer/Render/Sidebar/Type/GoogleCharts/Geo.php index e9a8ff8a3..a3d2c443e 100644 --- a/classes/Visualizer/Render/Sidebar/Type/GoogleCharts/Geo.php +++ b/classes/Visualizer/Render/Sidebar/Type/GoogleCharts/Geo.php @@ -64,6 +64,27 @@ protected function _renderGeneralSettings() { $this->title, esc_html__( 'Text to display in the back-end admin area.', 'visualizer' ) ); + self::_renderTextAreaItem( + esc_html__( 'Chart Description', 'visualizer' ), + 'description', + $this->description, + sprintf( esc_html__( 'Description to display in the structured data schema as explained %1$shere%2$s', 'visualizer' ), '', '' ) + ); + self::_renderSectionEnd(); + + self::_renderSectionStart( esc_html__( 'License & Creator', 'visualizer' ), false ); + self::_renderTextItem( + esc_html__( 'License', 'visualizer' ), + 'license', + $this->license, + '' + ); + self::_renderTextItem( + esc_html__( 'Creator', 'visualizer' ), + 'creator', + $this->creator, + '' + ); self::_renderSectionEnd(); self::_renderGroupEnd(); } diff --git a/classes/Visualizer/Render/Sidebar/Type/GoogleCharts/Tabular.php b/classes/Visualizer/Render/Sidebar/Type/GoogleCharts/Tabular.php index 1ac6b12f0..aa96780d8 100644 --- a/classes/Visualizer/Render/Sidebar/Type/GoogleCharts/Tabular.php +++ b/classes/Visualizer/Render/Sidebar/Type/GoogleCharts/Tabular.php @@ -73,8 +73,28 @@ protected function _renderGeneralSettings() { $this->title, esc_html__( 'Text to display in the back-end admin area.', 'visualizer' ) ); + self::_renderTextAreaItem( + esc_html__( 'Chart Description', 'visualizer' ), + 'description', + $this->description, + sprintf( esc_html__( 'Description to display in the structured data schema as explained %1$shere%2$s', 'visualizer' ), '', '' ) + ); self::_renderSectionEnd(); - self::_renderGroupEnd(); + + self::_renderSectionStart( esc_html__( 'License & Creator', 'visualizer' ), false ); + self::_renderTextItem( + esc_html__( 'License', 'visualizer' ), + 'license', + $this->license, + '' + ); + self::_renderTextItem( + esc_html__( 'Creator', 'visualizer' ), + 'creator', + $this->creator, + '' + ); + self::_renderGroupEnd(); } /** diff --git a/classes/Visualizer/Source.php b/classes/Visualizer/Source.php index 879e73cc5..4dd801add 100644 --- a/classes/Visualizer/Source.php +++ b/classes/Visualizer/Source.php @@ -335,7 +335,7 @@ public static final function get_date_formats_if_exists( $series, $data ) { * * @return string|null */ - private static final function determine_date_format( $value, $type ) { + private static function determine_date_format( $value, $type ) { if ( version_compare( phpversion(), '5.3.0', '<' ) ) { do_action( 'themeisle_log_event', Visualizer_Plugin::NAME, sprintf( 'PHP version %s not supported', phpversion() ), 'error', __FILE__, __LINE__ ); return null; diff --git a/css/media.css b/css/media.css index a3607532c..028fa779c 100644 --- a/css/media.css +++ b/css/media.css @@ -1,5 +1,5 @@ /* - Version: 3.5.0 + Version: 3.5.1 */ #visualizer-library-view { padding: 30px 10px 10px 30px; diff --git a/index.php b/index.php index 82267fb9f..2be62769d 100644 --- a/index.php +++ b/index.php @@ -3,7 +3,7 @@ Plugin Name: Visualizer: Tables and Charts for WordPress Plugin URI: https://themeisle.com/plugins/visualizer-charts-and-graphs-lite/ Description: A simple, easy to use and quite powerful tool to create, manage and embed interactive charts into your WordPress posts and pages. The plugin uses Google Visualization API to render charts, which supports cross-browser compatibility (adopting VML for older IE versions) and cross-platform portability to iOS and new Android releases. - Version: 3.5.0 + Version: 3.5.1 Author: Themeisle Author URI: http://themeisle.com Requires at least: 3.5 diff --git a/js/media.js b/js/media.js index 34bbec03a..1e9560e9c 100644 --- a/js/media.js +++ b/js/media.js @@ -5,7 +5,7 @@ wpmvtv = wpmv.toolbar.visualizer; mediaFrame = wpmv.MediaFrame.Post; - g.charts.load("current", { packages: ["corechart", "geochart", "gauge", "table", "timeline"] }); + g.load('visualization', 'current', { packages: ["corechart", "geochart", "gauge", "table", "timeline"] }); wpmv.MediaFrame.Post = mediaFrame.extend({ initialize: function() { diff --git a/js/render-google.js b/js/render-google.js index de890c224..d0d099566 100644 --- a/js/render-google.js +++ b/js/render-google.js @@ -451,14 +451,15 @@ var __visualizer_chart_images = []; } objects = {}; - google.charts.load("current", {packages: $chart_types, mapsApiKey: v.map_api_key, 'language' : v.language}); - google.charts.setOnLoadCallback(function() { - gv = google.visualization; - all_charts = v.charts; - if(v.is_front == true && typeof v.id !== 'undefined'){ // jshint ignore:line - renderChart(v.id); - } else { - render(); + google.load( 'visualization', 'current', {packages: $chart_types, mapsApiKey: v.map_api_key, 'language' : v.language, + callback: function () { + gv = google.visualization; + all_charts = v.charts; + if(v.is_front == true && typeof v.id !== 'undefined'){ // jshint ignore:line + renderChart(v.id); + } else { + render(); + } } }); }); diff --git a/package.json b/package.json index 8a203275a..d8639a7d8 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "visualizer", - "version": "3.5.0", + "version": "3.5.1", "description": "Visualizer Lite", "repository": { "type": "git", diff --git a/readme.txt b/readme.txt index 7ff857783..5242937f3 100755 --- a/readme.txt +++ b/readme.txt @@ -163,10 +163,23 @@ Pay attention that to turn your shortcodes into graphs, your theme has to have ` == Changelog == -#### [Version 3.5.0](https://github.com/Codeinwp/visualizer/compare/v3.4.11...v3.5.0) (2021-04-28) +##### [Version 3.5.1](https://github.com/Codeinwp/visualizer/compare/v3.5.0...v3.5.1) (2021-05-25) + + +- Fix compatibility with 3rd party plugins which use the same js library as Visualizer [#801](https://github.com/Codeinwp/visualizer/issues/801) +- Fix fatal error when a new chart is created on PHP 8 [#795](https://github.com/Codeinwp/visualizer/issues/795) +- Chart doesn't get refreshed automatically when the JSON endpoint is used as the data source + +#### Features: +- Adds option to add schema.org Dataset for license and creator [#794](https://github.com/Codeinwp/visualizer/issues/794) + -- Permissions tab disappears after a user modifies a chart's data [#728](https://github.com/Codeinwp/visualizer/issues/728) + +#### [Version 3.5.0](https://github.com/Codeinwp/visualizer/compare/v3.4.11...v3.5.0) (2021-04-28) + +#### Fixes +- Permissions tab disappears after a user modifies a chart's data - Conflict with Edit Flow plugin - Improve compatibility with Ninja Forms - Fix for color for Minor Grid Lines not working