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 |
---|---|
1575 | * @param unknown_type $errors |
1576 | * @param unknown_type $id |
1577 | */ |
1578 | function media_upload_type_form($type = 'file', $errors = null, $id = null) { |
1579 | media_upload_header(); |
1580 |
|
1581 | $post_id = isset( $_REQUEST['post_id'] )? intval( $_REQUEST['post_id'] ) : 0; |
1582 |
|
1583 | $form_action_url = admin_url("media-upload.php?type=$type&tab=type&post_id=$post_id"); |
1584 | $form_action_url = apply_filters('media_upload_form_url', $form_action_url, $type); |
1585 | ?> |
1586 |
|
1587 | <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"> |
1588 | <?php submit_button( '', 'hidden', 'save', false ); ?> |
1589 | <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" /> |
1590 | <?php wp_nonce_field('media-form'); ?> |
1591 |
|
1592 | <h3 class="media-title"><?php _e('Add media files from your computer'); ?></h3> |
1593 |
|
Line | Code |
1633 | * @param unknown_type $errors |
1634 | * @param unknown_type $id |
1635 | */ |
1636 | function media_upload_type_url_form($type = 'file', $errors = null, $id = null) { |
1637 | media_upload_header(); |
1638 |
|
1639 | $post_id = intval($_REQUEST['post_id']); |
1640 |
|
1641 | $form_action_url = admin_url("media-upload.php?type=$type&tab=type&post_id=$post_id"); |
1642 | $form_action_url = apply_filters('media_upload_form_url', $form_action_url, $type); |
1643 |
|
1644 | $callback = "type_url_form_$type"; |
1645 | ?> |
1646 |
|
1647 | <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"> |
1648 | <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" /> |
1649 | <?php wp_nonce_field('media-form'); ?> |
1650 |
|
1651 | <?php if ( is_callable($callback) ) { ?> |
Line | Code |
1751 | */ |
1752 | function media_upload_gallery_form($errors) { |
1753 | global $redir_tab, $type; |
1754 |
|
1755 | $redir_tab = 'gallery'; |
1756 | media_upload_header(); |
1757 |
|
1758 | $post_id = intval($_REQUEST['post_id']); |
1759 | $form_action_url = admin_url("media-upload.php?type=$type&tab=gallery&post_id=$post_id"); |
1760 | $form_action_url = apply_filters('media_upload_form_url', $form_action_url, $type); |
1761 | ?> |
1762 |
|
1763 | <script type="text/javascript"> |
1764 | <!-- |
1765 | jQuery(function($){ |
1766 | var preloaded = $(".media-item.preloaded"); |
1767 | if ( preloaded.length > 0 ) { |
1768 | preloaded.each(function(){prepareMediaItem({id:this.id.replace(/[^0-9]/g, '')},'');}); |
1769 | updateMediaForm(); |
Line | Code |
1893 | */ |
1894 | function media_upload_library_form($errors) { |
1895 | global $wpdb, $wp_query, $wp_locale, $type, $tab, $post_mime_types; |
1896 |
|
1897 | media_upload_header(); |
1898 |
|
1899 | $post_id = intval($_REQUEST['post_id']); |
1900 |
|
1901 | $form_action_url = admin_url("media-upload.php?type=$type&tab=library&post_id=$post_id"); |
1902 | $form_action_url = apply_filters('media_upload_form_url', $form_action_url, $type); |
1903 |
|
1904 | $_GET['paged'] = isset( $_GET['paged'] ) ? intval($_GET['paged']) : 0; |
1905 | if ( $_GET['paged'] < 1 ) |
1906 | $_GET['paged'] = 1; |
1907 | $start = ( $_GET['paged'] - 1 ) * 10; |
1908 | if ( $start < 1 ) |
1909 | $start = 0; |
1910 | add_filter( 'post_limits', create_function( '$a', "return 'LIMIT $start, 10';" ) ); |
1911 |
|