PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.0.10
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.0.10
4.0.8 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 All 149 releases
← All changes | classes/Visualizer/Render/Page/Data.php +28 -152 3.1.33.0.10 View file →
@@ -43,19 +43,13 @@
43 43 $Visualizer_Pro->_addEditor( $this->chart->ID );
44 44 if ( method_exists( $Visualizer_Pro, '_addFilterWizard' ) ) {
45 45 $Visualizer_Pro->_addFilterWizard( $this->chart->ID );
46 46 }
47 - } else {
48 - Visualizer_Render_Layout::show( 'faux-editor' );
49 47 }
50 -
51 - $this->add_additional_content();
52 -
53 48 // Added by Ash/Upwork
54 49 echo '<div id="canvas">';
55 50 echo '<img src="', VISUALIZER_ABSURL, 'images/ajax-loader.gif" class="loader">';
56 51 echo '</div>';
57 - echo $this->custom_css;
58 52 }
59 53
60 54 /**
61 55 * Renders sidebar content.
@@ -69,23 +63,12 @@
69 63 array(
70 64 'action' => Visualizer_Plugin::ACTION_UPLOAD_DATA,
71 65 'nonce' => wp_create_nonce(),
72 66 'chart' => $this->chart->ID,
73 - ),
74 - admin_url( 'admin-ajax.php' )
67 + ), admin_url( 'admin-ajax.php' )
75 68 );
76 -
77 - // this will allow us to open the correct source tab by default.
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 - }
85 - $type = get_post_meta( $this->chart->ID, Visualizer_Plugin::CF_CHART_TYPE, true );
86 69 ?>
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>
70 + <span id="visualizer-chart-id" data-id="<?php echo $this->chart->ID; ?>"></span>
88 71 <iframe id="thehole" name="thehole"></iframe>
89 72 <ul class="viz-group-wrapper full-height">
90 73 <li class="viz-group viz-group-category open" id="vz-chart-source">
91 74 <div class="viz-group-header">
@@ -92,9 +75,9 @@
92 75 <h2 class="viz-group-title viz-main-group"><?php _e( 'Chart Data', 'visualizer' ); ?></h2>
93 76 </div>
94 77 <ul class="viz-group-content">
95 78 <ul class="viz-group-wrapper">
96 - <li class="viz-group visualizer_source_csv">
79 + <li class="viz-group">
97 80 <h2 class="viz-group-title viz-sub-group visualizer-src-tab"><?php _e( 'Import data from file', 'visualizer' ); ?></h2>
98 81 <div class="viz-group-content">
99 82 <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 83 <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>
@@ -108,9 +91,9 @@
108 91 value="<?php _e( 'Import', 'visualizer' ); ?>">
109 92 </form>
110 93 </div>
111 94 </li>
112 - <li class="viz-group visualizer-import-url visualizer_source_csv_remote">
95 + <li class="viz-group visualizer-import-url">
113 96 <h2 class="viz-group-title viz-sub-group visualizer-src-tab"><?php _e( 'Import data from URL', 'visualizer' ); ?></h2>
114 97 <ul class="viz-group-content">
115 98 <li class="viz-subsection">
116 99 <span class="viz-section-title"><?php _e( 'One time import', 'visualizer' ); ?></span>
@@ -117,9 +100,9 @@
117 100
118 101 <div class="viz-section-items section-items">
119 102 <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 103 <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>
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>
104 + <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>
122 105 <form id="vz-one-time-import" action="<?php echo $upload_link; ?>" method="post"
123 106 target="thehole" enctype="multipart/form-data">
124 107 <div class="remote-file-section">
125 108 <input type="url" id="remote-data" name="remote_data"
@@ -137,10 +120,10 @@
137 120 <span
138 121 class="dashicons dashicons-lock"></span></span>
139 122 <div class="viz-section-items section-items">
140 123 <p class="viz-group-description"><?php _e( 'You can choose here to synchronize your chart data with a remote CSV file.', '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>
124 + <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>
125 + <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>
143 126 <form id="vz-schedule-import" action="<?php echo $upload_link; ?>" method="post"
144 127 target="thehole" enctype="multipart/form-data">
145 128 <div class="remote-file-section">
146 129 <input type="url" id="vz-schedule-url" name="remote_data"
@@ -151,15 +134,13 @@
151 134 <select name="vz-import-time" id="vz-import-time"
152 135 class="visualizer-select">
153 136 <?php
154 137 $hours = get_post_meta( $this->chart->ID, Visualizer_Plugin::CF_CHART_SCHEDULE, true );
155 - $schedules = apply_filters(
156 - 'visualizer_chart_schedules', array(
157 - '1' => __( 'Each hour', 'visualizer' ),
158 - '12' => __( 'Each 12 hours', 'visualizer' ),
159 - '24' => __( 'Each day', 'visualizer' ),
160 - '72' => __( 'Each 3 days', 'visualizer' ),
161 - )
138 + $schedules = array(
139 + '1' => __( 'Each hour', 'visualizer' ),
140 + '12' => __( 'Each 12 hours', 'visualizer' ),
141 + '24' => __( 'Each day', 'visualizer' ),
142 + '36' => __( 'Each 3 days', 'visualizer' ),
162 143 );
163 144 foreach ( $schedules as $num => $name ) {
164 145 $extra = $num == $hours ? 'selected' : '';
165 146 ?>
@@ -191,10 +172,9 @@
191 172 $fetch_link = add_query_arg(
192 173 array(
193 174 'action' => ( VISUALIZER_PRO ) ? Visualizer_Pro::ACTION_FETCH_DATA : '',
194 175 'nonce' => wp_create_nonce(),
195 - ),
196 - admin_url( 'admin-ajax.php' )
176 + ), admin_url( 'admin-ajax.php' )
197 177 );
198 178 $query_args_charts = array(
199 179 'post_type' => Visualizer_Plugin::CPT_VISUALIZER,
200 180 'posts_per_page' => 300,
@@ -220,51 +200,18 @@
220 200 </div>
221 201 </div>
222 202 </li>
223 203
224 - <?php
225 - $save_filter = add_query_arg(
226 - array(
227 - 'action' => Visualizer_Plugin::ACTION_SAVE_FILTER_QUERY,
228 - 'security' => wp_create_nonce( Visualizer_Plugin::ACTION_SAVE_FILTER_QUERY . Visualizer_Plugin::VERSION ),
229 - 'chart' => $this->chart->ID,
230 - ), admin_url( 'admin-ajax.php' )
231 - );
232 - ?>
233 - <li class="viz-group visualizer_source_query_wp <?php echo apply_filters( 'visualizer_pro_upsell_class', 'only-pro-feature', 'schedule-chart' ); ?> ">
204 + <li class="viz-group <?php echo apply_filters( 'visualizer_pro_upsell_class', 'only-pro-feature', 'schedule-chart' ); ?> ">
234 205 <h2 class="viz-group-title viz-sub-group"><?php _e( 'Import from WordPress', 'visualizer' ); ?><span
235 206 class="dashicons dashicons-lock"></span></h2>
236 207 <div class="viz-group-content edit-data-content">
237 208 <div>
238 - <p class="viz-group-description"><?php _e( 'You can import data from WordPress here.', 'visualizer' ); ?></p>
239 - <form id="vz-filter-wizard" action="<?php echo $save_filter; ?>" method="post" target="thehole">
240 - <p class="viz-group-description"><?php _e( 'How often do you want to refresh the data from WordPress.', 'visualizer' ); ?></p>
241 - <select name="refresh" id="vz-filter-import-time" class="visualizer-select">
242 - <?php
243 - $bttn_label = 'visualizer_source_query_wp' === $source_of_chart ? __( 'Modify Filter', 'visualizer' ) : __( 'Create Filter', 'visualizer' );
244 - $hours = get_post_meta( $this->chart->ID, Visualizer_Plugin::CF_DB_SCHEDULE, true );
245 - $schedules = apply_filters(
246 - 'visualizer_schedules', array(
247 - '0' => __( 'Live', 'visualizer' ),
248 - '1' => __( 'Each hour', 'visualizer' ),
249 - '12' => __( 'Each 12 hours', 'visualizer' ),
250 - '24' => __( 'Each day', 'visualizer' ),
251 - '72' => __( 'Each 3 days', 'visualizer' ),
252 - )
253 - );
254 - foreach ( $schedules as $num => $name ) {
255 - $extra = $num == $hours ? 'selected' : '';
256 - ?>
257 - <option value="<?php echo $num; ?>" <?php echo $extra; ?>><?php echo $name; ?></option>
258 - <?php
259 - }
260 - ?>
261 - </select>
262 -
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; ?>">
264 - <input type="button" id="db-filter-save-button" class="button button-primary" value="<?php _e( 'Save Schedule', 'visualizer' ); ?>">
265 - <?php echo apply_filters( 'visualizer_pro_upsell', '', 'db-query' ); ?>
266 - </form>
209 + <p class="viz-group-description"><?php _e( 'You can import here data from WordPress', 'visualizer' ); ?></p>
210 + <input type="button" id="filter-chart-button" class="button button-primary "
211 + value="<?php _e( 'Create Filters', 'visualizer' ); ?>" data-current="chart"
212 + data-t-filter="<?php _e( 'Show Chart', 'visualizer' ); ?>"
213 + data-t-chart="<?php _e( 'Create Filters', 'visualizer' ); ?>">
267 214 <?php echo apply_filters( 'visualizer_pro_upsell', '', 'schedule-chart' ); ?>
268 215 </div>
269 216 </div>
270 217 </li>
@@ -269,60 +216,12 @@
269 216 </div>
270 217 </li>
271 218
272 219 <?php
273 - $save_query = add_query_arg(
274 - array(
275 - 'action' => Visualizer_Plugin::ACTION_SAVE_DB_QUERY,
276 - 'security' => wp_create_nonce( Visualizer_Plugin::ACTION_SAVE_DB_QUERY . Visualizer_Plugin::VERSION ),
277 - 'chart' => $this->chart->ID,
278 - ), admin_url( 'admin-ajax.php' )
279 - );
280 - ?>
281 - <li class="viz-group visualizer_source_query <?php echo apply_filters( 'visualizer_pro_upsell_class', 'only-pro-feature', 'db-query' ); ?>">
282 - <h2 class="viz-group-title viz-sub-group"><?php _e( 'Import from database', 'visualizer' ); ?><span
283 - class="dashicons dashicons-lock"></span></h2>
284 - <div class="viz-group-content edit-data-content">
285 - <div>
286 - <p class="viz-group-description"><?php _e( 'You can import data from the database here.', 'visualizer' ); ?></p>
287 - <form id="vz-db-wizard" action="<?php echo $save_query; ?>" method="post" target="thehole">
288 - <p class="viz-group-description"><?php _e( 'How often do you want to refresh the data from the database.', 'visualizer' ); ?></p>
289 - <select name="refresh" id="vz-db-import-time" class="visualizer-select">
290 - <?php
291 - $bttn_label = 'visualizer_source_query' === $source_of_chart ? __( 'Modify Query', 'visualizer' ) : __( 'Create Query', 'visualizer' );
292 - $hours = get_post_meta( $this->chart->ID, Visualizer_Plugin::CF_DB_SCHEDULE, true );
293 - $schedules = apply_filters(
294 - 'visualizer_schedules', array(
295 - '0' => __( 'Live', 'visualizer' ),
296 - '1' => __( 'Each hour', 'visualizer' ),
297 - '12' => __( 'Each 12 hours', 'visualizer' ),
298 - '24' => __( 'Each day', 'visualizer' ),
299 - '72' => __( 'Each 3 days', 'visualizer' ),
300 - )
301 - );
302 - foreach ( $schedules as $num => $name ) {
303 - $extra = $num == $hours ? 'selected' : '';
304 - ?>
305 - <option value="<?php echo $num; ?>" <?php echo $extra; ?>><?php echo $name; ?></option>
306 - <?php
307 - }
308 - ?>
309 - </select>
310 - <input type="hidden" name="params" id="viz-db-wizard-params">
311 -
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; ?>">
313 - <input type="button" id="db-chart-save-button" class="button button-primary" value="<?php _e( 'Save Schedule', 'visualizer' ); ?>">
314 - <?php echo apply_filters( 'visualizer_pro_upsell', '', 'db-query' ); ?>
315 - </form>
316 - </div>
317 - </div>
318 - </li>
319 -
320 - <?php
321 - // we will auto-open the manual data feature but only when pro is active and source is empty.
220 + // we will auto-open the manual data feature but only when pro is active.
322 221 $pro_class = apply_filters( 'visualizer_pro_upsell_class', 'only-pro-feature' );
323 222 ?>
324 - <li class="viz-group <?php echo $pro_class; ?> <?php echo empty( $source_of_chart ) && empty( $pro_class ) ? 'open' : ''; ?> ">
223 + <li class="viz-group <?php echo $pro_class; ?> <?php echo empty( $pro_class ) ? 'open' : ''; ?> ">
325 224 <h2 class="viz-group-title viz-sub-group visualizer-editor-tab"
326 225 data-current="chart"><?php _e( 'Manual Data', 'visualizer' ); ?><span
327 226 class="dashicons dashicons-lock"></span></h2>
328 227 <form id="editor-form" action="<?php echo $upload_link; ?>" method="post" target="thehole">
@@ -362,12 +261,8 @@
362 261 </form>
363 262 </ul>
364 263 </li>
365 264
366 - <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>
368 - </li>
369 -
370 265 <?php $this->getPermissionsLink( $this->chart->ID ); ?>
371 266
372 267 <li class="viz-group bottom-fixed" id="vz-chart-copyright">Visualizer &copy; <?php echo date( 'Y', current_time( 'timestamp' ) ); ?></li>
373 268 </ul>
@@ -387,9 +282,9 @@
387 282 foreach ( $permissions as $k => $v ) {
388 283 $this->$k = $v;
389 284 }
390 285 }
391 - ?>
286 +?>
392 287 <li class="viz-group viz-group-category bottom-fixed sidebar-footer-link" id="vz-chart-permissions">
393 288 <h2><span class="dashicons dashicons-admin-users"></span><?php _e( 'Permissions', 'visualizer' ); ?></h2>
394 289 <div class="viz-group-header">
395 290 <button class="customize-section-back" tabindex="0"></button>
@@ -401,18 +296,17 @@
401 296 echo add_query_arg(
402 297 array(
403 298 'nonce' => wp_create_nonce(),
404 299 'tab' => 'permissions',
405 - ),
406 - remove_query_arg( 'tab', $_SERVER['REQUEST_URI'] )
300 + ), remove_query_arg( 'tab', $_SERVER['REQUEST_URI'] )
407 301 );
408 - ?>
302 +?>
409 303 " method="post">
410 304 <?php $this->permissionsSidebar(); ?>
411 305 </form>
412 306 </ul>
413 307 </li>
414 - <?php
308 +<?php
415 309 }
416 310
417 311 /**
418 312 * Generates the permissions form.
@@ -425,11 +319,9 @@
425 319 return;
426 320 }
427 321 Visualizer_Render_Sidebar::_renderGroupStart(
428 322 esc_html__( 'Who can see this chart?', 'visualizer' ) . '<span
429 - class="dashicons dashicons-lock"></span>',
430 - '',
431 - apply_filters( 'visualizer_pro_upsell_class', 'only-pro-feature', 'chart-permissions' )
323 + class="dashicons dashicons-lock"></span>', '', apply_filters( 'visualizer_pro_upsell_class', 'only-pro-feature', 'chart-permissions' )
432 324 );
433 325 Visualizer_Render_Sidebar::_renderSectionStart();
434 326 Visualizer_Render_Sidebar::_renderSectionDescription( esc_html__( 'Select who can view the chart on the front-end.', 'visualizer' ) );
435 327
@@ -469,11 +361,9 @@
469 361 Visualizer_Render_Sidebar::_renderGroupEnd();
470 362
471 363 Visualizer_Render_Sidebar::_renderGroupStart(
472 364 esc_html__( 'Who can edit this chart?', 'visualizer' ) . '<span
473 - class="dashicons dashicons-lock"></span>',
474 - '',
475 - apply_filters( 'visualizer_pro_upsell_class', 'only-pro-feature', 'chart-permissions' )
365 + class="dashicons dashicons-lock"></span>', '', apply_filters( 'visualizer_pro_upsell_class', 'only-pro-feature', 'chart-permissions' )
476 366 );
477 367 Visualizer_Render_Sidebar::_renderSectionStart();
478 368 Visualizer_Render_Sidebar::_renderSectionDescription( esc_html__( 'Select who can edit the chart on the front-end.', 'visualizer' ) );
479 369
@@ -533,23 +423,9 @@
533 423 echo '</div>';
534 424 }
535 425 echo '<input type="submit" id="settings-button" class="button button-primary button-large push-right" value="', $this->button, '">';
536 426 if ( isset( $this->cancel_button ) ) {
537 - echo '<input type="submit" id="cancel-button" class="button button-secondary button-large push-left" value="', $this->cancel_button, '">';
427 + echo '<input type="submit" id="cancel-button" class="button button-secondary button-large push-right" value="', $this->cancel_button, '">';
538 428 }
539 - }
540 -
541 - /**
542 - * Renders the additional content.
543 - *
544 - * @access private
545 - */
546 - private function add_additional_content() {
547 - $source = strtolower( get_post_meta( $this->chart->ID, Visualizer_Plugin::CF_SOURCE, true ) );
548 - $query = '';
549 - if ( 'visualizer_source_query' === $source ) {
550 - $query = get_post_meta( $this->chart->ID, Visualizer_Plugin::CF_DB_QUERY, true );
551 - }
552 - Visualizer_Render_Layout::show( 'db-query', $query );
553 429 }
554 430
555 431 }