From 216b2fa959f3e350669ef5ae94c07756e5e1ba78 Mon Sep 17 00:00:00 2001 From: contactashish13 Date: Thu, 1 Jun 2017 18:08:46 +0530 Subject: [PATCH 1/2] support for non Latin characters --- classes/Visualizer/Module/Chart.php | 1 - classes/Visualizer/Render/Page/Data.php | 2 +- classes/Visualizer/Source/Csv.php | 7 ++++++- languages/visualizer.pot | 20 +++++++++++++++----- 4 files changed, 22 insertions(+), 8 deletions(-) diff --git a/classes/Visualizer/Module/Chart.php b/classes/Visualizer/Module/Chart.php index cad62015..26a7063c 100644 --- a/classes/Visualizer/Module/Chart.php +++ b/classes/Visualizer/Module/Chart.php @@ -379,7 +379,6 @@ public function renderFlattrScript() { * @access public */ public function uploadData() { - error_log( 'in uploadData ' . print_r( $_GET,true ) . print_r( $_POST,true ) ); // validate nonce // do not use filter_input as it does not work for phpunit test cases, use filter_var instead if ( ! isset( $_GET['nonce'] ) || ! wp_verify_nonce( $_GET['nonce'] ) ) { diff --git a/classes/Visualizer/Render/Page/Data.php b/classes/Visualizer/Render/Page/Data.php index 6585b547..90287250 100644 --- a/classes/Visualizer/Render/Page/Data.php +++ b/classes/Visualizer/Render/Page/Data.php @@ -157,7 +157,7 @@ class="visualizer-select"> -
  • +
  • diff --git a/classes/Visualizer/Source/Csv.php b/classes/Visualizer/Source/Csv.php index 98628ace..d0672970 100644 --- a/classes/Visualizer/Source/Csv.php +++ b/classes/Visualizer/Source/Csv.php @@ -62,6 +62,7 @@ public function __construct( $filename = null ) { private function _fetchSeries( &$handle ) { // read column titles $labels = fgetcsv( $handle, 0, VISUALIZER_CSV_DELIMITER, VISUALIZER_CSV_ENCLOSURE ); + $labels = array_map( 'utf8_encode', $labels ); // read series types $types = fgetcsv( $handle, 0, VISUALIZER_CSV_DELIMITER, VISUALIZER_CSV_ENCLOSURE ); @@ -78,6 +79,7 @@ private function _fetchSeries( &$handle ) { // re read the labels and empty types array $labels = fgetcsv( $handle, 0, VISUALIZER_CSV_DELIMITER, VISUALIZER_CSV_ENCLOSURE ); + $labels = array_map( 'utf8_encode', $labels ); $types = array(); } @@ -105,7 +107,10 @@ protected function _get_file_handle( $filename = false ) { // set line endings auto detect mode ini_set( 'auto_detect_line_endings', true ); // open file and return handle - return fopen( $filename ? $filename : $this->_filename, 'rb' ); + $fc = iconv( 'ISO-8859-1', 'utf-8', file_get_contents( $filename ? $filename : $this->_filename ) ); + $tmp = tempnam( sys_get_temp_dir(), rand() ); + file_put_contents( $tmp, $fc ); + return fopen( $tmp, 'rb' ); } /** diff --git a/languages/visualizer.pot b/languages/visualizer.pot index a630597b..39a1e3e1 100644 --- a/languages/visualizer.pot +++ b/languages/visualizer.pot @@ -2,9 +2,9 @@ # This file is distributed under the GPL v2.0 or later. msgid "" msgstr "" -"Project-Id-Version: Visualizer: Charts and Graphs Lite 2.1.0\n" +"Project-Id-Version: Visualizer: Charts and Graphs Lite 2.1.1\n" "Report-Msgid-Bugs-To: https://github.com/Codeinwp/visualizer/issues\n" -"POT-Creation-Date: 2017-05-16 06:15:21+00:00\n" +"POT-Creation-Date: 2017-06-01 12:26:17+00:00\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -102,7 +102,7 @@ msgid "Pro Addon" msgstr "" #: classes/Visualizer/Module/Chart.php:298 -#: classes/Visualizer/Module/Chart.php:580 +#: classes/Visualizer/Module/Chart.php:579 msgid "You have entered invalid URL. Please, insert proper URL." msgstr "" @@ -118,11 +118,11 @@ msgstr "" msgid "Insert Chart" msgstr "" -#: classes/Visualizer/Module/Chart.php:412 +#: classes/Visualizer/Module/Chart.php:411 msgid "CSV file with chart data was not uploaded. Please, try again." msgstr "" -#: classes/Visualizer/Module/Chart.php:424 +#: classes/Visualizer/Module/Chart.php:423 msgid "CSV file is broken or invalid. Please, try again." msgstr "" @@ -1500,6 +1500,16 @@ msgstr "" msgid "Insert" msgstr "" +#: vendor/codeinwp/themeisle-sdk/class-themeisle-sdk-licenser.php:453 +msgid "" +"Updating this theme will lose any customizations you have made. Cancel to " +"stop, OK to update." +msgstr "" + +#: vendor/codeinwp/themeisle-sdk/class-themeisle-sdk-widget-dashboard-blog.php:197 +msgid "Install" +msgstr "" + #. Plugin Name of the plugin/theme msgid "Visualizer: Charts and Graphs Lite" msgstr "" From bdc4b2533b2bf085e1d40d1095ea434f9206de3e Mon Sep 17 00:00:00 2001 From: selu91 Date: Fri, 2 Jun 2017 11:34:30 +0300 Subject: [PATCH 2/2] Bump version and updated readme. --- classes/Visualizer/Plugin.php | 2 +- css/media.css | 2 +- index.php | 2 +- package.json | 2 +- readme.txt | 3 +++ 5 files changed, 7 insertions(+), 4 deletions(-) diff --git a/classes/Visualizer/Plugin.php b/classes/Visualizer/Plugin.php index a8f25d8d..ae2f70ab 100644 --- a/classes/Visualizer/Plugin.php +++ b/classes/Visualizer/Plugin.php @@ -28,7 +28,7 @@ class Visualizer_Plugin { const NAME = 'visualizer'; - const VERSION = '2.1.3'; + const VERSION = '2.1.4'; // custom post types const CPT_VISUALIZER = 'visualizer'; diff --git a/css/media.css b/css/media.css index 0ec060ba..fa4313ad 100644 --- a/css/media.css +++ b/css/media.css @@ -1,5 +1,5 @@ /* - Version: 2.1.3 + Version: 2.1.4 */ #visualizer-library-view { padding: 30px 10px 10px 30px; diff --git a/index.php b/index.php index 2b696b52..f85cab0e 100644 --- a/index.php +++ b/index.php @@ -4,7 +4,7 @@ Plugin Name: Visualizer: Charts and Graphs Lite 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: 2.1.3 + Version: 2.1.4 Author: Themeisle Author URI: http://themeisle.com License: GPL v2.0 or later diff --git a/package.json b/package.json index f8cbedc3..1732230c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "visualizer", - "version": "2.1.3", + "version": "2.1.4", "description": "Visualizer Lite", "repository": { "type": "git", diff --git a/readme.txt b/readme.txt index d6b82d66..e65f173b 100644 --- a/readme.txt +++ b/readme.txt @@ -119,6 +119,9 @@ http://docs.themeisle.com/article/610-how-can-i-edit-the-data-manually == Changelog == += 2.1.4 = +* Fixed issues with non-latin chars on CSV files to import. + = 2.1.2 = * Fixed priority issue with wp_enqueue_media * Added latest version of sdk