WordPress.org

Make WordPress Core

Changeset 26917


Ignore:
Timestamp:
01/08/2014 03:59:22 AM (7 years ago)
Author:
DrewAPicture
Message:

Inline documentation for hooks in wp-admin/media-upload.php.

Props piontkowski for the initial patch.
Fixes #26075.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/media-upload.php

    r26908 r26917  
    3939
    4040    // upload type: image, video, file, ..?
    41     if ( isset($_GET['type']) )
     41    if ( isset($_GET['type']) ) {
    4242        $type = strval($_GET['type']);
    43     else
    44         $type = apply_filters('media_upload_default_type', 'file');
     43    } else {
     44        /**
     45         * Filter the default media upload type in the legacy (pre-3.5.0) media popup.
     46         *
     47         * @since 2.5.0
     48         *
     49         * @param string $type The default media upload type. Possible values include
     50         *                     'image', 'audio', 'video', 'file', etc. Default 'file'.
     51         */
     52        $type = apply_filters( 'media_upload_default_type', 'file' );
     53    }
    4554
    4655    // tab: gallery, library, or type-specific
     
    5362         * @since 2.5.0
    5463         *
    55          * @param string $type The default media popup tab.
     64         * @param string $type The default media popup tab. Default 'type' (From Computer).
    5665         */
    5766        $tab = apply_filters( 'media_upload_default_tab', 'type' );
     
    6170
    6271    // let the action code decide how to handle the request
    63     if ( $tab == 'type' || $tab == 'type_url' || ! array_key_exists( $tab , media_upload_tabs() ) )
    64         do_action("media_upload_$type");
    65     else
    66         do_action("media_upload_$tab");
     72    if ( $tab == 'type' || $tab == 'type_url' || ! array_key_exists( $tab , media_upload_tabs() ) ) {
     73        /**
     74         * Fires inside specific upload-type views in the legacy (pre-3.5.0)
     75         * media popup based on the current tab.
     76         *
     77         * The dynamic portion of the hook name, $type, refers to the specific
     78         * media upload type. Possible values include 'image', 'audio', 'video',
     79         * 'file', etc.
     80         *
     81         * The hook only fires if the current $tab is 'type' (From Computer),
     82         * 'type_url' (From URL), or, if the tab does not exist (i.e., has not
     83         * been registered via the 'media_upload_tabs' filter.
     84         *
     85         * @since 2.5.0
     86         */
     87        do_action( "media_upload_$type" );
     88    } else {
     89        /**
     90         * Fires inside limited and specific upload-tab views in the legacy
     91         * (pre-3.5.0) media popup.
     92         *
     93         * The dynamic portion of the hook name, $tab, refers to the specific
     94         * media upload tab. Possible values include 'library' (Media Library),
     95         * or any custom tab registered via the 'media_upload_tabs' filter.
     96         *
     97         * @since 2.5.0
     98         */
     99        do_action( "media_upload_$tab" );
     100    }
Note: See TracChangeset for help on using the changeset viewer.