PluginProbe
aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder / 2.14.0
aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder v2.14.0
2.14.0 2.13.0 2.13.1 2.12.0 2.11.1 2.11.0 2.10.0 2.9.0 2.7.4 2.7.5 2.7.6 2.7.7 2.8.0 2.8.1 2.9.1 trunk 1.0 1.0-beta1 1.0-beta2 1.0-beta3 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 All 81 releases
← All changes | includes/blocks/dynamic-text/block.php +14 -5 2.8.1 → 2.14.0 View file →
@@ -22,15 +22,17 @@
22 22 $dynamic_text_css->add_class_styles(
23 23 '{{WRAPPER}} .ablocks-dynamic-text-output',
24 24 $this->get_dynamic_text_css( $attributes ),
25 25 $this->get_dynamic_text_css( $attributes, 'Tablet' ),
26 - $this->get_dynamic_text_css( $attributes, 'Mobile' )
26 + $this->get_dynamic_text_css( $attributes, 'Mobile' ),
27 + $dynamic_text_css->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_dynamic_text_css( $attributes, $device ); } )
27 28 );
28 29 $dynamic_text_css->add_class_styles(
29 30 '{{WRAPPER}} .ablocks-dynamic-text-output a',
30 31 $this->get_dynamic_text_css( $attributes ),
31 32 $this->get_dynamic_text_css( $attributes, 'Tablet' ),
32 - $this->get_dynamic_text_css( $attributes, 'Mobile' )
33 + $this->get_dynamic_text_css( $attributes, 'Mobile' ),
34 + $dynamic_text_css->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_dynamic_text_css( $attributes, $device ); } )
33 35 );
34 36
35 37 return $dynamic_text_css->generate_css();
36 38 }
@@ -81,14 +83,21 @@
81 83 $url = get_permalink( $post_id );
82 84 return '<a href="' . esc_url( $url ) . '">' . esc_html( $url ) . '</a>';
83 85 case 'core:content':
84 86 static $guard = false;
87 + static $content_cache = [];
85 88 if ( $guard ) {
86 89 return '';
87 90 }
88 - $guard = true;
89 - $content = do_blocks( get_post_field( 'post_content', $post_id ) );
90 - $guard = false;
91 + // Render the post's content once per request; multiple dynamic-text
92 + // "content" blocks (or a loop/archive) would otherwise re-run
93 + // do_blocks() on the full post each time.
94 + if ( ! isset( $content_cache[ $post_id ] ) ) {
95 + $guard = true;
96 + $content_cache[ $post_id ] = do_blocks( get_post_field( 'post_content', $post_id ) );
97 + $guard = false;
98 + }
99 + $content = $content_cache[ $post_id ];
91 100 if (
92 101 empty( trim( wp_strip_all_tags( $content ) ) )
93 102 && $this->is_editor_preview()
94 103 ) {