PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.3.2
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.3.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/Module/Frontend.php +50 -1 3.3.13.3.2 View file →
@@ -343,7 +343,56 @@
343 343 wp_enqueue_style( 'visualizer-front' );
344 344 }
345 345
346 346 // return placeholder div
347 - return $actions_div . '<div id="' . $id . '"' . $class . '></div>';
347 + return $actions_div . '<div id="' . $id . '"' . $class . '></div>' . $this->addSchema( $chart->ID );
348 + }
349 +
350 + /**
351 + * Adds the schema corresponding to the dataset.
352 + *
353 + * @since 3.3.2
354 + *
355 + * @access private
356 + */
357 + private function addSchema( $id ) {
358 + $settings = get_post_meta( $id, Visualizer_Plugin::CF_SETTINGS, true );
359 + $title = '';
360 + if ( isset( $settings['title'] ) && ! empty( $settings['title'] ) ) {
361 + $title = $settings['title'];
362 + if ( is_array( $title ) ) {
363 + $title = $settings['title']['text'];
364 + }
365 + }
366 + $title = apply_filters( 'visualizer_schema_name', $title, $id );
367 + if ( empty( $title ) ) {
368 + return '';
369 + }
370 +
371 + $desc = '';
372 + if ( isset( $settings['description'] ) && ! empty( $settings['description'] ) ) {
373 + $desc = $settings['description'];
374 + }
375 + $desc = apply_filters( 'visualizer_schema_description', $desc, $id );
376 + // descriptions below 50 chars are not allowed.
377 + if ( empty( $desc ) || strlen( $desc ) < 50 ) {
378 + return '';
379 + }
380 +
381 + $schema = apply_filters(
382 + 'visualizer_schema',
383 + '{
384 + "@context":"https://schema.org/",
385 + "@type":"Dataset",
386 + "name":"' . esc_html( $title ) . '",
387 + "description":"' . esc_html( $desc ) . '"
388 + }',
389 + $id
390 + );
391 +
392 + if ( empty( $schema ) ) {
393 + return '';
394 + }
395 +
396 + return '<script type="application/ld+json">' . $schema . '</script>';
348 397 }
349 398 }