Ticket #7484: 7484.iconv.patch
File 7484.iconv.patch, 1.4 KB (added by , 8 years ago) |
---|
-
src/bp-core/classes/class-bp-attachment.php
268 268 add_filter( 'upload_dir', $upload_dir_filter, 10, $this->upload_dir_filter_args ); 269 269 } 270 270 271 // Helper for utf-8 filenames. 272 if ( function_exists( 'iconv' ) ) { 273 add_filter( 'sanitize_file_name', array( $this, 'iconv' ) ); 274 } 275 271 276 // Upload the attachment. 272 277 $this->attachment = wp_handle_upload( $file[ $this->file_input ], $overrides, $time ); 273 278 … … 276 281 remove_filter( 'upload_dir', $upload_dir_filter, 10 ); 277 282 } 278 283 284 if ( function_exists( 'iconv' ) ) { 285 remove_filter( 'sanitize_file_name', array( $this, 'iconv' ) ); 286 } 287 279 288 // Remove the pre WordPress 4.0 static filter. 280 289 remove_filter( 'wp_handle_upload_prefilter', array( $this, 'validate_upload' ), 10 ); 281 290 … … 284 293 } 285 294 286 295 /** 296 * Helper to convert utf-8 characters in filenames to their ASCII equivalent. 297 * 298 * @since 2.9.0 299 * 300 * @param string $retval Filename. 301 * @return string 302 */ 303 public function iconv( $retval ) { 304 return iconv( 'UTF-8', 'ASCII//TRANSLIT//IGNORE', $retval ); 305 } 306 307 /** 287 308 * Validate the allowed mime types using WordPress allowed mime types. 288 309 * 289 310 * In case of a multisite, the mime types are already restricted by