Ticket #22949: class-wp-image-editor.php.patch
File class-wp-image-editor.php.patch, 1012 bytes (added by , 12 years ago) |
---|
-
wp-includes/class-wp-image-editor.php
371 371 372 372 foreach( $extensions as $_extension ) { 373 373 if ( preg_match( "/{$extension}/i", $_extension ) ) { 374 return $mime_types[$_extension]; 374 // asumes that the first mime type in the array is the most common/proper 375 return !is_array($mime_types[$_extension]) ? $mime_types[$_extension] : $mime_types[$_extension][0]; 375 376 } 376 377 } 377 378 … … 389 390 * @return string|boolean 390 391 */ 391 392 protected static function get_extension( $mime_type = null ) { 392 $extensions = explode( '|', array_search( $mime_type, wp_get_mime_types() ) ); 393 foreach ( wp_get_mime_types() as $extension => $mimes ) 394 if ( $match = array_search( $mime_type, (array) $mimes ) ) 395 $extensions = explode( '|', $extension ); 393 396 394 397 if ( empty( $extensions[0] ) ) 395 398 return false;