PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.11.7
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.11.7
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/Layout.php +87 -178 4.0.53.11.7 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>
@@ -197,18 +179,9 @@
197 179 <div>
198 180 <form id="json-endpoint-form">
199 181 <div class="json-wizard-hints">
200 182 <ul class="info">
201 - <li>
202 - <?php
203 - echo sprintf(
204 - // translators: %1$s - HTML link tag, %2$s - HTML closing link tag.
205 - __( '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' ),
206 - '<a href="https://docs.themeisle.com/article/1043-visualizer-how-to-extend-rest-endpoints-with-json-response" target="_blank">',
207 - '</a>'
208 - );
209 - ?>
210 - </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>
211 184 </ul>
212 185 </div>
213 186
214 187 <input
@@ -359,9 +332,9 @@
359 332 $action = esc_url(
360 333 add_query_arg(
361 334 array(
362 335 'action' => Visualizer_Plugin::ACTION_UPLOAD_DATA,
363 - 'nonce' => wp_create_nonce( 'visualizer-upload-data' ),
336 + 'nonce' => wp_create_nonce(),
364 337 'chart' => $chart_id,
365 338 ),
366 339 admin_url( 'admin-ajax.php' )
367 340 )
@@ -389,8 +362,9 @@
389 362 <?php Visualizer_Render_Layout::show( 'text-editor', $chart_id ); ?>
390 363
391 364 </div>
392 365 <?php
366 +
393 367 }
394 368
395 369 /**
396 370 * Show the text area editor.
@@ -530,9 +504,9 @@
530 504 private static function _renderPermissions( $args ) {
531 505 $chart_id = $args[1];
532 506
533 507 // ignore for unit tests because Travis throws the error "Indirect modification of overloaded property Visualizer_Render_Page_Data::$permissions has no effect".
534 - if ( defined( 'WP_TESTS_DOMAIN' ) && function_exists( 'tests_add_filter' ) ) {
508 + if ( defined( 'WP_TESTS_DOMAIN' ) ) {
535 509 return;
536 510 }
537 511
538 512 $permissions = apply_filters( 'visualizer_pro_get_permissions', null, $chart_id );
@@ -615,9 +589,9 @@
615 589 true,
616 590 array( 'visualizer-permission', 'visualizer-permission-specific', 'visualizer-permission-edit-specific' )
617 591 );
618 592 Visualizer_Render_Sidebar::_renderSectionEnd();
619 - 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' );
620 594 echo '</div>';
621 595 Visualizer_Render_Sidebar::_renderGroupEnd();
622 596 }
623 597
@@ -687,22 +661,12 @@
687 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>
688 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>
689 663 <?php
690 664 Visualizer_Render_Sidebar::_renderSectionEnd();
691 - // translators: %s - the chart type.
692 665 Visualizer_Render_Sidebar::_renderSectionStart( sprintf( __( '%s chart', 'visualizer' ), ucwords( $displayType ) ), true );
693 666 ?>
694 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>
695 - <h4><span class="dashicons dashicons-search"></span><a href="<?php echo str_replace( '#', $type, VISUALIZER_DOC_COLLECTION ); ?>" target="_blank">
696 - <?php
697 - echo sprintf(
698 - // translators: %s - the chart type.
699 - __( 'Articles containing "%s"', 'visualizer' ),
700 - $displayType
701 - );
702 - ?>
703 - </a>
704 - </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>
705 669 <?php
706 670 Visualizer_Render_Sidebar::_renderSectionEnd();
707 671 Visualizer_Render_Sidebar::_renderGroupEnd();
708 672 ?>
@@ -724,9 +688,9 @@
724 688 $upload_link = esc_url(
725 689 add_query_arg(
726 690 array(
727 691 'action' => Visualizer_Plugin::ACTION_UPLOAD_DATA,
728 - 'nonce' => wp_create_nonce( 'visualizer-upload-data' ),
692 + 'nonce' => wp_create_nonce(),
729 693 'chart' => $chart_id,
730 694 ),
731 695 admin_url( 'admin-ajax.php' )
732 696 )
@@ -761,9 +725,9 @@
761 725 <ul class="viz-group-content">
762 726 <ul class="viz-group-wrapper">
763 727 <!-- manual -->
764 728 <li class="viz-group visualizer_source_manual">
765 - <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>
766 730 <div class="viz-group-content edit-data-content">
767 731 <form id="editor-form" action="<?php echo $upload_link; ?>" method="post" target="thehole">
768 732 <input type="hidden" id="chart-data" name="chart_data">
769 733 <input type="hidden" id="chart-data-src" name="chart_data_src">
@@ -785,22 +749,22 @@
785 749 <?php _e( 'editor to manually edit the chart data.', 'visualizer' ); ?>
786 750 </p>
787 751 <input type="button" id="editor-undo" class="button button-secondary" style="display: none" value="<?php _e( 'Undo Changes', 'visualizer' ); ?>">
788 752 <input type="button" id="editor-button" class="button button-primary "
789 - value="<?php _e( 'Edit Data', 'visualizer' ); ?>" data-current="chart"
790 - data-t-editor="<?php _e( 'Show Chart', 'visualizer' ); ?>"
791 - 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' ); ?>"
792 756 >
793 - <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>
794 758 </div>
795 759 <?php } else { ?>
796 760 <input type="button" id="editor-undo" class="button button-secondary" style="display: none" value="<?php _e( 'Undo Changes', 'visualizer' ); ?>">
797 761 <input type="button" id="editor-chart-button" class="button button-primary "
798 - value="<?php _e( 'View Editor', 'visualizer' ); ?>" data-current="chart"
799 - data-t-editor="<?php _e( 'Show Chart', 'visualizer' ); ?>"
800 - 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' ); ?>"
801 765 >
802 - <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>
803 767 <?php } ?>
804 768 </form>
805 769 </div>
806 770 </li>
@@ -806,28 +770,18 @@
806 770 </li>
807 771
808 772 <!-- import from file -->
809 773 <li class="viz-group visualizer_source_csv <?php echo apply_filters( 'visualizer_pro_upsell_class', 'only-pro-feature', 'import-file' ); ?> ">
810 - <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>
811 775 <div class="viz-group-content">
812 776 <div>
813 - <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>
814 - <p class="viz-group-description viz-info-msg">
815 - <b>
816 - <?php
817 - echo sprintf(
818 - // translators: $s - the chart type with the link attached.
819 - __( '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' ),
820 - '<a href="' . VISUALIZER_ABSURL . 'samples/' . $type . '.csv" target="_blank">' . $type . '.csv</a>'
821 - );
822 - ?>
823 - </b>
824 - </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>
825 779 <form id="vz-csv-file-form" action="<?php echo $upload_link; ?>" method="post"
826 780 target="thehole" enctype="multipart/form-data">
827 781 <input type="hidden" id="remote-data" name="remote_data">
828 782 <div class="">
829 - <input type="file" id="csv-file" name="local_data" accept=".csv,.xlsx">
783 + <input type="file" id="csv-file" name="local_data">
830 784 </div>
831 785 <input type="button" class="button button-primary" id="vz-import-file"
832 786 value="<?php _e( 'Import', 'visualizer' ); ?>">
833 787 </form>
@@ -836,40 +790,21 @@
836 790 </div>
837 791 </li>
838 792 <!-- import from url -->
839 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' ); ?> ">
840 - <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>
841 795 <ul class="viz-group-content">
842 796 <!-- import from csv url -->
843 797 <li class="viz-subsection">
844 - <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>
845 799 <div class="only-pro-anchor">
846 800 <div class="viz-section-items section-items">
847 - <p class="viz-group-description">
848 - <?php
849 - echo sprintf(
850 - // translators: %1$s - HTML link tag, %2$s - HTML closing link tag.
851 - __( 'You can use this to import data from a remote CSV or Excel (XLSX) file, or %1$sGoogle Spreadsheet%2$s.', 'visualizer' ),
852 - '<a href="https://docs.themeisle.com/article/607-how-can-i-populate-data-from-google-spreadsheet" target="_blank" >',
853 - '</a>'
854 - );
855 - ?>
856 - </p>
857 - <p class="viz-group-description viz-info-msg">
858 - <b>
859 - <?php
860 - echo sprintf(
861 - // translators: %s - the chart type with the link attached.
862 - __( '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' ),
863 - '<a href="' . VISUALIZER_ABSURL . 'samples/' . $type . '.csv" target="_blank">' . $type . '.csv</a>'
864 - );
865 - ?>
866 - </b>
867 - </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>
868 803 <form id="vz-one-time-import" action="<?php echo $upload_link; ?>" method="post"
869 804 target="thehole" enctype="multipart/form-data">
870 805 <div class="remote-file-section">
871 - <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">
872 807 </div>
873 808 <select name="vz-import-time" id="vz-import-time" class="visualizer-select">
874 809 <?php
875 810 $hours = get_post_meta( $chart_id, Visualizer_Plugin::CF_CHART_SCHEDULE, true );
@@ -883,9 +818,9 @@
883 818 foreach ( $schedules as $num => $name ) {
884 819 // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
885 820 $extra = self::is_hour_selected( $hours, $num ) ? 'selected' : '';
886 821 ?>
887 - <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>
888 823 <?php
889 824 }
890 825 do_action( 'visualizer_chart_schedules_spl', 'csv', $chart_id, 1 );
891 826 ?>
@@ -908,9 +843,9 @@
908 843 </div>
909 844 </li>
910 845 <!-- import from json url -->
911 846 <li class="viz-subsection">
912 - <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>
913 848 <div class="only-pro-anchor">
914 849 <div class="viz-section-items section-items">
915 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>
916 851 <form id="vz-import-json" action="<?php echo $upload_link; ?>" method="post" target="thehole" enctype="multipart/form-data">
@@ -933,9 +868,9 @@
933 868 foreach ( $schedules as $num => $name ) {
934 869 // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
935 870 $extra = self::is_hour_selected( $hours, $num ) ? 'selected' : '';
936 871 ?>
937 - <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>
938 873 <?php
939 874 }
940 875 do_action( 'visualizer_chart_schedules_spl', 'json', $chart_id, 1 );
941 876 ?>
@@ -966,9 +901,9 @@
966 901 </li>
967 902 <!-- import from chart -->
968 903 <li class="viz-group viz-import-from-other <?php echo apply_filters( 'visualizer_pro_upsell_class', 'only-pro-feature' ); ?>">
969 904 <h2 class="viz-group-title viz-sub-group"
970 - 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
971 906 class="dashicons dashicons-lock"></span></h2>
972 907 <div class="viz-group-content edit-data-content">
973 908 <div>
974 909 <p class="viz-group-description"><?php _e( 'You can import here data from your previously created charts', 'visualizer' ); ?></p>
@@ -978,9 +913,9 @@
978 913 $fetch_link = esc_url(
979 914 add_query_arg(
980 915 array(
981 916 'action' => Visualizer_Module::is_pro() ? Visualizer_Pro::ACTION_FETCH_DATA : '',
982 - 'nonce' => Visualizer_Module::is_pro() ? wp_create_nonce( Visualizer_Pro::ACTION_FETCH_DATA ) : wp_create_nonce(),
917 + 'nonce' => wp_create_nonce(),
983 918 ),
984 919 admin_url( 'admin-ajax.php' )
985 920 )
986 921 );
@@ -1015,12 +950,12 @@
1015 950
1016 951 </select>
1017 952 </form>
1018 953 <input type="button" id="existing-chart" class="button button-primary"
1019 - value="<?php _e( 'Import Chart', 'visualizer' ); ?>"
1020 - data-viz-link="<?php echo $fetch_link; ?>">
954 + value="<?php _e( 'Import Chart', 'visualizer' ); ?>"
955 + data-viz-link="<?php echo $fetch_link; ?>">
1021 956 <?php
1022 - if ( ! Visualizer_Module_Admin::proFeaturesEnabled() ) {
957 + if ( ! Visualizer_Module_Admin::proFeaturesLocked() ) {
1023 958 echo apply_filters( 'visualizer_pro_upsell', '', 'import-chart' );
1024 959 }
1025 960 ?>
1026 961 </div>
@@ -1038,54 +973,41 @@
1038 973 )
1039 974 );
1040 975 ?>
1041 976 <!-- import from WordPress -->
1042 - <li class="viz-group visualizer_source_query_wp <?php echo esc_attr( apply_filters( 'visualizer_pro_upsell_class', 'only-pro-feature', 'import-wp' ) ); ?> ">
1043 - <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
1044 979 class="dashicons dashicons-lock"></span></h2>
1045 980 <div class="viz-group-content edit-data-content">
1046 981 <div>
1047 982 <p class="viz-group-description"><?php _e( 'You can import data from WordPress here.', 'visualizer' ); ?></p>
1048 - <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">
1049 986 <?php
1050 - $is_wp_source = 'visualizer_source_query_wp' === $source_of_chart;
1051 - $hours = get_post_meta( $chart_id, Visualizer_Plugin::CF_DB_SCHEDULE, true );
1052 - $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 );
1053 1003 ?>
1004 + </select>
1054 1005
1055 - <!-- Step 1: Choose / modify data source -->
1056 - <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 ); ?>">
1057 -
1058 - <!-- Step 2: Sync schedule toggle -->
1059 - <div id="vz-wp-sync-step">
1060 - <button type="button" id="vz-wp-sync-btn" class="vz-import-step-toggle" aria-expanded="<?php echo $is_wp_source ? 'true' : 'false'; ?>">
1061 - <?php echo '2. ' . __( 'Set Sync Schedule', 'visualizer' ); ?>
1062 - <span class="dashicons dashicons-arrow-down-alt2"></span>
1063 - </button>
1064 - <div id="vz-wp-sync-options"<?php echo $is_wp_source ? '' : ' style="display:none"'; ?>>
1065 - <select name="refresh" id="vz-filter-import-time" class="visualizer-select">
1066 - <?php
1067 - $schedules = apply_filters(
1068 - 'visualizer_chart_schedules', array(
1069 - '-1' => __( 'One-time', 'visualizer' ),
1070 - ),
1071 - 'wp',
1072 - $chart_id
1073 - );
1074 - foreach ( $schedules as $num => $name ) {
1075 - $extra = self::is_hour_selected( $hours, $num ) ? 'selected' : '';
1076 - ?>
1077 - <option value="<?php echo esc_attr( $num ); ?>" <?php echo esc_attr( $extra ); ?>><?php echo esc_html( $name ); ?></option>
1078 - <?php
1079 - }
1080 - do_action( 'visualizer_chart_schedules_spl', 'wp', $chart_id, 1 );
1081 - ?>
1082 - </select>
1083 - <input type="button" id="db-filter-save-button" class="button button-primary" value="<?php _e( 'Save Schedule', 'visualizer' ); ?>">
1084 - </div>
1085 - </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' ); ?>">
1086 1008 </form>
1087 - <?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' ); ?>
1088 1010 </div>
1089 1011 </div>
1090 1012 </li>
1091 1013
@@ -1127,9 +1049,9 @@
1127 1049 )
1128 1050 );
1129 1051 ?>
1130 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' ); ?> ">
1131 - <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>
1132 1054 <div class="viz-group-content edit-data-content">
1133 1055 <div>
1134 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>
1135 1057 <form id="vz-import-woo-report" action="<?php echo $upload_link; ?>" method="post" target="thehole" enctype="multipart/form-data">
@@ -1150,9 +1072,9 @@
1150 1072 );
1151 1073 foreach ( $schedules as $num => $name ) {
1152 1074 $extra = self::is_hour_selected( $hours, $num ) ? 'selected' : '';
1153 1075 ?>
1154 - <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>
1155 1077 <?php
1156 1078 }
1157 1079 do_action( 'visualizer_chart_schedules_spl', 'json', $chart_id, 1 );
1158 1080 ?>
@@ -1197,54 +1119,41 @@
1197 1119 )
1198 1120 );
1199 1121 ?>
1200 1122 <!-- import from db -->
1201 - <li class="viz-group visualizer_source_query <?php echo esc_attr( apply_filters( 'visualizer_pro_upsell_class', 'only-pro-feature', 'db-query' ) ); ?>">
1202 - <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
1203 1125 class="dashicons dashicons-lock"></span></h2>
1204 1126 <div class="viz-group-content edit-data-content">
1205 1127 <div>
1206 1128 <p class="viz-group-description"><?php _e( 'You can import data from the database here.', 'visualizer' ); ?></p>
1207 - <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">
1208 1132 <?php
1209 - $is_db_source = 'visualizer_source_query' === $source_of_chart;
1210 - $hours = get_post_meta( $chart_id, Visualizer_Plugin::CF_DB_SCHEDULE, true );
1211 - $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 );
1212 1149 ?>
1213 -
1214 - <!-- Step 1: Choose / modify data source -->
1150 + </select>
1215 1151 <input type="hidden" name="params" id="viz-db-wizard-params">
1216 - <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 ); ?>">
1217 1152
1218 - <!-- Step 2: Sync schedule toggle -->
1219 - <div id="vz-db-sync-step">
1220 - <button type="button" id="vz-db-sync-btn" class="vz-import-step-toggle" aria-expanded="<?php echo $is_db_source ? 'true' : 'false'; ?>">
1221 - <?php echo '2. ' . __( 'Set Sync Schedule', 'visualizer' ); ?>
1222 - <span class="dashicons dashicons-arrow-down-alt2"></span>
1223 - </button>
1224 - <div id="vz-db-sync-options"<?php echo $is_db_source ? '' : ' style="display:none"'; ?>>
1225 - <select name="refresh" id="vz-db-import-time" class="visualizer-select">
1226 - <?php
1227 - $schedules = apply_filters(
1228 - 'visualizer_chart_schedules', array(
1229 - '-1' => __( 'One-time', 'visualizer' ),
1230 - ),
1231 - 'db',
1232 - $chart_id
1233 - );
1234 - foreach ( $schedules as $num => $name ) {
1235 - $extra = self::is_hour_selected( $hours, $num ) ? 'selected' : '';
1236 - ?>
1237 - <option value="<?php echo esc_attr( $num ); ?>" <?php echo esc_attr( $extra ); ?>><?php echo esc_html( $name ); ?></option>
1238 - <?php
1239 - }
1240 - do_action( 'visualizer_chart_schedules_spl', 'db', $chart_id, 1 );
1241 - ?>
1242 - </select>
1243 - <input type="button" id="db-chart-save-button" class="button button-primary" value="<?php _e( 'Save Schedule', 'visualizer' ); ?>">
1244 - </div>
1245 - </div>
1246 - <?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' ); ?>
1247 1156 </form>
1248 1157 </div>
1249 1158 </div>
1250 1159 </li>