Skip to content
Open
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
10 changes: 4 additions & 6 deletions src/wp-includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -3033,12 +3033,10 @@ function wp_ext2type( $ext ) {
$ext = strtolower( $ext );

$ext2type = wp_get_ext_types();
foreach ( $ext2type as $type => $exts ) {
if ( in_array( $ext, $exts, true ) ) {
return $type;
}
}
return null;
return array_find_key(
$ext2type,
fn( $exts ) => in_array( $ext, $exts, true )
);
}

/**
Expand Down
13 changes: 5 additions & 8 deletions src/wp-includes/interactivity-api/class-wp-interactivity-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -1387,15 +1387,12 @@ private function merge_style_property( string $style_attribute_value, string $st
*/
private function data_wp_text_processor( WP_Interactivity_API_Directives_Processor $p, string $mode ) {
if ( 'enter' === $mode ) {
$entries = $this->get_directive_entries( $p, 'text' );
$valid_entry = null;
$entries = $this->get_directive_entries( $p, 'text' );
// Get the first valid `data-wp-text` entry without suffix or unique ID.
foreach ( $entries as $entry ) {
if ( null === $entry['suffix'] && null === $entry['unique_id'] && ! empty( $entry['value'] ) ) {
$valid_entry = $entry;
break;
}
}
$valid_entry = array_find(
$entries,
fn( $entry ) => null === $entry['suffix'] && null === $entry['unique_id'] && ! empty( $entry['value'] )
);
if ( null === $valid_entry ) {
return;
}
Expand Down
Loading