diff --git a/.github/ISSUE_TEMPLATE/Bug_report.yml b/.github/ISSUE_TEMPLATE/Bug_report.yml new file mode 100644 index 000000000..80485d4fd --- /dev/null +++ b/.github/ISSUE_TEMPLATE/Bug_report.yml @@ -0,0 +1,62 @@ +name: Bug report +description: Report a bug so we can get to squashing it. +labels: bug +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to fill out this bug report! + - type: textarea + attributes: + label: Description + description: Please write a brief description of the bug, including what you expect to happen and what is currently happening. + placeholder: | + Feature '...' is not working properly. I expect '...' to happen, but '...' happens instead + validations: + required: true + + - type: textarea + attributes: + label: Step-by-step reproduction instructions + description: Please write the steps needed to reproduce the bug. + placeholder: | + 1. Go to '...' + 2. Click on '...' + 3. Scroll down to '...' + validations: + required: true + + - type: textarea + attributes: + label: Screenshots, screen recording, code snippet or Help Scout ticket + description: | + If possible, please upload a screenshot or screen recording which demonstrates the bug. + Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in. + Tip: You can include links to customer Help Scout support thread. + validations: + required: false + + - type: input + attributes: + label: Environment info + description: | + Please share a https://pastebin.com/ link of your system details by going to site Admin -> Tools -> Site Health -> Info and Copy to Clipboard + placeholder: pastebin.com/ ... + validations: + required: false + + - type: dropdown + id: regression + attributes: + label: Is the issue you are reporting a regression + description: | + i.e, a previously working feature/functionality is now broken? + By specifying whether or not your issue is a regression, it will help the development team to more effectively diagnose and resolve the problem. + + multiple: false + options: + - 'No' + - 'Yes, this is a regression.' + validations: + required: true + \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/Feature_request.yml b/.github/ISSUE_TEMPLATE/Feature_request.yml new file mode 100644 index 000000000..45d8cbfbf --- /dev/null +++ b/.github/ISSUE_TEMPLATE/Feature_request.yml @@ -0,0 +1,21 @@ +name: Feature request +description: Suggest a feature that we can implement. +labels: new feature +body: +- type: textarea + attributes: + label: What problem does this address? + description: | + Can you give us a little more insight into this feature request? We'd love to know if it's related to any problems or pain points you've been facing. + If so, can you please let us know what the issue is in a clear and simple way? + Tip: If this is related to a customer request, please add the Help Scout thread URL. + placeholder: | + For example, something like "I find it tough when..." or "I get frustrated because..." would be great. + validations: + required: true +- type: textarea + attributes: + label: What is your proposed solution? + description: Can you please specify the desired feature or improvement and how it resolves the problem mentioned? + validations: + required: false \ No newline at end of file diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 000000000..ed55b0432 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,10 @@ + +version: 2 +updates: + + # Maintain dependencies for Composer + - package-ecosystem: "composer" + directory: "/" + target-branch: "development" + schedule: + interval: "weekly" \ No newline at end of file diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 000000000..9f1495f20 --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,5 @@ +regression: + - '(Yes, this is a regression)' + +customer report: + - '(helpscout)' \ No newline at end of file diff --git a/.github/workflows/issue-labeler.yml b/.github/workflows/issue-labeler.yml new file mode 100644 index 000000000..73283e313 --- /dev/null +++ b/.github/workflows/issue-labeler.yml @@ -0,0 +1,14 @@ +name: "Issue Labeler" +on: + issues: + types: [opened] + +jobs: + triage: + runs-on: ubuntu-latest + steps: + - uses: github/issue-labeler@master + with: + repo-token: "${{ secrets.BOT_TOKEN }}" + enable-versioned-regex: 0 + configuration-path: .github/labeler.yml \ No newline at end of file diff --git a/.github/workflows/test-e2e.yml b/.github/workflows/test-e2e.yml index 3ac325bbb..374143adf 100755 --- a/.github/workflows/test-e2e.yml +++ b/.github/workflows/test-e2e.yml @@ -41,13 +41,11 @@ jobs: bash ./bin/run-e2e-tests-${{matrix.env}}.sh - name: Run ${{ matrix.env }} Cypress tests env: - CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }} uses: cypress-io/github-action@v2 with: env: host=localhost,port=8080 browser: chrome - record: true install: ${{ ! steps.npm-and-build-cache.outputs.cache-hit }} headless: true spec: cypress/integration/${{ matrix.env }}/**/* \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 1cf5c123f..0a5029b60 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +##### [Version 3.9.6](https://github.com/Codeinwp/visualizer/compare/v3.9.5...v3.9.6) (2023-03-20) + +- Fixed custom format issue in ChartJS + ##### [Version 3.9.5](https://github.com/Codeinwp/visualizer/compare/v3.9.4...v3.9.5) (2023-01-30) - Improved security by escaping shortcode attribute before render diff --git a/classes/Visualizer/Plugin.php b/classes/Visualizer/Plugin.php index 782ecc386..2a150d195 100644 --- a/classes/Visualizer/Plugin.php +++ b/classes/Visualizer/Plugin.php @@ -28,7 +28,7 @@ class Visualizer_Plugin { const NAME = 'visualizer'; - const VERSION = '3.9.5'; + const VERSION = '3.9.6'; // custom post types const CPT_VISUALIZER = 'visualizer'; diff --git a/classes/Visualizer/Render/Sidebar/Type/ChartJS/Pie.php b/classes/Visualizer/Render/Sidebar/Type/ChartJS/Pie.php index 6540df2d8..3247ece3b 100644 --- a/classes/Visualizer/Render/Sidebar/Type/ChartJS/Pie.php +++ b/classes/Visualizer/Render/Sidebar/Type/ChartJS/Pie.php @@ -109,6 +109,26 @@ protected function _renderChartTypeSettings() { esc_html__( 'If checked, the chart will be rendered as a donut chart.', 'visualizer' ) ); + self::_renderTextItem( + esc_html__( 'Number Format', 'visualizer' ), + 'format', + isset( $this->format ) ? $this->format : '', + sprintf( + '%s

%s

%s', + esc_html__( 'Enter custom format pattern to apply to horizontal axis labels.', 'visualizer' ), + sprintf( + esc_html__( 'For number axis labels, this is a subset of the decimal formatting %1$sICU pattern set%2$s. For instance, $#,###.## will display values $1,234.56 for value 1234.56. Pay attention that if you use #%% percentage format then your values will be multiplied by 100.', 'visualizer' ), + '', + '' + ), + sprintf( + esc_html__( 'For date axis labels, this is a subset of the date formatting %1$sICU date and time format%2$s.', 'visualizer' ), + '', + '' + ) + ) + ); + self::_renderSectionEnd(); self::_renderGroupEnd(); diff --git a/composer.json b/composer.json old mode 100755 new mode 100644 index 741c5eefd..57713da94 --- a/composer.json +++ b/composer.json @@ -48,7 +48,7 @@ }, "require-dev": { "wp-coding-standards/wpcs": "^2.3", - "dealerdirect/phpcodesniffer-composer-installer": "^0.7.1", + "dealerdirect/phpcodesniffer-composer-installer": "^1.0.0", "phpcompatibility/phpcompatibility-wp": "*" } } diff --git a/composer.lock b/composer.lock old mode 100755 new mode 100644 index 1603abb2b..2e4dad601 --- a/composer.lock +++ b/composer.lock @@ -4,20 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "5d0ceaf13110caf44eba37c03a1a1e5f", + "content-hash": "70f95a41eef54d256d3b52f94b61c9cb", "packages": [ { "name": "codeinwp/themeisle-sdk", - "version": "3.2.30", + "version": "3.2.39", "source": { "type": "git", "url": "https://github.com/Codeinwp/themeisle-sdk.git", - "reference": "7239104ae452b13cd6d506d44e8fc127232d35ce" + "reference": "a8c4d66f8eb670caaf204f7dae9cd5850166bdaa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Codeinwp/themeisle-sdk/zipball/7239104ae452b13cd6d506d44e8fc127232d35ce", - "reference": "7239104ae452b13cd6d506d44e8fc127232d35ce", + "url": "https://api.github.com/repos/Codeinwp/themeisle-sdk/zipball/a8c4d66f8eb670caaf204f7dae9cd5850166bdaa", + "reference": "a8c4d66f8eb670caaf204f7dae9cd5850166bdaa", "shasum": "" }, "require-dev": { @@ -42,9 +42,9 @@ ], "support": { "issues": "https://github.com/Codeinwp/themeisle-sdk/issues", - "source": "https://github.com/Codeinwp/themeisle-sdk/tree/v3.2.30" + "source": "https://github.com/Codeinwp/themeisle-sdk/tree/v3.2.39" }, - "time": "2022-09-15T19:54:34+00:00" + "time": "2023-03-17T16:32:40+00:00" }, { "name": "markbaker/complex", @@ -412,35 +412,38 @@ "packages-dev": [ { "name": "dealerdirect/phpcodesniffer-composer-installer", - "version": "v0.7.2", + "version": "v1.0.0", "source": { "type": "git", - "url": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer.git", - "reference": "1c968e542d8843d7cd71de3c5c9c3ff3ad71a1db" + "url": "https://github.com/PHPCSStandards/composer-installer.git", + "reference": "4be43904336affa5c2f70744a348312336afd0da" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/1c968e542d8843d7cd71de3c5c9c3ff3ad71a1db", - "reference": "1c968e542d8843d7cd71de3c5c9c3ff3ad71a1db", + "url": "https://api.github.com/repos/PHPCSStandards/composer-installer/zipball/4be43904336affa5c2f70744a348312336afd0da", + "reference": "4be43904336affa5c2f70744a348312336afd0da", "shasum": "" }, "require": { "composer-plugin-api": "^1.0 || ^2.0", - "php": ">=5.3", + "php": ">=5.4", "squizlabs/php_codesniffer": "^2.0 || ^3.1.0 || ^4.0" }, "require-dev": { "composer/composer": "*", + "ext-json": "*", + "ext-zip": "*", "php-parallel-lint/php-parallel-lint": "^1.3.1", - "phpcompatibility/php-compatibility": "^9.0" + "phpcompatibility/php-compatibility": "^9.0", + "yoast/phpunit-polyfills": "^1.0" }, "type": "composer-plugin", "extra": { - "class": "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin" + "class": "PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin" }, "autoload": { "psr-4": { - "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/" + "PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -456,7 +459,7 @@ }, { "name": "Contributors", - "homepage": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer/graphs/contributors" + "homepage": "https://github.com/PHPCSStandards/composer-installer/graphs/contributors" } ], "description": "PHP_CodeSniffer Standards Composer Installer Plugin", @@ -480,10 +483,10 @@ "tests" ], "support": { - "issues": "https://github.com/dealerdirect/phpcodesniffer-composer-installer/issues", - "source": "https://github.com/dealerdirect/phpcodesniffer-composer-installer" + "issues": "https://github.com/PHPCSStandards/composer-installer/issues", + "source": "https://github.com/PHPCSStandards/composer-installer" }, - "time": "2022-02-04T12:51:07+00:00" + "time": "2023-01-05T11:28:13+00:00" }, { "name": "phpcompatibility/php-compatibility", @@ -549,16 +552,16 @@ }, { "name": "phpcompatibility/phpcompatibility-paragonie", - "version": "1.3.1", + "version": "1.3.2", "source": { "type": "git", "url": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie.git", - "reference": "ddabec839cc003651f2ce695c938686d1086cf43" + "reference": "bba5a9dfec7fcfbd679cfaf611d86b4d3759da26" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityParagonie/zipball/ddabec839cc003651f2ce695c938686d1086cf43", - "reference": "ddabec839cc003651f2ce695c938686d1086cf43", + "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityParagonie/zipball/bba5a9dfec7fcfbd679cfaf611d86b4d3759da26", + "reference": "bba5a9dfec7fcfbd679cfaf611d86b4d3759da26", "shasum": "" }, "require": { @@ -595,26 +598,27 @@ "paragonie", "phpcs", "polyfill", - "standards" + "standards", + "static analysis" ], "support": { "issues": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie/issues", "source": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie" }, - "time": "2021-02-15T10:24:51+00:00" + "time": "2022-10-25T01:46:02+00:00" }, { "name": "phpcompatibility/phpcompatibility-wp", - "version": "2.1.3", + "version": "2.1.4", "source": { "type": "git", "url": "https://github.com/PHPCompatibility/PHPCompatibilityWP.git", - "reference": "d55de55f88697b9cdb94bccf04f14eb3b11cf308" + "reference": "b6c1e3ee1c35de6c41a511d5eb9bd03e447480a5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityWP/zipball/d55de55f88697b9cdb94bccf04f14eb3b11cf308", - "reference": "d55de55f88697b9cdb94bccf04f14eb3b11cf308", + "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityWP/zipball/b6c1e3ee1c35de6c41a511d5eb9bd03e447480a5", + "reference": "b6c1e3ee1c35de6c41a511d5eb9bd03e447480a5", "shasum": "" }, "require": { @@ -649,26 +653,27 @@ "compatibility", "phpcs", "standards", + "static analysis", "wordpress" ], "support": { "issues": "https://github.com/PHPCompatibility/PHPCompatibilityWP/issues", "source": "https://github.com/PHPCompatibility/PHPCompatibilityWP" }, - "time": "2021-12-30T16:37:40+00:00" + "time": "2022-10-24T09:00:36+00:00" }, { "name": "squizlabs/php_codesniffer", - "version": "3.7.1", + "version": "3.7.2", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "1359e176e9307e906dc3d890bcc9603ff6d90619" + "reference": "ed8e00df0a83aa96acf703f8c2979ff33341f879" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/1359e176e9307e906dc3d890bcc9603ff6d90619", - "reference": "1359e176e9307e906dc3d890bcc9603ff6d90619", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/ed8e00df0a83aa96acf703f8c2979ff33341f879", + "reference": "ed8e00df0a83aa96acf703f8c2979ff33341f879", "shasum": "" }, "require": { @@ -704,14 +709,15 @@ "homepage": "https://github.com/squizlabs/PHP_CodeSniffer", "keywords": [ "phpcs", - "standards" + "standards", + "static analysis" ], "support": { "issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues", "source": "https://github.com/squizlabs/PHP_CodeSniffer", "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki" }, - "time": "2022-06-18T07:21:10+00:00" + "time": "2023-02-22T23:07:41+00:00" }, { "name": "wp-coding-standards/wpcs", @@ -775,5 +781,5 @@ "platform-overrides": { "php": "5.6" }, - "plugin-api-version": "2.1.0" + "plugin-api-version": "2.3.0" } diff --git a/css/media.css b/css/media.css index f922fddcd..22d327927 100644 --- a/css/media.css +++ b/css/media.css @@ -1,5 +1,5 @@ /* - Version: 3.9.5 + Version: 3.9.6 */ #visualizer-library-view { padding: 30px 10px 10px 30px; diff --git a/index.php b/index.php index ccf4a9653..ed1896720 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/ 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.9.5 + Version: 3.9.6 Author: Themeisle Author URI: http://themeisle.com Requires at least: 3.5 diff --git a/js/render-chartjs.js b/js/render-chartjs.js index d9d7ad951..60aaa5bcc 100644 --- a/js/render-chartjs.js +++ b/js/render-chartjs.js @@ -118,6 +118,35 @@ return; } + // Format series label. + settings.plugins.tooltip = { + callbacks: { + label: function(context) { + var label = ''; + if ( 'object' === typeof context.dataset.label ) { + label = context.label || ''; + } else { + label = context.dataset.label || ''; + } + if ( label ) { + label += ': '; + } + var format = context.dataset.format || ''; + if ( format ) { + label += format_datum( context.formattedValue, format ); + } else { + format = 'undefined' !== typeof context.chart.config._config.options.format ? context.chart.config._config.options.format : ''; + if ( format ) { + label += format_datum( context.formattedValue, format ); + } else { + label += context.formattedValue; + } + } + return label; + } + } + }; + var chartjs = new Chart(context, { type: type, data: { @@ -131,7 +160,7 @@ if ( $( '#chart-img' ).length ) { $( '#chart-img' ).val( canvas.toDataURL() ); } - }, + } }], }); diff --git a/package.json b/package.json index 4c703eae8..f40f28727 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "visualizer", - "version": "3.9.5", + "version": "3.9.6", "description": "Visualizer Lite", "repository": { "type": "git", diff --git a/readme.txt b/readme.txt index fab94b9e1..6200350e0 100755 --- a/readme.txt +++ b/readme.txt @@ -163,6 +163,13 @@ Pay attention that to turn your shortcodes into graphs, your theme has to have ` == Changelog == +##### [Version 3.9.6](https://github.com/Codeinwp/visualizer/compare/v3.9.5...v3.9.6) (2023-03-20) + +- Fixed custom format issue in ChartJS + + + + ##### [Version 3.9.5](https://github.com/Codeinwp/visualizer/compare/v3.9.4...v3.9.5) (2023-01-30) - Improved security by escaping shortcode attribute before render