Skip to content

Commit

Permalink
Merge pull request #50 from Codeinwp/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
selul committed Oct 26, 2015
2 parents fb82639 + 65eb150 commit e0755a3
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 29 deletions.
6 changes: 3 additions & 3 deletions classes/Visualizer/Module/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -343,13 +343,13 @@ public function getPluginMetaLinks( $plugin_meta, $plugin_file ) {
if ( $plugin_file == plugin_basename( VISUALIZER_BASEFILE ) ) {
// knowledge base link
$plugin_meta[] = sprintf(
'<a href="https://github.com/madpixelslabs/visualizer/wiki" target="_blank">%s</a>',
'<a href="https://github.com/codeinwp/visualizer/wiki" target="_blank">%s</a>',
esc_html__( 'Knowledge Base', Visualizer_Plugin::NAME )
);
// flattr link
$plugin_meta[] = sprintf(
'<a href="http://flattr.com/thing/2574985/WordPress-Visualizer" target="_blank">%s</a>',
esc_html__( 'Donate', Visualizer_Plugin::NAME )
'<a style="color:red" href="https://themeisle.com/plugins/visualizer-charts-and-graphs-pro-addon/" target="_blank">%s</a>',
esc_html__( 'Pro Addon', Visualizer_Plugin::NAME )
);
}

Expand Down
14 changes: 1 addition & 13 deletions classes/Visualizer/Module/Chart.php
Original file line number Diff line number Diff line change
Expand Up @@ -420,19 +420,7 @@ private function _handleSettingsPage() {
* @access public
*/
public function renderFlattrScript() {
echo <<<EOL
<script type="text/javascript">
/* <![CDATA[ */
(function() {
var s = document.createElement('script'), t = document.getElementsByTagName('script')[0];
s.type = 'text/javascript';
s.async = true;
s.src = 'http://api.flattr.com/js/0.6/load.js?mode=auto';
t.parentNode.insertBefore(s, t);
})();
/* ]]> */
</script>
EOL;
echo '';
}

/**
Expand Down
6 changes: 6 additions & 0 deletions classes/Visualizer/Module/Frontend.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ public function renderChart( $atts ) {
'class' => false, // chart class
'series' => false, // series filter hook
'data' => false, // data filter hook
'settings' => false, // data filter hook
), $atts );

// if empty id or chart does not exists, then return empty string
Expand All @@ -124,6 +125,11 @@ public function renderChart( $atts ) {
if ( !empty( $atts['series'] ) ) {
$series = apply_filters( $atts['series'], $series, $chart->ID, $type );
}
// handle settings filter hooks
$settings = apply_filters( Visualizer_Plugin::FILTER_GET_CHART_SETTINGS, $settings, $chart->ID, $type );
if ( !empty( $atts['settings'] ) ) {
$settings = apply_filters( $atts['settings'], $settings, $chart->ID, $type );
}

// handle data filter hooks
$data = apply_filters( Visualizer_Plugin::FILTER_GET_CHART_DATA, unserialize( $chart->post_content ), $chart->ID, $type );
Expand Down
3 changes: 2 additions & 1 deletion classes/Visualizer/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
class Visualizer_Plugin {

const NAME = 'visualizer';
const VERSION = '1.4.2.3';
const VERSION = '1.5';

// custom post types
const CPT_VISUALIZER = 'visualizer';
Expand All @@ -54,6 +54,7 @@ class Visualizer_Plugin {
const FILTER_CHART_WRAPPER_CLASS = 'visualizer-chart-wrapper-class';
const FILTER_GET_CHART_SERIES = 'visualizer-get-chart-series';
const FILTER_GET_CHART_DATA = 'visualizer-get-chart-data';
const FILTER_GET_CHART_SETTINGS = 'visualizer-get-chart-settings';

// Added by Ash/Upwork
const PRO_TEASER_URL = "http://www.google.com";
Expand Down
3 changes: 0 additions & 3 deletions classes/Visualizer/Render/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,6 @@ protected function _renderSidebar() {
echo '<a id="rate-link" href="http://wordpress.org/support/view/plugin-reviews/visualizer" target="_blank">';
esc_html_e( 'Rate it on WordPress.org', Visualizer_Plugin::NAME );
echo '</a>';
echo '<div id="flattr">';
echo '<a class="FlattrButton" style="display:none;" rev="flattr;button:compact;" href="http://wordpress.org/plugins/visualizer/"></a>';
echo '</div>';
echo '</div>';
echo '</div>';
}
Expand Down
6 changes: 3 additions & 3 deletions classes/Visualizer/Source.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,19 +119,20 @@ public function getRawData() {
*/
protected function _normalizeData( $data ) {
// normalize values
//print_r($data);
foreach ( $this->_series as $i => $series ) {
// if no value exists for the seires, then add null
if ( !isset( $data[$i] ) ) {
$data[$i] = null;
}

if ( is_null( $data[$i] ) ) {
if ( is_null( $data[$i] ) && !is_numeric($data[$i])) {
continue;
}

switch ( $series['type'] ) {
case 'number':
$data[$i] = !empty( $data[$i] ) ? floatval( $data[$i] ) : null;
$data[$i] = ( is_numeric($data[$i]) ) ? floatval( $data[$i] ) : null;
break;
case 'boolean':
$data[$i] = !empty( $data[$i] ) ? filter_validate( $data[$i], FILTER_VALIDATE_BOOLEAN ) : null;
Expand All @@ -149,7 +150,6 @@ protected function _normalizeData( $data ) {
break;
}
}

return $data;
}

Expand Down
1 change: 1 addition & 0 deletions classes/Visualizer/Source/Csv.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ public function fetch() {

// fetch data
while ( ( $data = fgetcsv( $handle, 0, VISUALIZER_CSV_DELIMITER, VISUALIZER_CSV_ENCLOSURE ) ) !== false ) {

$this->_data[] = $this->_normalizeData( $data );
}

Expand Down
12 changes: 6 additions & 6 deletions index.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<?php
/*
Plugin Name: WordPress Visualizer
Plugin URI: https://github.com/madpixelslabs/visualizer
Plugin Name: Visualizer: Charts and Graphs
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: 1.4.4
Author: Madpixels
Author URI: http://madpixels.net
Donate link: http://flattr.com/thing/2574985/WordPress-Visualizer
Version: 1.5
Author: Themeisle
Author URI: http://themeisle.com
License: GPL v2.0 or later
License URI: http://www.opensource.org/licenses/gpl-license.php
*/


// +----------------------------------------------------------------------+
// | Copyright 2013 Madpixels (email : [email protected]) |
Expand Down
6 changes: 6 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ Pay attention that to turn your shortcodes into graphs, your theme has to have `

== Changelog ==

= 1.5 =
* Added support for live editor
* Added support for importing data from other charts
* Added filter for chart settings
* Fixed bug when zero was not working on the charts

= 1.4.2.3 =
* Implemented ability to edit horizontal and vertical axis number format for bar and column charts

Expand Down

0 comments on commit e0755a3

Please sign in to comment.