Remove mbstring_binary_safe_strlen(). Use mbstring_binary_safe_encoding() and reset_mbstring_encoding() directly.

fixes #28162.
Built from https://develop.svn.wordpress.org/trunk@28808


git-svn-id: http://core.svn.wordpress.org/trunk@28617 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov
2014-06-23 22:21:15 +00:00
parent 54915274fa
commit 8b272f4379
3 changed files with 19 additions and 23 deletions

View File

@@ -289,11 +289,16 @@ function wp_read_image_metadata( $file ) {
if ( ! empty( $iptc['2#120'][0] ) ) { // description / legacy caption
$caption = trim( $iptc['2#120'][0] );
if ( empty( $meta['title'] ) ) {
mbstring_binary_safe_encoding();
$caption_length = strlen( $caption );
reset_mbstring_encoding();
// Assume the title is stored in 2:120 if it's short.
if ( mbstring_binary_safe_strlen( $caption ) < 80 )
if ( $caption_length < 80 ) {
$meta['title'] = $caption;
else
} else {
$meta['caption'] = $caption;
}
} elseif ( $caption != $meta['title'] ) {
$meta['caption'] = $caption;
}
@@ -327,7 +332,11 @@ function wp_read_image_metadata( $file ) {
}
if ( ! empty( $exif['ImageDescription'] ) ) {
if ( empty( $meta['title'] ) && mbstring_binary_safe_strlen( $exif['ImageDescription'] ) < 80 ) {
mbstring_binary_safe_encoding();
$description_length = strlen( $exif['ImageDescription'] );
reset_mbstring_encoding();
if ( empty( $meta['title'] ) && $description_length < 80 ) {
// Assume the title is stored in ImageDescription
$meta['title'] = trim( $exif['ImageDescription'] );
if ( empty( $meta['caption'] ) && ! empty( $exif['COMPUTED']['UserComment'] ) && trim( $exif['COMPUTED']['UserComment'] ) != $meta['title'] ) {