WordPress Charts and Graphs Lite - Version 1.4.2

Version Description

  • Fixed remote CSV uploading issue when allow_url_fopen option is disabled in php.ini
  • Replaced flattr image on widget and added donate link to plugin meta data
  • Added notification message at library page when allow_url_fopen option is disabled
Download this release

Release Info

Developer madpixels
Plugin Icon WordPress Charts and Graphs Lite
Version 1.4.2
Comparing to
See all releases

Code changes from version 1.4.1.1 to 1.4.2

classes/Visualizer/Module/Admin.php CHANGED
@@ -343,8 +343,13 @@ class Visualizer_Module_Admin extends Visualizer_Module {
343
  if ( $plugin_file == plugin_basename( VISUALIZER_BASEFILE ) ) {
344
  // knowledge base link
345
  $plugin_meta[] = sprintf(
346
- '<a href="https://github.com/madpixelslabs/visualizer/wiki">%s</a>',
347
- esc_html__( 'Knowledge Base' )
 
 
 
 
 
348
  );
349
  }
350
 
343
  if ( $plugin_file == plugin_basename( VISUALIZER_BASEFILE ) ) {
344
  // knowledge base link
345
  $plugin_meta[] = sprintf(
346
+ '<a href="https://github.com/madpixelslabs/visualizer/wiki" target="_blank">%s</a>',
347
+ esc_html__( 'Knowledge Base', Visualizer_Plugin::NAME )
348
+ );
349
+ // flattr link
350
+ $plugin_meta[] = sprintf(
351
+ '<a href="http://flattr.com/thing/2574985/WordPress-Visualizer" target="_blank">%s</a>',
352
+ esc_html__( 'Donate', Visualizer_Plugin::NAME )
353
  );
354
  }
355
 
classes/Visualizer/Module/Chart.php CHANGED
@@ -323,6 +323,8 @@ class Visualizer_Module_Chart extends Visualizer_Module {
323
  ),
324
  ) );
325
 
 
 
326
  wp_iframe( array( $render, 'render') );
327
  }
328
 
@@ -382,9 +384,35 @@ class Visualizer_Module_Chart extends Visualizer_Module {
382
  $render->button = esc_attr__( 'Insert Chart', Visualizer_Plugin::NAME );
383
  }
384
 
 
 
385
  wp_iframe( array( $render, 'render') );
386
  }
387
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
388
  /**
389
  * Parses uploaded CSV file and saves new data for the chart.
390
  *
323
  ),
324
  ) );
325
 
326
+ $this->_addAction( 'admin_head', 'render_flattr_script' );
327
+
328
  wp_iframe( array( $render, 'render') );
329
  }
330
 
384
  $render->button = esc_attr__( 'Insert Chart', Visualizer_Plugin::NAME );
385
  }
386
 
387
+ $this->_addAction( 'admin_head', 'render_flattr_script' );
388
+
389
  wp_iframe( array( $render, 'render') );
390
  }
391
 
392
+ /**
393
+ * Renders flattr script in the iframe <head>
394
+ *
395
+ * @since 1.4.2
396
+ * @action admin_head
397
+ *
398
+ * @access public
399
+ */
400
+ public function render_flattr_script() {
401
+ echo <<<EOL
402
+ <script type="text/javascript">
403
+ /* <![CDATA[ */
404
+ (function() {
405
+ var s = document.createElement('script'), t = document.getElementsByTagName('script')[0];
406
+ s.type = 'text/javascript';
407
+ s.async = true;
408
+ s.src = 'http://api.flattr.com/js/0.6/load.js?mode=auto';
409
+ t.parentNode.insertBefore(s, t);
410
+ })();
411
+ /* ]]> */
412
+ </script>
413
+ EOL;
414
+ }
415
+
416
  /**
417
  * Parses uploaded CSV file and saves new data for the chart.
418
  *
classes/Visualizer/Plugin.php CHANGED
@@ -30,7 +30,7 @@
30
  class Visualizer_Plugin {
31
 
32
  const NAME = 'visualizer';
33
- const VERSION = '1.4.1.1';
34
 
35
  // custom post types
36
  const CPT_VISUALIZER = 'visualizer';
30
  class Visualizer_Plugin {
31
 
32
  const NAME = 'visualizer';
33
+ const VERSION = '1.4.2';
34
 
35
  // custom post types
36
  const CPT_VISUALIZER = 'visualizer';
classes/Visualizer/Render/Library.php CHANGED
@@ -146,8 +146,26 @@ class Visualizer_Render_Library extends Visualizer_Render {
146
  echo ' <a href="javascript:;" class="add-new-h2">', esc_html__( 'Add New', Visualizer_Plugin::NAME ), '</a>';
147
  echo '</h2>';
148
 
 
149
  $this->_renderLibrary();
150
  echo '</div>';
151
  }
152
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
153
  }
146
  echo ' <a href="javascript:;" class="add-new-h2">', esc_html__( 'Add New', Visualizer_Plugin::NAME ), '</a>';
147
  echo '</h2>';
148
 
149
+ $this->_renderMessages();
150
  $this->_renderLibrary();
151
  echo '</div>';
152
  }
153
 
154
+ /**
155
+ * Renders notification messages if need be.
156
+ *
157
+ * @since 1.4.2
158
+ *
159
+ * @access private
160
+ */
161
+ private function _renderMessages() {
162
+ if ( !filter_var( ini_get( 'allow_url_fopen' ), FILTER_VALIDATE_BOOLEAN ) ) {
163
+ echo '<div class="updated error">';
164
+ echo '<p>';
165
+ printf( esc_html__( '%s option is disabled in your php.ini config. Please, enable it by change its value to 1. This option increases the speed of remote CSV uploading.', Visualizer_Plugin::NAME ), '<b>allow_url_fopen</b>' );
166
+ echo '</p>';
167
+ echo '</div>';
168
+ }
169
+ }
170
+
171
  }
classes/Visualizer/Render/Page.php CHANGED
@@ -77,9 +77,7 @@ class Visualizer_Render_Page extends Visualizer_Render {
77
  esc_html_e( 'Rate it on WordPress.org', Visualizer_Plugin::NAME );
78
  echo '</a>';
79
  echo '<div id="flattr">';
80
- echo '<a href="http://goo.gl/hN9FYf" target="_blank">';
81
- echo '<img src="//api.flattr.com/button/flattr-badge-large.png" alt="Flattr this" title="Flattr this" border="0">';
82
- echo '</a>';
83
  echo '</div>';
84
  echo '</div>';
85
  echo '</div>';
77
  esc_html_e( 'Rate it on WordPress.org', Visualizer_Plugin::NAME );
78
  echo '</a>';
79
  echo '<div id="flattr">';
80
+ echo '<a class="FlattrButton" style="display:none;" rev="flattr;button:compact;" href="http://wordpress.org/plugins/visualizer/"></a>';
 
 
81
  echo '</div>';
82
  echo '</div>';
83
  echo '</div>';
classes/Visualizer/Source/Csv.php CHANGED
@@ -75,7 +75,7 @@ class Visualizer_Source_Csv extends Visualizer_Source {
75
  if ( !self::_validateTypes( $types ) ) {
76
  // re open the file
77
  fclose( $handle );
78
- $handle = fopen( $this->_filename, 'rb' );
79
 
80
  // re read the labels and empty types array
81
  $labels = fgetcsv( $handle, 0, VISUALIZER_CSV_DELIMITER, VISUALIZER_CSV_ENCLOSURE );
@@ -93,6 +93,22 @@ class Visualizer_Source_Csv extends Visualizer_Source {
93
  return true;
94
  }
95
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
  /**
97
  * Fetches information from source, parses it and builds series and data arrays.
98
  *
@@ -107,11 +123,8 @@ class Visualizer_Source_Csv extends Visualizer_Source {
107
  return false;
108
  }
109
 
110
- // set line endings auto detect mode
111
- @ini_set( 'auto_detect_line_endings', true );
112
-
113
  // read file and fill arrays
114
- $handle = fopen( $this->_filename, 'rb' );
115
  if ( $handle ) {
116
  // fetch series
117
  if ( !$this->_fetchSeries( $handle ) ) {
75
  if ( !self::_validateTypes( $types ) ) {
76
  // re open the file
77
  fclose( $handle );
78
+ $handle = $this->_get_file_handle();
79
 
80
  // re read the labels and empty types array
81
  $labels = fgetcsv( $handle, 0, VISUALIZER_CSV_DELIMITER, VISUALIZER_CSV_ENCLOSURE );
93
  return true;
94
  }
95
 
96
+ /**
97
+ * Returns file handle to fetch data from.
98
+ *
99
+ * @since 1.4.2
100
+ *
101
+ * @access protected
102
+ * @param string $filename Optional file name to get handle. If omitted, $_filename is used.
103
+ * @return resource File handle resource on success, otherwise FALSE.
104
+ */
105
+ protected function _get_file_handle( $filename = false ) {
106
+ // set line endings auto detect mode
107
+ @ini_set( 'auto_detect_line_endings', true );
108
+ // open file and return handle
109
+ return fopen( $filename ? $filename : $this->_filename, 'rb' );
110
+ }
111
+
112
  /**
113
  * Fetches information from source, parses it and builds series and data arrays.
114
  *
123
  return false;
124
  }
125
 
 
 
 
126
  // read file and fill arrays
127
+ $handle = $this->_get_file_handle();
128
  if ( $handle ) {
129
  // fetch series
130
  if ( !$this->_fetchSeries( $handle ) ) {
classes/Visualizer/Source/Csv/Remote.php CHANGED
@@ -30,6 +30,16 @@
30
  */
31
  class Visualizer_Source_Csv_Remote extends Visualizer_Source_Csv {
32
 
 
 
 
 
 
 
 
 
 
 
33
  /**
34
  * Returns data parsed from source.
35
  *
@@ -115,4 +125,35 @@ class Visualizer_Source_Csv_Remote extends Visualizer_Source_Csv {
115
  return __CLASS__;
116
  }
117
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
118
  }
30
  */
31
  class Visualizer_Source_Csv_Remote extends Visualizer_Source_Csv {
32
 
33
+ /**
34
+ * Temporary file name used when allow_url_fopen option is disabled.
35
+ *
36
+ * @since 1.4.2
37
+ *
38
+ * @access private
39
+ * @var string
40
+ */
41
+ private $_tmpfile = false;
42
+
43
  /**
44
  * Returns data parsed from source.
45
  *
125
  return __CLASS__;
126
  }
127
 
128
+ /**
129
+ * Returns file handle to fetch data from.
130
+ *
131
+ * @since 1.4.2
132
+ *
133
+ * @access protected
134
+ * @staticvar boolean $allow_url_fopen Determines whether or not allow_url_fopen option is enabled.
135
+ * @param string $filename Optional file name to get handle. If omitted, $_filename is used.
136
+ * @return resource File handle resource on success, otherwise FALSE.
137
+ */
138
+ protected function _get_file_handle( $filename = false ) {
139
+ static $allow_url_fopen = null;
140
+
141
+ if ( $this->_tmpfile && is_readable( $this->_tmpfile ) ) {
142
+ return parent::_get_file_handle( $this->_tmpfile );
143
+ }
144
+
145
+ if ( is_null( $allow_url_fopen ) ) {
146
+ $allow_url_fopen = filter_var( ini_get( 'allow_url_fopen' ), FILTER_VALIDATE_BOOLEAN );
147
+ }
148
+
149
+ $scheme = parse_url( $this->_filename, PHP_URL_SCHEME );
150
+ if ( $allow_url_fopen && in_array( $scheme, stream_get_wrappers() ) ) {
151
+ return parent::_get_file_handle( $filename );
152
+ }
153
+
154
+ $this->_tmpfile = download_url( $this->_filename );
155
+
156
+ return !is_wp_error( $this->_tmpfile ) ? parent::_get_file_handle( $this->_tmpfile ) : false;
157
+ }
158
+
159
  }
index.php CHANGED
@@ -3,9 +3,10 @@
3
  Plugin Name: WordPress Visualizer
4
  Plugin URI: https://github.com/madpixelslabs/visualizer
5
  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.
6
- Version: 1.4.1.1
7
  Author: Madpixels
8
  Author URI: http://madpixels.net
 
9
  License: GPL v2.0 or later
10
  License URI: http://www.opensource.org/licenses/gpl-license.php
11
  */
3
  Plugin Name: WordPress Visualizer
4
  Plugin URI: https://github.com/madpixelslabs/visualizer
5
  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.
6
+ Version: 1.4.2
7
  Author: Madpixels
8
  Author URI: http://madpixels.net
9
+ Donate link: http://flattr.com/thing/2574985/WordPress-Visualizer
10
  License: GPL v2.0 or later
11
  License URI: http://www.opensource.org/licenses/gpl-license.php
12
  */
languages/visualizer-en_US.mo CHANGED
Binary file
languages/visualizer-en_US.po CHANGED
@@ -2,8 +2,8 @@ msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Visualizer\n"
4
  "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2013-12-14 23:05+0300\n"
6
- "PO-Revision-Date: 2013-12-14 23:05+0300\n"
7
  "Last-Translator: Eugene Manuilov <eugene@manuilov.org>\n"
8
  "Language-Team: Eugene Manuilov <eugene@manuilov.org>\n"
9
  "Language: en_US\n"
@@ -351,6 +351,15 @@ msgstr "Visualizer Library"
351
  msgid "Add New"
352
  msgstr "Add New"
353
 
 
 
 
 
 
 
 
 
 
354
  #: classes/Visualizer/Render/Templates.php:70
355
  msgid "Insert"
356
  msgstr "Insert"
@@ -1270,7 +1279,7 @@ msgid "The stroke width of rising candles."
1270
  msgstr "The stroke width of rising candles."
1271
 
1272
  #: classes/Visualizer/Render/Page/Settings.php:56
1273
- #: classes/Visualizer/Render/Page/Data.php:99
1274
  msgid "Back"
1275
  msgstr "Back"
1276
 
@@ -1305,11 +1314,11 @@ msgstr "or read how you can add Google spreadsheet in following %sarticle%s."
1305
  msgid "From Computer"
1306
  msgstr "From Computer"
1307
 
1308
- #: classes/Visualizer/Render/Page/Data.php:83
1309
  msgid "From Web"
1310
  msgstr "From Web"
1311
 
1312
- #: classes/Visualizer/Render/Page/Data.php:102
1313
  #: classes/Visualizer/Render/Page/Types.php:84
1314
  msgid "Next"
1315
  msgstr "Next"
@@ -1374,6 +1383,10 @@ msgstr "Library"
1374
  msgid "Knowledge Base"
1375
  msgstr "Knowledge Base"
1376
 
 
 
 
 
1377
  #: classes/Visualizer/Module/Chart.php:318
1378
  msgid "Please, enter the URL of CSV file:"
1379
  msgstr "Please, enter the URL of CSV file:"
@@ -1382,22 +1395,22 @@ msgstr "Please, enter the URL of CSV file:"
1382
  msgid "You have entered invalid URL. Please, insert proper URL."
1383
  msgstr "You have entered invalid URL. Please, insert proper URL."
1384
 
1385
- #: classes/Visualizer/Module/Chart.php:379
1386
  msgid "Save Chart"
1387
  msgstr "Save Chart"
1388
 
1389
- #: classes/Visualizer/Module/Chart.php:380
1390
  msgid "Create Chart"
1391
  msgstr "Create Chart"
1392
 
1393
- #: classes/Visualizer/Module/Chart.php:382
1394
  msgid "Insert Chart"
1395
  msgstr "Insert Chart"
1396
 
1397
- #: classes/Visualizer/Module/Chart.php:416
1398
  msgid "CSV file with chart data was not uploaded. Please, try again."
1399
  msgstr "CSV file with chart data was not uploaded. Please, try again."
1400
 
1401
- #: classes/Visualizer/Module/Chart.php:431
1402
  msgid "CSV file is broken or invalid. Please, try again."
1403
  msgstr "CSV file is broken or invalid. Please, try again."
2
  msgstr ""
3
  "Project-Id-Version: Visualizer\n"
4
  "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2014-02-06 12:33+0300\n"
6
+ "PO-Revision-Date: 2014-02-06 12:33+0300\n"
7
  "Last-Translator: Eugene Manuilov <eugene@manuilov.org>\n"
8
  "Language-Team: Eugene Manuilov <eugene@manuilov.org>\n"
9
  "Language: en_US\n"
351
  msgid "Add New"
352
  msgstr "Add New"
353
 
354
+ #: classes/Visualizer/Render/Library.php:165
355
+ #, php-format
356
+ msgid ""
357
+ "%s option is disabled in your php.ini config. Please, enable it by change "
358
+ "its value to 1. This option increases the speed of remote CSV uploading."
359
+ msgstr ""
360
+ "%s option is disabled in your php.ini config. Please, enable it by change "
361
+ "its value to 1. This option increases the speed of remote CSV uploading."
362
+
363
  #: classes/Visualizer/Render/Templates.php:70
364
  msgid "Insert"
365
  msgstr "Insert"
1279
  msgstr "The stroke width of rising candles."
1280
 
1281
  #: classes/Visualizer/Render/Page/Settings.php:56
1282
+ #: classes/Visualizer/Render/Page/Data.php:102
1283
  msgid "Back"
1284
  msgstr "Back"
1285
 
1314
  msgid "From Computer"
1315
  msgstr "From Computer"
1316
 
1317
+ #: classes/Visualizer/Render/Page/Data.php:85
1318
  msgid "From Web"
1319
  msgstr "From Web"
1320
 
1321
+ #: classes/Visualizer/Render/Page/Data.php:105
1322
  #: classes/Visualizer/Render/Page/Types.php:84
1323
  msgid "Next"
1324
  msgstr "Next"
1383
  msgid "Knowledge Base"
1384
  msgstr "Knowledge Base"
1385
 
1386
+ #: classes/Visualizer/Module/Admin.php:352
1387
+ msgid "Donate"
1388
+ msgstr "Donate"
1389
+
1390
  #: classes/Visualizer/Module/Chart.php:318
1391
  msgid "Please, enter the URL of CSV file:"
1392
  msgstr "Please, enter the URL of CSV file:"
1395
  msgid "You have entered invalid URL. Please, insert proper URL."
1396
  msgstr "You have entered invalid URL. Please, insert proper URL."
1397
 
1398
+ #: classes/Visualizer/Module/Chart.php:381
1399
  msgid "Save Chart"
1400
  msgstr "Save Chart"
1401
 
1402
+ #: classes/Visualizer/Module/Chart.php:382
1403
  msgid "Create Chart"
1404
  msgstr "Create Chart"
1405
 
1406
+ #: classes/Visualizer/Module/Chart.php:384
1407
  msgid "Insert Chart"
1408
  msgstr "Insert Chart"
1409
 
1410
+ #: classes/Visualizer/Module/Chart.php:444
1411
  msgid "CSV file with chart data was not uploaded. Please, try again."
1412
  msgstr "CSV file with chart data was not uploaded. Please, try again."
1413
 
1414
+ #: classes/Visualizer/Module/Chart.php:459
1415
  msgid "CSV file is broken or invalid. Please, try again."
1416
  msgstr "CSV file is broken or invalid. Please, try again."
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Visualizer ===
2
  Contributors: madpixels, straightforward
3
- Donate link: http://goo.gl/hN9FYf
4
  Tags: chart, charts, charting, graph, graphs, graphing, visualisation, visualise data, visualization, visualize data, HTML5, canvas, pie chart, line chart, bar chart, column chart, gauge chart, area chart, scatter chart, candlestick chart, geo chart, google visualization api
5
  Requires at least: 3.5
6
  Tested up to: 3.8.1
7
- Stable tag: 1.4.1.1
8
  License: GPL v2.0 or later
9
  License URI: http://www.opensource.org/licenses/gpl-license.php
10
 
@@ -58,6 +58,11 @@ Pay attention that to turn your shortcodes into graphs, your theme has to have `
58
 
59
  == Changelog ==
60
 
 
 
 
 
 
61
  = 1.4.1.1 =
62
  * Removed CSV parser escape constant to prevent warnings which appears when PHP 5.2.x or less is used
63
 
1
  === Visualizer ===
2
  Contributors: madpixels, straightforward
3
+ Donate link: http://flattr.com/thing/2574985/WordPress-Visualizer
4
  Tags: chart, charts, charting, graph, graphs, graphing, visualisation, visualise data, visualization, visualize data, HTML5, canvas, pie chart, line chart, bar chart, column chart, gauge chart, area chart, scatter chart, candlestick chart, geo chart, google visualization api
5
  Requires at least: 3.5
6
  Tested up to: 3.8.1
7
+ Stable tag: 1.4.2
8
  License: GPL v2.0 or later
9
  License URI: http://www.opensource.org/licenses/gpl-license.php
10
 
58
 
59
  == Changelog ==
60
 
61
+ = 1.4.2 =
62
+ * Fixed remote CSV uploading issue when allow_url_fopen option is disabled in php.ini
63
+ * Replaced flattr image on widget and added donate link to plugin meta data
64
+ * Added notification message at library page when allow_url_fopen option is disabled
65
+
66
  = 1.4.1.1 =
67
  * Removed CSV parser escape constant to prevent warnings which appears when PHP 5.2.x or less is used
68