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 |
---|---|
1473 | * @param unknown_type $errors |
1474 | * @param unknown_type $id |
1475 | */ |
1476 | function media_upload_type_form($type = 'file', $errors = null, $id = null) { |
1477 | media_upload_header(); |
1478 |
|
1479 | $post_id = intval($_REQUEST['post_id']); |
1480 |
|
1481 | $form_action_url = admin_url("media-upload.php?type=$type&tab=type&post_id=$post_id"); |
1482 | $form_action_url = apply_filters('media_upload_form_url', $form_action_url, $type); |
1483 | ?> |
1484 |
|
1485 | <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"> |
1486 | <input type="submit" class="hidden" name="save" value="" /> |
1487 | <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" /> |
1488 | <?php wp_nonce_field('media-form'); ?> |
1489 |
|
1490 | <h3 class="media-title"><?php _e('Add media files from your computer'); ?></h3> |
1491 |
|
Line | Code |
1530 | * @param unknown_type $errors |
1531 | * @param unknown_type $id |
1532 | */ |
1533 | function media_upload_type_url_form($type = 'file', $errors = null, $id = null) { |
1534 | media_upload_header(); |
1535 |
|
1536 | $post_id = intval($_REQUEST['post_id']); |
1537 |
|
1538 | $form_action_url = admin_url("media-upload.php?type=$type&tab=type&post_id=$post_id"); |
1539 | $form_action_url = apply_filters('media_upload_form_url', $form_action_url, $type); |
1540 |
|
1541 | $callback = "type_url_form_$type"; |
1542 | ?> |
1543 |
|
1544 | <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"> |
1545 | <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" /> |
1546 | <?php wp_nonce_field('media-form'); ?> |
1547 |
|
1548 | <?php if ( is_callable($callback) ) { ?> |
Line | Code |
1648 | */ |
1649 | function media_upload_gallery_form($errors) { |
1650 | global $redir_tab, $type; |
1651 |
|
1652 | $redir_tab = 'gallery'; |
1653 | media_upload_header(); |
1654 |
|
1655 | $post_id = intval($_REQUEST['post_id']); |
1656 | $form_action_url = admin_url("media-upload.php?type=$type&tab=gallery&post_id=$post_id"); |
1657 | $form_action_url = apply_filters('media_upload_form_url', $form_action_url, $type); |
1658 | ?> |
1659 |
|
1660 | <script type="text/javascript"> |
1661 | <!-- |
1662 | jQuery(function($){ |
1663 | var preloaded = $(".media-item.preloaded"); |
1664 | if ( preloaded.length > 0 ) { |
1665 | preloaded.each(function(){prepareMediaItem({id:this.id.replace(/[^0-9]/g, '')},'');}); |
1666 | updateMediaForm(); |
Line | Code |
1789 | */ |
1790 | function media_upload_library_form($errors) { |
1791 | global $wpdb, $wp_query, $wp_locale, $type, $tab, $post_mime_types; |
1792 |
|
1793 | media_upload_header(); |
1794 |
|
1795 | $post_id = intval($_REQUEST['post_id']); |
1796 |
|
1797 | $form_action_url = admin_url("media-upload.php?type=$type&tab=library&post_id=$post_id"); |
1798 | $form_action_url = apply_filters('media_upload_form_url', $form_action_url, $type); |
1799 |
|
1800 | $_GET['paged'] = isset( $_GET['paged'] ) ? intval($_GET['paged']) : 0; |
1801 | if ( $_GET['paged'] < 1 ) |
1802 | $_GET['paged'] = 1; |
1803 | $start = ( $_GET['paged'] - 1 ) * 10; |
1804 | if ( $start < 1 ) |
1805 | $start = 0; |
1806 | add_filter( 'post_limits', $limit_filter = create_function( '$a', "return 'LIMIT $start, 10';" ) ); |
1807 |
|