PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.2.0
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.2.0
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 +147 -50 3.1.23.2.0 View file →
@@ -44,9 +44,9 @@
44 44 if ( method_exists( $Visualizer_Pro, '_addFilterWizard' ) ) {
45 45 $Visualizer_Pro->_addFilterWizard( $this->chart->ID );
46 46 }
47 47 } else {
48 - Visualizer_Render_Layout::show( 'faux-editor' );
48 + Visualizer_Render_Layout::show( 'simple-editor-screen', $this->chart->ID );
49 49 }
50 50
51 51 $this->add_additional_content();
52 52
@@ -75,8 +75,14 @@
75 75 );
76 76
77 77 // this will allow us to open the correct source tab by default.
78 78 $source_of_chart = strtolower( get_post_meta( $this->chart->ID, Visualizer_Plugin::CF_SOURCE, true ) );
79 + // both import from wp and import from db have the same source so we need to differentiate.
80 + $filter_config = get_post_meta( $this->chart->ID, Visualizer_Plugin::CF_FILTER_CONFIG, true );
81 + // if filter config is present, then its import from wp.
82 + if ( ! empty( $filter_config ) ) {
83 + $source_of_chart .= '_wp';
84 + }
79 85 $type = get_post_meta( $this->chart->ID, Visualizer_Plugin::CF_CHART_TYPE, true );
80 86 ?>
81 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>
82 88 <iframe id="thehole" name="thehole"></iframe>
@@ -102,9 +108,9 @@
102 108 value="<?php _e( 'Import', 'visualizer' ); ?>">
103 109 </form>
104 110 </div>
105 111 </li>
106 - <li class="viz-group visualizer-import-url visualizer_source_csv_remote">
112 + <li class="viz-group visualizer-import-url visualizer_source_csv_remote visualizer_source_json">
107 113 <h2 class="viz-group-title viz-sub-group visualizer-src-tab"><?php _e( 'Import data from URL', 'visualizer' ); ?></h2>
108 114 <ul class="viz-group-content">
109 115 <li class="viz-subsection">
110 116 <span class="viz-section-title"><?php _e( 'One time import', 'visualizer' ); ?></span>
@@ -111,9 +117,9 @@
111 117
112 118 <div class="viz-section-items section-items">
113 119 <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>
114 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>
115 - <p class="viz-group-description"> <?php _e( 'You can also import data from Google Spreadsheet, for more info check <a href="https://github.com/Codeinwp/visualizer/wiki/How-can-I-populate-data-from-Google-Spreadsheet%3F" target="_blank" >this</a> tutorial', 'visualizer' ); ?></p>
121 + <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>
116 122 <form id="vz-one-time-import" action="<?php echo $upload_link; ?>" method="post"
117 123 target="thehole" enctype="multipart/form-data">
118 124 <div class="remote-file-section">
119 125 <input type="url" id="remote-data" name="remote_data"
@@ -131,10 +137,10 @@
131 137 <span
132 138 class="dashicons dashicons-lock"></span></span>
133 139 <div class="viz-section-items section-items">
134 140 <p class="viz-group-description"><?php _e( 'You can choose here to synchronize your chart data with a remote CSV file.', 'visualizer' ); ?> </p>
135 - <p class="viz-group-description"> <?php _e( 'You can also synchronize with your Google Spreadsheet file, for more info check <a href="https://github.com/Codeinwp/visualizer/wiki/How-can-I-populate-data-from-Google-Spreadsheet%3F" target="_blank" >this</a> tutorial', 'visualizer' ); ?></p>
136 - <p class="viz-group-description"> <?php _e( 'We will update the chart data based on your time interval preference by overwritting the current data with the one from the URL.', 'visualizer' ); ?></p>
141 + <p class="viz-group-description"> <?php _e( 'You can also synchronize with your Google Spreadsheet file, 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>
142 + <p class="viz-group-description"> <?php _e( 'We will update the chart data based on your time interval preference by overwriting the current data with the one from the URL.', 'visualizer' ); ?></p>
137 143 <form id="vz-schedule-import" action="<?php echo $upload_link; ?>" method="post"
138 144 target="thehole" enctype="multipart/form-data">
139 145 <div class="remote-file-section">
140 146 <input type="url" id="vz-schedule-url" name="remote_data"
@@ -151,11 +157,14 @@
151 157 '1' => __( 'Each hour', 'visualizer' ),
152 158 '12' => __( 'Each 12 hours', 'visualizer' ),
153 159 '24' => __( 'Each day', 'visualizer' ),
154 160 '72' => __( 'Each 3 days', 'visualizer' ),
155 - )
161 + ),
162 + 'csv',
163 + $this->chart->ID
156 164 );
157 165 foreach ( $schedules as $num => $name ) {
166 + // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
158 167 $extra = $num == $hours ? 'selected' : '';
159 168 ?>
160 169 <option value="<?php echo $num; ?>" <?php echo $extra; ?>><?php echo $name; ?></option>
161 170 <?php
@@ -169,8 +178,60 @@
169 178 <?php echo apply_filters( 'visualizer_pro_upsell', '', 'schedule-chart' ); ?>
170 179 </form>
171 180 </div>
172 181 </li>
182 +
183 + <li class="viz-subsection">
184 + <span class="viz-section-title visualizer_source_json"><?php _e( 'Import from JSON/REST', 'visualizer' ); ?>
185 + <span class="dashicons dashicons-lock"></span></span>
186 + <div class="viz-section-items section-items">
187 + <p class="viz-group-description"><?php _e( 'You can choose here to import/synchronize your chart data with a remote JSON/REST 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>
188 + <form id="vz-import-json" action="<?php echo $upload_link; ?>" method="post" target="thehole" enctype="multipart/form-data">
189 + <div class="remote-file-section">
190 + <?php
191 + $bttn_label = 'visualizer_source_json' === $source_of_chart ? __( 'Modify Parameters', 'visualizer' ) : __( 'Create Parameters', 'visualizer' );
192 + if ( VISUALIZER_PRO ) {
193 + ?>
194 + <p class="viz-group-description"><?php _e( 'How often do you want to check the URL', 'visualizer' ); ?></p>
195 + <select name="vz-json-time" id="vz-json-time" class="visualizer-select" data-chart="<?php echo $this->chart->ID; ?>">
196 + <?php
197 + $hours = get_post_meta( $this->chart->ID, Visualizer_Plugin::CF_JSON_SCHEDULE, true );
198 + $schedules = apply_filters(
199 + 'visualizer_chart_schedules', array(
200 + '-1' => __( 'One-time', 'visualizer' ),
201 + ),
202 + 'json',
203 + $this->chart->ID
204 + );
205 + foreach ( $schedules as $num => $name ) {
206 + // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
207 + $extra = $num == $hours ? 'selected' : '';
208 + ?>
209 + <option value="<?php echo $num; ?>" <?php echo $extra; ?>><?php echo $name; ?></option>
210 + <?php
211 + }
212 + ?>
213 + </select>
214 + <?php
215 + }
216 + ?>
217 + </div>
218 +
219 + <input type="button" id="json-chart-button" class="button button-secondary "
220 + value="<?php echo $bttn_label; ?>" data-current="chart"
221 + data-t-filter="<?php _e( 'Show Chart', 'visualizer' ); ?>"
222 + data-t-chart="<?php echo $bttn_label; ?>">
223 + <?php
224 + if ( VISUALIZER_PRO ) {
225 + ?>
226 + <input type="button" id="json-chart-save-button" class="button button-primary "
227 + value="<?php _e( 'Save Schedule', 'visualizer' ); ?>">
228 + <?php
229 + }
230 + ?>
231 + </form>
232 + </div>
233 + </li>
173 234 </ul>
174 235 </li>
175 236 <li class="viz-group <?php echo apply_filters( 'visualizer_pro_upsell_class', 'only-pro-feature' ); ?>">
176 237 <h2 class="viz-group-title viz-sub-group"
@@ -214,18 +275,52 @@
214 275 </div>
215 276 </div>
216 277 </li>
217 278
218 - <li class="viz-group <?php echo apply_filters( 'visualizer_pro_upsell_class', 'only-pro-feature', 'schedule-chart' ); ?> ">
279 + <?php
280 + $save_filter = add_query_arg(
281 + array(
282 + 'action' => Visualizer_Plugin::ACTION_SAVE_FILTER_QUERY,
283 + 'security' => wp_create_nonce( Visualizer_Plugin::ACTION_SAVE_FILTER_QUERY . Visualizer_Plugin::VERSION ),
284 + 'chart' => $this->chart->ID,
285 + ), admin_url( 'admin-ajax.php' )
286 + );
287 + ?>
288 + <li class="viz-group visualizer_source_query_wp <?php echo apply_filters( 'visualizer_pro_upsell_class', 'only-pro-feature', 'schedule-chart' ); ?> ">
219 289 <h2 class="viz-group-title viz-sub-group"><?php _e( 'Import from WordPress', 'visualizer' ); ?><span
220 290 class="dashicons dashicons-lock"></span></h2>
221 291 <div class="viz-group-content edit-data-content">
222 292 <div>
223 293 <p class="viz-group-description"><?php _e( 'You can import data from WordPress here.', 'visualizer' ); ?></p>
224 - <input type="button" id="filter-chart-button" class="button button-primary "
225 - value="<?php _e( 'Create Filters', 'visualizer' ); ?>" data-current="chart"
226 - data-t-filter="<?php _e( 'Show Chart', 'visualizer' ); ?>"
227 - data-t-chart="<?php _e( 'Create Filters', 'visualizer' ); ?>">
294 + <form id="vz-filter-wizard" action="<?php echo $save_filter; ?>" method="post" target="thehole">
295 + <p class="viz-group-description"><?php _e( 'How often do you want to refresh the data from WordPress.', 'visualizer' ); ?></p>
296 + <select name="refresh" id="vz-filter-import-time" class="visualizer-select">
297 + <?php
298 + $bttn_label = 'visualizer_source_query_wp' === $source_of_chart ? __( 'Modify Filter', 'visualizer' ) : __( 'Create Filter', 'visualizer' );
299 + $hours = get_post_meta( $this->chart->ID, Visualizer_Plugin::CF_DB_SCHEDULE, true );
300 + $schedules = apply_filters(
301 + 'visualizer_schedules', array(
302 + '0' => __( 'Live', 'visualizer' ),
303 + '1' => __( 'Each hour', 'visualizer' ),
304 + '12' => __( 'Each 12 hours', 'visualizer' ),
305 + '24' => __( 'Each day', 'visualizer' ),
306 + '72' => __( 'Each 3 days', 'visualizer' ),
307 + )
308 + );
309 + foreach ( $schedules as $num => $name ) {
310 + // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
311 + $extra = $num == $hours ? 'selected' : '';
312 + ?>
313 + <option value="<?php echo $num; ?>" <?php echo $extra; ?>><?php echo $name; ?></option>
314 + <?php
315 + }
316 + ?>
317 + </select>
318 +
319 + <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; ?>">
320 + <input type="button" id="db-filter-save-button" class="button button-primary" value="<?php _e( 'Save Schedule', 'visualizer' ); ?>">
321 + <?php echo apply_filters( 'visualizer_pro_upsell', '', 'db-query' ); ?>
322 + </form>
228 323 <?php echo apply_filters( 'visualizer_pro_upsell', '', 'schedule-chart' ); ?>
229 324 </div>
230 325 </div>
231 326 </li>
@@ -243,51 +338,47 @@
243 338 <h2 class="viz-group-title viz-sub-group"><?php _e( 'Import from database', 'visualizer' ); ?><span
244 339 class="dashicons dashicons-lock"></span></h2>
245 340 <div class="viz-group-content edit-data-content">
246 341 <div>
247 - <p class="viz-group-description"><?php _e( 'You can import data from the database here.', 'visualizer' ); ?></p>
248 - <form id="vz-db-wizard" action="<?php echo $save_query; ?>" method="post" target="thehole">
249 - <p class="viz-group-description"><?php _e( 'How often do you want to refresh the data from the database.', 'visualizer' ); ?></p>
250 - <select name="refresh" id="vz-db-import-time" class="visualizer-select">
251 - <?php
252 - $bttn_label = 'visualizer_source_query' === $source_of_chart ? __( 'Modify Query', 'visualizer' ) : __( 'Create Query', 'visualizer' );
253 - $hours = get_post_meta( $this->chart->ID, Visualizer_Plugin::CF_DB_SCHEDULE, true );
254 - $schedules = apply_filters(
255 - 'visualizer_schedules', array(
256 - '0' => __( 'Live', 'visualizer' ),
257 - '1' => __( 'Each hour', 'visualizer' ),
258 - '12' => __( 'Each 12 hours', 'visualizer' ),
259 - '24' => __( 'Each day', 'visualizer' ),
260 - '72' => __( 'Each 3 days', 'visualizer' ),
261 - )
262 - );
263 - foreach ( $schedules as $num => $name ) {
264 - $extra = $num == $hours ? 'selected' : '';
342 + <p class="viz-group-description"><?php _e( 'You can import data from the database here.', 'visualizer' ); ?></p>
343 + <form id="vz-db-wizard" action="<?php echo $save_query; ?>" method="post" target="thehole">
344 + <p class="viz-group-description"><?php _e( 'How often do you want to refresh the data from the database.', 'visualizer' ); ?></p>
345 + <select name="refresh" id="vz-db-import-time" class="visualizer-select">
346 + <?php
347 + $bttn_label = 'visualizer_source_query' === $source_of_chart ? __( 'Modify Query', 'visualizer' ) : __( 'Create Query', 'visualizer' );
348 + $hours = get_post_meta( $this->chart->ID, Visualizer_Plugin::CF_DB_SCHEDULE, true );
349 + $schedules = apply_filters(
350 + 'visualizer_schedules', array(
351 + '0' => __( 'Live', 'visualizer' ),
352 + '1' => __( 'Each hour', 'visualizer' ),
353 + '12' => __( 'Each 12 hours', 'visualizer' ),
354 + '24' => __( 'Each day', 'visualizer' ),
355 + '72' => __( 'Each 3 days', 'visualizer' ),
356 + )
357 + );
358 + foreach ( $schedules as $num => $name ) {
359 + // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
360 + $extra = $num == $hours ? 'selected' : '';
361 + ?>
362 + <option value="<?php echo $num; ?>" <?php echo $extra; ?>><?php echo $name; ?></option>
363 + <?php
364 + }
265 365 ?>
266 - <option value="<?php echo $num; ?>" <?php echo $extra; ?>><?php echo $name; ?></option>
267 - <?php
268 - }
269 - ?>
270 - </select>
271 - <input type="hidden" name="params" id="viz-db-wizard-params">
366 + </select>
367 + <input type="hidden" name="params" id="viz-db-wizard-params">
272 368
273 - <input type="button" id="db-chart-button" class="button button-secondary "
274 - value="<?php echo $bttn_label; ?>" data-current="chart"
275 - data-t-filter="<?php _e( 'Show Chart', 'visualizer' ); ?>"
276 - data-t-chart="<?php echo $bttn_label; ?>">
277 - <input type="button" id="db-chart-save-button" class="button button-primary "
278 - value="<?php _e( 'Save Schedule', 'visualizer' ); ?>">
369 + <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; ?>">
370 + <input type="button" id="db-chart-save-button" class="button button-primary" value="<?php _e( 'Save Schedule', 'visualizer' ); ?>">
279 371 <?php echo apply_filters( 'visualizer_pro_upsell', '', 'db-query' ); ?>
280 - </form>
281 - </div>
282 - </div>
372 + </form>
373 + </div>
374 + </div>
283 375 </li>
284 376
285 377 <?php
286 - // we will auto-open the manual data feature but only when pro is active and source is empty.
287 - $pro_class = apply_filters( 'visualizer_pro_upsell_class', 'only-pro-feature' );
378 + // we will auto-open the manual data feature only when source is empty.
288 379 ?>
289 - <li class="viz-group <?php echo $pro_class; ?> <?php echo empty( $source_of_chart ) && empty( $pro_class ) ? 'open' : ''; ?> ">
380 + <li class="viz-group <?php echo empty( $source_of_chart ) ? 'open' : ''; ?> ">
290 381 <h2 class="viz-group-title viz-sub-group visualizer-editor-tab"
291 382 data-current="chart"><?php _e( 'Manual Data', 'visualizer' ); ?><span
292 383 class="dashicons dashicons-lock"></span></h2>
293 384 <form id="editor-form" action="<?php echo $upload_link; ?>" method="post" target="thehole">
@@ -296,15 +387,16 @@
296 387 </form>
297 388
298 389 <div class="viz-group-content edit-data-content">
299 390 <div>
300 - <p class="viz-group-description"><?php _e( 'You can manually edit the chart data using the spreadsheet like editor.', 'visualizer' ); ?></p>
391 + <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>
392 + <?php if ( ! VISUALIZER_PRO ) { ?>
393 + <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>
394 + <?php } ?>
301 395 <input type="button" id="editor-chart-button" class="button button-primary "
302 396 value="<?php _e( 'View Editor', 'visualizer' ); ?>" data-current="chart"
303 397 data-t-editor="<?php _e( 'Show Chart', 'visualizer' ); ?>"
304 398 data-t-chart="<?php _e( 'View Editor', 'visualizer' ); ?>">
305 -
306 - <?php echo apply_filters( 'visualizer_pro_upsell', '' ); ?>
307 399 </div>
308 400 </div>
309 401 </li>
310 402 </ul>
@@ -327,8 +419,12 @@
327 419 </form>
328 420 </ul>
329 421 </li>
330 422
423 + <li class="viz-group viz-group-category bottom-fixed sidebar-footer-link" id="vz-chart-docs">
424 + <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>
425 + </li>
426 +
331 427 <?php $this->getPermissionsLink( $this->chart->ID ); ?>
332 428
333 429 <li class="viz-group bottom-fixed" id="vz-chart-copyright">Visualizer &copy; <?php echo date( 'Y', current_time( 'timestamp' ) ); ?></li>
334 430 </ul>
@@ -510,7 +606,8 @@
510 606 if ( 'visualizer_source_query' === $source ) {
511 607 $query = get_post_meta( $this->chart->ID, Visualizer_Plugin::CF_DB_QUERY, true );
512 608 }
513 609 Visualizer_Render_Layout::show( 'db-query', $query );
610 + Visualizer_Render_Layout::show( 'json-screen', $this->chart->ID );
514 611 }
515 612
516 613 }