Ticket #16777: 16777.diff
File 16777.diff, 2.7 KB (added by , 12 years ago) |
---|
-
wp-admin/includes/file.php
225 225 * @uses delete_transient 226 226 * @param array $file Reference to a single element of $_FILES. Call the function once for each uploaded file. 227 227 * @param array $overrides Optional. An associative array of names=>values to override default variables with extract( $overrides, EXTR_OVERWRITE ). 228 * @param string $time Optional. Time formatted in yyyy/mm 228 229 * @return array On success, returns an associative array of file attributes. On failure, returns $overrides['upload_error_handler'](&$file, $message ) or array( 'error'=>$message ). 229 230 */ 230 231 function wp_handle_upload( &$file, $overrides = false, $time = null ) { … … 357 358 * @uses wp_unique_filename 358 359 * @param array $file an array similar to that of a PHP $_FILES POST array 359 360 * @param array $overrides Optional. An associative array of names=>values to override default variables with extract( $overrides, EXTR_OVERWRITE ). 361 * @param string $time Optional. Time formatted in yyyy/mm 360 362 * @return array On success, returns an associative array of file attributes. On failure, returns $overrides['upload_error_handler'](&$file, $message ) or array( 'error'=>$message ). 361 363 */ 362 function wp_handle_sideload( &$file, $overrides = false ) {364 function wp_handle_sideload( &$file, $overrides = false, $time = null ) { 363 365 // The default error handler. 364 366 if (! function_exists( 'wp_handle_upload_error' ) ) { 365 367 function wp_handle_upload_error( &$file, $message ) { … … 436 438 } 437 439 438 440 // A writable uploads dir will pass this test. Again, there's no point overriding this one. 439 if ( ! ( ( $uploads = wp_upload_dir( ) ) && false === $uploads['error'] ) )441 if ( ! ( ( $uploads = wp_upload_dir( $time ) ) && false === $uploads['error'] ) ) 440 442 return $upload_error_handler( $file, $uploads['error'] ); 441 443 442 444 $filename = wp_unique_filename( $uploads['path'], $file['name'], $unique_filename_callback ); -
wp-admin/includes/media.php
251 251 */ 252 252 function media_handle_sideload($file_array, $post_id, $desc = null, $post_data = array()) { 253 253 $overrides = array('test_form'=>false); 254 255 $file = wp_handle_sideload($file_array, $overrides); 254 255 $time = null; 256 if ( $post = get_post($post_id) ) { 257 if ( substr( $post->post_date, 0, 4 ) > 0 ) 258 $time = $post->post_date; 259 } 260 261 $file = wp_handle_sideload( $file_array, $overrides, $time ); 256 262 if ( isset($file['error']) ) 257 263 return new WP_Error( 'upload_error', $file['error'] ); 258 264