Version Description
- The bug with CSV file uploading was fixed.
Download this release
Release Info
Developer | madpixels |
Plugin | WordPress Charts and Graphs Lite |
Version | 1.0.1 |
Comparing to | |
See all releases |
Code changes from version 1.0.0 to 1.0.1
- classes/Visualizer/Module/Chart.php +2 -2
- classes/Visualizer/Source.php +21 -0
- classes/Visualizer/Source/Csv.php +9 -1
- index.php +1 -1
- readme.txt +4 -1
classes/Visualizer/Module/Chart.php
CHANGED
@@ -409,8 +409,8 @@ class Visualizer_Module_Chart extends Visualizer_Module {
|
|
409 |
update_post_meta( $chart->ID, Visualizer_Plugin::CF_SOURCE, $source->getSourceName() );
|
410 |
update_post_meta( $chart->ID, Visualizer_Plugin::CF_DEFAULT_DATA, 0 );
|
411 |
|
412 |
-
$render->data = $source->getData();
|
413 |
-
$render->series = $source->getSeries();
|
414 |
} else {
|
415 |
$render->message = esc_html__( "CSV file is broken or incorrect. Please, try again.", Visualizer_Plugin::NAME );
|
416 |
}
|
409 |
update_post_meta( $chart->ID, Visualizer_Plugin::CF_SOURCE, $source->getSourceName() );
|
410 |
update_post_meta( $chart->ID, Visualizer_Plugin::CF_DEFAULT_DATA, 0 );
|
411 |
|
412 |
+
$render->data = json_encode( unserialize( $source->getData() ) );
|
413 |
+
$render->series = json_encode( $source->getSeries() );
|
414 |
} else {
|
415 |
$render->message = esc_html__( "CSV file is broken or incorrect. Please, try again.", Visualizer_Plugin::NAME );
|
416 |
}
|
classes/Visualizer/Source.php
CHANGED
@@ -143,4 +143,25 @@ abstract class Visualizer_Source {
|
|
143 |
return $data;
|
144 |
}
|
145 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
146 |
}
|
143 |
return $data;
|
144 |
}
|
145 |
|
146 |
+
/**
|
147 |
+
* Validates series tyeps.
|
148 |
+
*
|
149 |
+
* @since 1.0.1
|
150 |
+
*
|
151 |
+
* @static
|
152 |
+
* @access protected
|
153 |
+
* @param array $types The icoming series types.
|
154 |
+
* @return boolean TRUE if sereis types are valid, otherwise FALSE.
|
155 |
+
*/
|
156 |
+
protected static function _validateTypes( $types ) {
|
157 |
+
$allowed_types = array( 'string', 'number', 'boolean', 'date', 'datetime', 'timeofday' );
|
158 |
+
foreach ( $types as $type ) {
|
159 |
+
if ( !in_array( $type, $allowed_types ) ) {
|
160 |
+
return false;
|
161 |
+
}
|
162 |
+
}
|
163 |
+
|
164 |
+
return true;
|
165 |
+
}
|
166 |
+
|
167 |
}
|
classes/Visualizer/Source/Csv.php
CHANGED
@@ -71,10 +71,18 @@ class Visualizer_Source_Csv extends Visualizer_Source {
|
|
71 |
return false;
|
72 |
}
|
73 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
for ( $i = 0, $len = count( $labels ); $i < $len; $i++ ) {
|
|
|
75 |
$this->_series[] = array(
|
76 |
'label' => $labels[$i],
|
77 |
-
'type' => isset( $types[$i] ) ? $types[$i] :
|
78 |
);
|
79 |
}
|
80 |
|
71 |
return false;
|
72 |
}
|
73 |
|
74 |
+
// if no types were setup, re read labels and empty types array
|
75 |
+
if ( !self::_validateTypes( $types ) ) {
|
76 |
+
fseek( $handle, 0 );
|
77 |
+
$labels = fgetcsv( $handle );
|
78 |
+
$types = array();
|
79 |
+
}
|
80 |
+
|
81 |
for ( $i = 0, $len = count( $labels ); $i < $len; $i++ ) {
|
82 |
+
$default_type = $i == 0 ? 'string' : 'number';
|
83 |
$this->_series[] = array(
|
84 |
'label' => $labels[$i],
|
85 |
+
'type' => isset( $types[$i] ) ? $types[$i] : $default_type,
|
86 |
);
|
87 |
}
|
88 |
|
index.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: WordPress Visualizer
|
4 |
Plugin URI: http://visualizer.madpixels.net
|
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.0.
|
7 |
Author: Madpixels
|
8 |
Author URI: http://madpixels.net
|
9 |
License: GPL v2.0 or later
|
3 |
Plugin Name: WordPress Visualizer
|
4 |
Plugin URI: http://visualizer.madpixels.net
|
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.0.1
|
7 |
Author: Madpixels
|
8 |
Author URI: http://madpixels.net
|
9 |
License: GPL v2.0 or later
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link:
|
|
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.5.2
|
7 |
-
Stable tag: 1.0.
|
8 |
License: GPL v2.0 or later
|
9 |
License URI: http://www.opensource.org/licenses/gpl-license.php
|
10 |
|
@@ -42,6 +42,9 @@ Charts are rendered using HTML5/SVG technology to provide cross-browser compatib
|
|
42 |
|
43 |
== Changelog ==
|
44 |
|
|
|
|
|
|
|
45 |
= 1.0.0 =
|
46 |
* The first version of the plugin was implemented.
|
47 |
|
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.5.2
|
7 |
+
Stable tag: 1.0.1
|
8 |
License: GPL v2.0 or later
|
9 |
License URI: http://www.opensource.org/licenses/gpl-license.php
|
10 |
|
42 |
|
43 |
== Changelog ==
|
44 |
|
45 |
+
= 1.0.1 =
|
46 |
+
* The bug with CSV file uploading was fixed.
|
47 |
+
|
48 |
= 1.0.0 =
|
49 |
* The first version of the plugin was implemented.
|
50 |
|