PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 4.0.2
Visualizer – Tables & Charts Manager with Built-in AI Generator v4.0.2
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/Gutenberg/Block.php +2 -22 4.0.84.0.2 View file →
@@ -201,27 +201,10 @@
201 201 /**
202 202 * Hook server side rendering into render callback
203 203 */
204 204 public function register_block_type() {
205 - $asset_path = VISUALIZER_ABSPATH . '/classes/Visualizer/Gutenberg/build/index.asset.php';
206 - $version = $this->version;
207 - if ( file_exists( $asset_path ) ) {
208 - // @phpstan-ignore-next-line
209 - $asset = require $asset_path;
210 - $version = isset( $asset['version'] ) ? $asset['version'] : $version;
211 - }
212 - if ( ! wp_style_is( 'visualizer-datatables', 'registered' ) ) {
213 - wp_register_style( 'visualizer-datatables', VISUALIZER_ABSURL . 'css/lib/datatables.min.css', array(), Visualizer_Plugin::VERSION );
214 - }
215 - if ( ! wp_style_is( 'visualizer-gutenberg-block', 'registered' ) ) {
216 - wp_register_style( 'visualizer-gutenberg-block', VISUALIZER_ABSURL . 'classes/Visualizer/Gutenberg/build/style-index.css', array( 'visualizer-datatables' ), $version );
217 - }
218 205 register_block_type(
219 206 'visualizer/chart', array(
220 - // The editor_style registration is what gets the stylesheet into the
221 - // iframed editor canvas; styles enqueued via enqueue_block_editor_assets
222 - // only reach the parent document.
223 - 'editor_style' => 'visualizer-gutenberg-block',
224 207 'render_callback' => array( $this, 'gutenberg_block_callback' ),
225 208 'attributes' => array(
226 209 'id' => array(
227 210 'type' => 'number',
@@ -292,9 +275,9 @@
292 275 /**
293 276 * Get Post Meta Fields
294 277 */
295 278 public function get_visualizer_data( $post ) {
296 - if ( ! Visualizer_Module::can_edit_chart( $post['id'] ) ) {
279 + if ( ! current_user_can( 'edit_posts' ) ) {
297 280 return false;
298 281 }
299 282
300 283 $data = array();
@@ -313,11 +296,8 @@
313 296 $data['visualizer-default-data'] = get_post_meta( $post_id, Visualizer_Plugin::CF_DEFAULT_DATA, true );
314 297
315 298 // faetch and update settings
316 299 $data['visualizer-settings'] = get_post_meta( $post_id, Visualizer_Plugin::CF_SETTINGS, true );
317 - if ( ! is_array( $data['visualizer-settings'] ) ) {
318 - $data['visualizer-settings'] = array();
319 - }
320 300 if ( empty( $data['visualizer-settings']['pagination'] ) ) {
321 301 $data['visualizer-settings']['pageSize'] = '';
322 302 }
323 303 // handle series filter hooks
@@ -326,9 +306,9 @@
326 306 // handle settings filter hooks
327 307 $data['visualizer-settings'] = apply_filters( Visualizer_Plugin::FILTER_GET_CHART_SETTINGS, $data['visualizer-settings'], $post_id, $data['visualizer-chart-type'] );
328 308
329 309 // handle data filter hooks
330 - $data['visualizer-data'] = apply_filters( Visualizer_Plugin::FILTER_GET_CHART_DATA, Visualizer_Module::decode_content( html_entity_decode( get_post_field( 'post_content', $post_id, 'raw' ) ) ), $post_id, $data['visualizer-chart-type'] );
310 + $data['visualizer-data'] = apply_filters( Visualizer_Plugin::FILTER_GET_CHART_DATA, unserialize( html_entity_decode( get_the_content( $post_id ) ) ), $post_id, $data['visualizer-chart-type'] );
331 311
332 312 // we are going to format only for tabular charts, because we are not sure of the effect on others.
333 313 // this is to solve the case where boolean data shows up as all-ticks on gutenberg.
334 314 if ( in_array( $data['visualizer-chart-type'], array( 'tabular' ), true ) ) {