Changeset 22105
- Timestamp:
- 10/03/2012 06:49:37 PM (12 years ago)
- Location:
- trunk/wp-admin/includes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/file.php
r21350 r22105 2 2 /** 3 3 * Functions for reading, writing, modifying, and deleting files on the file system. 4 * Includes functionality for theme-specific files as well as operations for uploading, 4 * Includes functionality for theme-specific files as well as operations for uploading, 5 5 * archiving, and rendering output when necessary. 6 6 * … … 228 228 * @param array $file Reference to a single element of $_FILES. Call the function once for each uploaded file. 229 229 * @param array $overrides Optional. An associative array of names=>values to override default variables with extract( $overrides, EXTR_OVERWRITE ). 230 * @param string $time Optional. Time formatted in 'yyyy/mm'. 230 231 * @return array On success, returns an associative array of file attributes. On failure, returns $overrides['upload_error_handler'](&$file, $message ) or array( 'error'=>$message ). 231 232 */ … … 360 361 * @param array $file an array similar to that of a PHP $_FILES POST array 361 362 * @param array $overrides Optional. An associative array of names=>values to override default variables with extract( $overrides, EXTR_OVERWRITE ). 363 * @param string $time Optional. Time formatted in 'yyyy/mm'. 362 364 * @return array On success, returns an associative array of file attributes. On failure, returns $overrides['upload_error_handler'](&$file, $message ) or array( 'error'=>$message ). 363 365 */ 364 function wp_handle_sideload( &$file, $overrides = false ) {366 function wp_handle_sideload( &$file, $overrides = false, $time = null ) { 365 367 // The default error handler. 366 368 if (! function_exists( 'wp_handle_upload_error' ) ) { … … 439 441 440 442 // A writable uploads dir will pass this test. Again, there's no point overriding this one. 441 if ( ! ( ( $uploads = wp_upload_dir( ) ) && false === $uploads['error'] ) )443 if ( ! ( ( $uploads = wp_upload_dir( $time ) ) && false === $uploads['error'] ) ) 442 444 return $upload_error_handler( $file, $uploads['error'] ); 443 445 -
trunk/wp-admin/includes/media.php
r22093 r22105 270 270 $overrides = array('test_form'=>false); 271 271 272 $file = wp_handle_sideload($file_array, $overrides); 272 $time = current_time( 'mysql' ); 273 if ( $post = get_post( $post_id ) ) { 274 if ( substr( $post->post_date, 0, 4 ) > 0 ) 275 $time = $post->post_date; 276 } 277 278 $file = wp_handle_sideload( $file_array, $overrides, $time ); 273 279 if ( isset($file['error']) ) 274 280 return new WP_Error( 'upload_error', $file['error'] );
Note: See TracChangeset
for help on using the changeset viewer.