Version Description
- Fixed issue which prevents the plugin working on SSL backend
- Fixed issue with CSV file uploading in IE and other browsers
- Fixed issue with empty series, which appears due to leading space in a source file
- Added ability to define custom delimiter, enclosure and escape variables for CSV parsing
Download this release
Release Info
Developer | madpixels |
Plugin | WordPress Charts and Graphs Lite |
Version | 1.4.1 |
Comparing to | |
See all releases |
Code changes from version 1.4 to 1.4.1
- classes/Visualizer/Module/Admin.php +1 -1
- classes/Visualizer/Module/Chart.php +5 -5
- classes/Visualizer/Plugin.php +1 -1
- classes/Visualizer/Render/Library.php +2 -2
- classes/Visualizer/Render/Page/Data.php +6 -3
- classes/Visualizer/Render/Page/Settings.php +1 -1
- classes/Visualizer/Render/Page/Types.php +1 -1
- classes/Visualizer/Source/Csv.php +5 -5
- css/frame.css +7 -3
- index.php +13 -1
- readme.txt +8 -2
classes/Visualizer/Module/Admin.php
CHANGED
@@ -138,7 +138,7 @@ class Visualizer_Module_Admin extends Visualizer_Module {
|
|
138 |
'library' => array(
|
139 |
'filters' => self::_getChartTypesLocalized(),
|
140 |
),
|
141 |
-
'nonce' =>
|
142 |
'buildurl' => add_query_arg( 'action', Visualizer_Plugin::ACTION_CREATE_CHART, admin_url( 'admin-ajax.php' ) ),
|
143 |
);
|
144 |
|
138 |
'library' => array(
|
139 |
'filters' => self::_getChartTypesLocalized(),
|
140 |
),
|
141 |
+
'nonce' => wp_create_nonce(),
|
142 |
'buildurl' => add_query_arg( 'action', Visualizer_Plugin::ACTION_CREATE_CHART, admin_url( 'admin-ajax.php' ) ),
|
143 |
);
|
144 |
|
classes/Visualizer/Module/Chart.php
CHANGED
@@ -165,7 +165,7 @@ class Visualizer_Module_Chart extends Visualizer_Module {
|
|
165 |
$input_method = $is_post ? INPUT_POST : INPUT_GET;
|
166 |
|
167 |
$chart_id = $success = false;
|
168 |
-
$nonce =
|
169 |
$capable = current_user_can( 'delete_posts' );
|
170 |
if ( $nonce && $capable ) {
|
171 |
$chart_id = filter_input( $input_method, 'chart', FILTER_VALIDATE_INT, array( 'options' => array( 'min_range' => 1 ) ) );
|
@@ -261,7 +261,7 @@ class Visualizer_Module_Chart extends Visualizer_Module {
|
|
261 |
*/
|
262 |
private function _handleTypesPage() {
|
263 |
// process post request
|
264 |
-
if ( $_SERVER['REQUEST_METHOD'] == 'POST' &&
|
265 |
$type = filter_input( INPUT_POST, 'type' );
|
266 |
if ( in_array( $type, Visualizer_Plugin::getChartTypes() ) ) {
|
267 |
// save new chart type
|
@@ -334,7 +334,7 @@ class Visualizer_Module_Chart extends Visualizer_Module {
|
|
334 |
* @access private
|
335 |
*/
|
336 |
private function _handleSettingsPage() {
|
337 |
-
if ( $_SERVER['REQUEST_METHOD'] == 'POST' &&
|
338 |
if ( $this->_chart->post_status == 'auto-draft' ) {
|
339 |
$this->_chart->post_status = 'publish';
|
340 |
wp_update_post( $this->_chart->to_array() );
|
@@ -394,7 +394,7 @@ class Visualizer_Module_Chart extends Visualizer_Module {
|
|
394 |
*/
|
395 |
public function uploadData() {
|
396 |
// validate nonce
|
397 |
-
if ( !
|
398 |
status_header( 403 );
|
399 |
exit;
|
400 |
}
|
@@ -445,7 +445,7 @@ class Visualizer_Module_Chart extends Visualizer_Module {
|
|
445 |
*/
|
446 |
public function cloneChart() {
|
447 |
$chart_id = $success = false;
|
448 |
-
$nonce =
|
449 |
$capable = current_user_can( 'edit_posts' );
|
450 |
if ( $nonce && $capable ) {
|
451 |
$chart_id = filter_input( INPUT_GET, 'chart', FILTER_VALIDATE_INT, array( 'options' => array( 'min_range' => 1 ) ) );
|
165 |
$input_method = $is_post ? INPUT_POST : INPUT_GET;
|
166 |
|
167 |
$chart_id = $success = false;
|
168 |
+
$nonce = wp_verify_nonce( filter_input( $input_method, 'nonce' ) );
|
169 |
$capable = current_user_can( 'delete_posts' );
|
170 |
if ( $nonce && $capable ) {
|
171 |
$chart_id = filter_input( $input_method, 'chart', FILTER_VALIDATE_INT, array( 'options' => array( 'min_range' => 1 ) ) );
|
261 |
*/
|
262 |
private function _handleTypesPage() {
|
263 |
// process post request
|
264 |
+
if ( $_SERVER['REQUEST_METHOD'] == 'POST' && wp_verify_nonce( filter_input( INPUT_POST, 'nonce' ) ) ) {
|
265 |
$type = filter_input( INPUT_POST, 'type' );
|
266 |
if ( in_array( $type, Visualizer_Plugin::getChartTypes() ) ) {
|
267 |
// save new chart type
|
334 |
* @access private
|
335 |
*/
|
336 |
private function _handleSettingsPage() {
|
337 |
+
if ( $_SERVER['REQUEST_METHOD'] == 'POST' && wp_verify_nonce( filter_input( INPUT_GET, 'nonce' ) ) ) {
|
338 |
if ( $this->_chart->post_status == 'auto-draft' ) {
|
339 |
$this->_chart->post_status = 'publish';
|
340 |
wp_update_post( $this->_chart->to_array() );
|
394 |
*/
|
395 |
public function uploadData() {
|
396 |
// validate nonce
|
397 |
+
if ( !wp_verify_nonce( filter_input( INPUT_GET, 'nonce' ) ) ) {
|
398 |
status_header( 403 );
|
399 |
exit;
|
400 |
}
|
445 |
*/
|
446 |
public function cloneChart() {
|
447 |
$chart_id = $success = false;
|
448 |
+
$nonce = wp_verify_nonce( filter_input( INPUT_GET, 'nonce' ), Visualizer_Plugin::ACTION_CLONE_CHART );
|
449 |
$capable = current_user_can( 'edit_posts' );
|
450 |
if ( $nonce && $capable ) {
|
451 |
$chart_id = filter_input( INPUT_GET, 'chart', FILTER_VALIDATE_INT, array( 'options' => array( 'min_range' => 1 ) ) );
|
classes/Visualizer/Plugin.php
CHANGED
@@ -30,7 +30,7 @@
|
|
30 |
class Visualizer_Plugin {
|
31 |
|
32 |
const NAME = 'visualizer';
|
33 |
-
const VERSION = '1.4';
|
34 |
|
35 |
// custom post types
|
36 |
const CPT_VISUALIZER = 'visualizer';
|
30 |
class Visualizer_Plugin {
|
31 |
|
32 |
const NAME = 'visualizer';
|
33 |
+
const VERSION = '1.4.1';
|
34 |
|
35 |
// custom post types
|
36 |
const CPT_VISUALIZER = 'visualizer';
|
classes/Visualizer/Render/Library.php
CHANGED
@@ -44,13 +44,13 @@ class Visualizer_Render_Library extends Visualizer_Render {
|
|
44 |
|
45 |
$delete_url = add_query_arg( array(
|
46 |
'action' => Visualizer_Plugin::ACTION_DELETE_CHART,
|
47 |
-
'nonce' =>
|
48 |
'chart' => $chart_id,
|
49 |
), $ajax_url );
|
50 |
|
51 |
$clone_url = add_query_arg( array(
|
52 |
'action' => Visualizer_Plugin::ACTION_CLONE_CHART,
|
53 |
-
'nonce' =>
|
54 |
'chart' => $chart_id,
|
55 |
'type' => $this->type,
|
56 |
), $ajax_url );
|
44 |
|
45 |
$delete_url = add_query_arg( array(
|
46 |
'action' => Visualizer_Plugin::ACTION_DELETE_CHART,
|
47 |
+
'nonce' => wp_create_nonce(),
|
48 |
'chart' => $chart_id,
|
49 |
), $ajax_url );
|
50 |
|
51 |
$clone_url = add_query_arg( array(
|
52 |
'action' => Visualizer_Plugin::ACTION_CLONE_CHART,
|
53 |
+
'nonce' => wp_create_nonce( Visualizer_Plugin::ACTION_CLONE_CHART ),
|
54 |
'chart' => $chart_id,
|
55 |
'type' => $this->type,
|
56 |
), $ajax_url );
|
classes/Visualizer/Render/Page/Data.php
CHANGED
@@ -54,11 +54,11 @@ class Visualizer_Render_Page_Data extends Visualizer_Render_Page {
|
|
54 |
protected function _renderSidebarContent() {
|
55 |
$upload_link = add_query_arg( array(
|
56 |
'action' => Visualizer_Plugin::ACTION_UPLOAD_DATA,
|
57 |
-
'nonce' =>
|
58 |
'chart' => $this->chart->ID,
|
59 |
), admin_url( 'admin-ajax.php' ) );
|
60 |
|
61 |
-
echo '<li class="group">';
|
62 |
echo '<h3 class="group-title">', esc_html__( 'Upload CSV File', Visualizer_Plugin::NAME ), '</h3>';
|
63 |
echo '<div class="group-content">';
|
64 |
echo '<iframe id="thehole" name="thehole"></iframe>';
|
@@ -80,7 +80,10 @@ class Visualizer_Render_Page_Data extends Visualizer_Render_Page {
|
|
80 |
echo '<input type="file" id="csv-file" class="file" name="local_data">';
|
81 |
esc_attr_e( 'From Computer', Visualizer_Plugin::NAME );
|
82 |
echo '</div>';
|
83 |
-
|
|
|
|
|
|
|
84 |
echo '</form>';
|
85 |
echo '</div>';
|
86 |
echo '</div>';
|
54 |
protected function _renderSidebarContent() {
|
55 |
$upload_link = add_query_arg( array(
|
56 |
'action' => Visualizer_Plugin::ACTION_UPLOAD_DATA,
|
57 |
+
'nonce' => wp_create_nonce(),
|
58 |
'chart' => $this->chart->ID,
|
59 |
), admin_url( 'admin-ajax.php' ) );
|
60 |
|
61 |
+
echo '<li class="group open">';
|
62 |
echo '<h3 class="group-title">', esc_html__( 'Upload CSV File', Visualizer_Plugin::NAME ), '</h3>';
|
63 |
echo '<div class="group-content">';
|
64 |
echo '<iframe id="thehole" name="thehole"></iframe>';
|
80 |
echo '<input type="file" id="csv-file" class="file" name="local_data">';
|
81 |
esc_attr_e( 'From Computer', Visualizer_Plugin::NAME );
|
82 |
echo '</div>';
|
83 |
+
|
84 |
+
echo '<div>';
|
85 |
+
echo '<a id="remote-file" class="button" href="javascript:;">', esc_html__( 'From Web', Visualizer_Plugin::NAME ), '</a>';
|
86 |
+
echo '</div>';
|
87 |
echo '</form>';
|
88 |
echo '</div>';
|
89 |
echo '</div>';
|
classes/Visualizer/Render/Page/Settings.php
CHANGED
@@ -66,7 +66,7 @@ class Visualizer_Render_Page_Settings extends Visualizer_Render_Page {
|
|
66 |
* @access protected
|
67 |
*/
|
68 |
protected function _toHTML() {
|
69 |
-
echo '<form id="settings-form" action="', add_query_arg( 'nonce',
|
70 |
parent::_toHTML();
|
71 |
echo '</form>';
|
72 |
}
|
66 |
* @access protected
|
67 |
*/
|
68 |
protected function _toHTML() {
|
69 |
+
echo '<form id="settings-form" action="', add_query_arg( 'nonce', wp_create_nonce() ), '" method="post">';
|
70 |
parent::_toHTML();
|
71 |
echo '</form>';
|
72 |
}
|
classes/Visualizer/Render/Page/Types.php
CHANGED
@@ -40,7 +40,7 @@ class Visualizer_Render_Page_Types extends Visualizer_Render_Page {
|
|
40 |
*/
|
41 |
protected function _toHTML() {
|
42 |
echo '<form method="post">';
|
43 |
-
echo '<input type="hidden" name="nonce" value="',
|
44 |
parent::_toHTML();
|
45 |
echo '</form>';
|
46 |
}
|
40 |
*/
|
41 |
protected function _toHTML() {
|
42 |
echo '<form method="post">';
|
43 |
+
echo '<input type="hidden" name="nonce" value="', wp_create_nonce(), '">';
|
44 |
parent::_toHTML();
|
45 |
echo '</form>';
|
46 |
}
|
classes/Visualizer/Source/Csv.php
CHANGED
@@ -62,23 +62,23 @@ class Visualizer_Source_Csv extends Visualizer_Source {
|
|
62 |
*/
|
63 |
private function _fetchSeries( &$handle ) {
|
64 |
// read column titles
|
65 |
-
$labels = fgetcsv( $handle );
|
66 |
-
|
67 |
// read series types
|
68 |
-
$types = fgetcsv( $handle );
|
69 |
|
70 |
if ( !$labels || !$types ) {
|
71 |
return false;
|
72 |
}
|
73 |
|
74 |
// if no types were setup, re read labels and empty types array
|
|
|
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 );
|
82 |
$types = array();
|
83 |
}
|
84 |
|
@@ -119,7 +119,7 @@ class Visualizer_Source_Csv extends Visualizer_Source {
|
|
119 |
}
|
120 |
|
121 |
// fetch data
|
122 |
-
while ( ( $data = fgetcsv( $handle ) ) !== false ) {
|
123 |
$this->_data[] = $this->_normalizeData( $data );
|
124 |
}
|
125 |
|
62 |
*/
|
63 |
private function _fetchSeries( &$handle ) {
|
64 |
// read column titles
|
65 |
+
$labels = fgetcsv( $handle, 0, VISUALIZER_CSV_DELIMITER, VISUALIZER_CSV_ENCLOSURE, VISUALIZER_CSV_ESCAPRE );
|
|
|
66 |
// read series types
|
67 |
+
$types = fgetcsv( $handle, 0, VISUALIZER_CSV_DELIMITER, VISUALIZER_CSV_ENCLOSURE, VISUALIZER_CSV_ESCAPRE );
|
68 |
|
69 |
if ( !$labels || !$types ) {
|
70 |
return false;
|
71 |
}
|
72 |
|
73 |
// if no types were setup, re read labels and empty types array
|
74 |
+
$types = array_map( 'trim', $types );
|
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, VISUALIZER_CSV_ESCAPRE );
|
82 |
$types = array();
|
83 |
}
|
84 |
|
119 |
}
|
120 |
|
121 |
// fetch data
|
122 |
+
while ( ( $data = fgetcsv( $handle, 0, VISUALIZER_CSV_DELIMITER, VISUALIZER_CSV_ENCLOSURE, VISUALIZER_CSV_ESCAPRE ) ) !== false ) {
|
123 |
$this->_data[] = $this->_normalizeData( $data );
|
124 |
}
|
125 |
|
css/frame.css
CHANGED
@@ -407,16 +407,20 @@ div.group-content .group-description {
|
|
407 |
|
408 |
.file-wrapper {
|
409 |
position: relative;
|
410 |
-
|
411 |
}
|
412 |
|
413 |
.file {
|
|
|
414 |
position: absolute;
|
415 |
top: 0;
|
416 |
-
left: 0;
|
417 |
right: 0;
|
418 |
-
bottom: 0;
|
419 |
opacity: 0;
|
420 |
-moz-opacity: 0;
|
421 |
filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);
|
|
|
|
|
|
|
|
|
|
|
422 |
}
|
407 |
|
408 |
.file-wrapper {
|
409 |
position: relative;
|
410 |
+
overflow: hidden;
|
411 |
}
|
412 |
|
413 |
.file {
|
414 |
+
font-size: 200px;
|
415 |
position: absolute;
|
416 |
top: 0;
|
|
|
417 |
right: 0;
|
|
|
418 |
opacity: 0;
|
419 |
-moz-opacity: 0;
|
420 |
filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);
|
421 |
+
}
|
422 |
+
|
423 |
+
#remote-file {
|
424 |
+
margin-top: 10px;
|
425 |
+
clear: both;
|
426 |
}
|
index.php
CHANGED
@@ -3,7 +3,7 @@
|
|
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
|
7 |
Author: Madpixels
|
8 |
Author URI: http://madpixels.net
|
9 |
License: GPL v2.0 or later
|
@@ -70,6 +70,18 @@ function visualizer_launch() {
|
|
70 |
define( 'VISUALIZER_ABSURL', plugins_url( '/', __FILE__ ) );
|
71 |
define( 'VISUALIZER_ABSPATH', dirname( __FILE__ ) );
|
72 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
// don't load the plugin if cron job is running or doing autosave
|
74 |
$doing_autosave = defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE;
|
75 |
$doing_cron = defined( 'DOING_CRON' ) && DOING_CRON;
|
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
|
7 |
Author: Madpixels
|
8 |
Author URI: http://madpixels.net
|
9 |
License: GPL v2.0 or later
|
70 |
define( 'VISUALIZER_ABSURL', plugins_url( '/', __FILE__ ) );
|
71 |
define( 'VISUALIZER_ABSPATH', dirname( __FILE__ ) );
|
72 |
|
73 |
+
if ( !defined( 'VISUALIZER_CSV_DELIMITER' ) ) {
|
74 |
+
define( 'VISUALIZER_CSV_DELIMITER', ',' );
|
75 |
+
}
|
76 |
+
|
77 |
+
if ( !defined( 'VISUALIZER_CSV_ENCLOSURE' ) ) {
|
78 |
+
define( 'VISUALIZER_CSV_ENCLOSURE', '"' );
|
79 |
+
}
|
80 |
+
|
81 |
+
if ( !defined( 'VISUALIZER_CSV_ESCAPRE' ) ) {
|
82 |
+
define( 'VISUALIZER_CSV_ESCAPRE', '\\' );
|
83 |
+
}
|
84 |
+
|
85 |
// don't load the plugin if cron job is running or doing autosave
|
86 |
$doing_autosave = defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE;
|
87 |
$doing_cron = defined( 'DOING_CRON' ) && DOING_CRON;
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ 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
|
7 |
-
Stable tag: 1.4
|
8 |
License: GPL v2.0 or later
|
9 |
License URI: http://www.opensource.org/licenses/gpl-license.php
|
10 |
|
@@ -58,6 +58,12 @@ Pay attention that to turn your shortcodes into graphs, your theme has to have `
|
|
58 |
|
59 |
== Changelog ==
|
60 |
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
= 1.4 =
|
62 |
* Implemented aggregation target and selection mode options for candlestick chart
|
63 |
* Implemented focus target and data opacity for columnar chars
|
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
|
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.1 =
|
62 |
+
* Fixed issue which prevents the plugin working on SSL backend
|
63 |
+
* Fixed issue with CSV file uploading in IE and other browsers
|
64 |
+
* Fixed issue with empty series, which appears due to leading space in a source file
|
65 |
+
* Added ability to define custom delimiter, enclosure and escape variables for CSV parsing
|
66 |
+
|
67 |
= 1.4 =
|
68 |
* Implemented aggregation target and selection mode options for candlestick chart
|
69 |
* Implemented focus target and data opacity for columnar chars
|