Make WordPress Core

Changeset 27672


Ignore:
Timestamp:
03/24/2014 02:44:17 AM (11 years ago)
Author:
DrewAPicture
Message:

Inline documentation for hooks in wp-admin/includes/file.php.

Fixes #27429.

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/file.php

    r27546 r27672  
    195195 *
    196196 * @uses wp_handle_upload_error
    197  * @uses apply_filters
    198197 * @uses is_multisite
    199198 * @uses wp_check_filetype_and_ext
     
    215214    }
    216215
     216    /**
     217     * Filter data for the current file to upload.
     218     *
     219     * @since 2.9.0
     220     *
     221     * @param array $file An array of data for a single file.
     222     */
    217223    $file = apply_filters( 'wp_handle_upload_prefilter', $file );
    218224
     
    326332        delete_transient( 'dirsize_cache' );
    327333
     334    /**
     335     * Filter the data array for the uploaded file.
     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     */
    328348    return apply_filters( 'wp_handle_upload', array( 'file' => $new_file, 'url' => $url, 'type' => $type ), 'upload' );
    329349}
     
    337357 *
    338358 * @uses wp_handle_upload_error
    339  * @uses apply_filters
    340359 * @uses wp_check_filetype_and_ext
    341360 * @uses current_user_can
     
    451470    $url = $uploads['url'] . "/$filename";
    452471
     472    /** This filter is documented in wp-admin/includes/file.php */
    453473    $return = apply_filters( 'wp_handle_upload', array( 'file' => $new_file, 'url' => $url, 'type' => $type ), 'sideload' );
    454474
     
    544564
    545565    // Unzip can use a lot of memory, but not this much hopefully
     566    /** This filter is documented in wp-admin/admin.php */
    546567    @ini_set( 'memory_limit', apply_filters( 'admin_memory_limit', WP_MAX_MEMORY_LIMIT ) );
    547568
     
    567588    }
    568589
    569     if ( class_exists('ZipArchive') && apply_filters('unzip_file_use_ziparchive', true ) ) {
     590    /**
     591     * Filter whether to use ZipArchive to unzip archives.
     592     *
     593     * @since 3.0.0
     594     *
     595     * @param bool $ziparchive Whether to use ZipArchive. Default true.
     596     */
     597    if ( class_exists( 'ZipArchive' ) && apply_filters( 'unzip_file_use_ziparchive', true ) ) {
    570598        $result = _unzip_file_ziparchive($file, $to, $needed_dirs);
    571599        if ( true === $result ) {
     
    844872
    845873    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
    847887        if ( ! file_exists($abstraction_file) )
    848888            return;
     
    916956    if ( ! $method && extension_loaded('ftp') ) $method = 'ftpext';
    917957    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 use.
     961     *
     962     * @since 2.6.0
     963     *
     964     * @param string $method Filesystem method to return.
     965     * @param array  $args   An array of connection details for the method.
     966     */
     967    return apply_filters( 'filesystem_method', $method, $args );
    919968}
    920969
     
    937986 */
    938987function 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.
     1001     *                             Default false.
     1002     * @param string $context      Full path to the directory that is tested for
     1003     *                             being writable.
     1004     * @param array  $extra_fields Extra POST fields.
     1005     */
    9391006    $req_cred = apply_filters( 'request_filesystem_credentials', '', $form_post, $type, $error, $context, $extra_fields );
    9401007    if ( '' !== $req_cred )
     
    10151082        $types[ 'ssh' ] = __('SSH2');
    10161083
    1017     $types = apply_filters('fs_ftp_connection_types', $types, $credentials, $type, $error, $context);
     1084    /**
     1085     * Filter the connection types to output to the filesystem credentials form.
     1086     *
     1087     * @since 2.9.0
     1088     *
     1089     * @param array  $types       Types of connections.
     1090     * @param array  $credentials Credentials to connect with.
     1091     * @param string $type        Chosen filesystem method.
     1092     * @param object $error       Error object.
     1093     * @param string $context     Full path to the directory that is tested
     1094     *                            for being writable.
     1095     */
     1096    $types = apply_filters( 'fs_ftp_connection_types', $types, $credentials, $type, $error, $context );
    10181097
    10191098?>
  • trunk/src/wp-includes/class-wp-xmlrpc-server.php

    r27554 r27672  
    49964996            'type' => $type
    49974997        );
     4998
     4999        /** This filter is documented in wp-admin/includes/file.php */
    49985000        return apply_filters( 'wp_handle_upload', $struct, 'upload' );
    49995001    }
Note: See TracChangeset for help on using the changeset viewer.