PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 1.4.2.2
Visualizer – Tables & Charts Manager with Built-in AI Generator v1.4.2.2
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 +41 -448 3.1.01.4.2.2 View file →
@@ -1,5 +1,6 @@
1 1 <?php
2 +
2 3 // +----------------------------------------------------------------------+
3 4 // | Copyright 2013 Madpixels (email : visualizer@madpixels.net) |
4 5 // +----------------------------------------------------------------------+
5 6 // | This program is free software; you can redistribute it and/or modify |
@@ -17,8 +18,9 @@
17 18 // | MA 02110-1301 USA |
18 19 // +----------------------------------------------------------------------+
19 20 // | Author: Eugene Manuilov <eugene@manuilov.org> |
20 21 // +----------------------------------------------------------------------+
22 +
21 23 /**
22 24 * Renders chart data setup page.
23 25 *
24 26 * @category Visualizer
@@ -36,26 +38,11 @@
36 38 *
37 39 * @access protected
38 40 */
39 41 protected function _renderContent() {
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 );
46 - }
47 - } else {
48 - Visualizer_Render_Layout::show( 'faux-editor' );
49 - }
50 -
51 - $this->add_additional_content();
52 -
53 - // Added by Ash/Upwork
54 42 echo '<div id="canvas">';
55 - echo '<img src="', VISUALIZER_ABSURL, 'images/ajax-loader.gif" class="loader">';
43 + echo '<img src="', VISUALIZER_ABSURL, 'images/ajax-loader.gif" class="loader">';
56 44 echo '</div>';
57 - echo $this->custom_css;
58 45 }
59 46
60 47 /**
61 48 * Renders sidebar content.
@@ -64,420 +51,47 @@
64 51 *
65 52 * @access protected
66 53 */
67 54 protected function _renderSidebarContent() {
68 - $upload_link = add_query_arg(
69 - array(
70 - 'action' => Visualizer_Plugin::ACTION_UPLOAD_DATA,
71 - 'nonce' => wp_create_nonce(),
72 - 'chart' => $this->chart->ID,
73 - ),
74 - admin_url( 'admin-ajax.php' )
75 - );
55 + $upload_link = add_query_arg( array(
56 + 'action' => Visualizer_Plugin::ACTION_UPLOAD_DATA,
57 + 'nonce' => wp_create_nonce(),
58 + 'chart' => $this->chart->ID,
59 + ), admin_url( 'admin-ajax.php' ) );
76 60
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 - $type = get_post_meta( $this->chart->ID, Visualizer_Plugin::CF_CHART_TYPE, true );
80 - ?>
81 - <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 - <iframe id="thehole" name="thehole"></iframe>
83 - <ul class="viz-group-wrapper full-height">
84 - <li class="viz-group viz-group-category open" id="vz-chart-source">
85 - <div class="viz-group-header">
86 - <h2 class="viz-group-title viz-main-group"><?php _e( 'Chart Data', 'visualizer' ); ?></h2>
87 - </div>
88 - <ul class="viz-group-content">
89 - <ul class="viz-group-wrapper">
90 - <li class="viz-group visualizer_source_csv">
91 - <h2 class="viz-group-title viz-sub-group visualizer-src-tab"><?php _e( 'Import data from file', 'visualizer' ); ?></h2>
92 - <div class="viz-group-content">
93 - <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>
94 - <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>
95 - <form id="vz-csv-file-form" action="<?php echo $upload_link; ?>" method="post"
96 - target="thehole" enctype="multipart/form-data">
97 - <input type="hidden" id="remote-data" name="remote_data">
98 - <div class="">
99 - <input type="file" id="csv-file" name="local_data">
100 - </div>
101 - <input type="button" class="button button-primary" id="vz-import-file"
102 - value="<?php _e( 'Import', 'visualizer' ); ?>">
103 - </form>
104 - </div>
105 - </li>
106 - <li class="viz-group visualizer-import-url visualizer_source_csv_remote">
107 - <h2 class="viz-group-title viz-sub-group visualizer-src-tab"><?php _e( 'Import data from URL', 'visualizer' ); ?></h2>
108 - <ul class="viz-group-content">
109 - <li class="viz-subsection">
110 - <span class="viz-section-title"><?php _e( 'One time import', 'visualizer' ); ?></span>
61 + echo '<li class="group open">';
62 + echo '<h3 class="group-title">', esc_html__( 'Upload CSV File', Visualizer_Plugin::NAME ), '</h3>';
63 + echo '<div class="group-content">';
64 + echo '<iframe id="thehole" name="thehole"></iframe>';
111 65
112 - <div class="viz-section-items section-items">
113 - <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 - <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>
116 - <form id="vz-one-time-import" action="<?php echo $upload_link; ?>" method="post"
117 - target="thehole" enctype="multipart/form-data">
118 - <div class="remote-file-section">
119 - <input type="url" id="remote-data" name="remote_data"
120 - placeholder="<?php esc_html_e( 'Please enter the URL of CSV file', 'visualizer' ); ?>"
121 - class="visualizer-input">
66 + echo '<p class="group-description">';
67 + 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_Plugin::NAME );
68 + echo '</p>';
122 69
123 - </div>
124 - <input type="button" id="view-remote-file" class="button button-primary"
125 - value="<?php _e( 'Import', 'visualizer' ); ?>">
126 - </form>
127 - </div>
128 - </li>
129 - <li class="viz-subsection <?php echo apply_filters( 'visualizer_pro_upsell_class', 'only-pro-feature', 'schedule-chart' ); ?>">
130 - <span class="viz-section-title visualizer-import-url-schedule"><?php _e( 'Schedule Import', 'visualizer' ); ?>
131 - <span
132 - class="dashicons dashicons-lock"></span></span>
133 - <div class="viz-section-items section-items">
134 - <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>
137 - <form id="vz-schedule-import" action="<?php echo $upload_link; ?>" method="post"
138 - target="thehole" enctype="multipart/form-data">
139 - <div class="remote-file-section">
140 - <input type="url" id="vz-schedule-url" name="remote_data"
141 - value="<?php echo get_post_meta( $this->chart->ID, Visualizer_Plugin::CF_CHART_URL, true ); ?>"
142 - placeholder="<?php esc_html_e( 'Please enter the URL of CSV file', 'visualizer' ); ?>"
143 - class="visualizer-input visualizer-remote-url">
144 - <p class="viz-group-description"><?php _e( 'How often do you want to check the url', 'visualizer' ); ?></p>
145 - <select name="vz-import-time" id="vz-import-time"
146 - class="visualizer-select">
147 - <?php
148 - $hours = get_post_meta( $this->chart->ID, Visualizer_Plugin::CF_CHART_SCHEDULE, true );
149 - $schedules = apply_filters(
150 - 'visualizer_chart_schedules', array(
151 - '1' => __( 'Each hour', 'visualizer' ),
152 - '12' => __( 'Each 12 hours', 'visualizer' ),
153 - '24' => __( 'Each day', 'visualizer' ),
154 - '72' => __( 'Each 3 days', 'visualizer' ),
155 - )
156 - );
157 - foreach ( $schedules as $num => $name ) {
158 - $extra = $num == $hours ? 'selected' : '';
159 - ?>
160 - <option value="<?php echo $num; ?>" <?php echo $extra; ?>><?php echo $name; ?></option>
161 - <?php
162 - }
163 - ?>
164 - </select>
165 - </div>
166 - <input type="button" id="vz-save-schedule" class="button button-primary"
167 - value="<?php _e( 'Save schedule', 'visualizer' ); ?>">
70 + echo '<p class="group-description">';
71 + esc_html_e( 'If you are unsure about how to format your data CSV then please take a look at this sample:', Visualizer_Plugin::NAME );
72 + echo ' <a href="', VISUALIZER_ABSURL, 'samples/', $this->type, '.csv" target="_blank">', $this->type, '.csv</a> ';
73 + printf( esc_html__( 'or read how you can add Google spreadsheet in following %sarticle%s.', Visualizer_Plugin::NAME ), '<a href="https://github.com/madpixelslabs/visualizer/wiki/How-can-I-populate-data-from-Google-Spreadsheet%3F" target="_blank">', '</a>' );
74 + echo '</p>';
168 75
169 - <?php echo apply_filters( 'visualizer_pro_upsell', '', 'schedule-chart' ); ?>
170 - </form>
171 - </div>
172 - </li>
173 - </ul>
174 - </li>
175 - <li class="viz-group <?php echo apply_filters( 'visualizer_pro_upsell_class', 'only-pro-feature' ); ?>">
176 - <h2 class="viz-group-title viz-sub-group"
177 - data-current="chart"><?php _e( 'Import from other chart', 'visualizer' ); ?><span
178 - class="dashicons dashicons-lock"></span></h2>
179 - <div class="viz-group-content edit-data-content">
180 - <div>
181 - <p class="viz-group-description"><?php _e( 'You can import here data from your previously created charts', 'visualizer' ); ?></p>
182 - <form>
183 - <select name="vz-import-from-chart" id="chart-id" class="visualizer-select">
184 - <?php
185 - $fetch_link = add_query_arg(
186 - array(
187 - 'action' => ( VISUALIZER_PRO ) ? Visualizer_Pro::ACTION_FETCH_DATA : '',
188 - 'nonce' => wp_create_nonce(),
189 - ),
190 - admin_url( 'admin-ajax.php' )
191 - );
192 - $query_args_charts = array(
193 - 'post_type' => Visualizer_Plugin::CPT_VISUALIZER,
194 - 'posts_per_page' => 300,
195 - 'no_found_rows' => true,
196 - );
197 - $charts = array();
198 - $query = new WP_Query( $query_args_charts );
199 - while ( $query->have_posts() ) {
200 - $chart = $query->next_post();
201 - $settings = get_post_meta( $chart->ID, Visualizer_Plugin::CF_SETTINGS, true );
202 - ?>
203 - <option value="<?php echo $chart->ID; ?>"><?php echo empty( $settings['title'] ) ? '#' . $chart->ID : $settings['title']; ?></option>
204 - <?php
205 - }
206 - ?>
76 + echo '<div>';
77 + echo '<form id="csv-form" action="', $upload_link, '" method="post" target="thehole" enctype="multipart/form-data">';
78 + echo '<input type="hidden" id="remote-data" name="remote_data">';
79 + echo '<div class="button button-primary file-wrapper">';
80 + echo '<input type="file" id="csv-file" class="file" name="local_data">';
81 + esc_attr_e( 'From Computer', Visualizer_Plugin::NAME );
82 + echo '</div>';
207 83
208 - </select>
209 - </form>
210 - <input type="button" id="existing-chart" class="button button-primary"
211 - value="<?php _e( 'Import Chart', 'visualizer' ); ?>"
212 - data-viz-link="<?php echo $fetch_link; ?>">
213 - <?php echo apply_filters( 'visualizer_pro_upsell', '' ); ?>
214 - </div>
215 - </div>
216 - </li>
217 -
218 - <li class="viz-group <?php echo apply_filters( 'visualizer_pro_upsell_class', 'only-pro-feature', 'schedule-chart' ); ?> ">
219 - <h2 class="viz-group-title viz-sub-group"><?php _e( 'Import from WordPress', 'visualizer' ); ?><span
220 - class="dashicons dashicons-lock"></span></h2>
221 - <div class="viz-group-content edit-data-content">
222 - <div>
223 - <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' ); ?>">
228 - <?php echo apply_filters( 'visualizer_pro_upsell', '', 'schedule-chart' ); ?>
229 - </div>
230 - </div>
231 - </li>
232 -
233 - <?php
234 - $save_query = add_query_arg(
235 - array(
236 - 'action' => Visualizer_Plugin::ACTION_SAVE_DB_QUERY,
237 - 'security' => wp_create_nonce( Visualizer_Plugin::ACTION_SAVE_DB_QUERY . Visualizer_Plugin::VERSION ),
238 - 'chart' => $this->chart->ID,
239 - ), admin_url( 'admin-ajax.php' )
240 - );
241 - ?>
242 - <li class="viz-group visualizer_source_query <?php echo apply_filters( 'visualizer_pro_upsell_class', 'only-pro-feature', 'db-query' ); ?>">
243 - <h2 class="viz-group-title viz-sub-group"><?php _e( 'Import from database', 'visualizer' ); ?><span
244 - class="dashicons dashicons-lock"></span></h2>
245 - <div class="viz-group-content edit-data-content">
246 - <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' : '';
265 - ?>
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">
272 -
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' ); ?>">
279 - <?php echo apply_filters( 'visualizer_pro_upsell', '', 'db-query' ); ?>
280 - </form>
281 - </div>
282 - </div>
283 - </li>
284 -
285 - <?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' );
288 - ?>
289 - <li class="viz-group <?php echo $pro_class; ?> <?php echo empty( $source_of_chart ) && empty( $pro_class ) ? 'open' : ''; ?> ">
290 - <h2 class="viz-group-title viz-sub-group visualizer-editor-tab"
291 - data-current="chart"><?php _e( 'Manual Data', 'visualizer' ); ?><span
292 - class="dashicons dashicons-lock"></span></h2>
293 - <form id="editor-form" action="<?php echo $upload_link; ?>" method="post" target="thehole">
294 - <input type="hidden" id="chart-data" name="chart_data">
295 - <input type="hidden" id="chart-data-src" name="chart_data_src">
296 - </form>
297 -
298 - <div class="viz-group-content edit-data-content">
299 - <div>
300 - <p class="viz-group-description"><?php _e( 'You can manually edit the chart data using the spreadsheet like editor.', 'visualizer' ); ?></p>
301 - <input type="button" id="editor-chart-button" class="button button-primary "
302 - value="<?php _e( 'View Editor', 'visualizer' ); ?>" data-current="chart"
303 - data-t-editor="<?php _e( 'Show Chart', 'visualizer' ); ?>"
304 - data-t-chart="<?php _e( 'View Editor', 'visualizer' ); ?>">
305 -
306 - <?php echo apply_filters( 'visualizer_pro_upsell', '' ); ?>
307 - </div>
308 - </div>
309 - </li>
310 - </ul>
311 - </li>
312 - </ul>
313 - <li class="viz-group viz-group-category bottom-fixed sidebar-footer-link" id="vz-chart-settings">
314 - <h2><span class="dashicons dashicons-admin-tools"></span><?php _e( 'Advanced', 'visualizer' ); ?></h2>
315 - <div class="viz-group-header">
316 - <button class="customize-section-back" tabindex="0"></button>
317 - <h3 class="viz-group-title viz-main-group"><?php _e( 'Chart Settings', 'visualizer' ); ?></h3>
318 - </div>
319 - <ul class="viz-group-content">
320 - <form id="settings-form" action="<?php echo add_query_arg( 'nonce', wp_create_nonce() ); ?>"
321 - method="post">
322 - <?php echo $this->sidebar; ?>
323 - <input type="hidden" name="save" value="1">
324 - </form>
325 - <form id="cancel-form" action="<?php echo add_query_arg( 'nonce', wp_create_nonce() ); ?>" method="post">
326 - <input type="hidden" name="cancel" value="1">
327 - </form>
328 - </ul>
329 - </li>
330 -
331 - <?php $this->getPermissionsLink( $this->chart->ID ); ?>
332 -
333 - <li class="viz-group bottom-fixed" id="vz-chart-copyright">Visualizer &copy; <?php echo date( 'Y', current_time( 'timestamp' ) ); ?></li>
334 - </ul>
335 - <?php
336 - // changed by Ash/Upwork
84 + echo '<div>';
85 + echo '<a id="remote-file" class="button" href="javascript:;">', esc_html__( 'From Web', Visualizer_Plugin::NAME ), '</a>';
86 + echo '</div>';
87 + echo '</form>';
88 + echo '</div>';
89 + echo '</div>';
90 + echo '</li>';
337 91 }
338 92
339 93 /**
340 - * Generates the permissions link.
341 - *
342 - * @access private
343 - * @param int $id The chart id.
344 - */
345 - private function getPermissionsLink( $id ) {
346 - $permissions = apply_filters( 'visualizer_pro_get_permissions', null, $id );
347 - if ( $permissions ) {
348 - foreach ( $permissions as $k => $v ) {
349 - $this->$k = $v;
350 - }
351 - }
352 - ?>
353 - <li class="viz-group viz-group-category bottom-fixed sidebar-footer-link" id="vz-chart-permissions">
354 - <h2><span class="dashicons dashicons-admin-users"></span><?php _e( 'Permissions', 'visualizer' ); ?></h2>
355 - <div class="viz-group-header">
356 - <button class="customize-section-back" tabindex="0"></button>
357 - <h3 class="viz-group-title viz-main-group"><?php _e( 'Chart Settings', 'visualizer' ); ?></h3>
358 - </div>
359 - <ul class="viz-group-content">
360 - <form id="permissions-form" target="thehole" action="
361 - <?php
362 - echo add_query_arg(
363 - array(
364 - 'nonce' => wp_create_nonce(),
365 - 'tab' => 'permissions',
366 - ),
367 - remove_query_arg( 'tab', $_SERVER['REQUEST_URI'] )
368 - );
369 - ?>
370 -" method="post">
371 - <?php $this->permissionsSidebar(); ?>
372 - </form>
373 - </ul>
374 - </li>
375 - <?php
376 - }
377 -
378 - /**
379 - * Generates the permissions form.
380 - *
381 - * @access private
382 - */
383 - private function permissionsSidebar() {
384 - // ignore for unit tests because Travis throws the error "Indirect modification of overloaded property Visualizer_Render_Page_Data::$permissions has no effect".
385 - if ( defined( 'WP_TESTS_DOMAIN' ) ) {
386 - return;
387 - }
388 - Visualizer_Render_Sidebar::_renderGroupStart(
389 - esc_html__( 'Who can see this chart?', 'visualizer' ) . '<span
390 - class="dashicons dashicons-lock"></span>',
391 - '',
392 - apply_filters( 'visualizer_pro_upsell_class', 'only-pro-feature', 'chart-permissions' )
393 - );
394 - Visualizer_Render_Sidebar::_renderSectionStart();
395 - Visualizer_Render_Sidebar::_renderSectionDescription( esc_html__( 'Select who can view the chart on the front-end.', 'visualizer' ) );
396 -
397 - if ( ! isset( $this->permissions['read'] ) ) {
398 - $this->permissions['read'] = 'all';
399 - }
400 -
401 - Visualizer_Render_Sidebar::_renderSelectItem(
402 - '',
403 - 'permissions[read]',
404 - $this->permissions['read'],
405 - array(
406 - 'all' => esc_html__( 'All Users', 'visualizer' ),
407 - 'users' => esc_html__( 'Select Users', 'visualizer' ),
408 - 'roles' => esc_html__( 'Select Roles', 'visualizer' ),
409 - ),
410 - '',
411 - false,
412 - array( 'visualizer-permission', 'visualizer-permission-type', 'visualizer-permission-read' ),
413 - array(
414 - 'permission-type' => 'read',
415 - )
416 - );
417 -
418 - $options = apply_filters( 'visualizer_pro_get_permissions_data', array(), isset( $this->permissions['read'] ) ? $this->permissions['read'] : 'roles' );
419 -
420 - Visualizer_Render_Sidebar::_renderSelectItem(
421 - '',
422 - 'permissions[read-specific][]',
423 - isset( $this->permissions['read-specific'] ) ? $this->permissions['read-specific'] : array(),
424 - $options,
425 - '',
426 - true,
427 - array( 'visualizer-permission', 'visualizer-permission-specific', 'visualizer-permission-read-specific' )
428 - );
429 - Visualizer_Render_Sidebar::_renderSectionEnd( apply_filters( 'visualizer_pro_upsell', 'only-pro-feature', 'chart-permissions' ) );
430 - Visualizer_Render_Sidebar::_renderGroupEnd();
431 -
432 - Visualizer_Render_Sidebar::_renderGroupStart(
433 - esc_html__( 'Who can edit this chart?', 'visualizer' ) . '<span
434 - class="dashicons dashicons-lock"></span>',
435 - '',
436 - apply_filters( 'visualizer_pro_upsell_class', 'only-pro-feature', 'chart-permissions' )
437 - );
438 - Visualizer_Render_Sidebar::_renderSectionStart();
439 - Visualizer_Render_Sidebar::_renderSectionDescription( esc_html__( 'Select who can edit the chart on the front-end.', 'visualizer' ) );
440 -
441 - if ( ! isset( $this->permissions['edit'] ) ) {
442 - $this->permissions['edit'] = 'roles';
443 - $this->permissions['edit-specific'] = 'administrator';
444 - }
445 -
446 - Visualizer_Render_Sidebar::_renderSelectItem(
447 - '',
448 - 'permissions[edit]',
449 - $this->permissions['edit'],
450 - array(
451 - 'all' => esc_html__( 'All Users', 'visualizer' ),
452 - 'users' => esc_html__( 'Select Users', 'visualizer' ),
453 - 'roles' => esc_html__( 'Select Roles', 'visualizer' ),
454 - ),
455 - '',
456 - false,
457 - array( 'visualizer-permission', 'visualizer-permission-type', 'visualizer-permission-edit' ),
458 - array(
459 - 'permission-type' => 'edit',
460 - )
461 - );
462 -
463 - $options = apply_filters( 'visualizer_pro_get_permissions_data', array(), isset( $this->permissions['edit'] ) ? $this->permissions['edit'] : 'roles' );
464 -
465 - Visualizer_Render_Sidebar::_renderSelectItem(
466 - '',
467 - 'permissions[edit-specific][]',
468 - isset( $this->permissions['edit-specific'] ) ? $this->permissions['edit-specific'] : array(),
469 - $options,
470 - '',
471 - true,
472 - array( 'visualizer-permission', 'visualizer-permission-specific', 'visualizer-permission-edit-specific' )
473 - );
474 - Visualizer_Render_Sidebar::_renderSectionEnd( apply_filters( 'visualizer_pro_upsell', 'only-pro-feature', 'chart-permissions' ) );
475 - Visualizer_Render_Sidebar::_renderGroupEnd();
476 -
477 - }
478 -
479 - /**
480 94 * Renders toolbar content.
481 95 *
482 96 * @since 1.0.0
483 97 *
@@ -483,34 +97,13 @@
483 97 *
484 98 * @access protected
485 99 */
486 100 protected function _renderToolbar() {
487 - // don't show back button at all.
488 - // 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.
489 - if ( ! VISUALIZER_SKIP_CHART_TYPE_PAGE ) {
490 - echo '<div class="toolbar-div">';
491 - echo '<a class="button button-large" href="', add_query_arg( 'tab', 'types' ), '">';
492 - esc_html_e( 'Back', 'visualizer' );
493 - echo '</a>';
494 - echo '</div>';
495 - }
496 - echo '<input type="submit" id="settings-button" class="button button-primary button-large push-right" value="', $this->button, '">';
497 - if ( isset( $this->cancel_button ) ) {
498 - echo '<input type="submit" id="cancel-button" class="button button-secondary button-large push-left" value="', $this->cancel_button, '">';
499 - }
101 + echo '<a class="button button-large" href="', add_query_arg( 'tab', false ), '">';
102 + esc_html_e( 'Back', Visualizer_Plugin::NAME );
103 + echo '</a>';
104 + echo '<a class="button button-large button-primary push-right" href="', add_query_arg( 'tab', 'settings' ), '">';
105 + esc_html_e( 'Next', Visualizer_Plugin::NAME );
106 + echo '</a>';
500 107 }
501 108
502 - /**
503 - * Renders the additional content.
504 - *
505 - * @access private
506 - */
507 - private function add_additional_content() {
508 - $source = strtolower( get_post_meta( $this->chart->ID, Visualizer_Plugin::CF_SOURCE, true ) );
509 - $query = '';
510 - if ( 'visualizer_source_query' === $source ) {
511 - $query = get_post_meta( $this->chart->ID, Visualizer_Plugin::CF_DB_QUERY, true );
512 - }
513 - Visualizer_Render_Layout::show( 'db-query', $query );
514 - }
515 -
516 -}
109 +}