Skip to content

Commit a5faca5

Browse files
committed
Skip array intermediary for innerHTML
1 parent 5470109 commit a5faca5

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

src/wp-includes/media.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5312,7 +5312,7 @@ function get_post_galleries( $post, $html = true, $max_galleries = PHP_INT_MAX )
53125312
$gallery_ids = $processor->allocate_and_return_parsed_attributes()['ids'] ?? array();
53135313
$ids = array();
53145314
$sources = array();
5315-
$inner_html = array();
5315+
$inner_html = '';
53165316

53175317
while ( $processor->next_token() && $processor->get_depth() > $gallery_depth ) {
53185318
if ( ! $processor->is_html() ) {
@@ -5321,7 +5321,7 @@ function get_post_galleries( $post, $html = true, $max_galleries = PHP_INT_MAX )
53215321
}
53225322

53235323
if ( $processor->get_depth() === $gallery_depth + 1 ) {
5324-
$inner_html[] = $processor->get_html_content();
5324+
$inner_html .= $processor->get_html_content();
53255325
}
53265326
}
53275327

@@ -5377,7 +5377,7 @@ function get_post_galleries( $post, $html = true, $max_galleries = PHP_INT_MAX )
53775377

53785378
// Old Gallery block format as HTML.
53795379
if ( $html ) {
5380-
$galleries[] = implode( '', $inner_html );
5380+
$galleries[] = $inner_html;
53815381
continue;
53825382
}
53835383

@@ -5408,7 +5408,6 @@ function get_post_galleries( $post, $html = true, $max_galleries = PHP_INT_MAX )
54085408
}
54095409

54105410
// Otherwise, extract srcs from the innerHTML.
5411-
$inner_html = implode( '', $inner_html );
54125411
$src_finder = new WP_HTML_Tag_Processor( $inner_html );
54135412
while ( $src_finder->next_tag() ) {
54145413
$src = $src_finder->get_attribute( 'src' );

0 commit comments

Comments
 (0)