Skip to content

Commit 397b05d

Browse files
grunt
1 parent e3286fc commit 397b05d

File tree

5 files changed

+28
-27
lines changed

5 files changed

+28
-27
lines changed

classes/Visualizer/Module/Chart.php

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -799,15 +799,15 @@ private function handleCSVasString( $data ) {
799799
* @access private
800800
*/
801801
private function handleTabularData() {
802-
$csv = array();
802+
$csv = array();
803803
// the datatable mentions the headers twice, so lets remove the duplicates.
804-
$headers = array_unique( array_filter( $_POST['header'] ) );
805-
$types = $_POST['type'];
804+
$headers = array_unique( array_filter( $_POST['header'] ) );
805+
$types = $_POST['type'];
806806

807807
// capture all the indexes that correspond to excluded columns.
808-
$exclude = array();
809-
$index = 0;
810-
foreach( $types as $type ) {
808+
$exclude = array();
809+
$index = 0;
810+
foreach ( $types as $type ) {
811811
if ( empty( $type ) ) {
812812
$exclude[] = $index;
813813
}
@@ -819,27 +819,27 @@ private function handleTabularData() {
819819
// so unset the headers that have been renamed.
820820
if ( count( $headers ) !== count( $types ) ) {
821821
$to = count( $headers );
822-
for( $i = count( $types ); $i < $to; $i++ ) {
822+
for ( $i = count( $types ); $i < $to; $i++ ) {
823823
unset( $headers[ $i + 1 ] );
824824
}
825825
}
826826

827-
$columns = array();
828-
for( $i = 0; $i < count( $headers ); $i++ ) {
829-
if ( ! isset( $_POST['data' . $i] ) ) {
827+
$columns = array();
828+
for ( $i = 0; $i < count( $headers ); $i++ ) {
829+
if ( ! isset( $_POST[ 'data' . $i ] ) ) {
830830
continue;
831831
}
832-
$columns[$i] = $_POST['data' . $i];
832+
$columns[ $i ] = $_POST[ 'data' . $i ];
833833
}
834834

835-
$csv[] = $headers;
836-
$csv[] = $types;
837-
for( $j = 0; $j < count( $columns[0] ); $j++ ) {
835+
$csv[] = $headers;
836+
$csv[] = $types;
837+
for ( $j = 0; $j < count( $columns[0] ); $j++ ) {
838838
$row = array();
839-
for( $i = 0; $i < count( $headers ); $i++ ) {
840-
$row[] = $columns[$i][$j];
839+
for ( $i = 0; $i < count( $headers ); $i++ ) {
840+
$row[] = $columns[ $i ][ $j ];
841841
}
842-
$csv[] = $row;
842+
$csv[] = $row;
843843
}
844844

845845
$tmpfile = tempnam( get_temp_dir(), Visualizer_Plugin::NAME );

classes/Visualizer/Render/Layout.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ public static function _renderTextEditor( $args ) {
288288
?>
289289
<div class="viz-simple-editor-type viz-text-editor">
290290
<textarea id="edited_text"><?php echo $data; ?></textarea>
291-
<button id="viz-text-editor-button" class="button button-primary"><?php _e( 'Save &amp; Show Chart', 'visualizer' );?></button>
291+
<button id="viz-text-editor-button" class="button button-primary"><?php _e( 'Save &amp; Show Chart', 'visualizer' ); ?></button>
292292
</div>
293293
<?php
294294
}
@@ -302,18 +302,18 @@ public static function _renderEditorTable( $args ) {
302302
$data = $args[1];
303303
$chart_id = $args[2];
304304
$class = $args[3];
305-
$echo = $args[4];
305+
$echo = $args[4];
306306
$editable_data = $args[5];
307307
$series = get_post_meta( $chart_id, Visualizer_Plugin::CF_SERIES, true );
308-
$headers = array();
308+
$headers = array();
309309

310310
if ( is_null( $data ) ) {
311311
foreach ( $series as $column ) {
312312
$headers[] = $column['label'];
313313
}
314-
$chart = get_post( $chart_id );
315-
$type = get_post_meta( $chart_id, Visualizer_Plugin::CF_CHART_TYPE, true );
316-
$data = apply_filters( Visualizer_Plugin::FILTER_GET_CHART_DATA, unserialize( html_entity_decode( $chart->post_content ) ), $type );
314+
$chart = get_post( $chart_id );
315+
$type = get_post_meta( $chart_id, Visualizer_Plugin::CF_CHART_TYPE, true );
316+
$data = apply_filters( Visualizer_Plugin::FILTER_GET_CHART_DATA, unserialize( html_entity_decode( $chart->post_content ) ), $type );
317317
} else {
318318
$headers = array_keys( $data[0] );
319319
}

classes/Visualizer/Render/Page/Data.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ class="dashicons dashicons-lock"></span></h2>
390390
<div>
391391
<p class="viz-group-description"><?php echo sprintf( __( 'You can manually edit the chart data using the %s editor.', 'visualizer' ), VISUALIZER_PRO ? 'spreadsheet like' : 'simple' ); ?></p>
392392
<?php if ( ! VISUALIZER_PRO ) { ?>
393-
<p class="viz-group-description"><input type="checkbox" id="simple-editor-type" value="textarea"><label for="simple-editor-type"><?php _e( 'Use text area editor instead', 'visualizer' );?></label></p>
393+
<p class="viz-group-description"><input type="checkbox" id="simple-editor-type" value="textarea"><label for="simple-editor-type"><?php _e( 'Use text area editor instead', 'visualizer' ); ?></label></p>
394394
<?php } ?>
395395
<input type="button" id="editor-chart-button" class="button button-primary "
396396
value="<?php _e( 'View Editor', 'visualizer' ); ?>" data-current="chart"

js/frame.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@
396396
$('#json-conclude-form [name="root"]').val(data.data.root);
397397
$('#json-conclude-form .json-table').html(data.data.table);
398398

399-
$table = create_editor_table( '#json-conclude-form' );
399+
var $table = create_editor_table( '#json-conclude-form' );
400400

401401
json_accordion_activate(3, true);
402402
json_accordion_activate(2, false);
@@ -447,7 +447,7 @@
447447

448448
function init_editor_table() {
449449
$('body').on('visualizer:db:editor:table:init', function(event, data){
450-
$table = create_editor_table('.viz-table-editor');
450+
var $table = create_editor_table('.viz-table-editor');
451451
$('body').on('visualizer:db:editor:table:redraw', function(event, data){
452452
$table.draw();
453453
});

js/simple-editor.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* global visualizer1 */
2+
13
(function($, v) {
24

35
$(document).ready(function(){
@@ -9,7 +11,6 @@
911
$( '#editor-chart-button' ).on( 'click', function(){
1012
$('.viz-simple-editor-type').hide();
1113
if($("#simple-editor-type").is(':checked')){
12-
console.log("checked with " + $("#simple-editor-type").val());
1314
switch($("#simple-editor-type").val()) {
1415
case 'textarea':
1516
showText($(this));

0 commit comments

Comments
 (0)