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 +224 -31 3.0.63.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,8 +178,60 @@
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 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"
@@ -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,18 +275,52 @@
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>
@@ -216,12 +325,60 @@
216 325 </div>
217 326 </li>
218 327
219 328 <?php
220 - // we will auto-open the manual data feature but only when pro is active.
221 - $pro_class = apply_filters( 'visualizer_pro_upsell_class', 'only-pro-feature' );
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 + );
222 336 ?>
223 - <li class="viz-group <?php echo $pro_class; ?> <?php echo empty( $pro_class ) ? 'open' : ''; ?> ">
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' : ''; ?> ">
224 381 <h2 class="viz-group-title viz-sub-group visualizer-editor-tab"
225 382 data-current="chart"><?php _e( 'Manual Data', 'visualizer' ); ?><span
226 383 class="dashicons dashicons-lock"></span></h2>
227 384 <form id="editor-form" action="<?php echo $upload_link; ?>" method="post" target="thehole">
@@ -230,15 +387,16 @@
230 387 </form>
231 388
232 389 <div class="viz-group-content edit-data-content">
233 390 <div>
234 - <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 } ?>
235 395 <input type="button" id="editor-chart-button" class="button button-primary "
236 396 value="<?php _e( 'View Editor', 'visualizer' ); ?>" data-current="chart"
237 397 data-t-editor="<?php _e( 'Show Chart', 'visualizer' ); ?>"
238 398 data-t-chart="<?php _e( 'View Editor', 'visualizer' ); ?>">
239 -
240 - <?php echo apply_filters( 'visualizer_pro_upsell', '' ); ?>
241 399 </div>
242 400 </div>
243 401 </li>
244 402 </ul>
@@ -253,12 +411,20 @@
253 411 <ul class="viz-group-content">
254 412 <form id="settings-form" action="<?php echo add_query_arg( 'nonce', wp_create_nonce() ); ?>"
255 413 method="post">
256 414 <?php echo $this->sidebar; ?>
415 + <input type="hidden" name="save" value="1">
257 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>
258 420 </ul>
259 421 </li>
260 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 +
261 427 <?php $this->getPermissionsLink( $this->chart->ID ); ?>
262 428
263 429 <li class="viz-group bottom-fixed" id="vz-chart-copyright">Visualizer &copy; <?php echo date( 'Y', current_time( 'timestamp' ) ); ?></li>
264 430 </ul>
@@ -278,9 +444,9 @@
278 444 foreach ( $permissions as $k => $v ) {
279 445 $this->$k = $v;
280 446 }
281 447 }
282 -?>
448 + ?>
283 449 <li class="viz-group viz-group-category bottom-fixed sidebar-footer-link" id="vz-chart-permissions">
284 450 <h2><span class="dashicons dashicons-admin-users"></span><?php _e( 'Permissions', 'visualizer' ); ?></h2>
285 451 <div class="viz-group-header">
286 452 <button class="customize-section-back" tabindex="0"></button>
@@ -292,17 +458,18 @@
292 458 echo add_query_arg(
293 459 array(
294 460 'nonce' => wp_create_nonce(),
295 461 'tab' => 'permissions',
296 - ), remove_query_arg( 'tab', $_SERVER['REQUEST_URI'] )
462 + ),
463 + remove_query_arg( 'tab', $_SERVER['REQUEST_URI'] )
297 464 );
298 -?>
465 + ?>
299 466 " method="post">
300 467 <?php $this->permissionsSidebar(); ?>
301 468 </form>
302 469 </ul>
303 470 </li>
304 -<?php
471 + <?php
305 472 }
306 473
307 474 /**
308 475 * Generates the permissions form.
@@ -309,11 +476,17 @@
309 476 *
310 477 * @access private
311 478 */
312 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 + }
313 484 Visualizer_Render_Sidebar::_renderGroupStart(
314 485 esc_html__( 'Who can see this chart?', 'visualizer' ) . '<span
315 - 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' )
316 489 );
317 490 Visualizer_Render_Sidebar::_renderSectionStart();
318 491 Visualizer_Render_Sidebar::_renderSectionDescription( esc_html__( 'Select who can view the chart on the front-end.', 'visualizer' ) );
319 492
@@ -353,9 +526,11 @@
353 526 Visualizer_Render_Sidebar::_renderGroupEnd();
354 527
355 528 Visualizer_Render_Sidebar::_renderGroupStart(
356 529 esc_html__( 'Who can edit this chart?', 'visualizer' ) . '<span
357 - 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' )
358 533 );
359 534 Visualizer_Render_Sidebar::_renderSectionStart();
360 535 Visualizer_Render_Sidebar::_renderSectionDescription( esc_html__( 'Select who can edit the chart on the front-end.', 'visualizer' ) );
361 536
@@ -414,7 +589,25 @@
414 589 echo '</a>';
415 590 echo '</div>';
416 591 }
417 592 echo '<input type="submit" id="settings-button" class="button button-primary button-large push-right" value="', $this->button, '">';
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 + }
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 );
418 611 }
419 612
420 613 }