Skip to content

Commit

Permalink
Remove changes to consumer code
Browse files Browse the repository at this point in the history
  • Loading branch information
dmsnell committed Dec 20, 2023
1 parent d3319f5 commit f02244a
Show file tree
Hide file tree
Showing 22 changed files with 36 additions and 36 deletions.
2 changes: 1 addition & 1 deletion lib/block-supports/background.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' );
Expand Down
8 changes: 4 additions & 4 deletions lib/block-supports/behaviors.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' );

Expand Down Expand Up @@ -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 );
Expand Down Expand Up @@ -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' );
Expand All @@ -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' );
Expand Down
2 changes: 1 addition & 1 deletion lib/block-supports/elements.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) );
}
Expand Down
8 changes: 4 additions & 4 deletions lib/block-supports/layout.php
Original file line number Diff line number Diff line change
Expand Up @@ -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() ) {
Expand Down Expand Up @@ -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 ) ) {
Expand Down Expand Up @@ -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' ) ) {
Expand Down Expand Up @@ -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 );
Expand Down
2 changes: 1 addition & 1 deletion lib/block-supports/position.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
2 changes: 1 addition & 1 deletion lib/block-supports/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) );
}
Expand Down
2 changes: 1 addition & 1 deletion lib/class-wp-duotone-gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}
Expand Down
4 changes: 2 additions & 2 deletions lib/experimental/blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -181,7 +181,7 @@ function gutenberg_render_block_connections( $block_content, $block, $block_inst
}
$tag_name = $tags->get_tag();
$markup = "<$tag_name>$custom_value</$tag_name>";
$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.
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/cover/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' );
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/file/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' );
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/form/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/gallery/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );

Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/heading/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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() ) {
Expand Down
10 changes: 5 additions & 5 deletions packages/block-library/src/image/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 '';
Expand Down Expand Up @@ -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' );

Expand Down Expand Up @@ -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"}' );
Expand Down Expand Up @@ -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' );
Expand All @@ -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' );
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/navigation-submenu/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' );
}
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/query-pagination-next/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
4 changes: 2 additions & 2 deletions packages/block-library/src/query/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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"}' );
Expand Down Expand Up @@ -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' );
}
Expand Down
6 changes: 3 additions & 3 deletions packages/block-library/src/search/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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( '<label %1$s>%2$s</label>', $inline_styles['label'], $label_inner_html ) );
$label = new WP_HTML_Tag_Processor( sprintf( '<label %1$s>%2$s</label>', $inline_styles['label'], $label_inner_html ) );
if ( $label->next_tag() ) {
$label->set_attribute( 'for', $input_id );
$label->add_class( 'wp-block-search__label' );
Expand All @@ -64,7 +64,7 @@ function render_block_core_search( $attributes, $content, $block ) {
}
}

$input = new Gutenberg_HTML_Tag_Processor_6_5( sprintf( '<input type="search" name="s" required %s/>', $inline_styles['input'] ) );
$input = new WP_HTML_Tag_Processor( sprintf( '<input type="search" name="s" required %s/>', $inline_styles['input'] ) );
$input_classes = array( 'wp-block-search__input' );
if ( ! $is_button_inside && ! empty( $border_color_classes ) ) {
$input_classes[] = $border_color_classes;
Expand Down Expand Up @@ -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( '<button type="submit" %s>%s</button>', $inline_styles['button'], $button_internal_markup ) );
$button = new WP_HTML_Tag_Processor( sprintf( '<button type="submit" %s>%s</button>', $inline_styles['button'], $button_internal_markup ) );

if ( $button->next_tag() ) {
$button->add_class( implode( ' ', $button_classes ) );
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/site-logo/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)' ) );
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/social-link/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function render_block_core_social_link( $attributes, $content, $block ) {
$link .= esc_html( $label );
$link .= '</span></a></li>';

$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' ) );
Expand Down

0 comments on commit f02244a

Please sign in to comment.