From 6648c3ec5332f84f72e01c3eaa096422bad04680 Mon Sep 17 00:00:00 2001 From: Kevin Fodness <2650828+kevinfodness@users.noreply.github.com> Date: Thu, 27 Feb 2025 16:58:30 -0500 Subject: [PATCH 1/2] WIP: issue-1026 From 3081c71883433bf161d62f2cd6a8053c91a6d703 Mon Sep 17 00:00:00 2001 From: Kevin Fodness <2650828+kevinfodness@users.noreply.github.com> Date: Fri, 28 Feb 2025 10:25:36 -0500 Subject: [PATCH 2/2] Remove unnecessary iframe check from image component --- .../components/class-component.php | 34 ------------------- .../apple-exporter/components/class-image.php | 3 +- 2 files changed, 1 insertion(+), 36 deletions(-) diff --git a/includes/apple-exporter/components/class-component.php b/includes/apple-exporter/components/class-component.php index fa4b6b69..d8c9200a 100644 --- a/includes/apple-exporter/components/class-component.php +++ b/includes/apple-exporter/components/class-component.php @@ -882,39 +882,5 @@ public static function get_iframe_from_node( $node ) { return null; } - - /** - * Get iframe/embed node. - * - * @param DOMElement $node The node to examine. - * - * @return bool True if the figure is an iframe. - */ - public static function is_embed_figure( $node ) { - - // Return false if we don't have any child nodes. - if ( ! $node->hasChildNodes() ) { - return false; - } - - // Loop those child nodes. - foreach ( $node->childNodes as $child ) { - - // Return false if we don't have children, or if is an image. - if ( ! $child->hasChildNodes() || 'img' === $child->nodeName ) { - return false; - } - - foreach ( $child->childNodes as $c ) { - - // Return true if we're seeing an iframe. - if ( 'iframe' === $c->nodeName ) { - return true; - } - } - } - - return false; - } /* phpcs:enable WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase */ } diff --git a/includes/apple-exporter/components/class-image.php b/includes/apple-exporter/components/class-image.php index 0204f38d..8a81a8cd 100644 --- a/includes/apple-exporter/components/class-image.php +++ b/includes/apple-exporter/components/class-image.php @@ -40,8 +40,7 @@ public static function node_matches( $node ) { if ( self::node_has_class( $node, 'wp-block-cover' ) || 'img' === $node->nodeName || ( 'figure' === $node->nodeName - && ( Component::is_embed_figure( $node ) - || self::node_has_class( $node, 'wp-caption' ) + && ( self::node_has_class( $node, 'wp-caption' ) || $has_image_child ) )