PluginProbe
Gutenberg / 23.7.2
Gutenberg v23.7.2
23.9.1 23.9.0 23.8.0 23.7.2 23.7.1 23.7.0 23.6.1 23.6.2 23.6.0 23.5.3 23.5.2 23.5.1 23.5.0 23.4.0 23.3.2 23.3.1 23.3.0 23.2.0 23.2.1 23.2.2 23.1.1 23.1.0 23.0.1 12.6.0 7.4.0 All 402 releases
gutenberg / lib / compat / wordpress-7.1 / blocks.php

blocks.php in Gutenberg 23.7.2, at lib/compat/wordpress-7.1/blocks.php

62 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Compatibility shims for blocks for WordPress 7.1.
4 *
5 * @package gutenberg
6 */
7
8 if ( ! function_exists( '_wp_apply_block_content_filters' ) ) {
9 /**
10 * Applies standard content filters similar to 'the_content' filter.
11 *
12 * This function runs the typical content processing filters that WordPress
13 * applies to post content, useful for blocks that render nested content.
14 *
15 * The filters applied in order are:
16 * - shortcode_unautop()
17 * - do_shortcode()
18 * - do_blocks()
19 * - wptexturize()
20 * - convert_smilies()
21 * - wp_filter_content_tags()
22 * - $wp_embed->autoembed()
23 *
24 * Optionally supports recursion prevention by accepting a seen IDs array
25 * and an ID. When provided, the ID is added to the array before do_blocks()
26 * and removed after, preventing infinite loops when content references itself.
27 *
28 * @access private
29 *
30 * @global WP_Embed $wp_embed
31 *
32 * @param string $content The content to process.
33 * @param string $context Optional. Context identifier for wp_filter_content_tags. Default empty string.
34 * @param array|null $seen_ids Optional. Reference to array tracking seen IDs for recursion prevention. Default null.
35 * @param string|null $id Optional. Unique identifier for this content, used with $seen_ids. Default null.
36 * @return string The processed content.
37 */
38 function _wp_apply_block_content_filters( $content, $context = '', &$seen_ids = null, $id = null ) {
39 $content = shortcode_unautop( $content );
40 $content = do_shortcode( $content );
41
42 if ( null !== $seen_ids && null !== $id ) {
43 $seen_ids[ $id ] = true;
44 }
45
46 $content = do_blocks( $content );
47
48 if ( null !== $seen_ids && null !== $id ) {
49 unset( $seen_ids[ $id ] );
50 }
51
52 $content = wptexturize( $content );
53 $content = convert_smilies( $content );
54 $content = wp_filter_content_tags( $content, $context );
55
56 global $wp_embed;
57 $content = $wp_embed->autoembed( $content );
58
59 return $content;
60 }
61 }
62