Changes in trunk/wp-admin/includes/file.php [19225:20313]
- File:
-
- 1 edited
-
trunk/wp-admin/includes/file.php (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/file.php
r19225 r20313 66 66 } 67 67 68 return basename( $file);68 return trim( basename( $file ) ); 69 69 } 70 70 … … 82 82 if ( $home != '' && $home != $siteurl ) { 83 83 $wp_path_rel_to_home = str_replace($home, '', $siteurl); /* $siteurl - $home */ 84 $pos = str pos($_SERVER["SCRIPT_FILENAME"], $wp_path_rel_to_home);84 $pos = strrpos($_SERVER["SCRIPT_FILENAME"], $wp_path_rel_to_home); 85 85 $home_path = substr($_SERVER["SCRIPT_FILENAME"], 0, $pos); 86 86 $home_path = trailingslashit( $home_path ); … … 158 158 * 159 159 * The filename is based off the passed parameter or defaults to the current unix timestamp, 160 * while the directory can either be passed as well, or by leaving it blank, default to a writable temporary directory.160 * while the directory can either be passed as well, or by leaving it blank, default to a writable temporary directory. 161 161 * 162 162 * @since 2.6.0 … … 241 241 $upload_error_handler = 'wp_handle_upload_error'; 242 242 243 // You may have had one or more 'wp_handle_upload_prefilter' functions error out the file. Handle that gracefully.243 // You may have had one or more 'wp_handle_upload_prefilter' functions error out the file. Handle that gracefully. 244 244 if ( isset( $file['error'] ) && !is_numeric( $file['error'] ) && $file['error'] ) 245 245 return $upload_error_handler( $file, $file['error'] ); … … 324 324 $filename = wp_unique_filename( $uploads['path'], $file['name'], $unique_filename_callback ); 325 325 326 $tmp_file = wp_tempnam($filename);327 328 326 // Move the file to the uploads dir 329 if ( false === @ move_uploaded_file( $file['tmp_name'], $tmp_file ) ) 327 $new_file = $uploads['path'] . "/$filename"; 328 if ( false === @ move_uploaded_file( $file['tmp_name'], $new_file ) ) 330 329 return $upload_error_handler( $file, sprintf( __('The uploaded file could not be moved to %s.' ), $uploads['path'] ) ); 331 332 // If a resize was requested, perform the resize.333 $image_resize = isset( $_POST['image_resize'] ) && 'true' == $_POST['image_resize'];334 $do_resize = apply_filters( 'wp_upload_resize', $image_resize );335 $size = @getimagesize( $tmp_file );336 if ( $do_resize && $size ) {337 $old_temp = $tmp_file;338 $tmp_file = image_resize( $tmp_file, (int) get_option('large_size_w'), (int) get_option('large_size_h'), 0, 'resized');339 if ( ! is_wp_error($tmp_file) ) {340 unlink($old_temp);341 } else {342 $tmp_file = $old_temp;343 }344 }345 346 // Copy the temporary file into its destination347 $new_file = $uploads['path'] . "/$filename";348 copy( $tmp_file, $new_file );349 unlink($tmp_file);350 330 351 331 // Set correct file permissions … … 365 345 /** 366 346 * Handle sideloads, which is the process of retrieving a media item from another server instead of 367 * a traditional media upload. This process involves sanitizing the filename, checking extensions347 * a traditional media upload. This process involves sanitizing the filename, checking extensions 368 348 * for mime type, and moving the file to the appropriate directory within the uploads directory. 369 349 * … … 487 467 /** 488 468 * Downloads a url to a local temporary file using the WordPress HTTP Class. 489 * Please note, That the calling function must unlink() the file.469 * Please note, That the calling function must unlink() the file. 490 470 * 491 471 * @since 2.5.0 … … 649 629 650 630 if ( ! $wp_filesystem->put_contents( $to . $info['name'], $contents, FS_CHMOD_FILE) ) 651 return new WP_Error('copy_failed', __('Could not copy file.'), $to . $info[' filename']);631 return new WP_Error('copy_failed', __('Could not copy file.'), $to . $info['name']); 652 632 } 653 633 … … 885 865 886 866 /** 887 * Displays a form to the user to request for their FTP/SSH details in order to connect to the filesystem.867 * Displays a form to the user to request for their FTP/SSH details in order to connect to the filesystem. 888 868 * All chosen/entered details are saved, Excluding the Password. 889 869 * … … 897 877 * @param string $type the chosen Filesystem method in use 898 878 * @param boolean $error if the current request has failed to connect 899 * @param string $context The directory which is needed access to, The write-test will be performed on this directory by get_filesystem_method()879 * @param string $context The directory which is needed access to, The write-test will be performed on this directory by get_filesystem_method() 900 880 * @param string $extra_fields Extra POST fields which should be checked for to be included in the post. 901 881 * @return boolean False on failure. True on success. … … 1076 1056 return false; 1077 1057 } 1078 1079 ?>
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)