+ // Let the action code decide how to handle the request.
+ if ( $tab == 'type' || $tab == 'type_url' || ! array_key_exists( $tab , media_upload_tabs() ) ) {
+ /**
+ * Fires inside specific upload-type views in the legacy (pre-3.5.0)
+ * media popup based on the current tab.
+ *
+ * The dynamic portion of the hook name, $type, refers to the specific
+ * media upload type. Possible values include 'image', 'audio', 'video',
+ * 'file', etc.
+ *
+ * The hook only fires if the current $tab is 'type' (From Computer),
+ * 'type_url' (From URL), or, if the tab does not exist (i.e., has not
+ * been registered via the 'media_upload_tabs' filter.
+ *
+ * @since 2.5.0
+ */
+ do_action( "media_upload_$type" );
+ } else {
+ /**
+ * Fires inside limited and specific upload-tab views in the legacy
+ * (pre-3.5.0) media popup.
+ *
+ * The dynamic portion of the hook name, $tab, refers to the specific
+ * media upload tab. Possible values include 'library' (Media Library),
+ * or any custom tab registered via the 'media_upload_tabs' filter.
+ *
+ * @since 2.5.0
+ */
+ do_action( "media_upload_$tab" );
+ }