Skip to content

Commit f4981fa

Browse files
committed
Update image.php
1 parent d34ca53 commit f4981fa

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/wp-admin/includes/image.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1089,7 +1089,7 @@ function wp_get_image_alttext( $file ) {
10891089
$img_contents = file_get_contents( $file );
10901090
// Find the start and end positions of the XMP metadata.
10911091
$xmp_start = strpos( $img_contents, '<x:xmpmeta' );
1092-
$xmp_end = strpos( $img_contents, '</x:xmpmeta>');
1092+
$xmp_end = strpos( $img_contents, '</x:xmpmeta>' );
10931093

10941094
if ( ! $xmp_start || ! $xmp_end ) {
10951095
// No XMP metadata found.
@@ -1132,10 +1132,10 @@ function wp_get_image_alttext( $file ) {
11321132
// Evaluate in that order, stopping when we have a match.
11331133
$value = $xpath->evaluate( "string( rdf:Alt/rdf:li[ @xml:lang = '{$locale}' ] )", $node );
11341134
if ( ! $value ) {
1135-
$value = $xpath->evaluate( 'string( rdf:Alt/rdf:li[ @xml:lang = "' . substr( $locale, 0, 2 ) . '" ] )', $node );
1136-
if ( ! $value ) {
1137-
$value = $xpath->evaluate( 'string( rdf:Alt/rdf:li[ @xml:lang = "x-default" ] )', $node );
1138-
}
1135+
$value = $xpath->evaluate( 'string( rdf:Alt/rdf:li[ @xml:lang = "' . substr( $locale, 0, 2 ) . '" ] )', $node );
1136+
if ( ! $value ) {
1137+
$value = $xpath->evaluate( 'string( rdf:Alt/rdf:li[ @xml:lang = "x-default" ] )', $node );
1138+
}
11391139
}
11401140
}
11411141

0 commit comments

Comments
 (0)