Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: media_upload_form_url

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

This hook occurs 4 times in this file.

Line Code
1601  * @param unknown_type $errors
1602  * @param unknown_type $id
1603  */
1604 function media_upload_type_form($type = 'file', $errors = null, $id = null) {
1605      media_upload_header();
1606
1607      $post_id = isset( $_REQUEST['post_id'] )? intval( $_REQUEST['post_id'] ) : 0;
1608
1609      $form_action_url = admin_url("media-upload.php?type=$type&tab=type&post_id=$post_id");
1610      $form_action_url = apply_filters('media_upload_form_url', $form_action_url, $type);
1611 ?>
1612
1613 <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">
1614 <?php submit_button( '', 'hidden', 'save', false ); ?>
1615 <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
1616 <?php wp_nonce_field('media-form'); ?>
1617
1618 <h3 class="media-title"><?php _e('Add media files from your computer'); ?></h3>
1619
 
Line Code
1659  * @param unknown_type $errors
1660  * @param unknown_type $id
1661  */
1662 function media_upload_type_url_form($type = 'file', $errors = null, $id = null) {
1663      media_upload_header();
1664
1665      $post_id = intval($_REQUEST['post_id']);
1666
1667      $form_action_url = admin_url("media-upload.php?type=$type&tab=type&post_id=$post_id");
1668      $form_action_url = apply_filters('media_upload_form_url', $form_action_url, $type);
1669
1670      $callback = "type_url_form_$type";
1671 ?>
1672
1673 <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">
1674 <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
1675 <?php wp_nonce_field('media-form'); ?>
1676
1677 <?php if ( is_callable($callback) ) { ?>
 
Line Code
1777  */
1778 function media_upload_gallery_form($errors) {
1779      global $redir_tab, $type;
1780
1781      $redir_tab = 'gallery';
1782      media_upload_header();
1783
1784      $post_id = intval($_REQUEST['post_id']);
1785      $form_action_url = admin_url("media-upload.php?type=$type&tab=gallery&post_id=$post_id");
1786      $form_action_url = apply_filters('media_upload_form_url', $form_action_url, $type);
1787 ?>
1788
1789 <script type="text/javascript">
1790 <!--
1791 jQuery(function($){
1792      var preloaded = $(".media-item.preloaded");
1793      if ( preloaded.length > 0 ) {
1794           preloaded.each(function(){prepareMediaItem({id:this.id.replace(/[^0-9]/g, '')},'');});
1795           updateMediaForm();
 
Line Code
1919  */
1920 function media_upload_library_form($errors) {
1921      global $wpdb, $wp_query, $wp_locale, $type, $tab, $post_mime_types;
1922
1923      media_upload_header();
1924
1925      $post_id = intval($_REQUEST['post_id']);
1926
1927      $form_action_url = admin_url("media-upload.php?type=$type&tab=library&post_id=$post_id");
1928      $form_action_url = apply_filters('media_upload_form_url', $form_action_url, $type);
1929
1930      $_GET['paged'] = isset( $_GET['paged'] ) ? intval($_GET['paged']) : 0;
1931      if ( $_GET['paged'] < 1 )
1932           $_GET['paged'] = 1;
1933      $start = ( $_GET['paged'] - 1 ) * 10;
1934      if ( $start < 1 )
1935           $start = 0;
1936      add_filter( 'post_limits', create_function( '$a', "return 'LIMIT $start, 10';" ) );
1937