Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue-1026: Prevent Errors When Using VideoPress Videos #1223

Merged
merged 2 commits into from
Feb 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 0 additions & 34 deletions includes/apple-exporter/components/class-component.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
}
3 changes: 1 addition & 2 deletions includes/apple-exporter/components/class-image.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
)
Expand Down