49 ); |
49 ); |
50 } |
50 } |
51 |
51 |
52 // Upload type: image, video, file, ...? |
52 // Upload type: image, video, file, ...? |
53 if ( isset( $_GET['type'] ) ) { |
53 if ( isset( $_GET['type'] ) ) { |
54 $type = strval( $_GET['type'] ); |
54 $type = (string) $_GET['type']; |
55 } else { |
55 } else { |
56 /** |
56 /** |
57 * Filters the default media upload type in the legacy (pre-3.5.0) media popup. |
57 * Filters the default media upload type in the legacy (pre-3.5.0) media popup. |
58 * |
58 * |
59 * @since 2.5.0 |
59 * @since 2.5.0 |
64 $type = apply_filters( 'media_upload_default_type', 'file' ); |
64 $type = apply_filters( 'media_upload_default_type', 'file' ); |
65 } |
65 } |
66 |
66 |
67 // Tab: gallery, library, or type-specific. |
67 // Tab: gallery, library, or type-specific. |
68 if ( isset( $_GET['tab'] ) ) { |
68 if ( isset( $_GET['tab'] ) ) { |
69 $tab = strval( $_GET['tab'] ); |
69 $tab = (string) $_GET['tab']; |
70 } else { |
70 } else { |
71 /** |
71 /** |
72 * Filters the default tab in the legacy (pre-3.5.0) media popup. |
72 * Filters the default tab in the legacy (pre-3.5.0) media popup. |
73 * |
73 * |
74 * @since 2.5.0 |
74 * @since 2.5.0 |
75 * |
75 * |
76 * @param string $type The default media popup tab. Default 'type' (From Computer). |
76 * @param string $tab The default media popup tab. Default 'type' (From Computer). |
77 */ |
77 */ |
78 $tab = apply_filters( 'media_upload_default_tab', 'type' ); |
78 $tab = apply_filters( 'media_upload_default_tab', 'type' ); |
79 } |
79 } |
80 |
80 |
81 $body_id = 'media-upload'; |
81 $body_id = 'media-upload'; |
85 /** |
85 /** |
86 * Fires inside specific upload-type views in the legacy (pre-3.5.0) |
86 * Fires inside specific upload-type views in the legacy (pre-3.5.0) |
87 * media popup based on the current tab. |
87 * media popup based on the current tab. |
88 * |
88 * |
89 * The dynamic portion of the hook name, `$type`, refers to the specific |
89 * The dynamic portion of the hook name, `$type`, refers to the specific |
90 * media upload type. Possible values include 'image', 'audio', 'video', |
90 * media upload type. |
91 * 'file', etc. |
|
92 * |
91 * |
93 * The hook only fires if the current `$tab` is 'type' (From Computer), |
92 * The hook only fires if the current `$tab` is 'type' (From Computer), |
94 * 'type_url' (From URL), or, if the tab does not exist (i.e., has not |
93 * 'type_url' (From URL), or, if the tab does not exist (i.e., has not |
95 * been registered via the {@see 'media_upload_tabs'} filter. |
94 * been registered via the {@see 'media_upload_tabs'} filter. |
|
95 * |
|
96 * Possible hook names include: |
|
97 * |
|
98 * - `media_upload_audio` |
|
99 * - `media_upload_file` |
|
100 * - `media_upload_image` |
|
101 * - `media_upload_video` |
96 * |
102 * |
97 * @since 2.5.0 |
103 * @since 2.5.0 |
98 */ |
104 */ |
99 do_action( "media_upload_{$type}" ); |
105 do_action( "media_upload_{$type}" ); |
100 } else { |
106 } else { |