PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.11.10
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.11.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/Layout.php +94 -190 4.0.83.11.10 View file →
@@ -89,28 +89,10 @@
89 89 </div>
90 90 <div class='db-wizard-hints'>
91 91 <ul>
92 92 <li><?php echo __( 'Your database prefix is:', 'visualizer' ); ?> <span class="visualizer-emboss"><?php echo $wpdb->prefix; ?></span></li>
93 - <li>
94 - <?php
95 - echo sprintf(
96 - // translators: %1$s - HTML link tag, %2$s - HTML closing link tag.
97 - __( 'For examples of queries and links to resources that you can use with this feature, please click %1$shere%2$s', 'visualizer' ),
98 - '<a href="' . VISUALIZER_DB_QUERY_DOC_URL . '" target="_blank">',
99 - '</a>'
100 - );
101 - ?>
102 - </li>
103 - <li>
104 - <?php
105 - echo sprintf(
106 - // translators: %1$s - HTML link tag, %2$s - HTML closing link tag.
107 - __( 'Use %1$sShift+Space%2$s for autocompleting keywords or table names.', 'visualizer' ),
108 - '<span class="visualizer-emboss">',
109 - '</span>'
110 - );
111 - ?>
112 - </li>
93 + <li><?php echo sprintf( __( 'For examples of queries and links to resources that you can use with this feature, please click %1$shere%2$s', 'visualizer' ), '<a href="' . VISUALIZER_DB_QUERY_DOC_URL . '" target="_blank">', '</a>' ); ?></li>
94 + <li><?php echo sprintf( __( 'Use %1$sShift+Space%2$s for autocompleting keywords or table names.', 'visualizer' ), '<span class="visualizer-emboss">', '</span>' ); ?></li>
113 95 <?php do_action( 'visualizer_db_query_add_hints', $args ); ?>
114 96 </ul>
115 97 </div>
116 98 <div class='db-wizard-results'></div>
@@ -187,15 +169,10 @@
187 169 $headers['method'] = 'get';
188 170 }
189 171 $methods = apply_filters( 'visualizer_json_request_methods', array( 'GET', 'POST' ) );
190 172
191 - $auth = isset( $headers['auth'] ) ? $headers['auth'] : '';
192 - $auth_username = is_array( $auth ) && isset( $auth['username'] ) ? $auth['username'] : '';
193 - $auth_password = is_array( $auth ) && isset( $auth['password'] ) ? $auth['password'] : '';
194 - $auth_string = is_string( $auth ) ? $auth : '';
195 -
196 173 // open the headers by default?
197 - $headers_open = ! empty( $auth_username ) || ! empty( $auth_string );
174 + $headers_open = $headers && array_key_exists( 'auth', $headers ) && ( array_key_exists( 'username', $headers['auth'] ) && ! empty( $headers['auth']['username'] ) ) || ( ! empty( $headers['auth'] ) && is_string( $headers['auth'] ) );
198 175 ?>
199 176 <div id="visualizer-json-screen" style="display: none">
200 177 <div class="visualizer-json-form">
201 178 <h3 class="viz-step step1"><?php _e( 'STEP 1: Specify the JSON endpoint/URL', 'visualizer' ); ?></h3>
@@ -202,18 +179,9 @@
202 179 <div>
203 180 <form id="json-endpoint-form">
204 181 <div class="json-wizard-hints">
205 182 <ul class="info">
206 - <li>
207 - <?php
208 - echo sprintf(
209 - // translators: %1$s - HTML link tag, %2$s - HTML closing link tag.
210 - __( 'If you want to add authentication or headers to the endpoint or change the request in any way, please refer to our document %1$shere%2$s.', 'visualizer' ),
211 - '<a href="https://docs.themeisle.com/article/1043-visualizer-how-to-extend-rest-endpoints-with-json-response" target="_blank">',
212 - '</a>'
213 - );
214 - ?>
215 - </li>
183 + <li><?php echo sprintf( __( 'If you want to add authentication or headers to the endpoint or change the request in any way, please refer to our document %1$shere%2$s.', 'visualizer' ), '<a href="https://docs.themeisle.com/article/1043-visualizer-how-to-extend-rest-endpoints-with-json-response" target="_blank">', '</a>' ); ?></li>
216 184 </ul>
217 185 </div>
218 186
219 187 <input
@@ -246,9 +214,9 @@
246 214 <input
247 215 type="text"
248 216 id="vz-import-json-username"
249 217 name="username"
250 - value="<?php echo esc_attr( $auth_username ); ?>"
218 + value="<?php echo ( array_key_exists( 'auth', $headers ) && array_key_exists( 'username', $headers['auth'] ) ? $headers['auth']['username'] : '' ); ?>"
251 219 placeholder="<?php esc_html_e( 'Username/Access Key', 'visualizer' ); ?>"
252 220 class="json-form-element">
253 221 &
254 222 <input
@@ -254,9 +222,9 @@
254 222 <input
255 223 type="password"
256 224 id="vz-import-json-password"
257 225 name="password"
258 - value="<?php echo esc_attr( $auth_password ); ?>"
226 + value="<?php echo ( array_key_exists( 'auth', $headers ) && array_key_exists( 'password', $headers['auth'] ) ? $headers['auth']['password'] : '' ); ?>"
259 227 placeholder="<?php esc_html_e( 'Password/Secret Key', 'visualizer' ); ?>"
260 228 class="json-form-element">
261 229 </div>
262 230 </div>
@@ -270,9 +238,9 @@
270 238 <input
271 239 type="text"
272 240 id="vz-import-json-auth"
273 241 name="auth"
274 - value="<?php echo esc_attr( $auth_string ); ?>"
242 + value="<?php echo ( array_key_exists( 'auth', $headers ) && is_string( $headers['auth'] ) ? $headers['auth'] : '' ); ?>"
275 243 placeholder="<?php esc_html_e( 'e.g. SharedKey <AccountName>:<Signature>', 'visualizer' ); ?>"
276 244 class="visualizer-input json-form-element">
277 245 </div>
278 246 </div>
@@ -278,9 +246,9 @@
278 246 </div>
279 247 <div class="json-wizard-header">
280 248 <div class="field-title"><?php esc_html_e( 'Additional headers', 'visualizer' ); ?></div>
281 249 <div>
282 - <textarea name="additional_headers" class="visualizer-input" placeholder="<?php esc_html_e( 'Key:Value, Key2:Value2,...', 'visualizer' ); ?>"><?php echo esc_textarea( isset( $headers['additional_headers'] ) ? $headers['additional_headers'] : '' ); ?></textarea>
250 + <textarea name="additional_headers" class="visualizer-input" placeholder="<?php esc_html_e( 'Key:Value, Key2:Value2,...', 'visualizer' ); ?>"><?php echo isset( $headers['additional_headers'] ) ? $headers['additional_headers'] : ''; ?></textarea>
283 251 </div>
284 252 </div>
285 253 </div>
286 254 </div>
@@ -293,9 +261,9 @@
293 261 <select name="root" id="vz-import-json-root" class="json-form-element">
294 262 <?php
295 263 if ( ! empty( $root ) ) {
296 264 ?>
297 - <option value="<?php echo esc_attr( $root ); ?>"><?php echo esc_html( str_replace( Visualizer_Source_Json::TAG_SEPARATOR, Visualizer_Source_Json::TAG_SEPARATOR_VIEW, $root ) ); ?></option>
265 + <option value="<?php echo esc_attr( $root ); ?>"><?php echo str_replace( Visualizer_Source_Json::TAG_SEPARATOR, Visualizer_Source_Json::TAG_SEPARATOR_VIEW, $root ); ?></option>
298 266 <?php
299 267 }
300 268 ?>
301 269 </select>
@@ -311,9 +279,9 @@
311 279 <option value="0" class="static"><?php _e( 'Get results from the first page only', 'visualizer' ); ?></option>
312 280 <?php
313 281 if ( ! empty( $paging ) ) {
314 282 ?>
315 - <option value="<?php echo esc_attr( $paging ); ?>"><?php echo esc_html( sprintf( 'Get results from the first %d pages using %s', apply_filters( 'visualizer_json_fetch_pages', 5, $url ), str_replace( Visualizer_Source_Json::TAG_SEPARATOR, Visualizer_Source_Json::TAG_SEPARATOR_VIEW, $paging ) ) ); ?></option>
283 + <option value="<?php echo esc_attr( $paging ); ?>"><?php echo sprintf( 'Get results from the first %d pages using %s', apply_filters( 'visualizer_json_fetch_pages', 5, $url ), str_replace( Visualizer_Source_Json::TAG_SEPARATOR, Visualizer_Source_Json::TAG_SEPARATOR_VIEW, $paging ) ); ?></option>
316 284 <?php
317 285 }
318 286 ?>
319 287 </select>
@@ -364,9 +332,9 @@
364 332 $action = esc_url(
365 333 add_query_arg(
366 334 array(
367 335 'action' => Visualizer_Plugin::ACTION_UPLOAD_DATA,
368 - 'nonce' => wp_create_nonce( 'visualizer-upload-data' ),
336 + 'nonce' => wp_create_nonce(),
369 337 'chart' => $chart_id,
370 338 ),
371 339 admin_url( 'admin-ajax.php' )
372 340 )
@@ -394,8 +362,9 @@
394 362 <?php Visualizer_Render_Layout::show( 'text-editor', $chart_id ); ?>
395 363
396 364 </div>
397 365 <?php
366 +
398 367 }
399 368
400 369 /**
401 370 * Show the text area editor.
@@ -535,9 +504,9 @@
535 504 private static function _renderPermissions( $args ) {
536 505 $chart_id = $args[1];
537 506
538 507 // ignore for unit tests because Travis throws the error "Indirect modification of overloaded property Visualizer_Render_Page_Data::$permissions has no effect".
539 - if ( defined( 'WP_TESTS_DOMAIN' ) && function_exists( 'tests_add_filter' ) ) {
508 + if ( defined( 'WP_TESTS_DOMAIN' ) ) {
540 509 return;
541 510 }
542 511
543 512 $permissions = apply_filters( 'visualizer_pro_get_permissions', null, $chart_id );
@@ -620,9 +589,9 @@
620 589 true,
621 590 array( 'visualizer-permission', 'visualizer-permission-specific', 'visualizer-permission-edit-specific' )
622 591 );
623 592 Visualizer_Render_Sidebar::_renderSectionEnd();
624 - echo apply_filters( 'visualizer_pro_upsell', '', 'chart-permissions', 'https://docs.themeisle.com/article/1280-how-to-customize-permissions' );
593 + echo apply_filters( 'visualizer_pro_upsell', '', 'chart-permissions' );
625 594 echo '</div>';
626 595 Visualizer_Render_Sidebar::_renderGroupEnd();
627 596 }
628 597
@@ -692,22 +661,12 @@
692 661 <h4><span class="dashicons dashicons-editor-help"></span><a href="<?php echo VISUALIZER_MAIN_DOC; ?>" target="_blank"><?php _e( 'Main documentation page', 'visualizer' ); ?></a></h4>
693 662 <h4><span class="dashicons dashicons-media-code"></span><a href="<?php echo VISUALIZER_CODE_SNIPPETS_URL; ?>" target="_blank"><?php _e( 'Custom code snippets', 'visualizer' ); ?></a></h4>
694 663 <?php
695 664 Visualizer_Render_Sidebar::_renderSectionEnd();
696 - // translators: %s - the chart type.
697 665 Visualizer_Render_Sidebar::_renderSectionStart( sprintf( __( '%s chart', 'visualizer' ), ucwords( $displayType ) ), true );
698 666 ?>
699 667 <h4><span class="dashicons dashicons-video-alt2"></span>&nbsp;<a href="<?php echo str_replace( '#', "$type-chart", VISUALIZER_DEMO_URL ); ?>" target="_blank"><?php _e( 'View demo', 'visualizer' ); ?></a></h4>
700 - <h4><span class="dashicons dashicons-search"></span><a href="<?php echo str_replace( '#', $type, VISUALIZER_DOC_COLLECTION ); ?>" target="_blank">
701 - <?php
702 - echo sprintf(
703 - // translators: %s - the chart type.
704 - __( 'Articles containing "%s"', 'visualizer' ),
705 - $displayType
706 - );
707 - ?>
708 - </a>
709 - </h4>
668 + <h4><span class="dashicons dashicons-search"></span><a href="<?php echo str_replace( '#', $type, VISUALIZER_DOC_COLLECTION ); ?>" target="_blank"><?php echo sprintf( __( 'Articles containing "%s"', 'visualizer' ), $displayType ); ?></a></h4>
710 669 <?php
711 670 Visualizer_Render_Sidebar::_renderSectionEnd();
712 671 Visualizer_Render_Sidebar::_renderGroupEnd();
713 672 ?>
@@ -729,9 +688,9 @@
729 688 $upload_link = esc_url(
730 689 add_query_arg(
731 690 array(
732 691 'action' => Visualizer_Plugin::ACTION_UPLOAD_DATA,
733 - 'nonce' => wp_create_nonce( 'visualizer-upload-data' ),
692 + 'nonce' => wp_create_nonce(),
734 693 'chart' => $chart_id,
735 694 ),
736 695 admin_url( 'admin-ajax.php' )
737 696 )
@@ -766,9 +725,9 @@
766 725 <ul class="viz-group-content">
767 726 <ul class="viz-group-wrapper">
768 727 <!-- manual -->
769 728 <li class="viz-group visualizer_source_manual">
770 - <h2 class="viz-group-title viz-sub-group visualizer-editor-tab" data-current="chart" role="button" tabindex="0"><?php _e( 'Manual Data', 'visualizer' ); ?></h2>
729 + <h2 class="viz-group-title viz-sub-group visualizer-editor-tab" data-current="chart"><?php _e( 'Manual Data', 'visualizer' ); ?></h2>
771 730 <div class="viz-group-content edit-data-content">
772 731 <form id="editor-form" action="<?php echo $upload_link; ?>" method="post" target="thehole">
773 732 <input type="hidden" id="chart-data" name="chart_data">
774 733 <input type="hidden" id="chart-data-src" name="chart_data_src">
@@ -790,22 +749,22 @@
790 749 <?php _e( 'editor to manually edit the chart data.', 'visualizer' ); ?>
791 750 </p>
792 751 <input type="button" id="editor-undo" class="button button-secondary" style="display: none" value="<?php _e( 'Undo Changes', 'visualizer' ); ?>">
793 752 <input type="button" id="editor-button" class="button button-primary "
794 - value="<?php _e( 'Edit Data', 'visualizer' ); ?>" data-current="chart"
795 - data-t-editor="<?php _e( 'Show Chart', 'visualizer' ); ?>"
796 - data-t-chart="<?php _e( 'Edit Data', 'visualizer' ); ?>"
753 + value="<?php _e( 'Edit Data', 'visualizer' ); ?>" data-current="chart"
754 + data-t-editor="<?php _e( 'Show Chart', 'visualizer' ); ?>"
755 + data-t-chart="<?php _e( 'Edit Data', 'visualizer' ); ?>"
797 756 >
798 - <p class="viz-group-description viz-info-msg" style="display:none"><?php echo sprintf( __( 'Please make sure you click \'Show Chart\' before you save the chart.', 'visualizer' ) ); ?></p>
757 + <p class="viz-group-description viz-info-msg"><?php echo sprintf( __( 'Please make sure you click \'Show Chart\' before you save the chart.', 'visualizer' ) ); ?></p>
799 758 </div>
800 759 <?php } else { ?>
801 760 <input type="button" id="editor-undo" class="button button-secondary" style="display: none" value="<?php _e( 'Undo Changes', 'visualizer' ); ?>">
802 761 <input type="button" id="editor-chart-button" class="button button-primary "
803 - value="<?php _e( 'View Editor', 'visualizer' ); ?>" data-current="chart"
804 - data-t-editor="<?php _e( 'Show Chart', 'visualizer' ); ?>"
805 - data-t-chart="<?php _e( 'View Editor', 'visualizer' ); ?>"
762 + value="<?php _e( 'View Editor', 'visualizer' ); ?>" data-current="chart"
763 + data-t-editor="<?php _e( 'Show Chart', 'visualizer' ); ?>"
764 + data-t-chart="<?php _e( 'View Editor', 'visualizer' ); ?>"
806 765 >
807 - <p class="viz-group-description viz-info-msg" style="display:none"><?php echo sprintf( __( 'Please make sure you click \'Show Chart\' before you save the chart.', 'visualizer' ) ); ?></p>
766 + <p class="viz-group-description viz-info-msg"><?php echo sprintf( __( 'Please make sure you click \'Show Chart\' before you save the chart.', 'visualizer' ) ); ?></p>
808 767 <?php } ?>
809 768 </form>
810 769 </div>
811 770 </li>
@@ -811,28 +770,18 @@
811 770 </li>
812 771
813 772 <!-- import from file -->
814 773 <li class="viz-group visualizer_source_csv <?php echo apply_filters( 'visualizer_pro_upsell_class', 'only-pro-feature', 'import-file' ); ?> ">
815 - <h2 class="viz-group-title viz-sub-group visualizer-src-tab" role="button" tabindex="0"><?php _e( 'Import data from file', 'visualizer' ); ?><span class="dashicons dashicons-lock"></span></h2>
774 + <h2 class="viz-group-title viz-sub-group visualizer-src-tab"><?php _e( 'Import data from file', 'visualizer' ); ?><span class="dashicons dashicons-lock"></span></h2>
816 775 <div class="viz-group-content">
817 776 <div>
818 - <p class="viz-group-description"><?php esc_html_e( 'Select and upload your data file here. Supported formats: CSV, XLSX. The first row should contain the column headings. The second row should contain the series type (string, number, boolean, date, datetime, timeofday).', 'visualizer' ); ?></p>
819 - <p class="viz-group-description viz-info-msg">
820 - <b>
821 - <?php
822 - echo sprintf(
823 - // translators: $s - the chart type with the link attached.
824 - __( 'If you are unsure about how to format your data CSV then please take a look at this sample: %s. If you are using non-English characters, please make sure you save the file in UTF-8 encoding.', 'visualizer' ),
825 - '<a href="' . VISUALIZER_ABSURL . 'samples/' . $type . '.csv" target="_blank">' . $type . '.csv</a>'
826 - );
827 - ?>
828 - </b>
829 - </p>
777 + <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>
778 + <p class="viz-group-description viz-info-msg"><b><?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. If you are using non-English characters, please make sure you save the file in UTF-8 encoding.', 'visualizer' ), '<a href="' . VISUALIZER_ABSURL . 'samples/' . $type . '.csv" target="_blank">', $type, '.csv</a>' ); ?></b></p>
830 779 <form id="vz-csv-file-form" action="<?php echo $upload_link; ?>" method="post"
831 780 target="thehole" enctype="multipart/form-data">
832 781 <input type="hidden" id="remote-data" name="remote_data">
833 782 <div class="">
834 - <input type="file" id="csv-file" name="local_data" accept=".csv,.xlsx">
783 + <input type="file" id="csv-file" name="local_data">
835 784 </div>
836 785 <input type="button" class="button button-primary" id="vz-import-file"
837 786 value="<?php _e( 'Import', 'visualizer' ); ?>">
838 787 </form>
@@ -841,40 +790,21 @@
841 790 </div>
842 791 </li>
843 792 <!-- import from url -->
844 793 <li class="viz-group visualizer-import-url visualizer_source_csv_remote visualizer_source_json <?php echo apply_filters( 'visualizer_pro_upsell_class', 'only-pro-feature', 'import-url' ); ?> ">
845 - <h2 class="viz-group-title viz-sub-group visualizer-src-tab" role="button" tabindex="0"><?php _e( 'Import data from URL', 'visualizer' ); ?><span class="dashicons dashicons-lock"></span></h2>
794 + <h2 class="viz-group-title viz-sub-group visualizer-src-tab"><?php _e( 'Import data from URL', 'visualizer' ); ?><span class="dashicons dashicons-lock"></span></h2>
846 795 <ul class="viz-group-content">
847 796 <!-- import from csv url -->
848 797 <li class="viz-subsection">
849 - <span class="viz-section-title" role="button" tabindex="0"><?php _e( 'Import from CSV / XLSX', 'visualizer' ); ?></span>
798 + <span class="viz-section-title"><?php _e( 'Import from CSV', 'visualizer' ); ?></span>
850 799 <div class="only-pro-anchor">
851 800 <div class="viz-section-items section-items">
852 - <p class="viz-group-description">
853 - <?php
854 - echo sprintf(
855 - // translators: %1$s - HTML link tag, %2$s - HTML closing link tag.
856 - __( 'You can use this to import data from a remote CSV or Excel (XLSX) file, or %1$sGoogle Spreadsheet%2$s.', 'visualizer' ),
857 - '<a href="https://docs.themeisle.com/article/607-how-can-i-populate-data-from-google-spreadsheet" target="_blank" >',
858 - '</a>'
859 - );
860 - ?>
861 - </p>
862 - <p class="viz-group-description viz-info-msg">
863 - <b>
864 - <?php
865 - echo sprintf(
866 - // translators: %s - the chart type with the link attached.
867 - __( 'If you are unsure about how to format your data CSV then please take a look at this sample: %s. If you are using non-English characters, please make sure you save the file in UTF-8 encoding.', 'visualizer' ),
868 - '<a href="' . VISUALIZER_ABSURL . 'samples/' . $type . '.csv" target="_blank">' . $type . '.csv</a>'
869 - );
870 - ?>
871 - </b>
872 - </p>
801 + <p class="viz-group-description"><?php echo sprintf( __( 'You can use this to import data from a remote CSV file or %1$sGoogle Spreadsheet%2$s.', 'visualizer' ), '<a href="https://docs.themeisle.com/article/607-how-can-i-populate-data-from-google-spreadsheet" target="_blank" >', '</a>' ); ?> </p>
802 + <p class="viz-group-description viz-info-msg"><b><?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. If you are using non-English characters, please make sure you save the file in UTF-8 encoding.', 'visualizer' ), '<a href="' . VISUALIZER_ABSURL . 'samples/' . $type . '.csv" target="_blank">', $type, '.csv</a>' ); ?></b></p>
873 803 <form id="vz-one-time-import" action="<?php echo $upload_link; ?>" method="post"
874 804 target="thehole" enctype="multipart/form-data">
875 805 <div class="remote-file-section">
876 - <input type="url" id="vz-schedule-url" name="remote_data" value="<?php echo esc_attr( get_post_meta( $chart_id, Visualizer_Plugin::CF_CHART_URL, true ) ); ?>" placeholder="<?php esc_html_e( 'Please enter the URL of a CSV or XLSX file', 'visualizer' ); ?>" class="visualizer-input visualizer-remote-url">
806 + <input type="url" id="vz-schedule-url" name="remote_data" value="<?php echo esc_attr( get_post_meta( $chart_id, Visualizer_Plugin::CF_CHART_URL, true ) ); ?>" placeholder="<?php esc_html_e( 'Please enter the URL of CSV file', 'visualizer' ); ?>" class="visualizer-input visualizer-remote-url">
877 807 </div>
878 808 <select name="vz-import-time" id="vz-import-time" class="visualizer-select">
879 809 <?php
880 810 $hours = get_post_meta( $chart_id, Visualizer_Plugin::CF_CHART_SCHEDULE, true );
@@ -888,9 +818,9 @@
888 818 foreach ( $schedules as $num => $name ) {
889 819 // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
890 820 $extra = self::is_hour_selected( $hours, $num ) ? 'selected' : '';
891 821 ?>
892 - <option value="<?php echo esc_attr( $num ); ?>" <?php echo esc_attr( $extra ); ?>><?php echo esc_html( $name ); ?></option>
822 + <option value="<?php echo $num; ?>" <?php echo $extra; ?>><?php echo $name; ?></option>
893 823 <?php
894 824 }
895 825 do_action( 'visualizer_chart_schedules_spl', 'csv', $chart_id, 1 );
896 826 ?>
@@ -913,9 +843,9 @@
913 843 </div>
914 844 </li>
915 845 <!-- import from json url -->
916 846 <li class="viz-subsection">
917 - <span class="viz-section-title visualizer_source_json" role="button" tabindex="0"><?php _e( 'Import from JSON', 'visualizer' ); ?></span>
847 + <span class="viz-section-title visualizer_source_json"><?php _e( 'Import from JSON', 'visualizer' ); ?></span>
918 848 <div class="only-pro-anchor">
919 849 <div class="viz-section-items section-items">
920 850 <p class="viz-group-description"><?php _e( 'You can choose here to import/synchronize your chart data with a remote JSON 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>
921 851 <form id="vz-import-json" action="<?php echo $upload_link; ?>" method="post" target="thehole" enctype="multipart/form-data">
@@ -938,9 +868,9 @@
938 868 foreach ( $schedules as $num => $name ) {
939 869 // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
940 870 $extra = self::is_hour_selected( $hours, $num ) ? 'selected' : '';
941 871 ?>
942 - <option value="<?php echo esc_attr( $num ); ?>" <?php echo esc_attr( $extra ); ?>><?php echo esc_html( $name ); ?></option>
872 + <option value="<?php echo $num; ?>" <?php echo $extra; ?>><?php echo $name; ?></option>
943 873 <?php
944 874 }
945 875 do_action( 'visualizer_chart_schedules_spl', 'json', $chart_id, 1 );
946 876 ?>
@@ -971,9 +901,9 @@
971 901 </li>
972 902 <!-- import from chart -->
973 903 <li class="viz-group viz-import-from-other <?php echo apply_filters( 'visualizer_pro_upsell_class', 'only-pro-feature' ); ?>">
974 904 <h2 class="viz-group-title viz-sub-group"
975 - data-current="chart" role="button" tabindex="0"><?php _e( 'Import from other chart', 'visualizer' ); ?><span
905 + data-current="chart"><?php _e( 'Import from other chart', 'visualizer' ); ?><span
976 906 class="dashicons dashicons-lock"></span></h2>
977 907 <div class="viz-group-content edit-data-content">
978 908 <div>
979 909 <p class="viz-group-description"><?php _e( 'You can import here data from your previously created charts', 'visualizer' ); ?></p>
@@ -983,9 +913,9 @@
983 913 $fetch_link = esc_url(
984 914 add_query_arg(
985 915 array(
986 916 'action' => Visualizer_Module::is_pro() ? Visualizer_Pro::ACTION_FETCH_DATA : '',
987 - 'nonce' => Visualizer_Module::is_pro() ? wp_create_nonce( Visualizer_Pro::ACTION_FETCH_DATA ) : wp_create_nonce(),
917 + 'nonce' => wp_create_nonce(),
988 918 ),
989 919 admin_url( 'admin-ajax.php' )
990 920 )
991 921 );
@@ -1020,12 +950,12 @@
1020 950
1021 951 </select>
1022 952 </form>
1023 953 <input type="button" id="existing-chart" class="button button-primary"
1024 - value="<?php _e( 'Import Chart', 'visualizer' ); ?>"
1025 - data-viz-link="<?php echo $fetch_link; ?>">
954 + value="<?php _e( 'Import Chart', 'visualizer' ); ?>"
955 + data-viz-link="<?php echo $fetch_link; ?>">
1026 956 <?php
1027 - if ( ! Visualizer_Module_Admin::proFeaturesEnabled() ) {
957 + if ( ! Visualizer_Module_Admin::proFeaturesLocked() ) {
1028 958 echo apply_filters( 'visualizer_pro_upsell', '', 'import-chart' );
1029 959 }
1030 960 ?>
1031 961 </div>
@@ -1043,54 +973,41 @@
1043 973 )
1044 974 );
1045 975 ?>
1046 976 <!-- import from WordPress -->
1047 - <li class="viz-group visualizer_source_query_wp <?php echo esc_attr( apply_filters( 'visualizer_pro_upsell_class', 'only-pro-feature', 'import-wp' ) ); ?> ">
1048 - <h2 class="viz-group-title viz-sub-group" role="button" tabindex="0"><?php _e( 'Import from WordPress', 'visualizer' ); ?><span
977 + <li class="viz-group visualizer_source_query_wp <?php echo apply_filters( 'visualizer_pro_upsell_class', 'only-pro-feature', 'import-wp' ); ?> ">
978 + <h2 class="viz-group-title viz-sub-group"><?php _e( 'Import from WordPress', 'visualizer' ); ?><span
1049 979 class="dashicons dashicons-lock"></span></h2>
1050 980 <div class="viz-group-content edit-data-content">
1051 981 <div>
1052 982 <p class="viz-group-description"><?php _e( 'You can import data from WordPress here.', 'visualizer' ); ?></p>
1053 - <form id="vz-filter-wizard" action="<?php echo esc_url( $save_filter ); ?>" method="post" target="thehole">
983 + <form id="vz-filter-wizard" action="<?php echo $save_filter; ?>" method="post" target="thehole">
984 + <p class="viz-group-description"><?php _e( 'How often do you want to refresh the data from WordPress.', 'visualizer' ); ?></p>
985 + <select name="refresh" id="vz-filter-import-time" class="visualizer-select">
1054 986 <?php
1055 - $is_wp_source = 'visualizer_source_query_wp' === $source_of_chart;
1056 - $hours = get_post_meta( $chart_id, Visualizer_Plugin::CF_DB_SCHEDULE, true );
1057 - $bttn_label = $is_wp_source ? '1. ' . __( 'Modify Data Source', 'visualizer' ) : '1. ' . __( 'Choose Data Source', 'visualizer' );
987 + $bttn_label = 'visualizer_source_query_wp' === $source_of_chart ? __( 'Modify Filter', 'visualizer' ) : __( 'Create Filter', 'visualizer' );
988 + $hours = get_post_meta( $chart_id, Visualizer_Plugin::CF_DB_SCHEDULE, true );
989 + $schedules = apply_filters(
990 + 'visualizer_chart_schedules', array(
991 + '-1' => __( 'One-time', 'visualizer' ),
992 + ),
993 + 'wp',
994 + $chart_id
995 + );
996 + foreach ( $schedules as $num => $name ) {
997 + $extra = self::is_hour_selected( $hours, $num ) ? 'selected' : '';
998 + ?>
999 + <option value="<?php echo $num; ?>" <?php echo $extra; ?>><?php echo $name; ?></option>
1000 + <?php
1001 + }
1002 + do_action( 'visualizer_chart_schedules_spl', 'wp', $chart_id, 1 );
1058 1003 ?>
1004 + </select>
1059 1005
1060 - <!-- Step 1: Choose / modify data source -->
1061 - <input type="button" id="filter-chart-button" class="button button-secondary show-chart-toggle vz-import-step-btn" value="<?php echo esc_attr( $bttn_label ); ?>" data-current="chart" data-t-filter="<?php esc_attr_e( 'Show Chart', 'visualizer' ); ?>" data-t-chart="<?php echo esc_attr( $bttn_label ); ?>">
1062 -
1063 - <!-- Step 2: Sync schedule toggle -->
1064 - <div id="vz-wp-sync-step">
1065 - <button type="button" id="vz-wp-sync-btn" class="vz-import-step-toggle" aria-expanded="<?php echo $is_wp_source ? 'true' : 'false'; ?>">
1066 - <?php echo '2. ' . __( 'Set Sync Schedule', 'visualizer' ); ?>
1067 - <span class="dashicons dashicons-arrow-down-alt2"></span>
1068 - </button>
1069 - <div id="vz-wp-sync-options"<?php echo $is_wp_source ? '' : ' style="display:none"'; ?>>
1070 - <select name="refresh" id="vz-filter-import-time" class="visualizer-select">
1071 - <?php
1072 - $schedules = apply_filters(
1073 - 'visualizer_chart_schedules', array(
1074 - '-1' => __( 'One-time', 'visualizer' ),
1075 - ),
1076 - 'wp',
1077 - $chart_id
1078 - );
1079 - foreach ( $schedules as $num => $name ) {
1080 - $extra = self::is_hour_selected( $hours, $num ) ? 'selected' : '';
1081 - ?>
1082 - <option value="<?php echo esc_attr( $num ); ?>" <?php echo esc_attr( $extra ); ?>><?php echo esc_html( $name ); ?></option>
1083 - <?php
1084 - }
1085 - do_action( 'visualizer_chart_schedules_spl', 'wp', $chart_id, 1 );
1086 - ?>
1087 - </select>
1088 - <input type="button" id="db-filter-save-button" class="button button-primary" value="<?php _e( 'Save Schedule', 'visualizer' ); ?>">
1089 - </div>
1090 - </div>
1006 + <input type="button" id="filter-chart-button" class="button button-secondary show-chart-toggle" value="<?php echo $bttn_label; ?>" data-current="chart" data-t-filter="<?php _e( 'Show Chart', 'visualizer' ); ?>" data-t-chart="<?php echo $bttn_label; ?>">
1007 + <input type="button" id="db-filter-save-button" class="button button-primary" value="<?php _e( 'Save Schedule', 'visualizer' ); ?>">
1091 1008 </form>
1092 - <?php echo apply_filters( 'visualizer_pro_upsell', '', 'import-wp', 'https://docs.themeisle.com/article/1278-how-to-import-data-from-wordpress' ); ?>
1009 + <?php echo apply_filters( 'visualizer_pro_upsell', '', 'import-wp' ); ?>
1093 1010 </div>
1094 1011 </div>
1095 1012 </li>
1096 1013
@@ -1132,9 +1049,9 @@
1132 1049 )
1133 1050 );
1134 1051 ?>
1135 1052 <li class="viz-group visualizer_woocommerce_source<?php echo 'visualizer_source_json_wc' === $source_of_chart ? ' open' : ''; ?> <?php echo apply_filters( 'visualizer_pro_upsell_class', 'only-pro-feature', 'import-wc-report' ); ?> ">
1136 - <h2 class="viz-group-title viz-sub-group" role="button" tabindex="0"><?php _e( 'Import from WooCommerce Reports', 'visualizer' ); ?><span class="dashicons dashicons-lock"></span></h2>
1053 + <h2 class="viz-group-title viz-sub-group"><?php _e( 'Import from WooCommerce Reports', 'visualizer' ); ?><span class="dashicons dashicons-lock"></span></h2>
1137 1054 <div class="viz-group-content edit-data-content">
1138 1055 <div>
1139 1056 <p class="viz-group-description"><?php _e( 'You can choose here to import/synchronize your chart data with a WooCommerce report API. For more info check <a href="https://woocommerce.github.io/woocommerce-rest-api-docs/?shell#reports" target="_blank" >this</a> tutorial', 'visualizer' ); ?></p>
1140 1057 <form id="vz-import-woo-report" action="<?php echo $upload_link; ?>" method="post" target="thehole" enctype="multipart/form-data">
@@ -1155,9 +1072,9 @@
1155 1072 );
1156 1073 foreach ( $schedules as $num => $name ) {
1157 1074 $extra = self::is_hour_selected( $hours, $num ) ? 'selected' : '';
1158 1075 ?>
1159 - <option value="<?php echo esc_attr( $num ); ?>" <?php echo esc_attr( $extra ); ?>><?php echo esc_html( $name ); ?></option>
1076 + <option value="<?php echo $num; ?>" <?php echo $extra; ?>><?php echo $name; ?></option>
1160 1077 <?php
1161 1078 }
1162 1079 do_action( 'visualizer_chart_schedules_spl', 'json', $chart_id, 1 );
1163 1080 ?>
@@ -1202,54 +1119,41 @@
1202 1119 )
1203 1120 );
1204 1121 ?>
1205 1122 <!-- import from db -->
1206 - <li class="viz-group visualizer_source_query <?php echo esc_attr( apply_filters( 'visualizer_pro_upsell_class', 'only-pro-feature', 'db-query' ) ); ?>">
1207 - <h2 class="viz-group-title viz-sub-group" role="button" tabindex="0"><?php _e( 'Import from database', 'visualizer' ); ?><span
1123 + <li class="viz-group visualizer_source_query <?php echo apply_filters( 'visualizer_pro_upsell_class', 'only-pro-feature', 'db-query' ); ?>">
1124 + <h2 class="viz-group-title viz-sub-group"><?php _e( 'Import from database', 'visualizer' ); ?><span
1208 1125 class="dashicons dashicons-lock"></span></h2>
1209 1126 <div class="viz-group-content edit-data-content">
1210 1127 <div>
1211 1128 <p class="viz-group-description"><?php _e( 'You can import data from the database here.', 'visualizer' ); ?></p>
1212 - <form id="vz-db-wizard" action="<?php echo esc_url( $save_query ); ?>" method="post" target="thehole">
1129 + <form id="vz-db-wizard" action="<?php echo $save_query; ?>" method="post" target="thehole">
1130 + <p class="viz-group-description"><?php _e( 'How often do you want to refresh the data from the database.', 'visualizer' ); ?></p>
1131 + <select name="refresh" id="vz-db-import-time" class="visualizer-select">
1213 1132 <?php
1214 - $is_db_source = 'visualizer_source_query' === $source_of_chart;
1215 - $hours = get_post_meta( $chart_id, Visualizer_Plugin::CF_DB_SCHEDULE, true );
1216 - $bttn_label = $is_db_source ? __( '1. Modify Data Source', 'visualizer' ) : __( '1. Choose Data Source', 'visualizer' );
1133 + $bttn_label = 'visualizer_source_query' === $source_of_chart ? __( 'Modify Query', 'visualizer' ) : __( 'Create Query', 'visualizer' );
1134 + $hours = get_post_meta( $chart_id, Visualizer_Plugin::CF_DB_SCHEDULE, true );
1135 + $schedules = apply_filters(
1136 + 'visualizer_chart_schedules', array(
1137 + '-1' => __( 'One-time', 'visualizer' ),
1138 + ),
1139 + 'db',
1140 + $chart_id
1141 + );
1142 + foreach ( $schedules as $num => $name ) {
1143 + $extra = self::is_hour_selected( $hours, $num ) ? 'selected' : '';
1144 + ?>
1145 + <option value="<?php echo $num; ?>" <?php echo $extra; ?>><?php echo $name; ?></option>
1146 + <?php
1147 + }
1148 + do_action( 'visualizer_chart_schedules_spl', 'db', $chart_id, 1 );
1217 1149 ?>
1218 -
1219 - <!-- Step 1: Choose / modify data source -->
1150 + </select>
1220 1151 <input type="hidden" name="params" id="viz-db-wizard-params">
1221 - <input type="button" id="db-chart-button" class="button button-secondary show-chart-toggle vz-import-step-btn" value="<?php echo esc_attr( $bttn_label ); ?>" data-current="chart" data-t-filter="<?php esc_attr_e( 'Show Chart', 'visualizer' ); ?>" data-t-chart="<?php echo esc_attr( $bttn_label ); ?>">
1222 1152
1223 - <!-- Step 2: Sync schedule toggle -->
1224 - <div id="vz-db-sync-step">
1225 - <button type="button" id="vz-db-sync-btn" class="vz-import-step-toggle" aria-expanded="<?php echo $is_db_source ? 'true' : 'false'; ?>">
1226 - <?php echo '2. ' . __( 'Set Sync Schedule', 'visualizer' ); ?>
1227 - <span class="dashicons dashicons-arrow-down-alt2"></span>
1228 - </button>
1229 - <div id="vz-db-sync-options"<?php echo $is_db_source ? '' : ' style="display:none"'; ?>>
1230 - <select name="refresh" id="vz-db-import-time" class="visualizer-select">
1231 - <?php
1232 - $schedules = apply_filters(
1233 - 'visualizer_chart_schedules', array(
1234 - '-1' => __( 'One-time', 'visualizer' ),
1235 - ),
1236 - 'db',
1237 - $chart_id
1238 - );
1239 - foreach ( $schedules as $num => $name ) {
1240 - $extra = self::is_hour_selected( $hours, $num ) ? 'selected' : '';
1241 - ?>
1242 - <option value="<?php echo esc_attr( $num ); ?>" <?php echo esc_attr( $extra ); ?>><?php echo esc_html( $name ); ?></option>
1243 - <?php
1244 - }
1245 - do_action( 'visualizer_chart_schedules_spl', 'db', $chart_id, 1 );
1246 - ?>
1247 - </select>
1248 - <input type="button" id="db-chart-save-button" class="button button-primary" value="<?php _e( 'Save Schedule', 'visualizer' ); ?>">
1249 - </div>
1250 - </div>
1251 - <?php echo apply_filters( 'visualizer_pro_upsell', '', 'db-query', 'https://docs.themeisle.com/article/1279-how-to-import-data-from-a-database' ); ?>
1153 + <input type="button" id="db-chart-button" class="button button-secondary show-chart-toggle" value="<?php echo $bttn_label; ?>" data-current="chart" data-t-filter="<?php _e( 'Show Chart', 'visualizer' ); ?>" data-t-chart="<?php echo $bttn_label; ?>">
1154 + <input type="button" id="db-chart-save-button" class="button button-primary" value="<?php _e( 'Save Schedule', 'visualizer' ); ?>">
1155 + <?php echo apply_filters( 'visualizer_pro_upsell', '', 'db-query' ); ?>
1252 1156 </form>
1253 1157 </div>
1254 1158 </div>
1255 1159 </li>