diff --git a/composer.lock b/composer.lock index 834b16f..f45422f 100644 --- a/composer.lock +++ b/composer.lock @@ -726,12 +726,12 @@ "source": { "type": "git", "url": "https://github.com/chubes4/html-to-blocks-converter.git", - "reference": "c67194d10a5da1de5a446ffdbbc88f3e239bece8" + "reference": "a00e54228913474d2788802ea95d778c53a31ee7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/chubes4/html-to-blocks-converter/zipball/c67194d10a5da1de5a446ffdbbc88f3e239bece8", - "reference": "c67194d10a5da1de5a446ffdbbc88f3e239bece8", + "url": "https://api.github.com/repos/chubes4/html-to-blocks-converter/zipball/a00e54228913474d2788802ea95d778c53a31ee7", + "reference": "a00e54228913474d2788802ea95d778c53a31ee7", "shasum": "" }, "require": { @@ -759,7 +759,7 @@ "source": "https://github.com/chubes4/html-to-blocks-converter/tree/main", "issues": "https://github.com/chubes4/html-to-blocks-converter/issues" }, - "time": "2026-05-18T00:00:58+00:00" + "time": "2026-05-31T19:31:07+00:00" }, { "name": "fidry/console", diff --git a/tests/BFBConversionUnitTest.php b/tests/BFBConversionUnitTest.php index 3a11476..283a52f 100644 --- a/tests/BFBConversionUnitTest.php +++ b/tests/BFBConversionUnitTest.php @@ -219,6 +219,35 @@ public function detect( string $content ): bool { $this->assertSame( array( 'mode' => 'fidelity' ), $probe->received_options, 'Generic adapters should receive public conversion options.' ); } + /** + * Resolved asset metadata should flow through BFB into h2bc media transforms. + */ + public function test_asset_metadata_context_enriches_h2bc_image_blocks(): void { + $serialized = bfb_convert( + 'Source alt', + 'html', + 'blocks', + array( + 'context' => array( + 'asset_metadata' => array( + 'assets/hero.jpg' => array( + 'id' => 42, + 'url' => 'https://example.test/wp-content/uploads/hero.jpg', + ), + ), + ), + ) + ); + + $blocks = parse_blocks( $serialized ); + $image = $this->first_block_named( $blocks, 'core/image' ); + + $this->assertNotNull( $image ); + $this->assertSame( 42, $image['attrs']['id'] ?? null ); + $this->assertStringContainsString( 'alt="Source alt"', $image['innerHTML'] ?? '' ); + $this->assertStringContainsString( 'src="https://example.test/wp-content/uploads/hero.jpg"', $image['innerHTML'] ?? '' ); + } + /** * BFB should expose h2bc's expanded layout transforms through bfb_convert(). */ @@ -1000,6 +1029,30 @@ private function flatten_blocks( array $blocks ): array { return $names; } + /** + * Find the first block with the requested name in a parsed block tree. + * + * @param array> $blocks Parsed blocks. + * @param string $name Block name. + * @return array|null Matching block, or null. + */ + private function first_block_named( array $blocks, string $name ): ?array { + foreach ( $blocks as $block ) { + if ( $name === ( $block['blockName'] ?? null ) ) { + return $block; + } + + if ( ! empty( $block['innerBlocks'] ) && is_array( $block['innerBlocks'] ) ) { + $inner = $this->first_block_named( $block['innerBlocks'], $name ); + if ( null !== $inner ) { + return $inner; + } + } + } + + return null; + } + /** * Assert every expected substring appears in a conversion result. * diff --git a/vendor_prefixed/chubes4/html-to-blocks-converter/includes/class-html-element.php b/vendor_prefixed/chubes4/html-to-blocks-converter/includes/class-html-element.php index 256796e..b52b8c6 100644 --- a/vendor_prefixed/chubes4/html-to-blocks-converter/includes/class-html-element.php +++ b/vendor_prefixed/chubes4/html-to-blocks-converter/includes/class-html-element.php @@ -36,6 +36,9 @@ public static function from_html(string $html): ?self if (empty($html)) { return null; } + if (\preg_match('/^<\s*(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)\b([^>]*)\/?>\s*$/i', $html, $matches)) { + return new self($matches[1], self::parse_attribute_string($matches[2]), $html, ''); + } $processor = \WP_HTML_Processor::create_fragment($html); if (!$processor) { return null; @@ -102,6 +105,30 @@ private static function extract_attributes(\WP_HTML_Processor $processor): array } return $attributes; } + /** + * Parses attributes from a raw opening tag string. + * + * @param string $attribute_string Raw attribute markup. + * @return array Attribute map. + */ + private static function parse_attribute_string(string $attribute_string): array + { + $attributes = array(); + if (\preg_match_all('/([a-zA-Z_:][-a-zA-Z0-9_:.]*)\s*=\s*("([^"]*)"|\'([^\']*)\'|([^\s"\'>]+))/', $attribute_string, $matches, \PREG_SET_ORDER)) { + foreach ($matches as $match) { + $value = ''; + if (isset($match[3]) && '' !== $match[3]) { + $value = $match[3]; + } elseif (isset($match[4]) && '' !== $match[4]) { + $value = $match[4]; + } elseif (isset($match[5])) { + $value = $match[5]; + } + $attributes[\strtolower($match[1])] = \html_entity_decode($value, \ENT_QUOTES, 'UTF-8'); + } + } + return $attributes; + } /** * Extracts inner HTML from an element string * diff --git a/vendor_prefixed/chubes4/html-to-blocks-converter/includes/class-transform-registry.php b/vendor_prefixed/chubes4/html-to-blocks-converter/includes/class-transform-registry.php index 83d0654..1d075cc 100644 --- a/vendor_prefixed/chubes4/html-to-blocks-converter/includes/class-transform-registry.php +++ b/vendor_prefixed/chubes4/html-to-blocks-converter/includes/class-transform-registry.php @@ -122,13 +122,13 @@ private static function get_media_transforms() { return array(array('blockName' => 'core/gallery', 'priority' => 8, 'isMatch' => function ($element) { return self::is_gallery_element($element); - }, 'transform' => function ($element) { - return self::create_gallery_block($element); + }, 'transform' => function ($element, $handler = null, array $args = array()) { + return self::create_gallery_block($element, $args); }), array('blockName' => 'core/media-text', 'priority' => 8, 'isMatch' => function ($element) { $class = $element->has_attribute('class') ? $element->get_attribute('class') : ''; return \preg_match('/(?:^|\s)(?:wp-block-media-text|media-text)(?:$|\s)/i', $class) === 1 && ($element->query_selector('img') || $element->query_selector('video')); - }, 'transform' => function ($element, $handler) { - return self::create_media_text_block($element, $handler); + }, 'transform' => function ($element, $handler, array $args = array()) { + return self::create_media_text_block($element, $handler, $args); }), array('blockName' => 'core/video', 'priority' => 9, 'isMatch' => function ($element) { $video = $element->get_tag_name() === 'VIDEO' ? $element : $element->query_selector('video'); return $video && self::get_media_src($video) !== ''; @@ -192,7 +192,7 @@ private static function is_gallery_element($element): bool * @param HTML_To_Blocks_HTML_Element $element Gallery wrapper. * @return array Block array. */ - private static function create_gallery_block($element): array + private static function create_gallery_block($element, array $args = array()): array { $images = $element->query_selector_all('img'); $captions = $element->query_selector_all('figcaption'); @@ -200,7 +200,7 @@ private static function create_gallery_block($element): array $ids = array(); foreach ($images as $index => $img) { $caption = isset($captions[$index]) ? $captions[$index]->get_inner_html() : ''; - $image_block = self::create_image_block_from_img($img, $caption); + $image_block = self::create_image_block_from_img($img, $caption, $args); $inner_blocks[] = $image_block; if (isset($image_block['attrs']['id'])) { $ids[] = $image_block['attrs']['id']; @@ -222,7 +222,7 @@ private static function create_gallery_block($element): array * @param string $caption Optional caption HTML. * @return array Block array. */ - private static function create_image_block_from_img($img, string $caption = ''): array + private static function create_image_block_from_img($img, string $caption = '', array $args = array()): array { $attributes = array('url' => $img->get_attribute('src') ?? ''); self::apply_image_element_attributes($attributes, $img); @@ -232,6 +232,7 @@ private static function create_image_block_from_img($img, string $caption = ''): if ($img->has_attribute('class') && \preg_match('/(?:^|\s)wp-image-(\d+)(?:$|\s)/', $img->get_attribute('class'), $matches)) { $attributes['id'] = (int) $matches[1]; } + self::apply_image_asset_metadata($attributes, $args); return HTML_To_Blocks_Block_Factory::create_block('core/image', $attributes); } /** @@ -248,6 +249,62 @@ private static function apply_image_element_attributes(array &$attributes, $img) } } } + /** + * Applies caller-resolved asset metadata to image block attributes. + * + * @param array $attributes Block attributes. + * @param array $args Raw handler arguments. + */ + private static function apply_image_asset_metadata(array &$attributes, array $args): void + { + $metadata = self::get_asset_metadata_for_source($args, (string) ($attributes['url'] ?? '')); + if (empty($metadata)) { + return; + } + if (isset($metadata['url']) && \is_scalar($metadata['url']) && '' !== (string) $metadata['url']) { + $attributes['url'] = (string) $metadata['url']; + } + if (isset($metadata['id']) && \is_numeric($metadata['id']) && (int) $metadata['id'] > 0) { + $attributes['id'] = (int) $metadata['id']; + } + foreach (array('alt', 'width', 'height') as $attribute) { + if (!isset($attributes[$attribute]) && isset($metadata[$attribute]) && \is_scalar($metadata[$attribute])) { + $attributes[$attribute] = (string) $metadata[$attribute]; + } + } + } + /** + * Returns caller-provided asset metadata for a source reference. + * + * @param array $args Raw handler arguments. + * @param string $source Source URL/path from the HTML. + * @return array + */ + private static function get_asset_metadata_for_source(array $args, string $source): array + { + $context = isset($args['context']) && \is_array($args['context']) ? $args['context'] : array(); + $maps = array('asset_metadata', 'resolved_assets', 'assets'); + foreach ($maps as $map_key) { + if (empty($context[$map_key]) || !\is_array($context[$map_key])) { + continue; + } + $map = $context[$map_key]; + if (isset($map[$source]) && \is_array($map[$source])) { + return $map[$source]; + } + foreach ($map as $metadata) { + if (!\is_array($metadata)) { + continue; + } + foreach (array('source', 'src', 'path', 'original') as $source_key) { + if (isset($metadata[$source_key]) && (string) $metadata[$source_key] === $source) { + return $metadata; + } + } + } + } + return array(); + } /** * Creates a media-text block from a recognized two-column wrapper. * @@ -255,7 +312,7 @@ private static function apply_image_element_attributes(array &$attributes, $img) * @param callable $handler Recursive raw handler. * @return array Block array. */ - private static function create_media_text_block($element, $handler): array + private static function create_media_text_block($element, $handler, array $args = array()): array { $media = $element->query_selector('img') ? $element->query_selector('img') : $element->query_selector('video'); $content = $element->query_selector('.wp-block-media-text__content'); @@ -267,6 +324,18 @@ private static function create_media_text_block($element, $handler): array if ($media && $media->has_attribute('class') && \preg_match('/(?:^|\s)wp-image-(\d+)(?:$|\s)/', $media->get_attribute('class'), $matches)) { $attributes['mediaId'] = (int) $matches[1]; } + $metadata = self::get_asset_metadata_for_source($args, (string) $attributes['mediaUrl']); + if (!empty($metadata)) { + if (isset($metadata['url']) && \is_scalar($metadata['url']) && '' !== (string) $metadata['url']) { + $attributes['mediaUrl'] = (string) $metadata['url']; + } + if (isset($metadata['id']) && \is_numeric($metadata['id']) && (int) $metadata['id'] > 0) { + $attributes['mediaId'] = (int) $metadata['id']; + } + if (!isset($attributes['mediaAlt']) && isset($metadata['alt']) && \is_scalar($metadata['alt'])) { + $attributes['mediaAlt'] = (string) $metadata['alt']; + } + } if (\preg_match('/(?:^|\s)has-media-on-the-right(?:$|\s)/', $element->get_attribute('class') ?? '')) { $attributes['mediaPosition'] = 'right'; } @@ -749,6 +818,10 @@ private static function get_button_transforms() return self::is_static_visual_button($element); }, 'transform' => function ($element) { return self::create_static_visual_button_paragraph($element); + }), array('blockName' => 'core/html', 'priority' => 8, 'selector' => 'div,p', 'isMatch' => function ($element) { + return self::is_class_sensitive_action_link_container($element); + }, 'transform' => function ($element) { + return HTML_To_Blocks_Block_Factory::create_block('core/html', array('content' => $element->get_outer_html())); }), array('blockName' => 'core/buttons', 'priority' => 8, 'selector' => 'div,p', 'isMatch' => function ($element) { return self::is_button_anchor_container($element) || self::is_single_button_anchor_wrapper($element); }, 'transform' => function ($element) { @@ -786,7 +859,10 @@ private static function is_button_anchor_container($element): bool } if (self::is_action_link_container($element)) { foreach ($children as $child) { - if (self::is_class_sensitive_cta_anchor($child)) { + if (self::is_exact_cta_token_container($element) && self::is_generic_button_variant_anchor($child)) { + return \false; + } + if (self::is_class_sensitive_cta_anchor($child) && !self::is_generic_button_variant_anchor($child)) { return \false; } } @@ -1089,6 +1165,34 @@ private static function is_action_link_container($element): bool { return self::class_matches($element, '/(?:^|[-_\s])(?:actions?|buttons?|cta)(?:$|[-_\s])/i'); } + /** + * Checks whether an action wrapper should preserve class-sensitive anchors as raw HTML. + * + * Some action rows use direct anchors whose source CSS targets the anchor + * classes themselves. Converting those wrappers to core/buttons or flowing the + * anchors through a paragraph moves the effective styling target and changes + * visual rhythm. Keep only explicit action containers with class-sensitive CTA + * anchors as raw HTML; simpler action rows continue through native buttons. + * + * @param HTML_To_Blocks_HTML_Element $element Element to inspect. + * @return bool True when the wrapper should remain raw HTML. + */ + private static function is_class_sensitive_action_link_container($element): bool + { + if (!self::is_action_link_container($element)) { + return \false; + } + $children = self::get_direct_anchor_children_from_html($element->get_inner_html()); + if (\count($children) < 1) { + return \false; + } + foreach ($children as $child) { + if (self::is_class_sensitive_cta_anchor($child) && !self::is_generic_button_variant_anchor($child)) { + return \true; + } + } + return \false; + } /** * Gets direct anchor children when the HTML contains only sibling anchors and whitespace. * @@ -1196,7 +1300,36 @@ private static function is_class_sensitive_cta_anchor($element): bool if (\preg_match('/(?:^|\s)(?:wp-block-button__link|wp-element-button)(?:$|\s)/i', $class_name) === 1) { return \false; } - return \preg_match('/(?:^|\s)(?:button|cta-(?:btn|link)|(?:btn|link)-cta)(?:$|\s)/i', $class_name) === 1; + return \preg_match('/(?:^|\s)(?:cta-(?:btn|link)|(?:btn|link)-cta)(?:$|\s)/i', $class_name) === 1; + } + /** + * Checks whether a CTA/action container uses an explicit CTA class token. + * + * @param HTML_To_Blocks_HTML_Element $element Container element. + * @return bool True when the container should keep CTA-owned anchor classes. + */ + private static function is_exact_cta_token_container($element): bool + { + $class_name = $element->get_attribute('class') ?? ''; + return \preg_match('/(?:^|\s)(?:cta|cta[-_]?actions)(?:$|\s)/i', $class_name) === 1; + } + /** + * Checks whether an anchor has the generic button class plus visual variants. + * + * @param HTML_To_Blocks_HTML_Element $element Anchor element. + * @return bool True when the class shape is safe to treat as a native button. + */ + private static function is_generic_button_variant_anchor($element): bool + { + // @phpstan-ignore-next-line booleanNot.alwaysFalse -- Defensive public API guard for untyped external callers. + if (!$element || $element->get_tag_name() !== 'A') { + return \false; + } + $class_name = \trim((string) ($element->get_attribute('class') ?? '')); + if (\preg_match('/(?:^|\s)button(?:$|\s)/i', $class_name) !== 1) { + return \false; + } + return \preg_match('/(?:^|\s)(?:primary|secondary)(?:$|\s)/i', $class_name) === 1; } /** * Creates a buttons wrapper with one button child from an anchor. @@ -1344,7 +1477,7 @@ private static function get_image_transforms() } $img = $element->query_selector('img'); return null !== $img; - }, 'transform' => function ($element) { + }, 'transform' => function ($element, $handler = null, array $args = array()) { $img = $element->query_selector('img'); $figcaption = $element->query_selector('figcaption'); $attributes = array('url' => $img->get_attribute('src') ?? ''); @@ -1369,6 +1502,7 @@ private static function get_image_transforms() if ($element->has_attribute('id') && $element->get_attribute('id') !== '') { $attributes['anchor'] = $element->get_attribute('id'); } + self::apply_image_asset_metadata($attributes, $args); $anchor_element = $element->query_selector('a'); if ($anchor_element && $anchor_element->has_attribute('href')) { $attributes['href'] = $anchor_element->get_attribute('href'); @@ -1383,7 +1517,7 @@ private static function get_image_transforms() return HTML_To_Blocks_Block_Factory::create_block('core/image', $attributes); }), array('blockName' => 'core/image', 'priority' => 15, 'isMatch' => function ($element) { return $element->get_tag_name() === 'IMG'; - }, 'transform' => function ($element) { + }, 'transform' => function ($element, $handler = null, array $args = array()) { $attributes = array('url' => $element->get_attribute('src') ?? ''); self::apply_image_element_attributes($attributes, $element); $class_name = $element->has_attribute('class') ? $element->get_attribute('class') : ''; @@ -1393,6 +1527,7 @@ private static function get_image_transforms() if (\preg_match('/(?:^|\s)wp-image-(\d+)(?:$|\s)/', $class_name, $matches)) { $attributes['id'] = (int) $matches[1]; } + self::apply_image_asset_metadata($attributes, $args); return HTML_To_Blocks_Block_Factory::create_block('core/image', $attributes); })); } @@ -2953,8 +3088,43 @@ private static function create_card_grid_item_inner_blocks($element, ?array $chi $blocks[] = $block; } } + foreach (self::get_direct_image_children_from_html($element->get_inner_html()) as $image) { + $image_src = $image->get_attribute('src') ?? ''; + $has_image = \false; + foreach ($blocks as $block) { + if ('core/image' === ($block['blockName'] ?? '') && $image_src === ($block['attrs']['url'] ?? '')) { + $has_image = \true; + break; + } + } + if (!$has_image) { + \array_unshift($blocks, self::create_image_block_from_img($image)); + } + } return $blocks; } + /** + * Gets direct image children from raw inner HTML. + * + * @param string $html Inner HTML to inspect. + * @return array Image elements. + */ + private static function get_direct_image_children_from_html(string $html): array + { + $remaining = $html; + $images = array(); + if (!\preg_match_all('/]*\/?>/i', $html, $matches)) { + return array(); + } + foreach ($matches[0] as $image_html) { + $image = HTML_To_Blocks_HTML_Element::from_html($image_html); + if ($image) { + $images[] = $image; + } + $remaining = \str_replace($image_html, '', $remaining); + } + return '' === \trim(\preg_replace('/<[^>]+>.*?<\/[^>]+>/s', '', $remaining) ?? $remaining) ? $images : array(); + } /** * Convert one common card child to a native block. * diff --git a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-action-text-transforms.php b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-action-text-transforms.php index 432ccdb..5328db7 100644 --- a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-action-text-transforms.php +++ b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-action-text-transforms.php @@ -153,10 +153,19 @@ public function get_registered($name) $smoke_assert(\strpos($class_sensitive_cta_block['attrs']['content'], 'wp-block-button') === \false, 'class-sensitive-cta-anchor-avoids-button-wrapper'); $class_sensitive_cta_row = new HTML_To_Blocks_HTML_Element('div', ['class' => 'cta-actions'], '', 'Browse the docs'); $class_sensitive_cta_row_transform = $find_transform($class_sensitive_cta_row); -$smoke_assert('core/buttons' !== $class_sensitive_cta_row_transform['blockName'], 'class-sensitive-cta-row-avoids-buttons'); -$button_variant_row = new HTML_To_Blocks_HTML_Element('div', ['class' => 'hero-actions cta'], '', 'Find a classPlan your first visit'); +$smoke_assert('core/html' === $class_sensitive_cta_row_transform['blockName'], 'class-sensitive-cta-row-uses-html'); +$class_sensitive_cta_row_block = \call_user_func($class_sensitive_cta_row_transform['transform'], $class_sensitive_cta_row, $handler); +$smoke_assert(\strpos($class_sensitive_cta_row_block['attrs']['content'], '') !== \false, 'class-sensitive-cta-row-preserves-wrapper-html'); +$button_variant_row = new HTML_To_Blocks_HTML_Element('div', ['class' => 'hero-actions'], '', 'Find a classPlan your first visit'); $button_variant_row_transform = $find_transform($button_variant_row); -$smoke_assert('core/buttons' !== $button_variant_row_transform['blockName'], 'class-sensitive-button-variant-row-avoids-buttons'); +$button_variant_row_block = \call_user_func($button_variant_row_transform['transform'], $button_variant_row, $handler); +$smoke_assert('core/buttons' === $button_variant_row_transform['blockName'], 'generic-button-variant-row-becomes-buttons'); +$smoke_assert('hero-actions' === $button_variant_row_block['attrs']['className'], 'generic-button-variant-row-wrapper-class-preserved'); +$smoke_assert('#classes' === $button_variant_row_block['innerBlocks'][0]['attrs']['url'], 'generic-button-variant-row-first-url-preserved'); +$smoke_assert('#first-visit' === $button_variant_row_block['innerBlocks'][1]['attrs']['url'], 'generic-button-variant-row-second-url-preserved'); +$cta_button_variant_row = new HTML_To_Blocks_HTML_Element('div', ['class' => 'hero-actions cta'], '', 'Find a classPlan your first visit'); +$cta_button_variant_row_transform = $find_transform($cta_button_variant_row); +$smoke_assert('core/buttons' !== $cta_button_variant_row_transform['blockName'], 'class-sensitive-button-variant-row-avoids-buttons'); $ordinary_link = new HTML_To_Blocks_HTML_Element('p', [], '

Read more.

', 'Read more.'); $ordinary_link_transform = $find_transform($ordinary_link); $smoke_assert('core/paragraph' === $ordinary_link_transform['blockName'], 'ordinary-link-stays-paragraph'); diff --git a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-address-inline-strong-br.php b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-address-inline-strong-br.php index 270b3d0..7bcc1ce 100644 --- a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-address-inline-strong-br.php +++ b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-address-inline-strong-br.php @@ -61,7 +61,7 @@ public function get_registered($name) if (!\function_exists('BlockFormatBridge\Vendor\wp_strip_all_tags')) { function wp_strip_all_tags($text) { - return wp_strip_all_tags($text); + return \strip_tags((string) $text); } } if (!\function_exists('BlockFormatBridge\Vendor\get_shortcode_regex')) { diff --git a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-block-supports.php b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-block-supports.php index 5423339..44e0db1 100644 --- a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-block-supports.php +++ b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-block-supports.php @@ -37,7 +37,7 @@ public function get_registered($name) if (!\function_exists('BlockFormatBridge\Vendor\wp_strip_all_tags')) { function wp_strip_all_tags($text) { - return wp_strip_all_tags($text); + return \strip_tags((string) $text); } } $repo_root = \dirname(__DIR__); diff --git a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-code-chrome-decorative-fallbacks.php b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-code-chrome-decorative-fallbacks.php index d418550..ce64eeb 100644 --- a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-code-chrome-decorative-fallbacks.php +++ b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-code-chrome-decorative-fallbacks.php @@ -61,7 +61,7 @@ public function get_registered($name) if (!\function_exists('BlockFormatBridge\Vendor\wp_strip_all_tags')) { function wp_strip_all_tags($text) { - return wp_strip_all_tags($text); + return \strip_tags((string) $text); } } if (!\function_exists('BlockFormatBridge\Vendor\get_shortcode_regex')) { diff --git a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-code-demo-pre-svg.php b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-code-demo-pre-svg.php index 59cd166..5a0c316 100644 --- a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-code-demo-pre-svg.php +++ b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-code-demo-pre-svg.php @@ -61,7 +61,7 @@ public function get_registered($name) if (!\function_exists('BlockFormatBridge\Vendor\wp_strip_all_tags')) { function wp_strip_all_tags($text) { - return wp_strip_all_tags($text); + return \strip_tags((string) $text); } } if (!\function_exists('BlockFormatBridge\Vendor\get_shortcode_regex')) { diff --git a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-code-display-divs.php b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-code-display-divs.php index 28c369e..dd77711 100644 --- a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-code-display-divs.php +++ b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-code-display-divs.php @@ -61,7 +61,7 @@ public function get_registered($name) if (!\function_exists('BlockFormatBridge\Vendor\wp_strip_all_tags')) { function wp_strip_all_tags($text) { - return wp_strip_all_tags($text); + return \strip_tags((string) $text); } } if (!\function_exists('BlockFormatBridge\Vendor\get_shortcode_regex')) { diff --git a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-code-window-fallback-scope.php b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-code-window-fallback-scope.php index 2039498..7a0144e 100644 --- a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-code-window-fallback-scope.php +++ b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-code-window-fallback-scope.php @@ -61,7 +61,7 @@ public function get_registered($name) if (!\function_exists('BlockFormatBridge\Vendor\wp_strip_all_tags')) { function wp_strip_all_tags($text) { - return wp_strip_all_tags($text); + return \strip_tags((string) $text); } } if (!\function_exists('BlockFormatBridge\Vendor\get_shortcode_regex')) { diff --git a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-decorative-cta-wrapper-divs.php b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-decorative-cta-wrapper-divs.php index 93e988e..a65bfda 100644 --- a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-decorative-cta-wrapper-divs.php +++ b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-decorative-cta-wrapper-divs.php @@ -54,7 +54,7 @@ public function get_registered($name) if (!\function_exists('BlockFormatBridge\Vendor\wp_strip_all_tags')) { function wp_strip_all_tags($text) { - return wp_strip_all_tags($text); + return \strip_tags((string) $text); } } if (!\function_exists('BlockFormatBridge\Vendor\get_shortcode_regex')) { diff --git a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-decorative-div-fallbacks.php b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-decorative-div-fallbacks.php index 13070b4..0db86ae 100644 --- a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-decorative-div-fallbacks.php +++ b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-decorative-div-fallbacks.php @@ -54,7 +54,7 @@ public function get_registered($name) if (!\function_exists('BlockFormatBridge\Vendor\wp_strip_all_tags')) { function wp_strip_all_tags($text) { - return wp_strip_all_tags($text); + return \strip_tags((string) $text); } } if (!\function_exists('BlockFormatBridge\Vendor\get_shortcode_regex')) { diff --git a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-decorative-strip-marquee.php b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-decorative-strip-marquee.php index b936483..79974cc 100644 --- a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-decorative-strip-marquee.php +++ b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-decorative-strip-marquee.php @@ -61,7 +61,7 @@ public function get_registered($name) if (!\function_exists('BlockFormatBridge\Vendor\wp_strip_all_tags')) { function wp_strip_all_tags($text) { - return wp_strip_all_tags($text); + return \strip_tags((string) $text); } } if (!\function_exists('BlockFormatBridge\Vendor\get_shortcode_regex')) { diff --git a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-decorative-visual-clusters.php b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-decorative-visual-clusters.php index 28fd8a0..7aab8c2 100644 --- a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-decorative-visual-clusters.php +++ b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-decorative-visual-clusters.php @@ -54,7 +54,7 @@ public function get_registered($name) if (!\function_exists('BlockFormatBridge\Vendor\wp_strip_all_tags')) { function wp_strip_all_tags($text) { - return wp_strip_all_tags($text); + return \strip_tags((string) $text); } } if (!\function_exists('BlockFormatBridge\Vendor\get_shortcode_regex')) { diff --git a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-detail-br-wrapper-fallback.php b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-detail-br-wrapper-fallback.php index 20188ab..6da9b31 100644 --- a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-detail-br-wrapper-fallback.php +++ b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-detail-br-wrapper-fallback.php @@ -61,7 +61,7 @@ public function get_registered($name) if (!\function_exists('BlockFormatBridge\Vendor\wp_strip_all_tags')) { function wp_strip_all_tags($text) { - return wp_strip_all_tags($text); + return \strip_tags((string) $text); } } if (!\function_exists('BlockFormatBridge\Vendor\get_shortcode_regex')) { diff --git a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-div-code-snippet-linebreaks.php b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-div-code-snippet-linebreaks.php index 0150c04..782c572 100644 --- a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-div-code-snippet-linebreaks.php +++ b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-div-code-snippet-linebreaks.php @@ -61,7 +61,7 @@ public function get_registered($name) if (!\function_exists('BlockFormatBridge\Vendor\wp_strip_all_tags')) { function wp_strip_all_tags($text) { - return wp_strip_all_tags($text); + return \strip_tags((string) $text); } } if (!\function_exists('BlockFormatBridge\Vendor\get_shortcode_regex')) { diff --git a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-empty-bem-decorative-divs.php b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-empty-bem-decorative-divs.php index 6b5ab49..91e6a46 100644 --- a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-empty-bem-decorative-divs.php +++ b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-empty-bem-decorative-divs.php @@ -54,7 +54,7 @@ public function get_registered($name) if (!\function_exists('BlockFormatBridge\Vendor\wp_strip_all_tags')) { function wp_strip_all_tags($text) { - return wp_strip_all_tags($text); + return \strip_tags((string) $text); } } if (!\function_exists('BlockFormatBridge\Vendor\get_shortcode_regex')) { diff --git a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-empty-decorative-icon-placeholders.php b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-empty-decorative-icon-placeholders.php index 89d1cba..079c107 100644 --- a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-empty-decorative-icon-placeholders.php +++ b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-empty-decorative-icon-placeholders.php @@ -54,7 +54,7 @@ public function get_registered($name) if (!\function_exists('BlockFormatBridge\Vendor\wp_strip_all_tags')) { function wp_strip_all_tags($text) { - return wp_strip_all_tags($text); + return \strip_tags((string) $text); } } if (!\function_exists('BlockFormatBridge\Vendor\get_shortcode_regex')) { diff --git a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-empty-glow-decorative-divs.php b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-empty-glow-decorative-divs.php index fbf6dfc..9cf9d90 100644 --- a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-empty-glow-decorative-divs.php +++ b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-empty-glow-decorative-divs.php @@ -54,7 +54,7 @@ public function get_registered($name) if (!\function_exists('BlockFormatBridge\Vendor\wp_strip_all_tags')) { function wp_strip_all_tags($text) { - return wp_strip_all_tags($text); + return \strip_tags((string) $text); } } if (!\function_exists('BlockFormatBridge\Vendor\get_shortcode_regex')) { diff --git a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-info-address-contact-blocks.php b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-info-address-contact-blocks.php index b68afc9..e8fb904 100644 --- a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-info-address-contact-blocks.php +++ b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-info-address-contact-blocks.php @@ -61,7 +61,7 @@ public function get_registered($name) if (!\function_exists('BlockFormatBridge\Vendor\wp_strip_all_tags')) { function wp_strip_all_tags($text) { - return wp_strip_all_tags($text); + return \strip_tags((string) $text); } } if (!\function_exists('BlockFormatBridge\Vendor\get_shortcode_regex')) { diff --git a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-inline-script-fallback-scope.php b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-inline-script-fallback-scope.php index b36e0d1..fb24ee3 100644 --- a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-inline-script-fallback-scope.php +++ b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-inline-script-fallback-scope.php @@ -61,7 +61,7 @@ public function get_registered($name) if (!\function_exists('BlockFormatBridge\Vendor\wp_strip_all_tags')) { function wp_strip_all_tags($text) { - return wp_strip_all_tags($text); + return \strip_tags((string) $text); } } if (!\function_exists('BlockFormatBridge\Vendor\get_shortcode_regex')) { diff --git a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-inline-svg-fallback-scope.php b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-inline-svg-fallback-scope.php index 835d42d..f51eed4 100644 --- a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-inline-svg-fallback-scope.php +++ b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-inline-svg-fallback-scope.php @@ -54,7 +54,7 @@ public function get_registered($name) if (!\function_exists('BlockFormatBridge\Vendor\wp_strip_all_tags')) { function wp_strip_all_tags($text) { - return wp_strip_all_tags($text); + return \strip_tags((string) $text); } } if (!\function_exists('BlockFormatBridge\Vendor\get_shortcode_regex')) { diff --git a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-inline-svg-icon-classification.php b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-inline-svg-icon-classification.php index 048fa8e..e4e0c5f 100644 --- a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-inline-svg-icon-classification.php +++ b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-inline-svg-icon-classification.php @@ -54,7 +54,7 @@ public function get_registered($name) if (!\function_exists('BlockFormatBridge\Vendor\wp_strip_all_tags')) { function wp_strip_all_tags($text) { - return wp_strip_all_tags($text); + return \strip_tags((string) $text); } } if (!\function_exists('BlockFormatBridge\Vendor\get_shortcode_regex')) { diff --git a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-layout-transforms.php b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-layout-transforms.php index 76fa9be..0fc07dc 100644 --- a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-layout-transforms.php +++ b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-layout-transforms.php @@ -41,7 +41,7 @@ public function get_registered($name) if (!\function_exists('BlockFormatBridge\Vendor\wp_strip_all_tags')) { function wp_strip_all_tags($text) { - return wp_strip_all_tags($text); + return \strip_tags((string) $text); } } $repo_root = \dirname(__DIR__); diff --git a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-media-embed-transforms.php b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-media-embed-transforms.php index 594348f..a6597fe 100644 --- a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-media-embed-transforms.php +++ b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-media-embed-transforms.php @@ -34,6 +34,12 @@ function sanitize_html_class($value) return \preg_replace('/[^A-Za-z0-9_-]/', '', (string) $value); } } +if (!\function_exists('BlockFormatBridge\Vendor\wp_parse_url')) { + function wp_parse_url($url, $component = -1) + { + return \parse_url($url, $component); + } +} if (!\class_exists('WP_Block_Type_Registry', \false)) { class WP_Block_Type_Registry { @@ -54,7 +60,7 @@ public function __construct() $this->blocks[$name] = (object) ['attributes' => ['src' => $source_string, 'url' => $source_string, 'alt' => $source_string, 'caption' => $source_rich, 'poster' => $source_string, 'preload' => $source_string, 'autoplay' => ['type' => 'boolean', 'source' => 'attribute'], 'controls' => ['type' => 'boolean', 'source' => 'attribute'], 'loop' => ['type' => 'boolean', 'source' => 'attribute'], 'muted' => ['type' => 'boolean', 'source' => 'attribute'], 'id' => ['type' => 'number'], 'className' => ['type' => 'string']]]; } $this->blocks['core/gallery'] = (object) ['attributes' => ['ids' => ['type' => 'array'], 'columns' => ['type' => 'number']]]; - $this->blocks['core/media-text'] = (object) ['attributes' => ['mediaUrl' => ['type' => 'string'], 'mediaAlt' => $source_string, 'mediaType' => ['type' => 'string'], 'mediaPosition' => ['type' => 'string'], 'mediaWidth' => ['type' => 'number'], 'isStackedOnMobile' => ['type' => 'boolean']]]; + $this->blocks['core/media-text'] = (object) ['attributes' => ['mediaUrl' => ['type' => 'string'], 'mediaId' => ['type' => 'number'], 'mediaAlt' => $source_string, 'mediaType' => ['type' => 'string'], 'mediaPosition' => ['type' => 'string'], 'mediaWidth' => ['type' => 'number'], 'isStackedOnMobile' => ['type' => 'boolean']]]; $this->blocks['core/file'] = (object) ['attributes' => ['href' => ['type' => 'string'], 'textLinkHref' => $source_string, 'fileName' => $source_rich, 'showDownloadButton' => ['type' => 'boolean']]]; $this->blocks['core/embed'] = (object) ['attributes' => ['url' => ['type' => 'string'], 'type' => ['type' => 'string'], 'providerNameSlug' => ['type' => 'string'], 'responsive' => ['type' => 'boolean']]]; foreach (['core/paragraph', 'core/html'] as $name) { @@ -156,7 +162,7 @@ private function matches(string $selector): bool } return null; }; -$convert = function ($element) use ($find_transform) { +$convert = function ($element, array $args = []) use ($find_transform) { $transform = $find_transform($element); if (!$transform) { return null; @@ -164,7 +170,7 @@ private function matches(string $selector): bool $handler = function () { return [HTML_To_Blocks_Block_Factory::create_block('core/paragraph', ['content' => 'Nested text'])]; }; - return \call_user_func($transform['transform'], $element, $handler); + return \call_user_func($transform['transform'], $element, $handler, $args); }; $video = $convert(new H2BC_Fake_Element('video', ['src' => 'movie.mp4', 'poster' => 'poster.jpg', 'controls' => ''])); $assert('core/video' === $video['blockName'], 'video-direct-block'); @@ -180,10 +186,22 @@ private function matches(string $selector): bool $assert(\count($gallery['innerBlocks']) === 2, 'gallery-inner-image-count'); $assert(\strpos($gallery['innerHTML'], 'wp-block-gallery') !== \false, 'gallery-wrapper-html'); $assert(\strpos($gallery['innerBlocks'][0]['innerHTML'], 'Caption A') !== \false, 'gallery-caption-preserved'); +$resolved_gallery = $convert(new H2BC_Fake_Element('div', ['class' => 'gallery columns-2'], '', [new H2BC_Fake_Element('figure', [], '', [new H2BC_Fake_Element('img', ['src' => 'a.jpg', 'alt' => 'A'])]), new H2BC_Fake_Element('figure', [], '', [new H2BC_Fake_Element('img', ['src' => 'b.jpg', 'alt' => 'B'])])]), ['context' => ['asset_metadata' => ['a.jpg' => ['id' => 101, 'url' => 'https://example.test/uploads/a.jpg'], 'b.jpg' => ['id' => 102, 'url' => 'https://example.test/uploads/b.jpg']]]]); +$assert([101, 102] === ($resolved_gallery['attrs']['ids'] ?? []), 'gallery-resolved-ids'); +$assert(\strpos($resolved_gallery['innerBlocks'][0]['innerHTML'], 'https://example.test/uploads/a.jpg') !== \false, 'gallery-resolved-image-url'); $media_text = $convert(new H2BC_Fake_Element('div', ['class' => 'wp-block-media-text'], '', [new H2BC_Fake_Element('figure', [], '', [new H2BC_Fake_Element('img', ['src' => 'hero.jpg', 'alt' => 'Hero'])]), new H2BC_Fake_Element('div', ['class' => 'wp-block-media-text__content'], '

Copy

')])); $assert('core/media-text' === $media_text['blockName'], 'media-text-block'); $assert(($media_text['attrs']['mediaUrl'] ?? '') === 'hero.jpg', 'media-text-media-url'); $assert(\count($media_text['innerBlocks']) === 1, 'media-text-inner-blocks'); +$resolved_media_text = $convert(new H2BC_Fake_Element('div', ['class' => 'wp-block-media-text'], '', [new H2BC_Fake_Element('figure', [], '', [new H2BC_Fake_Element('img', ['src' => 'hero.jpg', 'alt' => 'Hero'])]), new H2BC_Fake_Element('div', ['class' => 'wp-block-media-text__content'], '

Copy

')]), ['context' => ['asset_metadata' => ['hero.jpg' => ['id' => 201, 'url' => 'https://example.test/uploads/hero.jpg', 'alt' => 'Resolved alt']]]]); +$assert(($resolved_media_text['attrs']['mediaUrl'] ?? '') === 'https://example.test/uploads/hero.jpg', 'media-text-resolved-url'); +$assert(($resolved_media_text['attrs']['mediaId'] ?? null) === 201, 'media-text-resolved-id'); +$assert(\strpos($resolved_media_text['innerHTML'], 'alt="Hero"') !== \false, 'media-text-preserves-source-alt'); +$resolved_image = $convert(new H2BC_Fake_Element('img', ['src' => 'product.jpg', 'alt' => 'Product', 'width' => '640', 'height' => '480']), ['context' => ['asset_metadata' => ['product.jpg' => ['id' => 301, 'url' => 'https://example.test/uploads/product.jpg', 'width' => '1280']]]]); +$assert(($resolved_image['attrs']['id'] ?? null) === 301, 'image-resolved-id'); +$assert(\strpos($resolved_image['innerHTML'], 'https://example.test/uploads/product.jpg') !== \false, 'image-resolved-url'); +$assert(\strpos($resolved_image['innerHTML'], 'width="640"') !== \false, 'image-preserves-source-width'); +$assert(\strpos($resolved_image['innerHTML'], 'https://example.test/uploads/product.jpg') !== \false, 'image-resolved-inner-html'); $file = $convert(new H2BC_Fake_Element('a', ['href' => 'https://example.com/report.pdf'], 'Download report')); $assert('core/file' === $file['blockName'], 'file-link-block'); $assert(($file['attrs']['href'] ?? '') === 'https://example.com/report.pdf', 'file-link-href'); diff --git a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-nested-landing-layout-content.php b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-nested-landing-layout-content.php index 5f7be9c..8f6a76e 100644 --- a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-nested-landing-layout-content.php +++ b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-nested-landing-layout-content.php @@ -61,7 +61,7 @@ public function get_registered($name) if (!\function_exists('BlockFormatBridge\Vendor\wp_strip_all_tags')) { function wp_strip_all_tags($text) { - return wp_strip_all_tags($text); + return \strip_tags((string) $text); } } if (!\function_exists('BlockFormatBridge\Vendor\get_shortcode_regex')) { diff --git a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-no-duplicate-descendants.php b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-no-duplicate-descendants.php index 1e0d891..9f91ffc 100644 --- a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-no-duplicate-descendants.php +++ b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-no-duplicate-descendants.php @@ -54,7 +54,7 @@ public function get_registered($name) if (!\function_exists('BlockFormatBridge\Vendor\wp_strip_all_tags')) { function wp_strip_all_tags($text) { - return wp_strip_all_tags($text); + return \strip_tags((string) $text); } } if (!\function_exists('BlockFormatBridge\Vendor\get_shortcode_regex')) { diff --git a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-product-card-decorative-placeholders.php b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-product-card-decorative-placeholders.php index 53201ff..8ac641a 100644 --- a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-product-card-decorative-placeholders.php +++ b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-product-card-decorative-placeholders.php @@ -61,7 +61,7 @@ public function get_registered($name) if (!\function_exists('BlockFormatBridge\Vendor\wp_strip_all_tags')) { function wp_strip_all_tags($text) { - return wp_strip_all_tags($text); + return \strip_tags((string) $text); } } if (!\function_exists('BlockFormatBridge\Vendor\get_shortcode_regex')) { diff --git a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-progress-fill-divs.php b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-progress-fill-divs.php index 5099e75..04041bf 100644 --- a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-progress-fill-divs.php +++ b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-progress-fill-divs.php @@ -54,7 +54,7 @@ public function get_registered($name) if (!\function_exists('BlockFormatBridge\Vendor\wp_strip_all_tags')) { function wp_strip_all_tags($text) { - return wp_strip_all_tags($text); + return \strip_tags((string) $text); } } if (!\function_exists('BlockFormatBridge\Vendor\get_shortcode_regex')) { diff --git a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-project-card-status-divs.php b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-project-card-status-divs.php index 23d8af2..ba4571b 100644 --- a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-project-card-status-divs.php +++ b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-project-card-status-divs.php @@ -54,7 +54,7 @@ public function get_registered($name) if (!\function_exists('BlockFormatBridge\Vendor\wp_strip_all_tags')) { function wp_strip_all_tags($text) { - return wp_strip_all_tags($text); + return \strip_tags((string) $text); } } if (!\function_exists('BlockFormatBridge\Vendor\get_shortcode_regex')) { diff --git a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-quote-attribution-wrapper.php b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-quote-attribution-wrapper.php index e88f2a6..92476a7 100644 --- a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-quote-attribution-wrapper.php +++ b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-quote-attribution-wrapper.php @@ -54,7 +54,7 @@ public function get_registered($name) if (!\function_exists('BlockFormatBridge\Vendor\wp_strip_all_tags')) { function wp_strip_all_tags($text) { - return wp_strip_all_tags($text); + return \strip_tags((string) $text); } } if (!\function_exists('BlockFormatBridge\Vendor\get_shortcode_regex')) { diff --git a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-quote-author-avatar-meta.php b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-quote-author-avatar-meta.php index 9629fb1..cfdc937 100644 --- a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-quote-author-avatar-meta.php +++ b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-quote-author-avatar-meta.php @@ -61,7 +61,7 @@ public function get_registered($name) if (!\function_exists('BlockFormatBridge\Vendor\wp_strip_all_tags')) { function wp_strip_all_tags($text) { - return wp_strip_all_tags($text); + return \strip_tags((string) $text); } } if (!\function_exists('BlockFormatBridge\Vendor\get_shortcode_regex')) { diff --git a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-raw-handler-context.php b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-raw-handler-context.php index 40fa00d..894bf63 100644 --- a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-raw-handler-context.php +++ b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-raw-handler-context.php @@ -54,7 +54,7 @@ public function get_registered($name) if (!\function_exists('BlockFormatBridge\Vendor\wp_strip_all_tags')) { function wp_strip_all_tags($text) { - return wp_strip_all_tags($text); + return \strip_tags((string) $text); } } if (!\function_exists('BlockFormatBridge\Vendor\get_shortcode_regex')) { diff --git a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-resized-svg-image-serialization.php b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-resized-svg-image-serialization.php index 3e48ee3..897f62c 100644 --- a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-resized-svg-image-serialization.php +++ b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-resized-svg-image-serialization.php @@ -36,7 +36,7 @@ if (!\function_exists('BlockFormatBridge\Vendor\wp_strip_all_tags')) { function wp_strip_all_tags($text) { - return wp_strip_all_tags($text); + return \strip_tags((string) $text); } } if (!\function_exists('BlockFormatBridge\Vendor\get_shortcode_regex')) { diff --git a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-rich-ui-clusters.php b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-rich-ui-clusters.php index a7d52f2..66bfbbc 100644 --- a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-rich-ui-clusters.php +++ b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-rich-ui-clusters.php @@ -61,7 +61,7 @@ public function get_registered($name) if (!\function_exists('BlockFormatBridge\Vendor\wp_strip_all_tags')) { function wp_strip_all_tags($text) { - return wp_strip_all_tags($text); + return \strip_tags((string) $text); } } if (!\function_exists('BlockFormatBridge\Vendor\get_shortcode_regex')) { diff --git a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-static-site-chrome.php b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-static-site-chrome.php index 76c1b60..343f770 100644 --- a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-static-site-chrome.php +++ b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-static-site-chrome.php @@ -54,7 +54,7 @@ public function get_registered($name) if (!\function_exists('BlockFormatBridge\Vendor\wp_strip_all_tags')) { function wp_strip_all_tags($text) { - return wp_strip_all_tags($text); + return \strip_tags((string) $text); } } if (!\function_exists('BlockFormatBridge\Vendor\get_shortcode_regex')) { diff --git a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-step-timeline-connectors.php b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-step-timeline-connectors.php index 28094f7..8b6af2e 100644 --- a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-step-timeline-connectors.php +++ b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-step-timeline-connectors.php @@ -61,7 +61,7 @@ public function get_registered($name) if (!\function_exists('BlockFormatBridge\Vendor\wp_strip_all_tags')) { function wp_strip_all_tags($text) { - return wp_strip_all_tags($text); + return \strip_tags((string) $text); } } if (!\function_exists('BlockFormatBridge\Vendor\get_shortcode_regex')) { diff --git a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-testimonial-figure-blockquote.php b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-testimonial-figure-blockquote.php index c413f6e..707dcc2 100644 --- a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-testimonial-figure-blockquote.php +++ b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-testimonial-figure-blockquote.php @@ -61,7 +61,7 @@ public function get_registered($name) if (!\function_exists('BlockFormatBridge\Vendor\wp_strip_all_tags')) { function wp_strip_all_tags($text) { - return wp_strip_all_tags($text); + return \strip_tags((string) $text); } } if (!\function_exists('BlockFormatBridge\Vendor\get_shortcode_regex')) { diff --git a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-text-metric-stat-cards.php b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-text-metric-stat-cards.php index 322242c..2feec4b 100644 --- a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-text-metric-stat-cards.php +++ b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-text-metric-stat-cards.php @@ -61,7 +61,7 @@ public function get_registered($name) if (!\function_exists('BlockFormatBridge\Vendor\wp_strip_all_tags')) { function wp_strip_all_tags($text) { - return wp_strip_all_tags($text); + return \strip_tags((string) $text); } } if (!\function_exists('BlockFormatBridge\Vendor\get_shortcode_regex')) { diff --git a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-traffic-light-decorative-dots.php b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-traffic-light-decorative-dots.php index 514e090..a896666 100644 --- a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-traffic-light-decorative-dots.php +++ b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-traffic-light-decorative-dots.php @@ -54,7 +54,7 @@ public function get_registered($name) if (!\function_exists('BlockFormatBridge\Vendor\wp_strip_all_tags')) { function wp_strip_all_tags($text) { - return wp_strip_all_tags($text); + return \strip_tags((string) $text); } } if (!\function_exists('BlockFormatBridge\Vendor\get_shortcode_regex')) { diff --git a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-trivial-theme-part-fragments.php b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-trivial-theme-part-fragments.php index b54cea8..df4c27c 100644 --- a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-trivial-theme-part-fragments.php +++ b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-trivial-theme-part-fragments.php @@ -54,7 +54,7 @@ public function get_registered($name) if (!\function_exists('BlockFormatBridge\Vendor\wp_strip_all_tags')) { function wp_strip_all_tags($text) { - return wp_strip_all_tags($text); + return \strip_tags((string) $text); } } if (!\function_exists('BlockFormatBridge\Vendor\get_shortcode_regex')) { diff --git a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-visual-list-groups.php b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-visual-list-groups.php index d15d1f3..59f37fb 100644 --- a/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-visual-list-groups.php +++ b/vendor_prefixed/chubes4/html-to-blocks-converter/tests/smoke-visual-list-groups.php @@ -61,7 +61,7 @@ public function get_registered($name) if (!\function_exists('BlockFormatBridge\Vendor\wp_strip_all_tags')) { function wp_strip_all_tags($text) { - return wp_strip_all_tags($text); + return \strip_tags((string) $text); } } if (!\function_exists('BlockFormatBridge\Vendor\get_shortcode_regex')) {