PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.3.4
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.3.4
4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.2 3.1.3 3.10.0 3.10.1 3.10.10 3.10.11 3.10.12 3.10.13 3.10.14 3.10.15 3.10.2 3.10.3 3.10.4 All 148 releases
← All changes | classes/Visualizer/Render/Page/Data.php +109 -26 3.1.33.3.4 View file →
@@ -37,16 +37,20 @@
37 37 * @access protected
38 38 */
39 39 protected function _renderContent() {
40 40 // Added by Ash/Upwork
41 - if ( VISUALIZER_PRO ) {
42 - global $Visualizer_Pro;
43 - $Visualizer_Pro->_addEditor( $this->chart->ID );
44 - if ( method_exists( $Visualizer_Pro, '_addFilterWizard' ) ) {
45 - $Visualizer_Pro->_addFilterWizard( $this->chart->ID );
41 + if ( Visualizer_Module::is_pro() ) {
42 + do_action( 'visualizer_add_editor_etc', $this->chart->ID );
43 +
44 + if ( Visualizer_Module::is_pro() && Visualizer_Module::is_pro_older_than( '1.9.0' ) ) {
45 + global $Visualizer_Pro;
46 + $Visualizer_Pro->_addEditor( $this->chart->ID );
47 + if ( method_exists( $Visualizer_Pro, '_addFilterWizard' ) ) {
48 + $Visualizer_Pro->_addFilterWizard( $this->chart->ID );
49 + }
46 50 }
47 51 } else {
48 - Visualizer_Render_Layout::show( 'faux-editor' );
52 + Visualizer_Render_Layout::show( 'simple-editor-screen', $this->chart->ID );
49 53 }
50 54
51 55 $this->add_additional_content();
52 56
@@ -82,10 +86,11 @@
82 86 if ( ! empty( $filter_config ) ) {
83 87 $source_of_chart .= '_wp';
84 88 }
85 89 $type = get_post_meta( $this->chart->ID, Visualizer_Plugin::CF_CHART_TYPE, true );
90 + $lib = get_post_meta( $this->chart->ID, Visualizer_Plugin::CF_CHART_LIBRARY, true );
86 91 ?>
87 - <span id="visualizer-chart-id" data-id="<?php echo $this->chart->ID; ?>" data-chart-source="<?php echo $source_of_chart; ?>" data-chart-type="<?php echo $type; ?>"></span>
92 + <span id="visualizer-chart-id" data-id="<?php echo $this->chart->ID; ?>" data-chart-source="<?php echo esc_attr( $source_of_chart ); ?>" data-chart-type="<?php echo esc_attr( $type ); ?>" data-chart-lib="<?php echo esc_attr( $lib ); ?>"></span>
88 93 <iframe id="thehole" name="thehole"></iframe>
89 94 <ul class="viz-group-wrapper full-height">
90 95 <li class="viz-group viz-group-category open" id="vz-chart-source">
91 96 <div class="viz-group-header">
@@ -96,9 +101,9 @@
96 101 <li class="viz-group visualizer_source_csv">
97 102 <h2 class="viz-group-title viz-sub-group visualizer-src-tab"><?php _e( 'Import data from file', 'visualizer' ); ?></h2>
98 103 <div class="viz-group-content">
99 104 <p class="viz-group-description"><?php esc_html_e( 'Select and upload your data CSV file here. The first row of the CSV file should contain the column headings. The second one should contain series type (string, number, boolean, date, datetime, timeofday).', 'visualizer' ); ?></p>
100 - <p class="viz-group-description"><?php echo sprintf( __( 'If you are unsure about how to format your data CSV then please take a look at this sample: %1$s %2$s%3$s', 'visualizer' ), '<a href="' . VISUALIZER_ABSURL . 'samples/' . $this->type . '.csv" target="_blank">', $this->type, '.csv</a>' ); ?></p>
105 + <p class="viz-group-description"><b><?php echo sprintf( __( 'If you are unsure about how to format your data CSV then please take a look at this sample: %1$s %2$s%3$s. If you are using non-English characters, please make sure you save the file in UTF-8 encoding.', 'visualizer' ), '<a href="' . VISUALIZER_ABSURL . 'samples/' . $this->type . '.csv" target="_blank">', $this->type, '.csv</a>' ); ?></b></p>
101 106 <form id="vz-csv-file-form" action="<?php echo $upload_link; ?>" method="post"
102 107 target="thehole" enctype="multipart/form-data">
103 108 <input type="hidden" id="remote-data" name="remote_data">
104 109 <div class="">
@@ -108,9 +113,9 @@
108 113 value="<?php _e( 'Import', 'visualizer' ); ?>">
109 114 </form>
110 115 </div>
111 116 </li>
112 - <li class="viz-group visualizer-import-url visualizer_source_csv_remote">
117 + <li class="viz-group visualizer-import-url visualizer_source_csv_remote visualizer_source_json">
113 118 <h2 class="viz-group-title viz-sub-group visualizer-src-tab"><?php _e( 'Import data from URL', 'visualizer' ); ?></h2>
114 119 <ul class="viz-group-content">
115 120 <li class="viz-subsection">
116 121 <span class="viz-section-title"><?php _e( 'One time import', 'visualizer' ); ?></span>
@@ -116,9 +121,9 @@
116 121 <span class="viz-section-title"><?php _e( 'One time import', 'visualizer' ); ?></span>
117 122
118 123 <div class="viz-section-items section-items">
119 124 <p class="viz-group-description"><?php _e( 'You can use this to import data from a remote CSV file. The first row of the CSV file should contain the column headings. The second one should contain series type (string, number, boolean, date, datetime, timeofday).', 'visualizer' ); ?> </p>
120 - <p class="viz-group-description"><?php echo sprintf( __( 'If you are unsure about how to format your data CSV then please take a look at this sample: %1$s %2$s%3$s', 'visualizer' ), '<a href="' . VISUALIZER_ABSURL . 'samples/' . $this->type . '.csv" target="_blank">', $this->type, '.csv</a>' ); ?></p>
125 + <p class="viz-group-description"><b><?php echo sprintf( __( 'If you are unsure about how to format your data CSV then please take a look at this sample: %1$s %2$s%3$s. If you have using non-English characters, please make sure you save the file in UTF-8 encoding.', 'visualizer' ), '<a href="' . VISUALIZER_ABSURL . 'samples/' . $this->type . '.csv" target="_blank">', $this->type, '.csv</a>' ); ?></b></p>
121 126 <p class="viz-group-description"> <?php _e( 'You can also import data from Google Spreadsheet, for more info check <a href="https://docs.themeisle.com/article/607-how-can-i-populate-data-from-google-spreadsheet" target="_blank" >this</a> tutorial', 'visualizer' ); ?></p>
122 127 <form id="vz-one-time-import" action="<?php echo $upload_link; ?>" method="post"
123 128 target="thehole" enctype="multipart/form-data">
124 129 <div class="remote-file-section">
@@ -143,9 +148,9 @@
143 148 <form id="vz-schedule-import" action="<?php echo $upload_link; ?>" method="post"
144 149 target="thehole" enctype="multipart/form-data">
145 150 <div class="remote-file-section">
146 151 <input type="url" id="vz-schedule-url" name="remote_data"
147 - value="<?php echo get_post_meta( $this->chart->ID, Visualizer_Plugin::CF_CHART_URL, true ); ?>"
152 + value="<?php echo esc_url( get_post_meta( $this->chart->ID, Visualizer_Plugin::CF_CHART_URL, true ) ); ?>"
148 153 placeholder="<?php esc_html_e( 'Please enter the URL of CSV file', 'visualizer' ); ?>"
149 154 class="visualizer-input visualizer-remote-url">
150 155 <p class="viz-group-description"><?php _e( 'How often do you want to check the url', 'visualizer' ); ?></p>
151 156 <select name="vz-import-time" id="vz-import-time"
@@ -157,11 +162,14 @@
157 162 '1' => __( 'Each hour', 'visualizer' ),
158 163 '12' => __( 'Each 12 hours', 'visualizer' ),
159 164 '24' => __( 'Each day', 'visualizer' ),
160 165 '72' => __( 'Each 3 days', 'visualizer' ),
161 - )
166 + ),
167 + 'csv',
168 + $this->chart->ID
162 169 );
163 170 foreach ( $schedules as $num => $name ) {
171 + // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
164 172 $extra = $num == $hours ? 'selected' : '';
165 173 ?>
166 174 <option value="<?php echo $num; ?>" <?php echo $extra; ?>><?php echo $name; ?></option>
167 175 <?php
@@ -175,11 +183,63 @@
175 183 <?php echo apply_filters( 'visualizer_pro_upsell', '', 'schedule-chart' ); ?>
176 184 </form>
177 185 </div>
178 186 </li>
187 +
188 + <li class="viz-subsection">
189 + <span class="viz-section-title visualizer_source_json"><?php _e( 'Import from JSON', 'visualizer' ); ?>
190 + <span class="dashicons dashicons-lock"></span></span>
191 + <div class="viz-section-items section-items">
192 + <p class="viz-group-description"><?php _e( 'You can choose here to import/synchronize your chart data with a remote JSON source. For more info check <a href="https://docs.themeisle.com/article/1052-how-to-generate-charts-from-json-data-rest-endpoints" target="_blank" >this</a> tutorial', 'visualizer' ); ?></p>
193 + <form id="vz-import-json" action="<?php echo $upload_link; ?>" method="post" target="thehole" enctype="multipart/form-data">
194 + <div class="remote-file-section">
195 + <?php
196 + $bttn_label = 'visualizer_source_json' === $source_of_chart ? __( 'Modify Parameters', 'visualizer' ) : __( 'Create Parameters', 'visualizer' );
197 + if ( Visualizer_Module::is_pro() ) {
198 + ?>
199 + <p class="viz-group-description"><?php _e( 'How often do you want to check the URL', 'visualizer' ); ?></p>
200 + <select name="vz-json-time" id="vz-json-time" class="visualizer-select" data-chart="<?php echo $this->chart->ID; ?>">
201 + <?php
202 + $hours = get_post_meta( $this->chart->ID, Visualizer_Plugin::CF_JSON_SCHEDULE, true );
203 + $schedules = apply_filters(
204 + 'visualizer_chart_schedules', array(
205 + '-1' => __( 'One-time', 'visualizer' ),
206 + ),
207 + 'json',
208 + $this->chart->ID
209 + );
210 + foreach ( $schedules as $num => $name ) {
211 + // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
212 + $extra = $num == $hours ? 'selected' : '';
213 + ?>
214 + <option value="<?php echo $num; ?>" <?php echo $extra; ?>><?php echo $name; ?></option>
215 + <?php
216 + }
217 + ?>
218 + </select>
219 + <?php
220 + }
221 + ?>
222 + </div>
223 +
224 + <input type="button" id="json-chart-button" class="button button-secondary show-chart-toggle"
225 + value="<?php echo $bttn_label; ?>" data-current="chart"
226 + data-t-filter="<?php _e( 'Show Chart', 'visualizer' ); ?>"
227 + data-t-chart="<?php echo $bttn_label; ?>">
228 + <?php
229 + if ( Visualizer_Module::is_pro() ) {
230 + ?>
231 + <input type="button" id="json-chart-save-button" class="button button-primary "
232 + value="<?php _e( 'Save Schedule', 'visualizer' ); ?>">
233 + <?php
234 + }
235 + ?>
236 + </form>
237 + </div>
238 + </li>
179 239 </ul>
180 240 </li>
181 - <li class="viz-group <?php echo apply_filters( 'visualizer_pro_upsell_class', 'only-pro-feature' ); ?>">
241 + <li class="viz-group viz-import-from-other <?php echo apply_filters( 'visualizer_pro_upsell_class', 'only-pro-feature' ); ?>">
182 242 <h2 class="viz-group-title viz-sub-group"
183 243 data-current="chart"><?php _e( 'Import from other chart', 'visualizer' ); ?><span
184 244 class="dashicons dashicons-lock"></span></h2>
185 245 <div class="viz-group-content edit-data-content">
@@ -189,9 +249,9 @@
189 249 <select name="vz-import-from-chart" id="chart-id" class="visualizer-select">
190 250 <?php
191 251 $fetch_link = add_query_arg(
192 252 array(
193 - 'action' => ( VISUALIZER_PRO ) ? Visualizer_Pro::ACTION_FETCH_DATA : '',
253 + 'action' => Visualizer_Module::is_pro() ? Visualizer_Pro::ACTION_FETCH_DATA : '',
194 254 'nonce' => wp_create_nonce(),
195 255 ),
196 256 admin_url( 'admin-ajax.php' )
197 257 );
@@ -204,10 +264,23 @@
204 264 $query = new WP_Query( $query_args_charts );
205 265 while ( $query->have_posts() ) {
206 266 $chart = $query->next_post();
207 267 $settings = get_post_meta( $chart->ID, Visualizer_Plugin::CF_SETTINGS, true );
268 +
269 + $title = '#' . $chart->ID;
270 + if ( ! empty( $settings['title'] ) ) {
271 + $title = $settings['title'];
272 + }
273 + // for ChartJS, title is an array.
274 + if ( is_array( $title ) && isset( $title['text'] ) ) {
275 + $title = $title['text'];
276 + }
277 + if ( empty( $title ) ) {
278 + $title = '#' . $chart->ID;
279 + }
280 +
208 281 ?>
209 - <option value="<?php echo $chart->ID; ?>"><?php echo empty( $settings['title'] ) ? '#' . $chart->ID : $settings['title']; ?></option>
282 + <option value="<?php echo $chart->ID; ?>"><?php echo $title; ?></option>
210 283 <?php
211 284 }
212 285 ?>
213 286
@@ -251,8 +324,9 @@
251 324 '72' => __( 'Each 3 days', 'visualizer' ),
252 325 )
253 326 );
254 327 foreach ( $schedules as $num => $name ) {
328 + // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
255 329 $extra = $num == $hours ? 'selected' : '';
256 330 ?>
257 331 <option value="<?php echo $num; ?>" <?php echo $extra; ?>><?php echo $name; ?></option>
258 332 <?php
@@ -259,9 +333,9 @@
259 333 }
260 334 ?>
261 335 </select>
262 336
263 - <input type="button" id="filter-chart-button" class="button button-secondary" value="<?php echo $bttn_label; ?>" data-current="chart" data-t-filter="<?php _e( 'Show Chart', 'visualizer' ); ?>" data-t-chart="<?php echo $bttn_label; ?>">
337 + <input type="button" id="filter-chart-button" class="button button-secondary show-chart-toggle" value="<?php echo $bttn_label; ?>" data-current="chart" data-t-filter="<?php _e( 'Show Chart', 'visualizer' ); ?>" data-t-chart="<?php echo $bttn_label; ?>">
264 338 <input type="button" id="db-filter-save-button" class="button button-primary" value="<?php _e( 'Save Schedule', 'visualizer' ); ?>">
265 339 <?php echo apply_filters( 'visualizer_pro_upsell', '', 'db-query' ); ?>
266 340 </form>
267 341 <?php echo apply_filters( 'visualizer_pro_upsell', '', 'schedule-chart' ); ?>
@@ -299,8 +373,9 @@
299 373 '72' => __( 'Each 3 days', 'visualizer' ),
300 374 )
301 375 );
302 376 foreach ( $schedules as $num => $name ) {
377 + // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
303 378 $extra = $num == $hours ? 'selected' : '';
304 379 ?>
305 380 <option value="<?php echo $num; ?>" <?php echo $extra; ?>><?php echo $name; ?></option>
306 381 <?php
@@ -308,9 +383,9 @@
308 383 ?>
309 384 </select>
310 385 <input type="hidden" name="params" id="viz-db-wizard-params">
311 386
312 - <input type="button" id="db-chart-button" class="button button-secondary" value="<?php echo $bttn_label; ?>" data-current="chart" data-t-filter="<?php _e( 'Show Chart', 'visualizer' ); ?>" data-t-chart="<?php echo $bttn_label; ?>">
387 + <input type="button" id="db-chart-button" class="button button-secondary show-chart-toggle" value="<?php echo $bttn_label; ?>" data-current="chart" data-t-filter="<?php _e( 'Show Chart', 'visualizer' ); ?>" data-t-chart="<?php echo $bttn_label; ?>">
313 388 <input type="button" id="db-chart-save-button" class="button button-primary" value="<?php _e( 'Save Schedule', 'visualizer' ); ?>">
314 389 <?php echo apply_filters( 'visualizer_pro_upsell', '', 'db-query' ); ?>
315 390 </form>
316 391 </div>
@@ -317,12 +392,11 @@
317 392 </div>
318 393 </li>
319 394
320 395 <?php
321 - // we will auto-open the manual data feature but only when pro is active and source is empty.
322 - $pro_class = apply_filters( 'visualizer_pro_upsell_class', 'only-pro-feature' );
396 + // we will auto-open the manual data feature only when source is empty.
323 397 ?>
324 - <li class="viz-group <?php echo $pro_class; ?> <?php echo empty( $source_of_chart ) && empty( $pro_class ) ? 'open' : ''; ?> ">
398 + <li class="viz-group <?php echo empty( $source_of_chart ) ? 'open' : ''; ?> ">
325 399 <h2 class="viz-group-title viz-sub-group visualizer-editor-tab"
326 400 data-current="chart"><?php _e( 'Manual Data', 'visualizer' ); ?><span
327 401 class="dashicons dashicons-lock"></span></h2>
328 402 <form id="editor-form" action="<?php echo $upload_link; ?>" method="post" target="thehole">
@@ -331,15 +405,18 @@
331 405 </form>
332 406
333 407 <div class="viz-group-content edit-data-content">
334 408 <div>
335 - <p class="viz-group-description"><?php _e( 'You can manually edit the chart data using the spreadsheet like editor.', 'visualizer' ); ?></p>
409 + <p class="viz-group-description"><?php echo sprintf( __( 'You can manually edit the chart data using the %s editor.', 'visualizer' ), Visualizer_Module::is_pro() ? 'spreadsheet like' : 'simple' ); ?></p>
410 + <?php if ( ! Visualizer_Module::is_pro() ) { ?>
411 + <p class="viz-group-description simple-editor-type"><input type="checkbox" id="simple-editor-type" value="textarea"><label for="simple-editor-type"><?php _e( 'Use text area editor instead', 'visualizer' ); ?></label></p>
412 + <?php } ?>
336 413 <input type="button" id="editor-chart-button" class="button button-primary "
337 414 value="<?php _e( 'View Editor', 'visualizer' ); ?>" data-current="chart"
338 415 data-t-editor="<?php _e( 'Show Chart', 'visualizer' ); ?>"
339 416 data-t-chart="<?php _e( 'View Editor', 'visualizer' ); ?>">
340 417
341 - <?php echo apply_filters( 'visualizer_pro_upsell', '' ); ?>
418 + <p class="viz-group-description viz-info-msg"><?php echo sprintf( __( 'Please make sure you click \'Show Chart\' before you save the chart.', 'visualizer' ) ); ?></p>
342 419 </div>
343 420 </div>
344 421 </li>
345 422 </ul>
@@ -363,14 +440,19 @@
363 440 </ul>
364 441 </li>
365 442
366 443 <li class="viz-group viz-group-category bottom-fixed sidebar-footer-link" id="vz-chart-docs">
367 - <h2><span class="dashicons dashicons-editor-help"></span><a href="https://docs.themeisle.com/category/657-visualizer" target="_blank"><?php _e( 'Docs', 'visualizer' ); ?></a></h2>
444 + <h2><span class="dashicons dashicons-editor-help"></span><a href="<?php echo VISUALIZER_MAIN_DOC; ?>" target="_blank"><?php _e( 'Docs', 'visualizer' ); ?></a></h2>
368 445 </li>
369 446
370 447 <?php $this->getPermissionsLink( $this->chart->ID ); ?>
371 448
372 - <li class="viz-group bottom-fixed" id="vz-chart-copyright">Visualizer &copy; <?php echo date( 'Y', current_time( 'timestamp' ) ); ?></li>
449 + <li class="viz-group bottom-fixed" id="vz-chart-copyright">Visualizer &copy;
450 + <?php
451 + // phpcs:ignore WordPress.DateTime.RestrictedFunctions.date_date, WordPress.DateTime.CurrentTimeTimestamp.Requested
452 + echo date( 'Y', current_time( 'timestamp' ) );
453 + ?>
454 + </li>
373 455 </ul>
374 456 <?php
375 457 // changed by Ash/Upwork
376 458 }
@@ -427,9 +509,9 @@
427 509 Visualizer_Render_Sidebar::_renderGroupStart(
428 510 esc_html__( 'Who can see this chart?', 'visualizer' ) . '<span
429 511 class="dashicons dashicons-lock"></span>',
430 512 '',
431 - apply_filters( 'visualizer_pro_upsell_class', 'only-pro-feature', 'chart-permissions' )
513 + 'viz-chart-perm-view ' . apply_filters( 'visualizer_pro_upsell_class', 'only-pro-feature', 'chart-permissions' )
432 514 );
433 515 Visualizer_Render_Sidebar::_renderSectionStart();
434 516 Visualizer_Render_Sidebar::_renderSectionDescription( esc_html__( 'Select who can view the chart on the front-end.', 'visualizer' ) );
435 517
@@ -471,9 +553,9 @@
471 553 Visualizer_Render_Sidebar::_renderGroupStart(
472 554 esc_html__( 'Who can edit this chart?', 'visualizer' ) . '<span
473 555 class="dashicons dashicons-lock"></span>',
474 556 '',
475 - apply_filters( 'visualizer_pro_upsell_class', 'only-pro-feature', 'chart-permissions' )
557 + 'viz-chart-perm-edit ' . apply_filters( 'visualizer_pro_upsell_class', 'only-pro-feature', 'chart-permissions' )
476 558 );
477 559 Visualizer_Render_Sidebar::_renderSectionStart();
478 560 Visualizer_Render_Sidebar::_renderSectionDescription( esc_html__( 'Select who can edit the chart on the front-end.', 'visualizer' ) );
479 561
@@ -549,7 +631,8 @@
549 631 if ( 'visualizer_source_query' === $source ) {
550 632 $query = get_post_meta( $this->chart->ID, Visualizer_Plugin::CF_DB_QUERY, true );
551 633 }
552 634 Visualizer_Render_Layout::show( 'db-query', $query );
635 + Visualizer_Render_Layout::show( 'json-screen', $this->chart->ID );
553 636 }
554 637
555 638 }