WP hooks navigation: Home/browse • Actions index • Filters index
To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).
The best way to understand what a hook does is to look at where it occurs in the source code.
do_action( "hook_name" )apply_filters( "hook_name", "what_to_filter" ).Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.
This hook occurs 4 times in this file.
| Line | Code |
|---|---|
| 1529 | * @param unknown_type $errors |
| 1530 | * @param unknown_type $id |
| 1531 | */ |
| 1532 | function media_upload_type_form($type = 'file', $errors = null, $id = null) { |
| 1533 | media_upload_header(); |
| 1534 | |
| 1535 | $post_id = isset( $_REQUEST['post_id'] )? intval( $_REQUEST['post_id'] ) : 0; |
| 1536 | |
| 1537 | $form_action_url = admin_url("media-upload.php?type=$type&tab=type&post_id=$post_id"); |
| 1538 | $form_action_url = apply_filters('media_upload_form_url', $form_action_url, $type); |
| 1539 | ?> |
| 1540 | |
| 1541 | <form enctype="multipart/form-data" method="post" action="<?php echo esc_attr($form_action_url); ?>" class="media-upload-form type-form validate" id="<?php echo $type; ?>-form"> |
| 1542 | <input type="submit" class="hidden" name="save" value="" /> |
| 1543 | <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" /> |
| 1544 | <?php wp_nonce_field('media-form'); ?> |
| 1545 | |
| 1546 | <h3 class="media-title"><?php _e('Add media files from your computer'); ?></h3> |
| 1547 | |
| Line | Code |
| 1587 | * @param unknown_type $errors |
| 1588 | * @param unknown_type $id |
| 1589 | */ |
| 1590 | function media_upload_type_url_form($type = 'file', $errors = null, $id = null) { |
| 1591 | media_upload_header(); |
| 1592 | |
| 1593 | $post_id = intval($_REQUEST['post_id']); |
| 1594 | |
| 1595 | $form_action_url = admin_url("media-upload.php?type=$type&tab=type&post_id=$post_id"); |
| 1596 | $form_action_url = apply_filters('media_upload_form_url', $form_action_url, $type); |
| 1597 | |
| 1598 | $callback = "type_url_form_$type"; |
| 1599 | ?> |
| 1600 | |
| 1601 | <form enctype="multipart/form-data" method="post" action="<?php echo esc_attr($form_action_url); ?>" class="media-upload-form type-form validate" id="<?php echo $type; ?>-form"> |
| 1602 | <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" /> |
| 1603 | <?php wp_nonce_field('media-form'); ?> |
| 1604 | |
| 1605 | <?php if ( is_callable($callback) ) { ?> |
| Line | Code |
| 1705 | */ |
| 1706 | function media_upload_gallery_form($errors) { |
| 1707 | global $redir_tab, $type; |
| 1708 | |
| 1709 | $redir_tab = 'gallery'; |
| 1710 | media_upload_header(); |
| 1711 | |
| 1712 | $post_id = intval($_REQUEST['post_id']); |
| 1713 | $form_action_url = admin_url("media-upload.php?type=$type&tab=gallery&post_id=$post_id"); |
| 1714 | $form_action_url = apply_filters('media_upload_form_url', $form_action_url, $type); |
| 1715 | ?> |
| 1716 | |
| 1717 | <script type="text/javascript"> |
| 1718 | <!-- |
| 1719 | jQuery(function($){ |
| 1720 | var preloaded = $(".media-item.preloaded"); |
| 1721 | if ( preloaded.length > 0 ) { |
| 1722 | preloaded.each(function(){prepareMediaItem({id:this.id.replace(/[^0-9]/g, '')},'');}); |
| 1723 | updateMediaForm(); |
| Line | Code |
| 1846 | */ |
| 1847 | function media_upload_library_form($errors) { |
| 1848 | global $wpdb, $wp_query, $wp_locale, $type, $tab, $post_mime_types; |
| 1849 | |
| 1850 | media_upload_header(); |
| 1851 | |
| 1852 | $post_id = intval($_REQUEST['post_id']); |
| 1853 | |
| 1854 | $form_action_url = admin_url("media-upload.php?type=$type&tab=library&post_id=$post_id"); |
| 1855 | $form_action_url = apply_filters('media_upload_form_url', $form_action_url, $type); |
| 1856 | |
| 1857 | $_GET['paged'] = isset( $_GET['paged'] ) ? intval($_GET['paged']) : 0; |
| 1858 | if ( $_GET['paged'] < 1 ) |
| 1859 | $_GET['paged'] = 1; |
| 1860 | $start = ( $_GET['paged'] - 1 ) * 10; |
| 1861 | if ( $start < 1 ) |
| 1862 | $start = 0; |
| 1863 | add_filter( 'post_limits', create_function( '$a', "return 'LIMIT $start, 10';" ) ); |
| 1864 | |