Ticket #21903: image_caption_encoding.patch
File image_caption_encoding.patch, 2.0 KB (added by , 8 years ago) |
---|
-
wp-admin/includes/
old new 253 253 254 254 // headline, "A brief synopsis of the caption." 255 255 if ( ! empty( $iptc['2#105'][0] ) ) 256 $meta['title'] = utf8_encode( trim( $iptc['2#105'][0] ));256 $meta['title'] = trim( $iptc['2#105'][0] ); 257 257 // title, "Many use the Title field to store the filename of the image, though the field may be used in many ways." 258 258 elseif ( ! empty( $iptc['2#005'][0] ) ) 259 $meta['title'] = utf8_encode( trim( $iptc['2#005'][0] ));259 $meta['title'] = trim( $iptc['2#005'][0] ); 260 260 261 261 if ( ! empty( $iptc['2#120'][0] ) ) { // description / legacy caption 262 $caption = utf8_encode( trim( $iptc['2#120'][0] ));262 $caption = trim( $iptc['2#120'][0] ); 263 263 if ( empty( $meta['title'] ) ) { 264 264 // Assume the title is stored in 2:120 if it's short. 265 265 if ( strlen( $caption ) < 80 ) … … 272 272 } 273 273 274 274 if ( ! empty( $iptc['2#110'][0] ) ) // credit 275 $meta['credit'] = utf8_encode(trim($iptc['2#110'][0]));275 $meta['credit'] = trim($iptc['2#110'][0]); 276 276 elseif ( ! empty( $iptc['2#080'][0] ) ) // creator / legacy byline 277 $meta['credit'] = utf8_encode(trim($iptc['2#080'][0]));277 $meta['credit'] = trim($iptc['2#080'][0]); 278 278 279 279 if ( ! empty( $iptc['2#055'][0] ) and ! empty( $iptc['2#060'][0] ) ) // created date and time 280 280 $meta['created_timestamp'] = strtotime( $iptc['2#055'][0] . ' ' . $iptc['2#060'][0] ); 281 281 282 282 if ( ! empty( $iptc['2#116'][0] ) ) // copyright 283 $meta['copyright'] = utf8_encode( trim( $iptc['2#116'][0] ) ); 283 $meta['copyright'] = trim( $iptc['2#116'][0] ); 284 285 // If the encoding is not UTF-8, try to encode it! 286 if ( ! isset( $iptc["1#090"] ) || $iptc["1#090"][0] != "\x1B%G" ) { 287 $encode_list = array('title', 'caption', 'credit', 'copyright'); 288 foreach ( $encode_list as $kname ) 289 if ( isset( $meta[$kname] ) ) 290 $meta[$kname] = utf8_encode($meta[$kname]); 291 } 284 292 } 285 293 } 286 294