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 +236 -38 3.0.53.2.0 View file →
@@ -43,13 +43,19 @@
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( 'simple-editor-screen', $this->chart->ID );
47 49 }
50 +
51 + $this->add_additional_content();
52 +
48 53 // Added by Ash/Upwork
49 54 echo '<div id="canvas">';
50 55 echo '<img src="', VISUALIZER_ABSURL, 'images/ajax-loader.gif" class="loader">';
51 56 echo '</div>';
57 + echo $this->custom_css;
52 58 }
53 59
54 60 /**
55 61 * Renders sidebar content.
@@ -63,12 +69,23 @@
63 69 array(
64 70 'action' => Visualizer_Plugin::ACTION_UPLOAD_DATA,
65 71 'nonce' => wp_create_nonce(),
66 72 'chart' => $this->chart->ID,
67 - ), admin_url( 'admin-ajax.php' )
73 + ),
74 + admin_url( 'admin-ajax.php' )
68 75 );
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 );
69 86 ?>
70 - <span id="visualizer-chart-id" data-id="<?php echo $this->chart->ID; ?>"></span>
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>
71 88 <iframe id="thehole" name="thehole"></iframe>
72 89 <ul class="viz-group-wrapper full-height">
73 90 <li class="viz-group viz-group-category open" id="vz-chart-source">
74 91 <div class="viz-group-header">
@@ -75,9 +92,9 @@
75 92 <h2 class="viz-group-title viz-main-group"><?php _e( 'Chart Data', 'visualizer' ); ?></h2>
76 93 </div>
77 94 <ul class="viz-group-content">
78 95 <ul class="viz-group-wrapper">
79 - <li class="viz-group">
96 + <li class="viz-group visualizer_source_csv">
80 97 <h2 class="viz-group-title viz-sub-group visualizer-src-tab"><?php _e( 'Import data from file', 'visualizer' ); ?></h2>
81 98 <div class="viz-group-content">
82 99 <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>
83 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>
@@ -91,9 +108,9 @@
91 108 value="<?php _e( 'Import', 'visualizer' ); ?>">
92 109 </form>
93 110 </div>
94 111 </li>
95 - <li class="viz-group visualizer-import-url">
112 + <li class="viz-group visualizer-import-url visualizer_source_csv_remote visualizer_source_json">
96 113 <h2 class="viz-group-title viz-sub-group visualizer-src-tab"><?php _e( 'Import data from URL', 'visualizer' ); ?></h2>
97 114 <ul class="viz-group-content">
98 115 <li class="viz-subsection">
99 116 <span class="viz-section-title"><?php _e( 'One time import', 'visualizer' ); ?></span>
@@ -100,9 +117,9 @@
100 117
101 118 <div class="viz-section-items section-items">
102 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>
103 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>
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>
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>
105 122 <form id="vz-one-time-import" action="<?php echo $upload_link; ?>" method="post"
106 123 target="thehole" enctype="multipart/form-data">
107 124 <div class="remote-file-section">
108 125 <input type="url" id="remote-data" name="remote_data"
@@ -120,10 +137,10 @@
120 137 <span
121 138 class="dashicons dashicons-lock"></span></span>
122 139 <div class="viz-section-items section-items">
123 140 <p class="viz-group-description"><?php _e( 'You can choose here to synchronize your chart data with a remote CSV file.', '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>
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>
126 143 <form id="vz-schedule-import" action="<?php echo $upload_link; ?>" method="post"
127 144 target="thehole" enctype="multipart/form-data">
128 145 <div class="remote-file-section">
129 146 <input type="url" id="vz-schedule-url" name="remote_data"
@@ -134,15 +151,20 @@
134 151 <select name="vz-import-time" id="vz-import-time"
135 152 class="visualizer-select">
136 153 <?php
137 154 $hours = get_post_meta( $this->chart->ID, Visualizer_Plugin::CF_CHART_SCHEDULE, true );
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' ),
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 + ),
162 + 'csv',
163 + $this->chart->ID
143 164 );
144 165 foreach ( $schedules as $num => $name ) {
166 + // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
145 167 $extra = $num == $hours ? 'selected' : '';
146 168 ?>
147 169 <option value="<?php echo $num; ?>" <?php echo $extra; ?>><?php echo $name; ?></option>
148 170 <?php
@@ -156,11 +178,63 @@
156 178 <?php echo apply_filters( 'visualizer_pro_upsell', '', 'schedule-chart' ); ?>
157 179 </form>
158 180 </div>
159 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>
160 234 </ul>
161 235 </li>
162 - <li class="viz-group <?php echo apply_filters( 'visualizer_pro_upsell_class', '' ); ?> ">
236 + <li class="viz-group <?php echo apply_filters( 'visualizer_pro_upsell_class', 'only-pro-feature' ); ?>">
163 237 <h2 class="viz-group-title viz-sub-group"
164 238 data-current="chart"><?php _e( 'Import from other chart', 'visualizer' ); ?><span
165 239 class="dashicons dashicons-lock"></span></h2>
166 240 <div class="viz-group-content edit-data-content">
@@ -172,9 +246,10 @@
172 246 $fetch_link = add_query_arg(
173 247 array(
174 248 'action' => ( VISUALIZER_PRO ) ? Visualizer_Pro::ACTION_FETCH_DATA : '',
175 249 'nonce' => wp_create_nonce(),
176 - ), admin_url( 'admin-ajax.php' )
250 + ),
251 + admin_url( 'admin-ajax.php' )
177 252 );
178 253 $query_args_charts = array(
179 254 'post_type' => Visualizer_Plugin::CPT_VISUALIZER,
180 255 'posts_per_page' => 300,
@@ -200,26 +275,112 @@
200 275 </div>
201 276 </div>
202 277 </li>
203 278
204 - <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' ); ?> ">
205 289 <h2 class="viz-group-title viz-sub-group"><?php _e( 'Import from WordPress', 'visualizer' ); ?><span
206 290 class="dashicons dashicons-lock"></span></h2>
207 291 <div class="viz-group-content edit-data-content">
208 292 <div>
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' ); ?>">
293 + <p class="viz-group-description"><?php _e( 'You can import data from WordPress here.', 'visualizer' ); ?></p>
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>
214 323 <?php echo apply_filters( 'visualizer_pro_upsell', '', 'schedule-chart' ); ?>
215 324 </div>
216 325 </div>
217 326 </li>
218 327
219 - <li class="viz-group <?php echo apply_filters( 'visualizer_pro_upsell_class', 'only-pro-feature' ); ?>">
328 + <?php
329 + $save_query = add_query_arg(
330 + array(
331 + 'action' => Visualizer_Plugin::ACTION_SAVE_DB_QUERY,
332 + 'security' => wp_create_nonce( Visualizer_Plugin::ACTION_SAVE_DB_QUERY . Visualizer_Plugin::VERSION ),
333 + 'chart' => $this->chart->ID,
334 + ), admin_url( 'admin-ajax.php' )
335 + );
336 + ?>
337 + <li class="viz-group visualizer_source_query <?php echo apply_filters( 'visualizer_pro_upsell_class', 'only-pro-feature', 'db-query' ); ?>">
338 + <h2 class="viz-group-title viz-sub-group"><?php _e( 'Import from database', 'visualizer' ); ?><span
339 + class="dashicons dashicons-lock"></span></h2>
340 + <div class="viz-group-content edit-data-content">
341 + <div>
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 + }
365 + ?>
366 + </select>
367 + <input type="hidden" name="params" id="viz-db-wizard-params">
368 +
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' ); ?>">
371 + <?php echo apply_filters( 'visualizer_pro_upsell', '', 'db-query' ); ?>
372 + </form>
373 + </div>
374 + </div>
375 + </li>
376 +
377 + <?php
378 + // we will auto-open the manual data feature only when source is empty.
379 + ?>
380 + <li class="viz-group <?php echo empty( $source_of_chart ) ? 'open' : ''; ?> ">
220 381 <h2 class="viz-group-title viz-sub-group visualizer-editor-tab"
221 - data-current="chart"><?php _e( 'Add data manually', 'visualizer' ); ?><span
382 + data-current="chart"><?php _e( 'Manual Data', 'visualizer' ); ?><span
222 383 class="dashicons dashicons-lock"></span></h2>
223 384 <form id="editor-form" action="<?php echo $upload_link; ?>" method="post" target="thehole">
224 385 <input type="hidden" id="chart-data" name="chart_data">
225 386 <input type="hidden" id="chart-data-src" name="chart_data_src">
@@ -226,15 +387,16 @@
226 387 </form>
227 388
228 389 <div class="viz-group-content edit-data-content">
229 390 <div>
230 - <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 } ?>
231 395 <input type="button" id="editor-chart-button" class="button button-primary "
232 396 value="<?php _e( 'View Editor', 'visualizer' ); ?>" data-current="chart"
233 397 data-t-editor="<?php _e( 'Show Chart', 'visualizer' ); ?>"
234 398 data-t-chart="<?php _e( 'View Editor', 'visualizer' ); ?>">
235 -
236 - <?php echo apply_filters( 'visualizer_pro_upsell', '' ); ?>
237 399 </div>
238 400 </div>
239 401 </li>
240 402 </ul>
@@ -249,12 +411,20 @@
249 411 <ul class="viz-group-content">
250 412 <form id="settings-form" action="<?php echo add_query_arg( 'nonce', wp_create_nonce() ); ?>"
251 413 method="post">
252 414 <?php echo $this->sidebar; ?>
415 + <input type="hidden" name="save" value="1">
253 416 </form>
417 + <form id="cancel-form" action="<?php echo add_query_arg( 'nonce', wp_create_nonce() ); ?>" method="post">
418 + <input type="hidden" name="cancel" value="1">
419 + </form>
254 420 </ul>
255 421 </li>
256 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 +
257 427 <?php $this->getPermissionsLink( $this->chart->ID ); ?>
258 428
259 429 <li class="viz-group bottom-fixed" id="vz-chart-copyright">Visualizer &copy; <?php echo date( 'Y', current_time( 'timestamp' ) ); ?></li>
260 430 </ul>
@@ -274,9 +444,9 @@
274 444 foreach ( $permissions as $k => $v ) {
275 445 $this->$k = $v;
276 446 }
277 447 }
278 -?>
448 + ?>
279 449 <li class="viz-group viz-group-category bottom-fixed sidebar-footer-link" id="vz-chart-permissions">
280 450 <h2><span class="dashicons dashicons-admin-users"></span><?php _e( 'Permissions', 'visualizer' ); ?></h2>
281 451 <div class="viz-group-header">
282 452 <button class="customize-section-back" tabindex="0"></button>
@@ -288,17 +458,18 @@
288 458 echo add_query_arg(
289 459 array(
290 460 'nonce' => wp_create_nonce(),
291 461 'tab' => 'permissions',
292 - ), remove_query_arg( 'tab', $_SERVER['REQUEST_URI'] )
462 + ),
463 + remove_query_arg( 'tab', $_SERVER['REQUEST_URI'] )
293 464 );
294 -?>
465 + ?>
295 466 " method="post">
296 467 <?php $this->permissionsSidebar(); ?>
297 468 </form>
298 469 </ul>
299 470 </li>
300 -<?php
471 + <?php
301 472 }
302 473
303 474 /**
304 475 * Generates the permissions form.
@@ -305,11 +476,17 @@
305 476 *
306 477 * @access private
307 478 */
308 479 private function permissionsSidebar() {
480 + // ignore for unit tests because Travis throws the error "Indirect modification of overloaded property Visualizer_Render_Page_Data::$permissions has no effect".
481 + if ( defined( 'WP_TESTS_DOMAIN' ) ) {
482 + return;
483 + }
309 484 Visualizer_Render_Sidebar::_renderGroupStart(
310 485 esc_html__( 'Who can see this chart?', 'visualizer' ) . '<span
311 - class="dashicons dashicons-lock"></span>', '', apply_filters( 'visualizer_pro_upsell_class', 'only-pro-feature', 'chart-permissions' )
486 + class="dashicons dashicons-lock"></span>',
487 + '',
488 + apply_filters( 'visualizer_pro_upsell_class', 'only-pro-feature', 'chart-permissions' )
312 489 );
313 490 Visualizer_Render_Sidebar::_renderSectionStart();
314 491 Visualizer_Render_Sidebar::_renderSectionDescription( esc_html__( 'Select who can view the chart on the front-end.', 'visualizer' ) );
315 492
@@ -349,9 +526,11 @@
349 526 Visualizer_Render_Sidebar::_renderGroupEnd();
350 527
351 528 Visualizer_Render_Sidebar::_renderGroupStart(
352 529 esc_html__( 'Who can edit this chart?', 'visualizer' ) . '<span
353 - class="dashicons dashicons-lock"></span>', '', apply_filters( 'visualizer_pro_upsell_class', 'only-pro-feature', 'chart-permissions' )
530 + class="dashicons dashicons-lock"></span>',
531 + '',
532 + apply_filters( 'visualizer_pro_upsell_class', 'only-pro-feature', 'chart-permissions' )
354 533 );
355 534 Visualizer_Render_Sidebar::_renderSectionStart();
356 535 Visualizer_Render_Sidebar::_renderSectionDescription( esc_html__( 'Select who can edit the chart on the front-end.', 'visualizer' ) );
357 536
@@ -400,16 +579,35 @@
400 579 *
401 580 * @access protected
402 581 */
403 582 protected function _renderToolbar() {
404 - // changed by Ash/Upwork
405 - echo '<div class="toolbar-div">';
406 - echo '<a class="button button-large" href="', add_query_arg( 'tab', 'types' ), '">';
407 - esc_html_e( 'Back', 'visualizer' );
408 - echo '</a>';
409 - echo '</div>';
583 + // don't show back button at all.
584 + // NOTE: We can't be selective on the post_status here because when a new chart reaches the settings screen, its status changes to publish.
585 + if ( ! VISUALIZER_SKIP_CHART_TYPE_PAGE ) {
586 + echo '<div class="toolbar-div">';
587 + echo '<a class="button button-large" href="', add_query_arg( 'tab', 'types' ), '">';
588 + esc_html_e( 'Back', 'visualizer' );
589 + echo '</a>';
590 + echo '</div>';
591 + }
410 592 echo '<input type="submit" id="settings-button" class="button button-primary button-large push-right" value="', $this->button, '">';
411 - echo '</div>';
593 + if ( isset( $this->cancel_button ) ) {
594 + echo '<input type="submit" id="cancel-button" class="button button-secondary button-large push-left" value="', $this->cancel_button, '">';
595 + }
596 + }
412 597
598 + /**
599 + * Renders the additional content.
600 + *
601 + * @access private
602 + */
603 + private function add_additional_content() {
604 + $source = strtolower( get_post_meta( $this->chart->ID, Visualizer_Plugin::CF_SOURCE, true ) );
605 + $query = '';
606 + if ( 'visualizer_source_query' === $source ) {
607 + $query = get_post_meta( $this->chart->ID, Visualizer_Plugin::CF_DB_QUERY, true );
608 + }
609 + Visualizer_Render_Layout::show( 'db-query', $query );
610 + Visualizer_Render_Layout::show( 'json-screen', $this->chart->ID );
413 611 }
414 612
415 613 }