diff --git a/lib/block-supports/background.php b/lib/block-supports/background.php index a0186038f7bd0..ab2fa84361fc2 100644 --- a/lib/block-supports/background.php +++ b/lib/block-supports/background.php @@ -72,7 +72,7 @@ function gutenberg_render_background_support( $block_content, $block ) { if ( ! empty( $styles['css'] ) ) { // Inject background styles to the first element, presuming it's the wrapper, if it exists. - $tags = new Gutenberg_HTML_Tag_Processor_6_5( $block_content ); + $tags = new WP_HTML_Tag_Processor( $block_content ); if ( $tags->next_tag() ) { $existing_style = $tags->get_attribute( 'style' ); diff --git a/lib/block-supports/behaviors.php b/lib/block-supports/behaviors.php index dd6700392994d..383f4b4e6f927 100644 --- a/lib/block-supports/behaviors.php +++ b/lib/block-supports/behaviors.php @@ -80,7 +80,7 @@ function gutenberg_render_behaviors_support_lightbox( $block_content, $block ) { return $block_content; } - $processor = new Gutenberg_HTML_Tag_Processor_6_5( $block_content ); + $processor = new WP_HTML_Tag_Processor( $block_content ); $aria_label = __( 'Enlarge image', 'gutenberg' ); @@ -123,7 +123,7 @@ function gutenberg_render_behaviors_support_lightbox( $block_content, $block ) { $scale_attr = false; } - $w = new Gutenberg_HTML_Tag_Processor_6_5( $block_content ); + $w = new WP_HTML_Tag_Processor( $block_content ); $w->next_tag( 'figure' ); $w->add_class( 'wp-lightbox-container' ); $w->set_attribute( 'data-wp-interactive', true ); @@ -184,7 +184,7 @@ function gutenberg_render_behaviors_support_lightbox( $block_content, $block ) { // image is a copy of the one in the body, which animates immediately // as the lightbox is opened, while the enlarged one is a full-sized // version that will likely still be loading as the animation begins. - $m = new Gutenberg_HTML_Tag_Processor_6_5( $block_content ); + $m = new WP_HTML_Tag_Processor( $block_content ); $m->next_tag( 'figure' ); $m->add_class( 'responsive-image' ); $m->next_tag( 'img' ); @@ -200,7 +200,7 @@ function gutenberg_render_behaviors_support_lightbox( $block_content, $block ) { $m->set_attribute( 'data-wp-style--object-fit', 'selectors.core.image.lightboxObjectFit' ); $initial_image_content = $m->get_updated_html(); - $q = new Gutenberg_HTML_Tag_Processor_6_5( $block_content ); + $q = new WP_HTML_Tag_Processor( $block_content ); $q->next_tag( 'figure' ); $q->add_class( 'enlarged-image' ); $q->next_tag( 'img' ); diff --git a/lib/block-supports/elements.php b/lib/block-supports/elements.php index d44a04c5839cd..85dbd7d39797c 100644 --- a/lib/block-supports/elements.php +++ b/lib/block-supports/elements.php @@ -89,7 +89,7 @@ function gutenberg_render_elements_support( $block_content, $block ) { * contains a single wrapper and that it's the first element in the * rendered output. That first element, if it exists, gets the class. */ - $tags = new Gutenberg_HTML_Tag_Processor_6_5( $block_content ); + $tags = new WP_HTML_Tag_Processor( $block_content ); if ( $tags->next_tag() ) { $tags->add_class( wp_get_elements_class_name( $block ) ); } diff --git a/lib/block-supports/layout.php b/lib/block-supports/layout.php index d91866ca2f38b..db02364b70790 100644 --- a/lib/block-supports/layout.php +++ b/lib/block-supports/layout.php @@ -599,7 +599,7 @@ function gutenberg_render_layout_support_flag( $block_content, $block ) { } // Prep the processor for modifying the block output. - $processor = new Gutenberg_HTML_Tag_Processor_6_5( $block_content ); + $processor = new WP_HTML_Tag_Processor( $block_content ); // Having no tags implies there are no tags onto which to add class names. if ( ! $processor->next_tag() ) { @@ -793,7 +793,7 @@ function gutenberg_render_layout_support_flag( $block_content, $block ) { $inner_block_wrapper_classes = null; $first_chunk = $block['innerContent'][0] ?? null; if ( is_string( $first_chunk ) && count( $block['innerContent'] ) > 1 ) { - $first_chunk_processor = new Gutenberg_HTML_Tag_Processor_6_5( $first_chunk ); + $first_chunk_processor = new WP_HTML_Tag_Processor( $first_chunk ); while ( $first_chunk_processor->next_tag() ) { $class_attribute = $first_chunk_processor->get_attribute( 'class' ); if ( is_string( $class_attribute ) && ! empty( $class_attribute ) ) { @@ -874,7 +874,7 @@ function gutenberg_restore_group_inner_container( $block_content, $block ) { * have to be removed from the outer wrapper and then added to the inner. */ $layout_classes = array(); - $processor = new Gutenberg_HTML_Tag_Processor_6_5( $block_content ); + $processor = new WP_HTML_Tag_Processor( $block_content ); if ( $processor->next_tag( array( 'class_name' => 'wp-block-group' ) ) ) { if ( method_exists( $processor, 'class_list' ) ) { @@ -917,7 +917,7 @@ static function ( $matches ) { // Add layout classes to inner wrapper. if ( ! empty( $layout_classes ) ) { - $processor = new Gutenberg_HTML_Tag_Processor_6_5( $updated_content ); + $processor = new WP_HTML_Tag_Processor( $updated_content ); if ( $processor->next_tag( array( 'class_name' => 'wp-block-group__inner-container' ) ) ) { foreach ( $layout_classes as $class_name ) { $processor->add_class( $class_name ); diff --git a/lib/block-supports/position.php b/lib/block-supports/position.php index 178c28d524920..930e726d12321 100644 --- a/lib/block-supports/position.php +++ b/lib/block-supports/position.php @@ -123,7 +123,7 @@ function gutenberg_render_position_support( $block_content, $block ) { ); // Inject class name to block container markup. - $content = new Gutenberg_HTML_Tag_Processor_6_5( $block_content ); + $content = new WP_HTML_Tag_Processor( $block_content ); $content->next_tag(); foreach ( $wrapper_classes as $class ) { $content->add_class( $class ); diff --git a/lib/block-supports/settings.php b/lib/block-supports/settings.php index 6da6302e160a0..b175fe778ce1b 100644 --- a/lib/block-supports/settings.php +++ b/lib/block-supports/settings.php @@ -33,7 +33,7 @@ function _gutenberg_add_block_level_presets_class( $block_content, $block ) { // Like the layout hook this assumes the hook only applies to blocks with a single wrapper. // Add the class name to the first element, presuming it's the wrapper, if it exists. - $tags = new Gutenberg_HTML_Tag_Processor_6_5( $block_content ); + $tags = new WP_HTML_Tag_Processor( $block_content ); if ( $tags->next_tag() ) { $tags->add_class( _wp_get_presets_class_name( $block ) ); } diff --git a/lib/class-wp-duotone-gutenberg.php b/lib/class-wp-duotone-gutenberg.php index 110b1f4cc6948..93714e5974006 100644 --- a/lib/class-wp-duotone-gutenberg.php +++ b/lib/class-wp-duotone-gutenberg.php @@ -892,7 +892,7 @@ public static function render_duotone_support( $block_content, $block ) { } // Like the layout hook, this assumes the hook only applies to blocks with a single wrapper. - $tags = new Gutenberg_HTML_Tag_Processor_6_5( $block_content ); + $tags = new WP_HTML_Tag_Processor( $block_content ); if ( $tags->next_tag() ) { $tags->add_class( $filter_id ); } diff --git a/lib/experimental/blocks.php b/lib/experimental/blocks.php index b65c8fc3a0299..88e46b478389d 100644 --- a/lib/experimental/blocks.php +++ b/lib/experimental/blocks.php @@ -168,7 +168,7 @@ function gutenberg_render_block_connections( $block_content, $block, $block_inst continue; } - $tags = new Gutenberg_HTML_Tag_Processor_6_5( $block_content ); + $tags = new WP_HTML_Tag_Processor( $block_content ); $found = $tags->next_tag( array( // TODO: In the future, when blocks other than Paragraph and Image are @@ -181,7 +181,7 @@ function gutenberg_render_block_connections( $block_content, $block, $block_inst } $tag_name = $tags->get_tag(); $markup = "<$tag_name>$custom_value"; - $updated_tags = new Gutenberg_HTML_Tag_Processor_6_5( $markup ); + $updated_tags = new WP_HTML_Tag_Processor( $markup ); $updated_tags->next_tag(); // Get all the attributes from the original block and add them to the new markup. diff --git a/packages/block-library/src/cover/index.php b/packages/block-library/src/cover/index.php index 3b659844f84ae..5f6b2cadaaa57 100644 --- a/packages/block-library/src/cover/index.php +++ b/packages/block-library/src/cover/index.php @@ -50,7 +50,7 @@ function render_block_core_cover( $attributes, $content ) { return $content; } - $processor = new Gutenberg_HTML_Tag_Processor_6_5( $content ); + $processor = new WP_HTML_Tag_Processor( $content ); $processor->next_tag(); $styles = $processor->get_attribute( 'style' ); diff --git a/packages/block-library/src/file/index.php b/packages/block-library/src/file/index.php index 3cdcba127e2b5..5910a63e6cf18 100644 --- a/packages/block-library/src/file/index.php +++ b/packages/block-library/src/file/index.php @@ -65,7 +65,7 @@ static function ( $matches ) { // If it uses the Interactivity API, add the directives. if ( $should_load_view_script ) { - $processor = new Gutenberg_HTML_Tag_Processor_6_5( $content ); + $processor = new WP_HTML_Tag_Processor( $content ); $processor->next_tag(); $processor->set_attribute( 'data-wp-interactive', '{"namespace":"core/file"}' ); $processor->next_tag( 'object' ); diff --git a/packages/block-library/src/form/index.php b/packages/block-library/src/form/index.php index d7c18ef2cfe11..b9e3a9c25c628 100644 --- a/packages/block-library/src/form/index.php +++ b/packages/block-library/src/form/index.php @@ -15,7 +15,7 @@ */ function render_block_core_form( $attributes, $content ) { - $processed_content = new Gutenberg_HTML_Tag_Processor_6_5( $content ); + $processed_content = new WP_HTML_Tag_Processor( $content ); $processed_content->next_tag( 'form' ); // Get the action for this form. diff --git a/packages/block-library/src/gallery/index.php b/packages/block-library/src/gallery/index.php index f512f4652b52f..edde9b4da101a 100644 --- a/packages/block-library/src/gallery/index.php +++ b/packages/block-library/src/gallery/index.php @@ -77,7 +77,7 @@ function block_core_gallery_render( $attributes, $content ) { } $unique_gallery_classname = wp_unique_id( 'wp-block-gallery-' ); - $processed_content = new Gutenberg_HTML_Tag_Processor_6_5( $content ); + $processed_content = new WP_HTML_Tag_Processor( $content ); $processed_content->next_tag(); $processed_content->add_class( $unique_gallery_classname ); diff --git a/packages/block-library/src/heading/index.php b/packages/block-library/src/heading/index.php index b48ce42a09b12..5a7e8dbaab43c 100644 --- a/packages/block-library/src/heading/index.php +++ b/packages/block-library/src/heading/index.php @@ -24,7 +24,7 @@ function block_core_heading_render( $attributes, $content ) { return $content; } - $p = new Gutenberg_HTML_Tag_Processor_6_5( $content ); + $p = new WP_HTML_Tag_Processor( $content ); $header_tags = array( 'H1', 'H2', 'H3', 'H4', 'H5', 'H6' ); while ( $p->next_tag() ) { diff --git a/packages/block-library/src/image/index.php b/packages/block-library/src/image/index.php index 4ad62ef764a87..85cf3de57b127 100644 --- a/packages/block-library/src/image/index.php +++ b/packages/block-library/src/image/index.php @@ -20,7 +20,7 @@ function render_block_core_image( $attributes, $content, $block ) { return ''; } - $processor = new Gutenberg_HTML_Tag_Processor_6_5( $content ); + $processor = new WP_HTML_Tag_Processor( $content ); if ( ! $processor->next_tag( 'img' ) || null === $processor->get_attribute( 'src' ) ) { return ''; @@ -140,7 +140,7 @@ function block_core_image_render_lightbox( $block_content, $block ) { return $block_content; } - $processor = new Gutenberg_HTML_Tag_Processor_6_5( $block_content ); + $processor = new WP_HTML_Tag_Processor( $block_content ); $aria_label = __( 'Enlarge image' ); @@ -188,7 +188,7 @@ function block_core_image_render_lightbox( $block_content, $block ) { $scale_attr = false; } - $w = new Gutenberg_HTML_Tag_Processor_6_5( $block_content ); + $w = new WP_HTML_Tag_Processor( $block_content ); $w->next_tag( 'figure' ); $w->add_class( 'wp-lightbox-container' ); $w->set_attribute( 'data-wp-interactive', '{"namespace":"core/image"}' ); @@ -256,7 +256,7 @@ class="lightbox-trigger" // image is a copy of the one in the body, which animates immediately // as the lightbox is opened, while the enlarged one is a full-sized // version that will likely still be loading as the animation begins. - $m = new Gutenberg_HTML_Tag_Processor_6_5( $block_content ); + $m = new WP_HTML_Tag_Processor( $block_content ); $m->next_tag( 'figure' ); $m->add_class( 'responsive-image' ); $m->next_tag( 'img' ); @@ -272,7 +272,7 @@ class="lightbox-trigger" $m->set_attribute( 'data-wp-style--object-fit', 'state.lightboxObjectFit' ); $initial_image_content = $m->get_updated_html(); - $q = new Gutenberg_HTML_Tag_Processor_6_5( $block_content ); + $q = new WP_HTML_Tag_Processor( $block_content ); $q->next_tag( 'figure' ); $q->add_class( 'enlarged-image' ); $q->next_tag( 'img' ); diff --git a/packages/block-library/src/navigation-submenu/index.php b/packages/block-library/src/navigation-submenu/index.php index 4702898784a85..2ae23a92b69c4 100644 --- a/packages/block-library/src/navigation-submenu/index.php +++ b/packages/block-library/src/navigation-submenu/index.php @@ -208,7 +208,7 @@ function render_block_core_navigation_submenu( $attributes, $content, $block ) { } if ( strpos( $inner_blocks_html, 'current-menu-item' ) ) { - $tag_processor = new Gutenberg_HTML_Tag_Processor_6_5( $html ); + $tag_processor = new WP_HTML_Tag_Processor( $html ); while ( $tag_processor->next_tag( array( 'class_name' => 'wp-block-navigation-item__content' ) ) ) { $tag_processor->add_class( 'current-menu-ancestor' ); } diff --git a/packages/block-library/src/query-pagination-next/index.php b/packages/block-library/src/query-pagination-next/index.php index 2c9251690ead3..ca134f62192f9 100644 --- a/packages/block-library/src/query-pagination-next/index.php +++ b/packages/block-library/src/query-pagination-next/index.php @@ -64,7 +64,7 @@ function render_block_core_query_pagination_next( $attributes, $content, $block } if ( $enhanced_pagination && isset( $content ) ) { - $p = new Gutenberg_HTML_Tag_Processor_6_5( $content ); + $p = new WP_HTML_Tag_Processor( $content ); if ( $p->next_tag( array( 'tag_name' => 'a', diff --git a/packages/block-library/src/query-pagination-numbers/index.php b/packages/block-library/src/query-pagination-numbers/index.php index 8f4909ac19ef1..2f9370751f6d2 100644 --- a/packages/block-library/src/query-pagination-numbers/index.php +++ b/packages/block-library/src/query-pagination-numbers/index.php @@ -91,7 +91,7 @@ function render_block_core_query_pagination_numbers( $attributes, $content, $blo } if ( $enhanced_pagination ) { - $p = new Gutenberg_HTML_Tag_Processor_6_5( $content ); + $p = new WP_HTML_Tag_Processor( $content ); while ( $p->next_tag( array( 'tag_name' => 'a', diff --git a/packages/block-library/src/query-pagination-previous/index.php b/packages/block-library/src/query-pagination-previous/index.php index c4435b3b56eb5..b49130a44d8dd 100644 --- a/packages/block-library/src/query-pagination-previous/index.php +++ b/packages/block-library/src/query-pagination-previous/index.php @@ -52,7 +52,7 @@ function render_block_core_query_pagination_previous( $attributes, $content, $bl } if ( $enhanced_pagination && isset( $content ) ) { - $p = new Gutenberg_HTML_Tag_Processor_6_5( $content ); + $p = new WP_HTML_Tag_Processor( $content ); if ( $p->next_tag( array( 'tag_name' => 'a', diff --git a/packages/block-library/src/query/index.php b/packages/block-library/src/query/index.php index cf154afc9d26d..75b5218364d7b 100644 --- a/packages/block-library/src/query/index.php +++ b/packages/block-library/src/query/index.php @@ -18,7 +18,7 @@ */ function render_block_core_query( $attributes, $content, $block ) { if ( $attributes['enhancedPagination'] && isset( $attributes['queryId'] ) ) { - $p = new Gutenberg_HTML_Tag_Processor_6_5( $content ); + $p = new WP_HTML_Tag_Processor( $content ); if ( $p->next_tag() ) { // Add the necessary directives. $p->set_attribute( 'data-wp-interactive', '{"namespace":"core/query"}' ); @@ -196,7 +196,7 @@ function block_core_query_disable_enhanced_pagination( $parsed_block ) { } if ( isset( $dirty_enhanced_queries[ $block['attrs']['queryId'] ] ) ) { - $p = new Gutenberg_HTML_Tag_Processor_6_5( $content ); + $p = new WP_HTML_Tag_Processor( $content ); if ( $p->next_tag() ) { $p->set_attribute( 'data-wp-navigation-disabled', 'true' ); } diff --git a/packages/block-library/src/search/index.php b/packages/block-library/src/search/index.php index ab8e824f223ec..f5391eefc8cac 100644 --- a/packages/block-library/src/search/index.php +++ b/packages/block-library/src/search/index.php @@ -51,7 +51,7 @@ function render_block_core_search( $attributes, $content, $block ) { $open_by_default = 'false'; $label_inner_html = empty( $attributes['label'] ) ? __( 'Search' ) : wp_kses_post( $attributes['label'] ); - $label = new Gutenberg_HTML_Tag_Processor_6_5( sprintf( '', $inline_styles['label'], $label_inner_html ) ); + $label = new WP_HTML_Tag_Processor( sprintf( '', $inline_styles['label'], $label_inner_html ) ); if ( $label->next_tag() ) { $label->set_attribute( 'for', $input_id ); $label->add_class( 'wp-block-search__label' ); @@ -64,7 +64,7 @@ function render_block_core_search( $attributes, $content, $block ) { } } - $input = new Gutenberg_HTML_Tag_Processor_6_5( sprintf( '', $inline_styles['input'] ) ); + $input = new WP_HTML_Tag_Processor( sprintf( '', $inline_styles['input'] ) ); $input_classes = array( 'wp-block-search__input' ); if ( ! $is_button_inside && ! empty( $border_color_classes ) ) { $input_classes[] = $border_color_classes; @@ -150,7 +150,7 @@ function render_block_core_search( $attributes, $content, $block ) { // Include the button element class. $button_classes[] = wp_theme_get_element_class_name( 'button' ); - $button = new Gutenberg_HTML_Tag_Processor_6_5( sprintf( '', $inline_styles['button'], $button_internal_markup ) ); + $button = new WP_HTML_Tag_Processor( sprintf( '', $inline_styles['button'], $button_internal_markup ) ); if ( $button->next_tag() ) { $button->add_class( implode( ' ', $button_classes ) ); diff --git a/packages/block-library/src/site-logo/index.php b/packages/block-library/src/site-logo/index.php index 3572f39cfc1b0..f1819fcaac8d0 100644 --- a/packages/block-library/src/site-logo/index.php +++ b/packages/block-library/src/site-logo/index.php @@ -39,7 +39,7 @@ function render_block_core_site_logo( $attributes ) { if ( $attributes['isLink'] && '_blank' === $attributes['linkTarget'] ) { // Add the link target after the rel="home". // Add an aria-label for informing that the page opens in a new tab. - $processor = new Gutenberg_HTML_Tag_Processor_6_5( $custom_logo ); + $processor = new WP_HTML_Tag_Processor( $custom_logo ); $processor->next_tag( 'a' ); if ( 'home' === $processor->get_attribute( 'rel' ) ) { $processor->set_attribute( 'aria-label', __( '(Home link, opens in a new tab)' ) ); diff --git a/packages/block-library/src/social-link/index.php b/packages/block-library/src/social-link/index.php index f5482b22c40f0..b203a662822f5 100644 --- a/packages/block-library/src/social-link/index.php +++ b/packages/block-library/src/social-link/index.php @@ -59,7 +59,7 @@ function render_block_core_social_link( $attributes, $content, $block ) { $link .= esc_html( $label ); $link .= ''; - $processor = new Gutenberg_HTML_Tag_Processor_6_5( $link ); + $processor = new WP_HTML_Tag_Processor( $link ); $processor->next_tag( 'a' ); if ( $open_in_new_tab ) { $processor->set_attribute( 'rel', trim( $rel . ' noopener nofollow' ) );