PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 2.0.3
Visualizer – Tables & Charts Manager with Built-in AI Generator v2.0.3
4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.2 3.1.3 3.10.0 3.10.1 3.10.10 3.10.11 3.10.12 3.10.13 3.10.14 3.10.15 3.10.2 3.10.3 3.10.4 All 148 releases
← All changes | classes/Visualizer/Render/Page/Data.php +186 -70 3.10.102.0.3 View file →
@@ -1,5 +1,6 @@
1 1 <?php
2 +
2 3 // +----------------------------------------------------------------------+
3 4 // | Copyright 2013 Madpixels (email : visualizer@madpixels.net) |
4 5 // +----------------------------------------------------------------------+
5 6 // | This program is free software; you can redistribute it and/or modify |
@@ -37,38 +38,16 @@
37 38 * @access protected
38 39 */
39 40 protected function _renderContent() {
40 41 // Added by Ash/Upwork
41 - if ( Visualizer_Module::can_show_feature( 'simple-editor' ) ) {
42 - Visualizer_Render_Layout::show( 'simple-editor-screen', $this->chart->ID );
42 + if ( VISUALIZER_PRO ) {
43 + global $Visualizer_Pro;
44 + $Visualizer_Pro->_addEditor();
43 45 }
44 -
45 - if ( Visualizer_Module::is_pro() ) {
46 - do_action( 'visualizer_add_editor_etc', $this->chart->ID );
47 -
48 - if ( Visualizer_Module::is_pro() && Visualizer_Module::is_pro_older_than( '1.9.0' ) ) {
49 - global $Visualizer_Pro;
50 - $Visualizer_Pro->_addEditor( $this->chart->ID );
51 - if ( method_exists( $Visualizer_Pro, '_addFilterWizard' ) ) {
52 - $Visualizer_Pro->_addFilterWizard( $this->chart->ID );
53 - }
54 - }
55 - }
56 -
57 - $this->add_additional_content();
58 -
59 46 // Added by Ash/Upwork
60 - if ( Visualizer_Module::is_pro() ) {
61 - echo '<div id="chart_wrapper_canvas">';
62 - echo '<div id="control_wrapper_canvas"></div>';
63 - }
64 47 echo '<div id="canvas">';
65 48 echo '<img src="', VISUALIZER_ABSURL, 'images/ajax-loader.gif" class="loader">';
66 49 echo '</div>';
67 - if ( Visualizer_Module::is_pro() ) {
68 - echo '</div>';
69 - }
70 - echo $this->custom_css;
71 50 }
72 51
73 52 /**
74 53 * Renders sidebar content.
@@ -77,30 +56,185 @@
77 56 *
78 57 * @access protected
79 58 */
80 59 protected function _renderSidebarContent() {
60 + $upload_link = add_query_arg( array(
61 + 'action' => Visualizer_Plugin::ACTION_UPLOAD_DATA,
62 + 'nonce' => wp_create_nonce(),
63 + 'chart' => $this->chart->ID,
64 + ), admin_url( 'admin-ajax.php' ) );
65 +
81 66 ?>
82 - <div id="viz-tabs">
83 - <ul>
84 - <li><a href="#viz-tab-basic-content" id="viz-tab-basic"><?php _e( 'Source', 'visualizer' ); ?></a></li>
85 - <li><a href="#viz-tab-advanced-content" id="viz-tab-advanced"><?php _e( 'Settings', 'visualizer' ); ?></a></li>
86 - <li><a href="#viz-tab-help-content" id="viz-tab-help"><?php _e( 'Help', 'visualizer' ); ?></a></li>
87 - </ul>
88 - <div id="viz-tab-basic-content"><?php Visualizer_Render_Layout::show( 'tab-basic', $this->chart->ID ); ?></div>
89 - <div id="viz-tab-advanced-content"><?php Visualizer_Render_Layout::show( 'tab-advanced', $this->chart->ID, $this->sidebar ); ?></div>
90 - <div id="viz-tab-help-content"><?php Visualizer_Render_Layout::show( 'tab-help', $this->chart->ID ); ?></div>
91 - </div>
67 + <iframe id="thehole" name="thehole"></iframe>
68 + <ul class="group-wrapper full-height">
69 + <li class="group group-category open" id="vz-chart-source">
70 + <div class="group-header">
71 + <h2 class="group-title main-group"><?php _e( 'Chart Data', 'visualizer' ); ?></h2>
72 + </div>
73 + <ul class="group-content">
74 + <ul class="group-wrapper">
75 + <li class="group">
76 + <h2 class="group-title sub-group visualizer-src-tab"><?php _e( 'Import data from file', 'visualizer' ); ?></h2>
77 + <div class="group-content">
78 + <p class="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>
79 + <p class="group-description"><?php echo sprintf( __( 'If you are unsure about how to format your data CSV then please take a look at this sample: %1$s %2$s%3$s', 'visualizer' ), '<a href="' . VISUALIZER_ABSURL . 'samples/' . $this->type . '.csv" target="_blank">' , $this->type , '.csv</a>' ); ?></p>
80 + <form id="vz-csv-file-form" action="<?php echo $upload_link ?>" method="post"
81 + target="thehole" enctype="multipart/form-data">
82 + <input type="hidden" id="remote-data" name="remote_data">
83 + <div class="">
84 + <input type="file" id="csv-file" name="local_data">
85 + </div>
86 + <input type="button" class="button button-primary" id="vz-import-file"
87 + value="<?php _e( 'Import', 'visualizer' ); ?>">
88 + </form>
89 + </div>
90 + </li>
91 + <li class="group visualizer-import-url">
92 + <h2 class="group-title sub-group visualizer-src-tab"><?php _e( 'Import data from URL', 'visualizer' ); ?></h2>
93 + <ul class="group-content">
94 + <li class="subsection">
95 + <span class="section-title"><?php _e( 'One time import', 'visualizer' ); ?></span>
92 96
93 - <li class="viz-group bottom-fixed" id="vz-chart-copyright">
94 - Hate it? Love it? <a href="https://wordpress.org/support/plugin/visualizer/reviews/#new-post" target="_blank">Rate it!</a>
95 - <br/>
96 - Visualizer &copy;
97 + <div class="section-items">
98 + <p class="group-description"><?php _e( 'You can use this to import data from a remote CSV file. The first row of the CSV file should contain the column headings. The second one should contain series type (string, number, boolean, date, datetime, timeofday).', 'visualizer' ); ?> </p>
99 + <p class="group-description"><?php echo sprintf( __( 'If you are unsure about how to format your data CSV then please take a look at this sample: %1$s %2$s%3$s', 'visualizer' ), '<a href="' . VISUALIZER_ABSURL . 'samples/' . $this->type . '.csv" target="_blank">' , $this->type , '.csv</a>' ); ?></p>
100 + <p class="group-description"> <?php _e( 'You can also import data from Google Spreadsheet, for more info check <a href="https://github.com/Codeinwp/visualizer/wiki/How-can-I-populate-data-from-Google-Spreadsheet%3F" target="_blank" >this</a> tutorial', 'visualizer' ); ?></p>
101 + <form id="vz-one-time-import" action="<?php echo $upload_link ?>" method="post"
102 + target="thehole" enctype="multipart/form-data">
103 + <div class="remote-file-section">
104 + <input type="url" id="remote-data" name="remote_data"
105 + placeholder="<?php esc_html_e( 'Please enter the URL of CSV file', 'visualizer' ); ?>"
106 + class="visualizer-input">
107 +
108 + </div>
109 + <input type="button" id="view-remote-file" class="button button-primary"
110 + value="<?php _e( 'Import', 'visualizer' ); ?>">
111 + </form>
112 + </div>
113 + </li>
114 + <li class="subsection <?php echo apply_filters( 'visualizer_pro_upsell_class','only-pro-feature', 'schedule-chart' ); ?>">
115 + <span class="section-title visualizer-import-url-schedule"><?php _e( 'Schedule Import', 'visualizer' ); ?><span
116 + class="dashicons dashicons-lock"></span></span>
117 + <div class="section-items">
118 + <p class="group-description"><?php _e( 'You can choose here to synchronize your chart data with a remote CSV file.', 'visualizer' ); ?> </p>
119 + <p class="group-description"> <?php _e( 'You can also synchronize with your Google Spreadsheet file, for more info check <a href="https://github.com/Codeinwp/visualizer/wiki/How-can-I-populate-data-from-Google-Spreadsheet%3F" target="_blank" >this</a> tutorial', 'visualizer' ); ?></p>
120 + <p class="group-description"> <?php _e( 'We will update the chart data based on your time interval preference by overwritting the current data with the one from the URL.', 'visualizer' ); ?></p>
121 + <form id="vz-schedule-import" action="<?php echo $upload_link ?>" method="post"
122 + target="thehole" enctype="multipart/form-data">
123 + <div class="remote-file-section">
124 + <input type="url" id="vz-schedule-url" name="remote_data" value="<?php echo get_post_meta( $this->chart->ID, Visualizer_Plugin::CF_CHART_URL, true );?>"
125 + placeholder="<?php esc_html_e( 'Please enter the URL of CSV file', 'visualizer' ); ?>"
126 + class="visualizer-input visualizer-remote-url">
127 + <p class="group-description"><?php _e( 'How often do you want to check the url', 'visualizer' ); ?></p>
128 + <select name="vz-import-time" id="vz-import-time" class="visualizer-select">
129 + <?php
130 + $hours = get_post_meta( $this->chart->ID, Visualizer_Plugin::CF_CHART_SCHEDULE, true );
131 + $schedules = array(
132 + '1' => __( 'Each hour', 'visualizer' ),
133 + '12' => __( 'Each 12 hours', 'visualizer' ),
134 + '24' => __( 'Each day', 'visualizer' ),
135 + '36' => __( 'Each 3 days', 'visualizer' ),
136 + );
137 + foreach ( $schedules as $num => $name ) {
138 + $extra = $num == $hours ? 'selected' : '';
139 + ?>
140 + <option value="<?php echo $num;?>" <?php echo $extra;?>><?php echo $name;?></option>
141 + <?php
142 + }
143 + ?>
144 + </select>
145 + </div>
146 + <input type="button" id="vz-save-schedule" class="button button-primary"
147 + value="<?php _e( 'Save schedule', 'visualizer' ); ?>">
148 +
149 +
150 + <?php echo apply_filters( 'visualizer_pro_upsell', '', 'schedule-chart' ); ?>
151 + </form>
152 + </div>
153 + </li>
154 + </ul>
155 + </li>
156 + <li class="group <?php echo apply_filters( 'visualizer_pro_upsell_class','only-pro-feature' ); ?> ">
157 + <h2 class="group-title sub-group"
158 + data-current="chart"><?php _e( 'Import from other chart', 'visualizer' ); ?><span
159 + class="dashicons dashicons-lock"></span></h2>
160 + <div class="group-content edit-data-content">
161 + <div>
162 + <p class="group-description"><?php _e( 'You can import here data from your previously created charts', 'visualizer' ); ?></p>
163 + <form>
164 + <select name="vz-import-from-chart" id="chart-id" class="visualizer-select">
165 + <?php
166 + $fetch_link = add_query_arg( array(
167 + 'action' => ( VISUALIZER_PRO ) ? Visualizer_Pro::ACTION_FETCH_DATA : '',
168 + 'nonce' => wp_create_nonce(),
169 + ), admin_url( 'admin-ajax.php' ) );
170 +
171 + $query_args_charts = array(
172 + 'post_type' => Visualizer_Plugin::CPT_VISUALIZER,
173 + 'posts_per_page' => 300,
174 + 'no_found_rows' => true,
175 + );
176 + $charts = array();
177 + $query = new WP_Query( $query_args_charts );
178 + while ( $query->have_posts() ) {
179 + $chart = $query->next_post();
180 + $settings = get_post_meta( $chart->ID, Visualizer_Plugin::CF_SETTINGS, true );
181 + ?>
182 + <option value="<?php echo $chart->ID; ?>"><?php echo empty( $settings['title'] ) ? '#' . $chart->ID : $settings['title']; ?></option>
183 + <?php
184 + }
185 + ?>
186 +
187 + </select>
188 + </form>
189 + <input type="button" id="existing-chart" class="button button-primary"
190 + value="<?php _e( 'Import Chart', 'visualizer' ); ?>" data-viz-link="<?php echo $fetch_link;?>">
191 + <?php echo apply_filters( 'visualizer_pro_upsell', '' ); ?>
192 + </div>
193 + </div>
194 + </li>
195 + <li class="group <?php echo apply_filters( 'visualizer_pro_upsell_class','only-pro-feature' ); ?>">
196 + <h2 class="group-title sub-group visualizer-editor-tab"
197 + data-current="chart"><?php _e( 'Edit current data', 'visualizer' ); ?><span
198 + class="dashicons dashicons-lock"></span></h2>
199 + <form id="editor-form" action="<?php echo $upload_link?>" method="post" target="thehole">
200 + <input type="hidden" id="chart-data" name="chart_data">
201 + </form>
202 +
203 + <div class="group-content edit-data-content">
204 + <div>
205 + <p class="group-description"><?php _e( 'You can manually edit the chart data using the spreadsheet like editor.', 'visualizer' ); ?></p>
206 + <input type="button" id="editor-chart-button" class="button button-primary "
207 + value="<?php _e( 'View Editor', 'visualizer' ); ?>" data-current="chart" data-t-editor="<?php _e( 'Show Chart', 'visualizer' );?>" data-t-chart="<?php _e( 'View Editor', 'visualizer' );?>">
208 +
209 + <?php echo apply_filters( 'visualizer_pro_upsell', '' ); ?>
210 + </div>
211 + </div>
212 + </li>
213 + </ul>
214 + </li>
215 + </ul>
216 + <li class="group group-category bottom-fixed " id="vz-chart-settings">
217 + <h2><?php _e( 'Advanced Settings', 'visualizer' ); ?></h2>
218 + <div class="group-header">
219 + <button class="customize-section-back" tabindex="0"></button>
220 + <h3 class="group-title main-group"><?php _e( 'Chart Settings', 'visualizer' ); ?></h3>
221 + </div>
222 + <ul class="group-content">
223 + <form id="settings-form" action="<?php echo add_query_arg( 'nonce', wp_create_nonce() ); ?>"
224 + method="post">
225 + <?php echo $this->sidebar; ?>
226 + </form>
227 + </ul>
228 + </li>
229 + <li class=" group bottom-fixed" id="vz-chart-review">
230 + <a href="https://wordpress.org/support/plugin/visualizer/reviews/?filter=5#new-post"
231 + target="_blank"><?php _e( 'Rate our plugin', 'visualizer' ); ?></a>
232 + </li>
233 + <li class="group bottom-fixed" id="vz-chart-copyright">Visualizer &copy; 2014</li>
234 + </ul>
97 235 <?php
98 - // phpcs:ignore WordPress.DateTime.RestrictedFunctions.date_date, WordPress.DateTime.CurrentTimeTimestamp.Requested
99 - echo date( 'Y', current_time( 'timestamp' ) );
100 - ?>
101 - </li>
102 - <?php
236 + // changed by Ash/Upwork
103 237 }
104 238
105 239 /**
106 240 * Renders toolbar content.
@@ -109,35 +243,17 @@
109 243 *
110 244 * @access protected
111 245 */
112 246 protected function _renderToolbar() {
113 - // don't show back button at all.
114 - // NOTE: We can't be selective on the post_status here because when a new chart reaches the settings screen, its status changes to publish.
115 - if ( ! VISUALIZER_SKIP_CHART_TYPE_PAGE ) {
116 - echo '<div class="toolbar-div">';
117 - echo '<a class="button button-large" href="', esc_url( add_query_arg( 'tab', 'types' ) ), '">';
118 - esc_html_e( 'Back', 'visualizer' );
119 - echo '</a>';
120 - echo '</div>';
121 - }
247 + // changed by Ash/Upwork
248 + echo '<div class="toolbar-div">';
249 + echo '<a class="button button-large" href="', add_query_arg( 'tab', 'types' ), '">';
250 + esc_html_e( 'Back', 'visualizer' );
251 + echo '</a>';
252 + echo '</div>';
122 253 echo '<input type="submit" id="settings-button" class="button button-primary button-large push-right" value="', $this->button, '">';
123 - if ( isset( $this->cancel_button ) ) {
124 - echo '<input type="submit" id="cancel-button" class="button button-secondary button-large push-right" value="', $this->cancel_button, '">';
125 - }
126 - }
127 254
128 - /**
129 - * Renders the additional content.
130 - *
131 - * @access private
132 - */
133 - private function add_additional_content() {
134 - $source = strtolower( get_post_meta( $this->chart->ID, Visualizer_Plugin::CF_SOURCE, true ) );
135 - $query = '';
136 - if ( 'visualizer_source_query' === $source ) {
137 - $query = get_post_meta( $this->chart->ID, Visualizer_Plugin::CF_DB_QUERY, true );
138 - }
139 - Visualizer_Render_Layout::show( 'db-query', $query, $this->chart->ID );
140 - Visualizer_Render_Layout::show( 'json-screen', $this->chart->ID );
255 + echo '</div>';
256 +
141 257 }
142 258
143 259 }