Skip to content

Commit e5097b5

Browse files
Fix file conflict
2 parents 322d9ee + f7fb53c commit e5097b5

File tree

8 files changed

+133
-14
lines changed

8 files changed

+133
-14
lines changed

classes/Visualizer/Gutenberg/Block.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ private function __construct() {
6767
* Enqueue front end and editor JavaScript and CSS
6868
*/
6969
public function enqueue_gutenberg_scripts() {
70-
global $wp_version;
70+
global $wp_version, $pagenow;
7171

7272
$blockPath = VISUALIZER_ABSURL . 'classes/Visualizer/Gutenberg/build/block.js';
7373
$handsontableJS = VISUALIZER_ABSURL . 'classes/Visualizer/Gutenberg/build/handsontable.js';
@@ -112,6 +112,7 @@ public function enqueue_gutenberg_scripts() {
112112
'sqlTable' => $table_col_mapping,
113113
'chartsPerPage' => defined( 'TI_CYPRESS_TESTING' ) ? 20 : 6,
114114
'proFeaturesLocked' => Visualizer_Module_Admin::proFeaturesLocked(),
115+
'isFullSiteEditor' => 'site-editor.php' === $pagenow,
115116
);
116117
wp_localize_script( 'visualizer-gutenberg-block', 'visualizerLocalize', $translation_array );
117118

@@ -367,6 +368,10 @@ public function get_visualizer_data( $post ) {
367368
$data['visualizer-data'] = $this->format_chart_data( $data['visualizer-data'], $data['visualizer-series'] );
368369
}
369370

371+
if ( ! isset( $data['visualizer-settings']['hAxis']['format'] ) ) {
372+
$data['visualizer-settings']['hAxis']['format'] = '';
373+
}
374+
370375
$data['visualizer-data-exploded'] = '';
371376
// handle annotations for google charts
372377
if ( 'GoogleCharts' === $library ) {

classes/Visualizer/Gutenberg/build/block.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

classes/Visualizer/Gutenberg/src/Editor.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,18 @@ class Editor extends Component {
466466
);
467467
}
468468

469+
if ( '1' === visualizerLocalize.isFullSiteEditor ) {
470+
return (
471+
<Notice
472+
status="error"
473+
isDismissible={ false }
474+
>
475+
<Dashicon icon="chart-pie" />
476+
{ __( 'Visualizer block charts are currently not available for selection here, you must visit the library, get the shortcode, and add the chart here in a shortcode tag.' ) }
477+
</Notice>
478+
);
479+
}
480+
469481
if ( 'renderChart' === this.state.route && null !== this.state.chart ) {
470482
return (
471483
<ChartRender

classes/Visualizer/Module.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,9 @@ private function _getCSV( $rows, $filename, $enclose ) {
272272
// phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged
273273
$fp = function_exists( 'tmpfile' ) ? @tmpfile() : null;
274274
if ( null === $fp ) {
275+
if ( ! function_exists( 'wp_tempnam' ) ) {
276+
require_once ABSPATH . 'wp-admin/includes/file.php';
277+
}
275278
$fp = fopen( wp_tempnam(), 'w+' );
276279
}
277280
if ( ! apply_filters( 'vizualizer_export_include_series_type', true ) ) {
@@ -628,7 +631,7 @@ protected function get_inline_custom_css( $id, $settings ) {
628631
}
629632

630633
$img_path = VISUALIZER_ABSURL . 'images';
631-
$css .= ".locker,.locker-loader{position:absolute;top:0;left:0;width:100%;height:100%}.locker{z-index:1000;opacity:.8;background-color:#fff;-ms-filter:\"progid:DXImageTransform.Microsoft.Alpha(Opacity=80)\";filter:alpha(opacity=80)}.locker-loader{z-index:1001;background:url($img_path/ajax-loader.gif) no-repeat center center}.dt-button{display:none!important}.visualizer-front-container.visualizer-lazy-render{content-visibility: auto;}.google-visualization-controls-categoryfilter label.google-visualization-controls-label {vertical-align: middle;}.google-visualization-controls-categoryfilter li.goog-inline-block {margin: 0 0.2em;}.google-visualization-controls-categoryfilter li {padding: 0 0.2em;}";
634+
$css .= ".locker,.locker-loader{position:absolute;top:0;left:0;width:100%;height:100%}.locker{z-index:1000;opacity:.8;background-color:#fff;-ms-filter:\"progid:DXImageTransform.Microsoft.Alpha(Opacity=80)\";filter:alpha(opacity=80)}.locker-loader{z-index:1001;background:url($img_path/ajax-loader.gif) no-repeat center center}.dt-button{display:none!important}.visualizer-front-container.visualizer-lazy-render{content-visibility: auto;}.google-visualization-controls-categoryfilter label.google-visualization-controls-label {vertical-align: middle;}.google-visualization-controls-categoryfilter li.goog-inline-block {margin: 0 0.2em;}.google-visualization-controls-categoryfilter li {padding: 0 0.2em;}.visualizer-front-container .dataTables_scrollHeadInner{margin: 0 auto;}";
632635
$css .= '</style>';
633636

634637
$arguments = array( $css, $settings );

classes/Visualizer/Module/Wizard.php

Lines changed: 101 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ private function setup_wizard_import_chart() {
206206

207207
$source = new Visualizer_Source_Csv( VISUALIZER_ABSPATH . DIRECTORY_SEPARATOR . 'samples' . DIRECTORY_SEPARATOR . $chart_type . '.csv' );
208208
$source->fetch();
209+
$series = $source->getSeries();
209210
$response = array(
210211
'success' => 2,
211212
'message' => __( 'Something went wrong while importing the chart', 'visualizer' ),
@@ -228,13 +229,111 @@ private function setup_wizard_import_chart() {
228229
update_post_meta( $chart_id, Visualizer_Plugin::CF_CHART_TYPE, $chart_type );
229230
update_post_meta( $chart_id, Visualizer_Plugin::CF_DEFAULT_DATA, 1 );
230231
update_post_meta( $chart_id, Visualizer_Plugin::CF_SOURCE, $source->getSourceName() );
231-
update_post_meta( $chart_id, Visualizer_Plugin::CF_SERIES, $source->getSeries() );
232+
update_post_meta( $chart_id, Visualizer_Plugin::CF_SERIES, $series );
232233
update_post_meta( $chart_id, Visualizer_Plugin::CF_CHART_LIBRARY, '' );
234+
235+
$setting_series = array();
236+
foreach ( $series as $s ) {
237+
$setting_series[] = array(
238+
'visibleInLegend' => '',
239+
'lineWidth' => '',
240+
'pointSize' => '',
241+
'format' => '',
242+
'curveType' => '',
243+
'color' => '',
244+
'role' => '',
245+
);
246+
}
233247
update_post_meta(
234248
$chart_id,
235249
Visualizer_Plugin::CF_SETTINGS,
236250
array(
237-
'focusTarget' => 'datum',
251+
'title' => '',
252+
'titlePosition' => '',
253+
'titleTextStyle' => array(
254+
'color' => '#000',
255+
),
256+
'legend' => array(
257+
'position' => 'right',
258+
'alignment' => 15,
259+
'textStyle' => array(
260+
'color' => '#000',
261+
'text' => 'both',
262+
),
263+
),
264+
'tooltip' => array(
265+
'trigger' => 'focus',
266+
'showColorCode' => 0,
267+
'showColorCode' => 0,
268+
),
269+
'animation' => array(
270+
'startup' => 0,
271+
'duration' => '',
272+
'easing' => 'linear',
273+
),
274+
'width' => '',
275+
'height' => '',
276+
'keepAspectRatio' => false,
277+
'isStacked' => false,
278+
'lazy_load_chart' => true,
279+
'backgroundColor' => array(
280+
'strokeWidth' => '',
281+
'stroke' => '',
282+
'fill' => '',
283+
),
284+
'chartArea' => array(
285+
'left' => '',
286+
'top' => '',
287+
'width' => '',
288+
'height' => '',
289+
),
290+
'focusTarget' => 'datum',
291+
'series' => $setting_series,
292+
'slices' => array(),
293+
'vAxis' => array(
294+
'title' => '',
295+
'textPosition' => '',
296+
'direction' => 1,
297+
'baselineColor' => '#000',
298+
'textStyle' => array(
299+
'color' => '#000',
300+
),
301+
'format' => '',
302+
'gridlines' => array(
303+
'count' => '',
304+
'color' => '#ccc',
305+
),
306+
'minorGridlines' => array(
307+
'count' => '',
308+
'color' => '',
309+
),
310+
'viewWindow' => array(
311+
'max' => '',
312+
'min' => '',
313+
),
314+
),
315+
'hAxis' => array(
316+
'title' => '',
317+
'textPosition' => '',
318+
'direction' => 1,
319+
'baselineColor' => '#000',
320+
'textStyle' => array(
321+
'color' => '#000',
322+
),
323+
'format' => '',
324+
'gridlines' => array(
325+
'count' => '',
326+
'color' => '#ccc',
327+
),
328+
'minorGridlines' => array(
329+
'count' => '',
330+
'color' => '',
331+
),
332+
'viewWindow' => array(
333+
'max' => '',
334+
'min' => '',
335+
),
336+
),
238337
)
239338
);
240339
$wizard_data = array(

classes/Visualizer/Render/Sidebar/Google.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function __construct( $data = array() ) {
5959
parent::__construct( $data );
6060

6161
$this->_legendPositions = array(
62-
'' => '',
62+
'' => esc_html__( 'Default', 'visualizer' ),
6363
'left' => esc_html__( 'Left of the chart', 'visualizer' ),
6464
'right' => esc_html__( 'Right of the chart', 'visualizer' ),
6565
'top' => esc_html__( 'Above the chart', 'visualizer' ),
@@ -318,7 +318,7 @@ protected function _renderTooltipSettigns() {
318318
'tooltip[trigger]',
319319
isset( $this->tooltip['trigger'] ) ? $this->tooltip['trigger'] : null,
320320
array(
321-
'' => '',
321+
'' => esc_html__( 'Default', 'visualizer' ),
322322
'focus' => esc_html__( 'The tooltip will be displayed when the user hovers over an element', 'visualizer' ),
323323
'selection' => esc_html__( 'The tooltip will be displayed when the user selects an element', 'visualizer' ),
324324
'none' => esc_html__( 'The tooltip will not be displayed', 'visualizer' ),

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ protected function _renderTooltipSettigns() {
205205
'tooltip[trigger]',
206206
isset( $this->tooltip['trigger'] ) ? $this->tooltip['trigger'] : null,
207207
array(
208-
'' => '',
208+
'' => esc_html__( 'Default', 'visualizer' ),
209209
'focus' => esc_html__( 'The tooltip will be displayed when the user hovers over an element', 'visualizer' ),
210210
'none' => esc_html__( 'The tooltip will not be displayed', 'visualizer' ),
211211
),

composer.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)