PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.11.14
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.11.14
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 +81 -106 4.0.73.11.14 View file →
@@ -359,9 +359,9 @@
359 359 $action = esc_url(
360 360 add_query_arg(
361 361 array(
362 362 'action' => Visualizer_Plugin::ACTION_UPLOAD_DATA,
363 - 'nonce' => wp_create_nonce( 'visualizer-upload-data' ),
363 + 'nonce' => wp_create_nonce(),
364 364 'chart' => $chart_id,
365 365 ),
366 366 admin_url( 'admin-ajax.php' )
367 367 )
@@ -389,8 +389,9 @@
389 389 <?php Visualizer_Render_Layout::show( 'text-editor', $chart_id ); ?>
390 390
391 391 </div>
392 392 <?php
393 +
393 394 }
394 395
395 396 /**
396 397 * Show the text area editor.
@@ -530,9 +531,9 @@
530 531 private static function _renderPermissions( $args ) {
531 532 $chart_id = $args[1];
532 533
533 534 // 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' ) ) {
535 + if ( defined( 'WP_TESTS_DOMAIN' ) ) {
535 536 return;
536 537 }
537 538
538 539 $permissions = apply_filters( 'visualizer_pro_get_permissions', null, $chart_id );
@@ -615,9 +616,9 @@
615 616 true,
616 617 array( 'visualizer-permission', 'visualizer-permission-specific', 'visualizer-permission-edit-specific' )
617 618 );
618 619 Visualizer_Render_Sidebar::_renderSectionEnd();
619 - echo apply_filters( 'visualizer_pro_upsell', '', 'chart-permissions', 'https://docs.themeisle.com/article/1280-how-to-customize-permissions' );
620 + echo apply_filters( 'visualizer_pro_upsell', '', 'chart-permissions' );
620 621 echo '</div>';
621 622 Visualizer_Render_Sidebar::_renderGroupEnd();
622 623 }
623 624
@@ -724,9 +725,9 @@
724 725 $upload_link = esc_url(
725 726 add_query_arg(
726 727 array(
727 728 'action' => Visualizer_Plugin::ACTION_UPLOAD_DATA,
728 - 'nonce' => wp_create_nonce( 'visualizer-upload-data' ),
729 + 'nonce' => wp_create_nonce(),
729 730 'chart' => $chart_id,
730 731 ),
731 732 admin_url( 'admin-ajax.php' )
732 733 )
@@ -761,9 +762,9 @@
761 762 <ul class="viz-group-content">
762 763 <ul class="viz-group-wrapper">
763 764 <!-- manual -->
764 765 <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>
766 + <h2 class="viz-group-title viz-sub-group visualizer-editor-tab" data-current="chart"><?php _e( 'Manual Data', 'visualizer' ); ?></h2>
766 767 <div class="viz-group-content edit-data-content">
767 768 <form id="editor-form" action="<?php echo $upload_link; ?>" method="post" target="thehole">
768 769 <input type="hidden" id="chart-data" name="chart_data">
769 770 <input type="hidden" id="chart-data-src" name="chart_data_src">
@@ -785,22 +786,22 @@
785 786 <?php _e( 'editor to manually edit the chart data.', 'visualizer' ); ?>
786 787 </p>
787 788 <input type="button" id="editor-undo" class="button button-secondary" style="display: none" value="<?php _e( 'Undo Changes', 'visualizer' ); ?>">
788 789 <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' ); ?>"
790 + value="<?php _e( 'Edit Data', 'visualizer' ); ?>" data-current="chart"
791 + data-t-editor="<?php _e( 'Show Chart', 'visualizer' ); ?>"
792 + data-t-chart="<?php _e( 'Edit Data', 'visualizer' ); ?>"
792 793 >
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>
794 + <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 795 </div>
795 796 <?php } else { ?>
796 797 <input type="button" id="editor-undo" class="button button-secondary" style="display: none" value="<?php _e( 'Undo Changes', 'visualizer' ); ?>">
797 798 <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' ); ?>"
799 + value="<?php _e( 'View Editor', 'visualizer' ); ?>" data-current="chart"
800 + data-t-editor="<?php _e( 'Show Chart', 'visualizer' ); ?>"
801 + data-t-chart="<?php _e( 'View Editor', 'visualizer' ); ?>"
801 802 >
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>
803 + <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 804 <?php } ?>
804 805 </form>
805 806 </div>
806 807 </li>
@@ -806,12 +807,12 @@
806 807 </li>
807 808
808 809 <!-- import from file -->
809 810 <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>
811 + <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 812 <div class="viz-group-content">
812 813 <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"><?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>
814 815 <p class="viz-group-description viz-info-msg">
815 816 <b>
816 817 <?php
817 818 echo sprintf(
@@ -825,9 +826,9 @@
825 826 <form id="vz-csv-file-form" action="<?php echo $upload_link; ?>" method="post"
826 827 target="thehole" enctype="multipart/form-data">
827 828 <input type="hidden" id="remote-data" name="remote_data">
828 829 <div class="">
829 - <input type="file" id="csv-file" name="local_data" accept=".csv,.xlsx">
830 + <input type="file" id="csv-file" name="local_data">
830 831 </div>
831 832 <input type="button" class="button button-primary" id="vz-import-file"
832 833 value="<?php _e( 'Import', 'visualizer' ); ?>">
833 834 </form>
@@ -836,13 +837,13 @@
836 837 </div>
837 838 </li>
838 839 <!-- import from url -->
839 840 <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>
841 + <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 842 <ul class="viz-group-content">
842 843 <!-- import from csv url -->
843 844 <li class="viz-subsection">
844 - <span class="viz-section-title" role="button" tabindex="0"><?php _e( 'Import from CSV / XLSX', 'visualizer' ); ?></span>
845 + <span class="viz-section-title"><?php _e( 'Import from CSV', 'visualizer' ); ?></span>
845 846 <div class="only-pro-anchor">
846 847 <div class="viz-section-items section-items">
847 848 <p class="viz-group-description">
848 849 <?php
@@ -847,9 +848,9 @@
847 848 <p class="viz-group-description">
848 849 <?php
849 850 echo sprintf(
850 851 // 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 + __( 'You can use this to import data from a remote CSV file or %1$sGoogle Spreadsheet%2$s.', 'visualizer' ),
852 853 '<a href="https://docs.themeisle.com/article/607-how-can-i-populate-data-from-google-spreadsheet" target="_blank" >',
853 854 '</a>'
854 855 );
855 856 ?>
@@ -867,9 +868,9 @@
867 868 </p>
868 869 <form id="vz-one-time-import" action="<?php echo $upload_link; ?>" method="post"
869 870 target="thehole" enctype="multipart/form-data">
870 871 <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">
872 + <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 873 </div>
873 874 <select name="vz-import-time" id="vz-import-time" class="visualizer-select">
874 875 <?php
875 876 $hours = get_post_meta( $chart_id, Visualizer_Plugin::CF_CHART_SCHEDULE, true );
@@ -883,9 +884,9 @@
883 884 foreach ( $schedules as $num => $name ) {
884 885 // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
885 886 $extra = self::is_hour_selected( $hours, $num ) ? 'selected' : '';
886 887 ?>
887 - <option value="<?php echo esc_attr( $num ); ?>" <?php echo esc_attr( $extra ); ?>><?php echo esc_html( $name ); ?></option>
888 + <option value="<?php echo $num; ?>" <?php echo $extra; ?>><?php echo $name; ?></option>
888 889 <?php
889 890 }
890 891 do_action( 'visualizer_chart_schedules_spl', 'csv', $chart_id, 1 );
891 892 ?>
@@ -908,9 +909,9 @@
908 909 </div>
909 910 </li>
910 911 <!-- import from json url -->
911 912 <li class="viz-subsection">
912 - <span class="viz-section-title visualizer_source_json" role="button" tabindex="0"><?php _e( 'Import from JSON', 'visualizer' ); ?></span>
913 + <span class="viz-section-title visualizer_source_json"><?php _e( 'Import from JSON', 'visualizer' ); ?></span>
913 914 <div class="only-pro-anchor">
914 915 <div class="viz-section-items section-items">
915 916 <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 917 <form id="vz-import-json" action="<?php echo $upload_link; ?>" method="post" target="thehole" enctype="multipart/form-data">
@@ -933,9 +934,9 @@
933 934 foreach ( $schedules as $num => $name ) {
934 935 // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
935 936 $extra = self::is_hour_selected( $hours, $num ) ? 'selected' : '';
936 937 ?>
937 - <option value="<?php echo esc_attr( $num ); ?>" <?php echo esc_attr( $extra ); ?>><?php echo esc_html( $name ); ?></option>
938 + <option value="<?php echo $num; ?>" <?php echo $extra; ?>><?php echo $name; ?></option>
938 939 <?php
939 940 }
940 941 do_action( 'visualizer_chart_schedules_spl', 'json', $chart_id, 1 );
941 942 ?>
@@ -966,9 +967,9 @@
966 967 </li>
967 968 <!-- import from chart -->
968 969 <li class="viz-group viz-import-from-other <?php echo apply_filters( 'visualizer_pro_upsell_class', 'only-pro-feature' ); ?>">
969 970 <h2 class="viz-group-title viz-sub-group"
970 - data-current="chart" role="button" tabindex="0"><?php _e( 'Import from other chart', 'visualizer' ); ?><span
971 + data-current="chart"><?php _e( 'Import from other chart', 'visualizer' ); ?><span
971 972 class="dashicons dashicons-lock"></span></h2>
972 973 <div class="viz-group-content edit-data-content">
973 974 <div>
974 975 <p class="viz-group-description"><?php _e( 'You can import here data from your previously created charts', 'visualizer' ); ?></p>
@@ -978,9 +979,9 @@
978 979 $fetch_link = esc_url(
979 980 add_query_arg(
980 981 array(
981 982 '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(),
983 + 'nonce' => wp_create_nonce(),
983 984 ),
984 985 admin_url( 'admin-ajax.php' )
985 986 )
986 987 );
@@ -1015,12 +1016,12 @@
1015 1016
1016 1017 </select>
1017 1018 </form>
1018 1019 <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; ?>">
1020 + value="<?php _e( 'Import Chart', 'visualizer' ); ?>"
1021 + data-viz-link="<?php echo $fetch_link; ?>">
1021 1022 <?php
1022 - if ( ! Visualizer_Module_Admin::proFeaturesEnabled() ) {
1023 + if ( ! Visualizer_Module_Admin::proFeaturesLocked() ) {
1023 1024 echo apply_filters( 'visualizer_pro_upsell', '', 'import-chart' );
1024 1025 }
1025 1026 ?>
1026 1027 </div>
@@ -1038,54 +1039,41 @@
1038 1039 )
1039 1040 );
1040 1041 ?>
1041 1042 <!-- 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
1043 + <li class="viz-group visualizer_source_query_wp <?php echo apply_filters( 'visualizer_pro_upsell_class', 'only-pro-feature', 'import-wp' ); ?> ">
1044 + <h2 class="viz-group-title viz-sub-group"><?php _e( 'Import from WordPress', 'visualizer' ); ?><span
1044 1045 class="dashicons dashicons-lock"></span></h2>
1045 1046 <div class="viz-group-content edit-data-content">
1046 1047 <div>
1047 1048 <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">
1049 + <form id="vz-filter-wizard" action="<?php echo $save_filter; ?>" method="post" target="thehole">
1050 + <p class="viz-group-description"><?php _e( 'How often do you want to refresh the data from WordPress.', 'visualizer' ); ?></p>
1051 + <select name="refresh" id="vz-filter-import-time" class="visualizer-select">
1049 1052 <?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' );
1053 + $bttn_label = 'visualizer_source_query_wp' === $source_of_chart ? __( 'Modify Filter', 'visualizer' ) : __( 'Create Filter', 'visualizer' );
1054 + $hours = get_post_meta( $chart_id, Visualizer_Plugin::CF_DB_SCHEDULE, true );
1055 + $schedules = apply_filters(
1056 + 'visualizer_chart_schedules', array(
1057 + '-1' => __( 'One-time', 'visualizer' ),
1058 + ),
1059 + 'wp',
1060 + $chart_id
1061 + );
1062 + foreach ( $schedules as $num => $name ) {
1063 + $extra = self::is_hour_selected( $hours, $num ) ? 'selected' : '';
1064 + ?>
1065 + <option value="<?php echo $num; ?>" <?php echo $extra; ?>><?php echo $name; ?></option>
1066 + <?php
1067 + }
1068 + do_action( 'visualizer_chart_schedules_spl', 'wp', $chart_id, 1 );
1053 1069 ?>
1070 + </select>
1054 1071
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>
1072 + <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; ?>">
1073 + <input type="button" id="db-filter-save-button" class="button button-primary" value="<?php _e( 'Save Schedule', 'visualizer' ); ?>">
1086 1074 </form>
1087 - <?php echo apply_filters( 'visualizer_pro_upsell', '', 'import-wp', 'https://docs.themeisle.com/article/1278-how-to-import-data-from-wordpress' ); ?>
1075 + <?php echo apply_filters( 'visualizer_pro_upsell', '', 'import-wp' ); ?>
1088 1076 </div>
1089 1077 </div>
1090 1078 </li>
1091 1079
@@ -1127,9 +1115,9 @@
1127 1115 )
1128 1116 );
1129 1117 ?>
1130 1118 <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>
1119 + <h2 class="viz-group-title viz-sub-group"><?php _e( 'Import from WooCommerce Reports', 'visualizer' ); ?><span class="dashicons dashicons-lock"></span></h2>
1132 1120 <div class="viz-group-content edit-data-content">
1133 1121 <div>
1134 1122 <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 1123 <form id="vz-import-woo-report" action="<?php echo $upload_link; ?>" method="post" target="thehole" enctype="multipart/form-data">
@@ -1150,9 +1138,9 @@
1150 1138 );
1151 1139 foreach ( $schedules as $num => $name ) {
1152 1140 $extra = self::is_hour_selected( $hours, $num ) ? 'selected' : '';
1153 1141 ?>
1154 - <option value="<?php echo esc_attr( $num ); ?>" <?php echo esc_attr( $extra ); ?>><?php echo esc_html( $name ); ?></option>
1142 + <option value="<?php echo $num; ?>" <?php echo $extra; ?>><?php echo $name; ?></option>
1155 1143 <?php
1156 1144 }
1157 1145 do_action( 'visualizer_chart_schedules_spl', 'json', $chart_id, 1 );
1158 1146 ?>
@@ -1197,54 +1185,41 @@
1197 1185 )
1198 1186 );
1199 1187 ?>
1200 1188 <!-- 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
1189 + <li class="viz-group visualizer_source_query <?php echo apply_filters( 'visualizer_pro_upsell_class', 'only-pro-feature', 'db-query' ); ?>">
1190 + <h2 class="viz-group-title viz-sub-group"><?php _e( 'Import from database', 'visualizer' ); ?><span
1203 1191 class="dashicons dashicons-lock"></span></h2>
1204 1192 <div class="viz-group-content edit-data-content">
1205 1193 <div>
1206 1194 <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">
1195 + <form id="vz-db-wizard" action="<?php echo $save_query; ?>" method="post" target="thehole">
1196 + <p class="viz-group-description"><?php _e( 'How often do you want to refresh the data from the database.', 'visualizer' ); ?></p>
1197 + <select name="refresh" id="vz-db-import-time" class="visualizer-select">
1208 1198 <?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' );
1199 + $bttn_label = 'visualizer_source_query' === $source_of_chart ? __( 'Modify Query', 'visualizer' ) : __( 'Create Query', 'visualizer' );
1200 + $hours = get_post_meta( $chart_id, Visualizer_Plugin::CF_DB_SCHEDULE, true );
1201 + $schedules = apply_filters(
1202 + 'visualizer_chart_schedules', array(
1203 + '-1' => __( 'One-time', 'visualizer' ),
1204 + ),
1205 + 'db',
1206 + $chart_id
1207 + );
1208 + foreach ( $schedules as $num => $name ) {
1209 + $extra = self::is_hour_selected( $hours, $num ) ? 'selected' : '';
1210 + ?>
1211 + <option value="<?php echo $num; ?>" <?php echo $extra; ?>><?php echo $name; ?></option>
1212 + <?php
1213 + }
1214 + do_action( 'visualizer_chart_schedules_spl', 'db', $chart_id, 1 );
1212 1215 ?>
1213 -
1214 - <!-- Step 1: Choose / modify data source -->
1216 + </select>
1215 1217 <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 1218
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' ); ?>
1219 + <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; ?>">
1220 + <input type="button" id="db-chart-save-button" class="button button-primary" value="<?php _e( 'Save Schedule', 'visualizer' ); ?>">
1221 + <?php echo apply_filters( 'visualizer_pro_upsell', '', 'db-query' ); ?>
1247 1222 </form>
1248 1223 </div>
1249 1224 </div>
1250 1225 </li>