Skip to content

Commit a290176

Browse files
authored
Merge pull request #216 from Codeinwp/development
Adds compatibility with WordPress 4.9.
2 parents 32f02f7 + 1a999dd commit a290176

File tree

13 files changed

+55
-25
lines changed

13 files changed

+55
-25
lines changed

Gruntfile.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,10 @@ module.exports = function (grunt) {
66

77
var loader = require( 'load-project-config' ),
88
config = require( 'grunt-plugin-fleet' );
9+
config = config();
10+
// jshint ignore: start
11+
config.taskMap['faq_builder'] = 'grunt-helpscout-faq';
12+
// jshint ignore: end
13+
loader(grunt, config).init();
914
loader( grunt, config ).init();
1015
};

classes/Visualizer/Module/Frontend.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -169,13 +169,14 @@ public function enqueueScripts() {
169169
* @param array $atts The array of shortcode attributes.
170170
*/
171171
public function renderChart( $atts ) {
172+
global $wp_version;
172173
$atts = shortcode_atts(
173174
array(
174175
'id' => false, // chart id
175-
'class' => false, // chart class
176-
'series' => false, // series filter hook
177-
'data' => false, // data filter hook
178-
'settings' => false, // data filter hook
176+
'class' => false, // chart class
177+
'series' => false, // series filter hook
178+
'data' => false, // data filter hook
179+
'settings' => false, // data filter hook
179180
), $atts
180181
);
181182

@@ -239,7 +240,7 @@ public function renderChart( $atts ) {
239240
'visualizer-render', 'visualizer', array(
240241
'charts' => $this->_charts,
241242
'map_api_key' => get_option( 'visualizer-map-api-key' ),
242-
'rest_url' => rest_url( 'visualizer/v' . VISUALIZER_REST_VERSION . '/action/#id#/#type#/' ),
243+
'rest_url' => version_compare( $wp_version, '4.7.0', '>=' ) ? rest_url( 'visualizer/v' . VISUALIZER_REST_VERSION . '/action/#id#/#type#/' ) : '',
243244
'i10n' => array(
244245
'copied' => __( 'Copied!', 'visualizer' ),
245246
),

classes/Visualizer/Plugin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
class Visualizer_Plugin {
2929

3030
const NAME = 'visualizer';
31-
const VERSION = '3.0.2';
31+
const VERSION = '3.0.3';
3232

3333
// custom post types
3434
const CPT_VISUALIZER = 'visualizer';

classes/Visualizer/Render/Sidebar.php

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ protected function _renderAdvancedSettings() {
157157

158158
self::_renderGroupStart( esc_html__( 'Manual Configuration', 'visualizer' ) );
159159
self::_renderSectionStart();
160-
self::_renderSectionDescription( __( 'Configure the graph by providing configuration variables right from the','visualizer' ) . ' <a href="https://developers.google.com/chart/interactive/docs/reference" target="_blank">Google Visualization</a> API.' );
160+
self::_renderSectionDescription( __( 'Configure the graph by providing configuration variables right from the', 'visualizer' ) . ' <a href="https://developers.google.com/chart/interactive/docs/reference" target="_blank">Google Visualization</a> API.' );
161161

162162
$example = '
163163
{
@@ -192,20 +192,24 @@ protected function _renderAdvancedSettings() {
192192
* @access protected
193193
*/
194194
protected function _renderActionSettings() {
195+
global $wp_version;
196+
$disable_actions = version_compare( $wp_version, '4.7.0', '<' );
195197
self::_renderSectionStart( esc_html__( 'Actions', 'visualizer' ), false );
196198
self::_renderCheckboxItem(
197199
esc_html__( 'Print', 'visualizer' ),
198200
'actions[]',
199201
isset( $this->actions ) && in_array( 'print', $this->actions ) ? true : false,
200202
'print',
201-
esc_html__( 'To enable printing the data.', 'visualizer' )
203+
$disable_actions ? '<span class="viz-section-error">' . esc_html__( 'Upgrade to at least WordPress 4.7 to use this.', 'visualizer' ) . '</span>' : esc_html__( 'To enable printing the data.', 'visualizer' ),
204+
$disable_actions
202205
);
203206
self::_renderCheckboxItem(
204207
esc_html__( 'CSV', 'visualizer' ),
205208
'actions[]',
206209
isset( $this->actions ) && in_array( 'csv;application/csv', $this->actions ) ? true : false,
207210
'csv;application/csv',
208-
esc_html__( 'To enable downloading the data as a CSV.', 'visualizer' )
211+
$disable_actions ? '<span class="viz-section-error">' . esc_html__( 'Upgrade to at least WordPress 4.7 to use this.', 'visualizer' ) . '</span>' : esc_html__( 'To enable downloading the data as a CSV.', 'visualizer' ),
212+
$disable_actions
209213
);
210214

211215
$disabled = ! ( class_exists( 'PHPExcel' ) && extension_loaded( 'zip' ) && extension_loaded( 'xml' ) && version_compare( PHP_VERSION, '5.2.0', '>' ) );
@@ -214,15 +218,16 @@ protected function _renderActionSettings() {
214218
'actions[]',
215219
isset( $this->actions ) && in_array( 'xls;application/vnd.ms-excel', $this->actions ) ? true : false,
216220
'xls;application/vnd.ms-excel',
217-
$disabled ? '<span class="viz-section-error">' . esc_html__( 'Enable the ZIP and XML extensions to use this setting.', 'visualizer' ) . '</span>' : esc_html__( 'To enable downloading the data as an Excel spreadsheet.', 'visualizer' ),
218-
$disabled
221+
$disable_actions ? '<span class="viz-section-error">' . esc_html__( 'Upgrade to at least WordPress 4.7 to use this.', 'visualizer' ) . '</span>' : ( $disabled ? '<span class="viz-section-error">' . esc_html__( 'Enable the ZIP and XML extensions to use this setting.', 'visualizer' ) . '</span>' : esc_html__( 'To enable downloading the data as an Excel spreadsheet.', 'visualizer' ) ),
222+
$disable_actions || $disabled
219223
);
220224
self::_renderCheckboxItem(
221225
esc_html__( 'Copy', 'visualizer' ),
222226
'actions[]',
223227
isset( $this->actions ) && in_array( 'copy', $this->actions ) ? true : false,
224228
'copy',
225-
esc_html__( 'To enable copying the data to the clipboard.', 'visualizer' )
229+
$disable_actions ? '<span class="viz-section-error">' . esc_html__( 'Upgrade to at least WordPress 4.7 to use this.', 'visualizer' ) . '</span>' : esc_html__( 'To enable copying the data to the clipboard.', 'visualizer' ),
230+
$disable_actions
226231
);
227232
self::_renderSectionEnd();
228233
}
@@ -663,7 +668,7 @@ protected static function _renderCheckboxItem( $title, $name, $value, $default,
663668
echo '<div class="viz-section-item">';
664669
echo '<a class="more-info" href="javascript:;">[?]</a>';
665670
echo '<b>', $title, '</b>';
666-
echo '<input type="checkbox" class="control-check" value="', $default, '" name="', $name, '" ', ($value == $default ? 'checked' : ''), ' ', ($disabled ? 'disabled=disabled' : ''), '>';
671+
echo '<input type="checkbox" class="control-check" value="', $default, '" name="', $name, '" ', ( $value == $default ? 'checked' : '' ), ' ', ( $disabled ? 'disabled=disabled' : '' ), '>';
667672
echo '<p class="viz-section-description">', $desc, '</p>';
668673
echo '</div>';
669674
}

classes/Visualizer/Render/Sidebar/Graph.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -426,12 +426,12 @@ protected function _renderHorizontalAxisFormatField() {
426426
'%s<br><br>%s<br><br>%s',
427427
esc_html__( 'Enter custom format pattern to apply to horizontal axis labels.', 'visualizer' ),
428428
sprintf(
429-
esc_html__( 'For number axis labels, this is a subset of the decimal formatting %1$sICU pattern set%2$s. For instance, $#,###.## will display values $1,234.56 for value 1234.56. Pay attention that if you use #&#37;&#37; percentage format then your values will be multiplied by 100.','visualizer' ),
429+
esc_html__( 'For number axis labels, this is a subset of the decimal formatting %1$sICU pattern set%2$s. For instance, $#,###.## will display values $1,234.56 for value 1234.56. Pay attention that if you use #&#37;&#37; percentage format then your values will be multiplied by 100.', 'visualizer' ),
430430
'<a href="http://icu-project.org/apiref/icu4c/classDecimalFormat.html#_details" target="_blank">',
431431
'</a>'
432432
),
433433
sprintf(
434-
esc_html__( 'For date axis labels, this is a subset of the date formatting %1$sICU date and time format%2$s.','visualizer' ),
434+
esc_html__( 'For date axis labels, this is a subset of the date formatting %1$sICU date and time format%2$s.', 'visualizer' ),
435435
'<a href="http://userguide.icu-project.org/formatparse/datetime#TOC-Date-Time-Format-Syntax" target="_blank">',
436436
'</a>'
437437
)
@@ -455,12 +455,12 @@ protected function _renderVerticalAxisFormatField() {
455455
'%s<br><br>%s<br><br>%s',
456456
esc_html__( 'Enter custom format pattern to apply to vertical axis labels.', 'visualizer' ),
457457
sprintf(
458-
esc_html__( 'For number axis labels, this is a subset of the decimal formatting %1$sICU pattern set%2$s. For instance, $#,###.## will display values $1,234.56 for value 1234.56. Pay attention that if you use #&#37;&#37; percentage format then your values will be multiplied by 100.','visualizer' ),
458+
esc_html__( 'For number axis labels, this is a subset of the decimal formatting %1$sICU pattern set%2$s. For instance, $#,###.## will display values $1,234.56 for value 1234.56. Pay attention that if you use #&#37;&#37; percentage format then your values will be multiplied by 100.', 'visualizer' ),
459459
'<a href="http://icu-project.org/apiref/icu4c/classDecimalFormat.html#_details" target="_blank">',
460460
'</a>'
461461
),
462462
sprintf(
463-
esc_html__( 'For date axis labels, this is a subset of the date formatting %1$sICU date and time format%2$s.','visualizer' ),
463+
esc_html__( 'For date axis labels, this is a subset of the date formatting %1$sICU date and time format%2$s.', 'visualizer' ),
464464
'<a href="http://userguide.icu-project.org/formatparse/datetime#TOC-Date-Time-Format-Syntax" target="_blank">',
465465
'</a>'
466466
)

classes/Visualizer/Render/Sidebar/Type/Geo.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ protected function _renderMapSettings() {
7373

7474
self::_renderSectionStart( esc_html__( 'Region', 'visualizer' ), false );
7575
self::_renderSectionDescription(
76-
esc_html__( 'Configure the region area to display on the map. (Surrounding areas will be displayed as well.) Can be one of the following:' , 'visualizer' ) .
76+
esc_html__( 'Configure the region area to display on the map. (Surrounding areas will be displayed as well.) Can be one of the following:', 'visualizer' ) .
7777
'<ul>' .
7878
'<li>' . esc_html__( "'world' - A map of the entire world.", 'visualizer' ) . '</li>' .
7979
'<li>' . sprintf( esc_html__( "A continent or a sub-continent, specified by its %s code, e.g., '011' for Western Africa.", 'visualizer' ), '<a href="https://google-developers.appspot.com/chart/interactive/docs/gallery/geochart#Continent_Hierarchy" target="_blank">3-digit</a>' ) . '</li>' .

classes/Visualizer/Render/Sidebar/Type/Pie.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,12 @@ protected function _renderPieSettings() {
6565
'%s<br><br>%s<br><br>%s',
6666
esc_html__( 'Enter custom format pattern to apply to horizontal axis labels.', 'visualizer' ),
6767
sprintf(
68-
esc_html__( 'For number axis labels, this is a subset of the decimal formatting %1$sICU pattern set%2$s. For instance, $#,###.## will display values $1,234.56 for value 1234.56. Pay attention that if you use #&#37;&#37; percentage format then your values will be multiplied by 100.','visualizer' ),
68+
esc_html__( 'For number axis labels, this is a subset of the decimal formatting %1$sICU pattern set%2$s. For instance, $#,###.## will display values $1,234.56 for value 1234.56. Pay attention that if you use #&#37;&#37; percentage format then your values will be multiplied by 100.', 'visualizer' ),
6969
'<a href="http://icu-project.org/apiref/icu4c/classDecimalFormat.html#_details" target="_blank">',
7070
'</a>'
7171
),
7272
sprintf(
73-
esc_html__( 'For date axis labels, this is a subset of the date formatting %1$sICU date and time format%2$s.','visualizer' ),
73+
esc_html__( 'For date axis labels, this is a subset of the date formatting %1$sICU date and time format%2$s.', 'visualizer' ),
7474
'<a href="http://userguide.icu-project.org/formatparse/datetime#TOC-Date-Time-Format-Syntax" target="_blank">',
7575
'</a>'
7676
)

css/media.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Version: 3.0.2
2+
Version: 3.0.3
33
*/
44
#visualizer-library-view {
55
padding: 30px 10px 10px 30px;

grunt/faq_builder.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/**
2+
* Faq builder for Grunt
3+
*/
4+
//jshint ignore: start
5+
module.exports = {
6+
options: {
7+
filename: 'readme.txt',
8+
api_key: 'e2a5c1a75f6132ced80bb05ee445a76ffa7fc430',
9+
collection_id: '561ec249c69791452ed4bceb',
10+
category_id: '596e5c5f2c7d3a73488b33ec',
11+
template: "= {article_title} = \n [{article_link}]({article_link}) \n\n ",
12+
},
13+
helpscout: {},
14+
};

index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Plugin Name: Visualizer: Charts and Graphs Lite
55
Plugin URI: https://themeisle.com/plugins/visualizer-charts-and-graphs-lite/
66
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.
7-
Version: 3.0.2
7+
Version: 3.0.3
88
Author: Themeisle
99
Author URI: http://themeisle.com
1010
License: GPL v2.0 or later

0 commit comments

Comments
 (0)