Ticket #27429: 27429.diff
| File 27429.diff, 6.4 KB (added by , 12 years ago) |
|---|
-
src/wp-admin/includes/file.php
194 194 * @since 2.0.0 195 195 * 196 196 * @uses wp_handle_upload_error 197 * @uses apply_filters198 197 * @uses is_multisite 199 198 * @uses wp_check_filetype_and_ext 200 199 * @uses current_user_can … … 214 213 } 215 214 } 216 215 216 /** 217 * Filter the file data for the current file to upload. 218 * 219 * @since 2.9.0 220 * 221 * @param array $file Array of data for a single file. 222 */ 217 223 $file = apply_filters( 'wp_handle_upload_prefilter', $file ); 218 224 219 225 // You may define your own function and pass the name in $overrides['upload_error_handler'] … … 325 331 if ( is_multisite() ) 326 332 delete_transient( 'dirsize_cache' ); 327 333 334 /** 335 * Filter the uploaded file data array. 336 * 337 * @since 2.1.0 338 * 339 * @param array $upload { 340 * Array of upload data. 341 * 342 * @type string $file Filename of the newly-uploaded file. 343 * @type string $url URL of the uploaded file. 344 * @type string $type File type. 345 * } 346 * @param string $context The type of upload action. Accepts 'upload' or 'sideload'. 347 */ 328 348 return apply_filters( 'wp_handle_upload', array( 'file' => $new_file, 'url' => $url, 'type' => $type ), 'upload' ); 329 349 } 330 350 … … 336 356 * @since 2.6.0 337 357 * 338 358 * @uses wp_handle_upload_error 339 * @uses apply_filters340 359 * @uses wp_check_filetype_and_ext 341 360 * @uses current_user_can 342 361 * @uses wp_upload_dir … … 450 469 // Compute the URL 451 470 $url = $uploads['url'] . "/$filename"; 452 471 472 /** This filter is documented in wp-admin/includes/file.php */ 453 473 $return = apply_filters( 'wp_handle_upload', array( 'file' => $new_file, 'url' => $url, 'type' => $type ), 'sideload' ); 454 474 455 475 return $return; … … 543 563 return new WP_Error('fs_unavailable', __('Could not access filesystem.')); 544 564 545 565 // Unzip can use a lot of memory, but not this much hopefully 566 /** This filter is documented in wp-admin/admin.php */ 546 567 @ini_set( 'memory_limit', apply_filters( 'admin_memory_limit', WP_MAX_MEMORY_LIMIT ) ); 547 568 548 569 $needed_dirs = array(); … … 566 587 } 567 588 } 568 589 569 if ( class_exists('ZipArchive') && apply_filters('unzip_file_use_ziparchive', true ) ) { 590 /** 591 * Filter whether to use ZipArchive to unzip the archive. 592 * 593 * @since 594 * 595 * @param bool $ziparchive Whether or not to use ZipArchive. Default true. 596 */ 597 if ( class_exists( 'ZipArchive' ) && apply_filters( 'unzip_file_use_ziparchive', true ) ) { 570 598 $result = _unzip_file_ziparchive($file, $to, $needed_dirs); 571 599 if ( true === $result ) { 572 600 return $result; … … 843 871 return false; 844 872 845 873 if ( ! class_exists("WP_Filesystem_$method") ) { 846 $abstraction_file = apply_filters('filesystem_method_file', ABSPATH . 'wp-admin/includes/class-wp-filesystem-' . $method . '.php', $method); 874 875 /** 876 * Filter the path for a specific filesystem method class file. 877 * 878 * @since 2.6.0 879 * 880 * @see get_filesystem_method() 881 * 882 * @param string $path Path to the specific filesystem method class file. 883 * @param string $method The filesystem method to use. 884 */ 885 $abstraction_file = apply_filters( 'filesystem_method_file', ABSPATH . 'wp-admin/includes/class-wp-filesystem-' . $method . '.php', $method ); 886 847 887 if ( ! file_exists($abstraction_file) ) 848 888 return; 849 889 … … 915 955 if ( ! $method && isset($args['connection_type']) && 'ssh' == $args['connection_type'] && extension_loaded('ssh2') && function_exists('stream_get_contents') ) $method = 'ssh2'; 916 956 if ( ! $method && extension_loaded('ftp') ) $method = 'ftpext'; 917 957 if ( ! $method && ( extension_loaded('sockets') || function_exists('fsockopen') ) ) $method = 'ftpsockets'; //Sockets: Socket extension; PHP Mode: FSockopen / fwrite / fread 918 return apply_filters('filesystem_method', $method, $args); 958 959 /** 960 * Filter the filesystem method to return. 961 * 962 * @since 2.6.0 963 * 964 * @param string $method Filesystem method to return. 965 * @param array $args Array of connection details for the method. 966 */ 967 return apply_filters( 'filesystem_method', $method, $args ); 919 968 } 920 969 921 970 /** … … 936 985 * @return boolean False on failure. True on success. 937 986 */ 938 987 function request_filesystem_credentials($form_post, $type = '', $error = false, $context = false, $extra_fields = null) { 988 989 /** 990 * Filter the filesystem credentials form output. 991 * 992 * Returning anything other than an empty string will effectively short-circuit 993 * output of the filesystem credentials form, returning that value instead. 994 * 995 * @since 2.5.0 996 * 997 * @param mixed $output Form output to return instead. Default empty. 998 * @param string $form_post URL to POST the form to. 999 * @param string $type Chosen type of filesystem. 1000 * @param bool $error Whether the current request has failed to connect or not. Default false. 1001 * @param string $context Full path to the directory that is tested for being writable. 1002 * @param array $extra_fields Extra POST fields. 1003 */ 939 1004 $req_cred = apply_filters( 'request_filesystem_credentials', '', $form_post, $type, $error, $context, $extra_fields ); 940 1005 if ( '' !== $req_cred ) 941 1006 return $req_cred; … … 1014 1079 if ( extension_loaded('ssh2') && function_exists('stream_get_contents') ) 1015 1080 $types[ 'ssh' ] = __('SSH2'); 1016 1081 1017 $types = apply_filters('fs_ftp_connection_types', $types, $credentials, $type, $error, $context); 1082 /** 1083 * Filter the connection types to output to the filesystem credentials form. 1084 * 1085 * @since 2.9.0 1086 * 1087 * @param array $types Types of connections. 1088 * @param array $credentials Credentials to connect with. 1089 * @param string $type Chosen filesystem method. 1090 * @param object $error Error object. 1091 * @param string $context Full path to the directory that is tested for being writable. 1092 */ 1093 $types = apply_filters( 'fs_ftp_connection_types', $types, $credentials, $type, $error, $context ); 1018 1094 1019 1095 ?> 1020 1096 <script type="text/javascript"> -
src/wp-includes/class-wp-xmlrpc-server.php
4995 4995 'url' => $upload[ 'url' ], 4996 4996 'type' => $type 4997 4997 ); 4998 4999 /** This filter is documented in wp-admin/includes/file.php */ 4998 5000 return apply_filters( 'wp_handle_upload', $struct, 'upload' ); 4999 5001 } 5000 5002
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)