PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.2.0
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.2.0
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/Module/Frontend.php +32 -2 3.1.03.2.0 View file →
@@ -68,11 +68,32 @@
68 68 add_filter( 'term_description', 'do_shortcode' );
69 69 }
70 70
71 71 add_action( 'rest_api_init', array( $this, 'endpoint_register' ) );
72 +
73 + $this->_addFilter( 'script_loader_tag', 'script_loader_tag', null, 10, 3 );
72 74 }
73 75
74 76 /**
77 + * Adds the async attribute to certain scripts.
78 + */
79 + function script_loader_tag( $tag, $handle, $src ) {
80 + if ( is_admin() ) {
81 + return $tag;
82 + }
83 +
84 + $scripts = array( 'google-jsapi-new', 'google-jsapi-old', 'visualizer-render-google-lib', 'visualizer-render-google' );
85 +
86 + foreach ( $scripts as $async ) {
87 + if ( $async === $handle ) {
88 + $tag = str_replace( ' src', ' async="async" defer="defer" src', $tag );
89 + break;
90 + }
91 + }
92 + return $tag;
93 + }
94 +
95 + /**
75 96 * Returns the language/locale.
76 97 */
77 98 function getLanguage( $dummy, $only_language ) {
78 99 return $this->get_language();
@@ -189,9 +210,9 @@
189 210 $atts
190 211 );
191 212
192 213 // if empty id or chart does not exists, then return empty string
193 - if ( ! $atts['id'] || ! ( $chart = get_post( $atts['id'] ) ) || $chart->post_type != Visualizer_Plugin::CPT_VISUALIZER ) {
214 + if ( ! $atts['id'] || ! ( $chart = get_post( $atts['id'] ) ) || $chart->post_type !== Visualizer_Plugin::CPT_VISUALIZER ) {
194 215 return '';
195 216 }
196 217
197 218 if ( ! apply_filters( 'visualizer_pro_show_chart', true, $atts['id'] ) ) {
@@ -198,8 +219,9 @@
198 219 return '';
199 220 }
200 221
201 222 // in case revisions exist.
223 + // phpcs:ignore WordPress.CodeAnalysis.AssignmentInCondition.Found
202 224 if ( true === ( $revisions = $this->undoRevisions( $chart->ID, true ) ) ) {
203 225 $chart = get_post( $chart->ID );
204 226 }
205 227
@@ -244,8 +266,15 @@
244 266 }
245 267
246 268 $library = $this->load_chart_type( $chart->ID );
247 269
270 + $id = $id . '-' . rand();
271 +
272 + $amp = Visualizer_Plugin::instance()->getModule( Visualizer_Module_AMP::NAME );
273 + if ( $amp && $amp->is_amp() ) {
274 + return '<div id="' . $id . '"' . $class . '>' . $amp->get_chart( $chart, $data, $series, $settings ) . '</div>';
275 + }
276 +
248 277 // add chart to the array
249 278 $this->_charts[ $id ] = array(
250 279 'type' => $type,
251 280 'series' => $series,
@@ -274,8 +303,9 @@
274 303 'i10n' => array(
275 304 'copied' => __( 'Copied!', 'visualizer' ),
276 305 ),
277 306 'page_type' => 'frontend',
307 + 'is_front' => true,
278 308 )
279 309 );
280 310 wp_enqueue_style( 'visualizer-front' );
281 311
@@ -292,9 +322,9 @@
292 322 $key = $array[0];
293 323 $mime = end( $array );
294 324 }
295 325 $label = $actions[ $key ];
296 - $actions_div .= '<a href="#" class="visualizer-action visualizer-action-' . $key . '" data-visualizer-type="' . $key . '" data-visualizer-chart-id="' . $atts['id'] . '" data-visualizer-mime="' . $mime . '" title="' . $label . '" ';
326 + $actions_div .= '<a href="#" class="visualizer-action visualizer-action-' . $key . '" data-visualizer-type="' . $key . '" data-visualizer-chart-id="' . $atts['id'] . '" data-visualizer-container-id="' . $id . '" data-visualizer-mime="' . $mime . '" title="' . $label . '" ';
297 327
298 328 if ( 'copy' === $key ) {
299 329 $copy = $this->_getDataAs( $atts['id'], 'csv' );
300 330 $actions_div .= ' data-clipboard-text="' . esc_attr( $copy['csv'] ) . '"';