Skip to content

Commit 2b2b116

Browse files
grunt
1 parent a8cf390 commit 2b2b116

File tree

8 files changed

+42
-32
lines changed

8 files changed

+42
-32
lines changed

classes/Visualizer/Module.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -450,11 +450,11 @@ protected function get_user_customization_js() {
450450
*/
451451
protected function load_chart_type( $chart_id ) {
452452
$type = get_post_meta( $chart_id, Visualizer_Plugin::CF_CHART_TYPE, true );
453-
$name = 'Visualizer_Render_Sidebar_Type_' . ucwords( $type );
454-
$class = null;
453+
$name = 'Visualizer_Render_Sidebar_Type_' . ucwords( $type );
454+
$class = null;
455455
if ( class_exists( $name ) ) {
456-
$class = new $name;
457-
} else if ( true === apply_filters( 'visualizer_load_chart', false, $name ) ) {
456+
$class = new $name;
457+
} elseif ( true === apply_filters( 'visualizer_load_chart', false, $name ) ) {
458458
$class = new $name;
459459
}
460460
return is_null( $class ) ? null : $class->getLibrary();
@@ -464,8 +464,8 @@ protected function load_chart_type( $chart_id ) {
464464
* Generates the inline CSS to apply to the chart and adds these classes to the settings.
465465
*
466466
* @access public
467-
* @param int $id The id of the chart.
468-
* @param array $settings The settings of the chart.
467+
* @param int $id The id of the chart.
468+
* @param array $settings The settings of the chart.
469469
*/
470470
protected function get_inline_custom_css( $id, $settings ) {
471471
$css = '';
@@ -493,7 +493,7 @@ protected function get_inline_custom_css( $id, $settings ) {
493493

494494
$settings['cssClassNames'] = $classes;
495495

496-
$arguments = array( $css, $settings );
496+
$arguments = array( $css, $settings );
497497
apply_filters_ref_array( 'visualizer_inline_css', array( &$arguments ) );
498498

499499
return $arguments;

classes/Visualizer/Module/Admin.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,9 @@ public function registerAdminMenu() {
470470
$this->_libraryPage = add_submenu_page( 'upload.php', $title, $title, 'edit_posts', Visualizer_Plugin::NAME, $callback );
471471
}
472472

473+
/**
474+
* Get the instance of WP_Query that fetches the charts as per the given criteria.
475+
*/
473476
private function getQuery() {
474477
static $q;
475478
if ( ! is_null( $q ) ) {
@@ -552,7 +555,7 @@ public function renderLibraryPage() {
552555
$filter = 'all';
553556
}
554557

555-
$css = '';
558+
$css = '';
556559
while ( $query->have_posts() ) {
557560
$chart = $query->next_post();
558561

@@ -574,7 +577,7 @@ public function renderLibraryPage() {
574577
$data = apply_filters( Visualizer_Plugin::FILTER_GET_CHART_DATA, unserialize( html_entity_decode( $chart->post_content ) ), $chart->ID, $type );
575578
$library = $this->load_chart_type( $chart->ID );
576579

577-
$id = 'visualizer-' . $chart->ID;
580+
$id = 'visualizer-' . $chart->ID;
578581
$arguments = $this->get_inline_custom_css( $id, $settings );
579582
if ( ! empty( $arguments ) ) {
580583
$css .= $arguments[0];
@@ -618,15 +621,15 @@ public function renderLibraryPage() {
618621
$ajaxurl
619622
),
620623
),
621-
'page_type' => 'library',
624+
'page_type' => 'library',
622625
)
623626
);
624627
// render library page
625628
$render = new Visualizer_Render_Library();
626629
$render->charts = $charts;
627630
$render->type = $filter;
628631
$render->types = self::_getChartTypesLocalized();
629-
$render->custom_css = $css;
632+
$render->custom_css = $css;
630633
$render->pagination = paginate_links(
631634
array(
632635
'base' => add_query_arg( 'vpage', '%#%' ),

classes/Visualizer/Module/Chart.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ private function _getChartArray( WP_Post $chart = null ) {
141141
$settings = apply_filters( $atts['settings'], $settings, $chart->ID, $type );
142142
}
143143

144-
$css = '';
144+
$css = '';
145145
$arguments = $this->get_inline_custom_css( 'visualizer-' . $chart->ID, $settings );
146146
if ( ! empty( $arguments ) ) {
147147
$css = $arguments[0];
@@ -154,7 +154,7 @@ private function _getChartArray( WP_Post $chart = null ) {
154154
'settings' => $settings,
155155
'data' => $data,
156156
'library' => $library,
157-
'css' => $css,
157+
'css' => $css,
158158
);
159159
}
160160

@@ -401,7 +401,7 @@ private function _handleDataAndSettingsPage() {
401401
$render = new Visualizer_Render_Page_Data();
402402
$render->chart = $this->_chart;
403403
$render->type = $data['type'];
404-
$render->custom_css = $data['css'];
404+
$render->custom_css = $data['css'];
405405
$render->sidebar = $sidebar;
406406
if ( filter_input( INPUT_GET, 'library', FILTER_VALIDATE_BOOLEAN ) ) {
407407
$render->button = filter_input( INPUT_GET, 'action' ) == Visualizer_Plugin::ACTION_EDIT_CHART
@@ -546,7 +546,7 @@ public function uploadData() {
546546
update_post_meta( $chart->ID, Visualizer_Plugin::CF_SERIES, $source->getSeries() );
547547
update_post_meta( $chart->ID, Visualizer_Plugin::CF_SOURCE, $source->getSourceName() );
548548
update_post_meta( $chart->ID, Visualizer_Plugin::CF_DEFAULT_DATA, 0 );
549-
$render->id = $chart->ID;
549+
$render->id = $chart->ID;
550550
$render->data = json_encode( $source->getRawData() );
551551
$render->series = json_encode( $source->getSeries() );
552552
} else {

classes/Visualizer/Module/Frontend.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ public function renderChart( $atts ) {
241241
$settings = $arguments[1];
242242
}
243243

244-
$library = $this->load_chart_type( $chart->ID );
244+
$library = $this->load_chart_type( $chart->ID );
245245

246246
// add chart to the array
247247
$this->_charts[ $id ] = array(
@@ -266,13 +266,13 @@ public function renderChart( $atts ) {
266266
'visualizer',
267267
array(
268268
'charts' => $this->_charts,
269-
'language' => $this->get_language(),
269+
'language' => $this->get_language(),
270270
'map_api_key' => get_option( 'visualizer-map-api-key' ),
271271
'rest_url' => version_compare( $wp_version, '4.7.0', '>=' ) ? rest_url( 'visualizer/v' . VISUALIZER_REST_VERSION . '/action/#id#/#type#/' ) : '',
272272
'i10n' => array(
273273
'copied' => __( 'Copied!', 'visualizer' ),
274274
),
275-
'page_type' => 'frontend',
275+
'page_type' => 'frontend',
276276
)
277277
);
278278
wp_enqueue_style( 'visualizer-front' );

classes/Visualizer/Render/Sidebar/Google.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,11 @@
3131
*/
3232
abstract class Visualizer_Render_Sidebar_Google extends Visualizer_Render_Sidebar {
3333

34+
/**
35+
* The constructor.
36+
*/
3437
public function __construct( $data = array() ) {
35-
$this->_library = 'google';
38+
$this->_library = 'google';
3639
parent::__construct( $data );
3740
}
3841

@@ -47,6 +50,9 @@ protected function hooks() {
4750
}
4851
}
4952

53+
/**
54+
* Loads the assets.
55+
*/
5056
function load_google_assets( $deps, $is_frontend ) {
5157
wp_register_script( 'google-jsapi-new', '//www.gstatic.com/charts/loader.js', array(), null, true );
5258
wp_register_script( 'google-jsapi-old', '//www.google.com/jsapi', array( 'google-jsapi-new' ), null, true );
@@ -60,12 +66,12 @@ function load_google_assets( $deps, $is_frontend ) {
6066
true
6167
);
6268

63-
return array_merge(
69+
return array_merge(
6470
$deps,
6571
array( 'visualizer-render-google-lib' )
6672
);
6773

6874
}
6975

7076

71-
}
77+
}

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class Visualizer_Render_Sidebar_Type_DataTable extends Visualizer_Render_Sidebar
3535
* @param array $data The data what has to be associated with this render.
3636
*/
3737
public function __construct( $data = array() ) {
38-
$this->_library = 'datatables';
38+
$this->_library = 'datatables';
3939
$this->_includeCurveTypes = false;
4040

4141
parent::__construct( $data );
@@ -58,8 +58,8 @@ protected function hooks() {
5858
* @access public
5959
*/
6060
function load_assets( $deps, $is_frontend ) {
61-
wp_register_script( 'visualizer-datatables', '//cdn.datatables.net/v/dt/dt-1.10.18/fc-3.2.5/fh-3.1.4/r-2.2.2/sc-1.5.0/sl-1.2.6/datatables.min.js', array( 'jquery-ui-core' ), Visualizer_Plugin::VERSION );
62-
wp_enqueue_style( 'visualizer-datatables', '//cdn.datatables.net/v/dt/dt-1.10.18/fc-3.2.5/fh-3.1.4/r-2.2.2/sc-1.5.0/sl-1.2.6/datatables.min.css', array(), Visualizer_Plugin::VERSION );
61+
wp_register_script( 'visualizer-datatables', '//cdn.datatables.net/v/dt/dt-1.10.18/fc-3.2.5/fh-3.1.4/r-2.2.2/sc-1.5.0/sl-1.2.6/datatables.min.js', array( 'jquery-ui-core' ), Visualizer_Plugin::VERSION );
62+
wp_enqueue_style( 'visualizer-datatables', '//cdn.datatables.net/v/dt/dt-1.10.18/fc-3.2.5/fh-3.1.4/r-2.2.2/sc-1.5.0/sl-1.2.6/datatables.min.css', array(), Visualizer_Plugin::VERSION );
6363

6464
wp_register_script(
6565
'visualizer-render-datatables-lib',
@@ -71,7 +71,7 @@ function load_assets( $deps, $is_frontend ) {
7171
true
7272
);
7373

74-
return array_merge(
74+
return array_merge(
7575
$deps,
7676
array( 'visualizer-render-datatables-lib' )
7777
);
@@ -207,7 +207,7 @@ protected function _renderTableSettings() {
207207
self::_renderGroupStart( esc_html__( 'Row/Cell Settings', 'visualizer' ) );
208208

209209
self::_renderSectionStart( esc_html__( 'Odd Table Row', 'visualizer' ) );
210-
210+
211211
self::_renderSectionDescription( esc_html__( 'These values will be applied once you save the chart.', 'visualizer' ) );
212212

213213
self::_renderColorPickerItem(
@@ -327,7 +327,7 @@ protected function _renderSeries( $index ) {
327327
* @access protected
328328
*/
329329
protected function _renderSeriesSettings() {
330-
330+
331331
}
332332

333333
}

js/render-datatables.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/* global console */
2+
/* global visualizer */
23

34
(function($) {
45
var all_charts;
@@ -42,7 +43,7 @@
4243
rows.push(row);
4344
}
4445

45-
var settings = {
46+
settings = {
4647
destroy: true,
4748
paging: false,
4849
searching: false,
@@ -70,7 +71,7 @@
7071
var select = {
7172
info: false
7273
};
73-
$.extend( settings, { select } );
74+
$.extend( settings, { select } ); // jshint ignore:line
7475

7576
// in preview mode, cssClassNames will not exist when a color is changed.
7677
if(typeof chart.settings['cssClassNames'] !== 'undefined'){
@@ -89,7 +90,7 @@
8990
}
9091
}
9192

92-
for (var i in chart.settings) {
93+
for (i in chart.settings) {
9394
var valoo = chart.settings[i];
9495

9596
// remove the type suffix to get the name of the setting.
@@ -107,7 +108,7 @@
107108
// if the setting name has an '_' this means it is a sub-setting e.g. select_items means { select: { items: ... } }.
108109
var array = i.split('_');
109110
if(array.length === 2){
110-
i = eval( array[0] );
111+
i = eval( array[0] ); // jshint ignore:line
111112
i[ array[1] ] = valoo;
112113
}
113114
settings[i] = valoo;

js/render-google.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ var __visualizer_chart_images = [];
77

88
(function($) {
99
var gv;
10-
var all_charts;
10+
var all_charts, objects;
1111

1212
function renderChart(id) {
1313
var chart, render, container, series, data, table, settings, i, j, row, date, axis, property, format, formatter;

0 commit comments

Comments
 (0)