<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[26908] trunk/src/wp-admin: Inline documentation for hooks in wp-admin/includes/media.php.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/26908">26908</a></dd>
<dt>Author</dt> <dd>DrewAPicture</dd>
<dt>Date</dt> <dd>2014-01-06 05:47:51 +0000 (Mon, 06 Jan 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Inline documentation for hooks in wp-admin/includes/media.php.

Props kpdesign, DrewAPicture.
Fixes <a href="http://core.trac.wordpress.org/ticket/25375">#25375</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadminincludesmediaphp">trunk/src/wp-admin/includes/media.php</a></li>
<li><a href="#trunksrcwpadminmediauploadphp">trunk/src/wp-admin/media-upload.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpadminincludesmediaphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/includes/media.php (26907 => 26908)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/includes/media.php    2014-01-05 18:57:43 UTC (rev 26907)
+++ trunk/src/wp-admin/includes/media.php       2014-01-06 05:47:51 UTC (rev 26908)
</span><span class="lines">@@ -21,7 +21,14 @@
</span><span class="cx">          'library' => __('Media Library')
</span><span class="cx">  );
</span><span class="cx"> 
</span><del>-       return apply_filters('media_upload_tabs', $_default_tabs);
</del><ins>+        /**
+        * Filter the available tabs in the legacy (pre-3.5.0) media popup.
+        *
+        * @since 2.5.0
+        *
+        * @param array $_default_tabs An array of media tabs.
+        */
+       return apply_filters( 'media_upload_tabs', $_default_tabs );
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><span class="lines">@@ -68,12 +75,14 @@
</span><span class="cx"> 
</span><span class="cx">  if ( !empty($tabs) ) {
</span><span class="cx">          echo "<ul id='sidemenu'>\n";
</span><del>-               if ( isset($redir_tab) && array_key_exists($redir_tab, $tabs) )
</del><ins>+                if ( isset($redir_tab) && array_key_exists($redir_tab, $tabs) ) {
</ins><span class="cx">                   $current = $redir_tab;
</span><del>-               elseif ( isset($_GET['tab']) && array_key_exists($_GET['tab'], $tabs) )
</del><ins>+                } elseif ( isset($_GET['tab']) && array_key_exists($_GET['tab'], $tabs) ) {
</ins><span class="cx">                   $current = $_GET['tab'];
</span><del>-               else
-                       $current = apply_filters('media_upload_default_tab', $default);
</del><ins>+                } else {
+                       /** This filter is documented in wp-admin/media-upload.php */
+                       $current = apply_filters( 'media_upload_default_tab', $default );
+               }
</ins><span class="cx"> 
</span><span class="cx">          foreach ( $tabs as $callback => $text ) {
</span><span class="cx">                  $class = '';
</span><span class="lines">@@ -113,6 +122,20 @@
</span><span class="cx">  if ( $url )
</span><span class="cx">          $html = '<a href="' . esc_attr($url) . "\"$rel>$html</a>";
</span><span class="cx"> 
</span><ins>+       /**
+        * Filter the image HTML markup to send to the editor.
+        *
+        * @since 2.5.0
+        *
+        * @param string $html    The image HTML markup to send.
+        * @param int    $id      The attachment id.
+        * @param string $caption The image caption.
+        * @param string $title   The image title.
+        * @param string $align   The image alignment.
+        * @param string $url     The image source URL.
+        * @param string $size    The image size.
+        * @param string $alt     The image alternative, or alt, text.
+        */
</ins><span class="cx">   $html = apply_filters( 'image_send_to_editor', $html, $id, $caption, $title, $align, $url, $size, $alt );
</span><span class="cx"> 
</span><span class="cx">  return $html;
</span><span class="lines">@@ -135,6 +158,16 @@
</span><span class="cx">  */
</span><span class="cx"> function image_add_caption( $html, $id, $caption, $title, $align, $url, $size, $alt = '' ) {
</span><span class="cx"> 
</span><ins>+       /**
+        * Filter whether to disable captions.
+        *
+        * Prevents image captions from being appended to image HTML when inserted into the editor.
+        *
+        * @since 2.6.0
+        *
+        * @param bool $bool Whether to disable appending captions. Returning true to the filter
+        *                   will disable captions. Default empty string.
+        */
</ins><span class="cx">   if ( empty($caption) || apply_filters( 'disable_captions', '' ) )
</span><span class="cx">          return $html;
</span><span class="cx"> 
</span><span class="lines">@@ -156,6 +189,14 @@
</span><span class="cx"> 
</span><span class="cx">  $shcode = '[caption id="' . $id . '" align="align' . $align      . '" width="' . $width . '"]' . $html . ' ' . $caption . '[/caption]';
</span><span class="cx"> 
</span><ins>+       /**
+        * Filter the image HTML markup including the caption shortcode.
+        *
+        * @since 2.6.0
+        *
+        * @param string $shcode The image HTML markup with caption shortcode.
+        * @param string $html   The image HTML markup.
+        */
</ins><span class="cx">   return apply_filters( 'image_add_caption_shortcode', $shcode, $html );
</span><span class="cx"> }
</span><span class="cx"> add_filter( 'image_send_to_editor', 'image_add_caption', 20, 8 );
</span><span class="lines">@@ -397,16 +438,54 @@
</span><span class="cx"> //]]>
</span><span class="cx"> </script>
</span><span class="cx"> <?php
</span><del>-do_action('admin_enqueue_scripts', 'media-upload-popup');
-do_action('admin_print_styles-media-upload-popup');
-do_action('admin_print_styles');
-do_action('admin_print_scripts-media-upload-popup');
-do_action('admin_print_scripts');
-do_action('admin_head-media-upload-popup');
-do_action('admin_head');
</del><ins>+        /** This action is documented in wp-admin/admin-header.php */
+       do_action( 'admin_enqueue_scripts', 'media-upload-popup' );
</ins><span class="cx"> 
</span><del>-if ( is_string($content_func) )
</del><ins>+        /**
+        * Print admin styles enqueued for the legacy (pre-3.5.0) media upload popup.
+        *
+        * @since 2.9.0
+        */
+       do_action( 'admin_print_styles-media-upload-popup' );
+
+       /** This action is documented in wp-admin/admin-header.php */
+       do_action( 'admin_print_styles' );
+
+       /**
+        * Print admin scripts enqueued for the legacy (pre-3.5.0) media upload popup.
+        *
+        * @since 2.9.0
+        */
+       do_action( 'admin_print_scripts-media-upload-popup' );
+
+       /** This action is documented in wp-admin/admin-header.php */
+       do_action( 'admin_print_scripts' );
+
+       /**
+        * Print scripts enqueued for the admin header for the legacy (pre-3.5.0)
+        * media upload popup.
+        *
+        * @since 2.9.0
+        */
+       do_action( 'admin_head-media-upload-popup' );
+
+       /** This action is documented in wp-admin/admin-header.php */
+       do_action( 'admin_head' );
+
+if ( is_string( $content_func ) ) {
+       /**
+        * Fires in the admin header for each specific form tab in the legacy
+        * (pre-3.5.0) media upload popup.
+        *
+        * The dynamic portion of the hook, $content_func, refers to the form
+        * callback for the media upload type. Possible values include
+        * 'media_upload_type_form', 'media_upload_type_url_form', and
+        * 'media_upload_library_form'.
+        *
+        * @since 2.5.0
+        */
</ins><span class="cx">   do_action( "admin_head_{$content_func}" );
</span><ins>+}
</ins><span class="cx"> ?>
</span><span class="cx"> </head>
</span><span class="cx"> <body<?php if ( isset($GLOBALS['body_id']) ) echo ' id="' . $GLOBALS['body_id'] . '"'; ?> class="wp-core-ui no-js">
</span><span class="lines">@@ -418,7 +497,8 @@
</span><span class="cx">  $args = array_slice($args, 1);
</span><span class="cx">  call_user_func_array($content_func, $args);
</span><span class="cx"> 
</span><del>-       do_action('admin_print_footer_scripts');
</del><ins>+        /** This action is documented in wp-admin/admin-footer.php */
+       do_action( 'admin_print_footer_scripts' );
</ins><span class="cx"> ?>
</span><span class="cx"> <script type="text/javascript">if(typeof wpOnload=='function')wpOnload();</script>
</span><span class="cx"> </body>
</span><span class="lines">@@ -446,8 +526,15 @@
</span><span class="cx"> 
</span><span class="cx">  echo '<a href="#" id="insert-media-button" class="button insert-media add_media" data-editor="' . esc_attr( $editor_id ) . '" title="' . esc_attr__( 'Add Media' ) . '">' . $img . __( 'Add Media' ) . '</a>';
</span><span class="cx"> 
</span><del>-       // Don't use this filter. Want to add a button? Use the media_buttons action.
-       $legacy_filter = apply_filters('media_buttons_context', ''); // deprecated
</del><ins>+        /**
+        * Filter the legacy (pre-3.5.0) media buttons.
+        *
+        * @since 2.5.0
+        * @deprecated 3.5.0 Use 'media_buttons' action instead.
+        *
+        * @param string $string Media buttons context. Default empty.
+        */
+       $legacy_filter = apply_filters( 'media_buttons_context', '' );
</ins><span class="cx"> 
</span><span class="cx">  if ( $legacy_filter ) {
</span><span class="cx">          // #WP22559. Close <a> if a plugin started by closing <a> to open their own <a> tag.
</span><span class="lines">@@ -472,7 +559,17 @@
</span><span class="cx">  if ( ! empty( $tab ) )
</span><span class="cx">          $upload_iframe_src = add_query_arg('tab', $tab, $upload_iframe_src);
</span><span class="cx"> 
</span><del>-       $upload_iframe_src = apply_filters($type . '_upload_iframe_src', $upload_iframe_src);
</del><ins>+        /**
+        * Filter the upload iframe source URL for a specific media type.
+        *
+        * The dynamic portion of the hook name, $type, refers to the type
+        * of media uploaded.
+        *
+        * @since 3.0.0
+        *
+        * @param string $upload_iframe_src The upload iframe source URL by type.
+        */
+       $upload_iframe_src = apply_filters( $type . '_upload_iframe_src', $upload_iframe_src );
</ins><span class="cx"> 
</span><span class="cx">  return add_query_arg('TB_iframe', true, $upload_iframe_src);
</span><span class="cx"> }
</span><span class="lines">@@ -514,7 +611,17 @@
</span><span class="cx">                          $post['post_parent'] = $attachment['post_parent'];
</span><span class="cx">          }
</span><span class="cx"> 
</span><del>-               $post = apply_filters('attachment_fields_to_save', $post, $attachment);
</del><ins>+                /**
+                * Filter the attachment fields to be saved.
+                *
+                * @since 2.5.0
+                *
+                * @see wp_get_attachment_metadata()
+                *
+                * @param WP_Post $post       The WP_Post object.
+                * @param array   $attachment An array of attachment metadata.
+                */
+               $post = apply_filters( 'attachment_fields_to_save', $post, $attachment );
</ins><span class="cx"> 
</span><span class="cx">          if ( isset($attachment['image_alt']) ) {
</span><span class="cx">                  $image_alt = wp_unslash( $attachment['image_alt'] );
</span><span class="lines">@@ -561,7 +668,18 @@
</span><span class="cx">                  $html = "<a href='{$attachment['url']}'$rel>$html</a>";
</span><span class="cx">          }
</span><span class="cx"> 
</span><del>-               $html = apply_filters('media_send_to_editor', $html, $send_id, $attachment);
</del><ins>+                /**
+                * Filter the HTML markup for a media item sent to the editor.
+                *
+                * @since 2.5.0
+                *
+                * @see wp_get_attachment_metadata()
+                *
+                * @param string $html       HTML markup for a media item sent to the editor.
+                * @param int    $send_id    The first key from the $_POST['send'] data.
+                * @param array  $attachment Array of attachment metadata.
+                */
+               $html = apply_filters( 'media_send_to_editor', $html, $send_id, $attachment );
</ins><span class="cx">           return media_send_to_editor($html);
</span><span class="cx">  }
</span><span class="cx"> 
</span><span class="lines">@@ -608,6 +726,18 @@
</span><span class="cx">                          && ( 'audio' == $ext_type || 'video' == $ext_type ) )
</span><span class="cx">                                  $type = $ext_type;
</span><span class="cx"> 
</span><ins>+                       /**
+                        * Filter the URL sent to the editor for a specific media type.
+                        *
+                        * The dynamic portion of the hook name, $type, refers to the type
+                        * of media being sent.
+                        *
+                        * @since 3.3.0
+                        *
+                        * @param string $html  HTML markup sent to the editor.
+                        * @param string $src   Media source URL.
+                        * @param string $title Media title.
+                        */
</ins><span class="cx">                   $html = apply_filters( $type . '_send_to_editor_url', $html, esc_url_raw( $src ), $title );
</span><span class="cx">          } else {
</span><span class="cx">                  $align = '';
</span><span class="lines">@@ -619,6 +749,17 @@
</span><span class="cx">                  if ( !empty($src) )
</span><span class="cx">                          $html = "<img src='" . esc_url($src) . "' alt='$alt'$class />";
</span><span class="cx"> 
</span><ins>+                       /**
+                        * Filter the image URL sent to the editor.
+                        *
+                        * @since 2.8.0
+                        *
+                        * @param string $html  HTML markup sent to the editor for an image.
+                        * @param string $src   Image source URL.
+                        * @param string $alt   Image alternate, or alt, text.
+                        * @param string $align The image alignment. Default 'alignnone'. Possible values include
+                        *                      'alignleft', 'aligncenter', 'alignright', 'alignnone'.
+                        */
</ins><span class="cx">                   $html = apply_filters( 'image_send_to_editor_url', $html, esc_url_raw( $src ), $alt, $align );
</span><span class="cx">          }
</span><span class="cx"> 
</span><span class="lines">@@ -778,8 +919,20 @@
</span><span class="cx">  */
</span><span class="cx"> function image_size_input_fields( $post, $check = '' ) {
</span><span class="cx"> 
</span><del>-               // get a list of the actual pixel dimensions of each possible intermediate version of this image
-               $size_names = apply_filters( 'image_size_names_choose', array('thumbnail' => __('Thumbnail'), 'medium' => __('Medium'), 'large' => __('Large'), 'full' => __('Full Size')) );
</del><ins>+        /**
+        * Filter the names and labels of the default image sizes.
+        *
+        * @since 3.3.0
+        *
+        * @param array $size_names Array of image sizes and their names. Default values
+        *                          include 'Thumbnail', 'Medium', 'Large', 'Full Size'.
+        */
+       $size_names = apply_filters( 'image_size_names_choose', array(
+               'thumbnail' => __( 'Thumbnail' ),
+               'medium'    => __( 'Medium' ),
+               'large'     => __( 'Large' ),
+               'full'      => __( 'Full Size' )
+       ) );
</ins><span class="cx"> 
</span><span class="cx">          if ( empty($check) )
</span><span class="cx">                  $check = get_user_setting('imgsize', 'medium');
</span><span class="lines">@@ -1061,7 +1214,15 @@
</span><span class="cx">          unset( $form_fields['image_alt'] );
</span><span class="cx">  }
</span><span class="cx"> 
</span><del>-       $form_fields = apply_filters('attachment_fields_to_edit', $form_fields, $post);
</del><ins>+        /**
+        * Filter the attachment fields to edit.
+        *
+        * @since 2.5.0
+        *
+        * @param array   $form_fields An array of attachment form fields.
+        * @param WP_Post $post        The WP_Post attachment object.
+        */
+       $form_fields = apply_filters( 'attachment_fields_to_edit', $form_fields, $post );
</ins><span class="cx"> 
</span><span class="cx">  return $form_fields;
</span><span class="cx"> }
</span><span class="lines">@@ -1126,6 +1287,16 @@
</span><span class="cx"> 
</span><span class="cx">  $default_args = array( 'errors' => null, 'send' => $current_post_id ? post_type_supports( get_post_type( $current_post_id ), 'editor' ) : true, 'delete' => true, 'toggle' => true, 'show_title' => true );
</span><span class="cx">  $args = wp_parse_args( $args, $default_args );
</span><ins>+
+       /**
+        * Filter the arguments used to retrieve an image for the edit image form.
+        *
+        * @since 3.1.0
+        *
+        * @see get_media_item
+        *
+        * @param array $args An array of arguments.
+        */
</ins><span class="cx">   $args = apply_filters( 'get_media_item_args', $args );
</span><span class="cx">  extract( $args, EXTR_SKIP );
</span><span class="cx"> 
</span><span class="lines">@@ -1180,6 +1351,15 @@
</span><span class="cx">  $meta = wp_get_attachment_metadata( $post->ID );
</span><span class="cx">  if ( isset( $meta['width'], $meta['height'] ) )
</span><span class="cx">          $media_dims .= "<span id='media-dims-$post->ID'>{$meta['width']}&nbsp;&times;&nbsp;{$meta['height']}</span> ";
</span><ins>+
+       /**
+        * Filter the media metadata.
+        *
+        * @since 2.5.0
+        *
+        * @param string  $media_dims The HTML markup containing the media dimensions.
+        * @param WP_Post $post       The WP_Post attachment object.
+        */
</ins><span class="cx">   $media_dims = apply_filters( 'media_meta', $media_dims, $post );
</span><span class="cx"> 
</span><span class="cx">  $image_edit_button = '';
</span><span class="lines">@@ -1343,6 +1523,8 @@
</span><span class="cx">  $user_can_edit = current_user_can( 'edit_post', $attachment_id );
</span><span class="cx"> 
</span><span class="cx">  $args = wp_parse_args( $args, $default_args );
</span><ins>+
+       /** This filter is documented in wp-admin/includes/media.php */
</ins><span class="cx">   $args = apply_filters( 'get_media_item_args', $args );
</span><span class="cx"> 
</span><span class="cx">  $form_fields = array();
</span><span class="lines">@@ -1376,12 +1558,14 @@
</span><span class="cx">  // The recursive merge is easily traversed with array casting: foreach( (array) $things as $thing )
</span><span class="cx">  $form_fields = array_merge_recursive($form_fields, (array) $args['errors'] );
</span><span class="cx"> 
</span><ins>+       /** This filter is documented in wp-admin/includes/media.php */
</ins><span class="cx">   $form_fields = apply_filters( 'attachment_fields_to_edit', $form_fields, $post );
</span><span class="cx"> 
</span><span class="cx">  unset( $form_fields['image-size'], $form_fields['align'], $form_fields['image_alt'],
</span><span class="cx">          $form_fields['post_title'], $form_fields['post_excerpt'], $form_fields['post_content'],
</span><span class="cx">          $form_fields['url'], $form_fields['menu_order'], $form_fields['image_url'] );
</span><span class="cx"> 
</span><ins>+       /** This filter is documented in wp-admin/includes/media.php */
</ins><span class="cx">   $media_meta = apply_filters( 'media_meta', '', $post );
</span><span class="cx"> 
</span><span class="cx">  $defaults = array(
</span><span class="lines">@@ -1541,11 +1725,21 @@
</span><span class="cx"> ?></div>
</span><span class="cx"> <?php
</span><span class="cx"> if ( is_multisite() && !is_upload_space_available() ) {
</span><ins>+       /**
+        * Fires when an upload will exceed the defined upload space quota for a network site.
+        *
+        * @since 3.5.0
+        */
</ins><span class="cx">   do_action( 'upload_ui_over_quota' );
</span><span class="cx">  return;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-do_action('pre-upload-ui');
</del><ins>+/**
+ * Fires just before the legacy (pre-3.5.0) upload interface is loaded.
+ *
+ * @since 2.6.0
+ */
+do_action( 'pre-upload-ui' );
</ins><span class="cx"> 
</span><span class="cx"> $post_params = array(
</span><span class="cx">          "post_id" => $post_id,
</span><span class="lines">@@ -1555,7 +1749,15 @@
</span><span class="cx">          "short" => "1",
</span><span class="cx"> );
</span><span class="cx"> 
</span><del>-$post_params = apply_filters( 'upload_post_params', $post_params ); // hook change! old name: 'swfupload_post_params'
</del><ins>+/**
+ * Filter the media upload post parameters.
+ *
+ * @since 3.1.0 As 'swfupload_post_params'
+ * @since 3.3.0
+ *
+ * @param array $post_params An array of media upload parameters used by Plupload.
+ */
+$post_params = apply_filters( 'upload_post_params', $post_params );
</ins><span class="cx"> 
</span><span class="cx"> $plupload_init = array(
</span><span class="cx">  'runtimes' => 'html5,silverlight,flash,html4',
</span><span class="lines">@@ -1579,6 +1781,13 @@
</span><span class="cx"> if ( wp_is_mobile() )
</span><span class="cx">  $plupload_init['multi_selection'] = false;
</span><span class="cx"> 
</span><ins>+/**
+ * Filter the default Plupload settings.
+ *
+ * @since 3.3.0
+ *
+ * @param array $plupload_init An array of default settings used by Plupload.
+ */
</ins><span class="cx"> $plupload_init = apply_filters( 'plupload_init', $plupload_init );
</span><span class="cx"> 
</span><span class="cx"> ?>
</span><span class="lines">@@ -1598,7 +1807,14 @@
</span><span class="cx"> </script>
</span><span class="cx"> 
</span><span class="cx"> <div id="plupload-upload-ui" class="hide-if-no-js">
</span><del>-<?php do_action('pre-plupload-upload-ui'); // hook change, old name: 'pre-flash-upload-ui' ?>
</del><ins>+<?php
+/**
+ * Fires before the upload interface loads.
+ *
+ * @since 2.6.0 As 'pre-flash-upload-ui'
+ * @since 3.3.0
+ */
+do_action( 'pre-plupload-upload-ui' ); ?>
</ins><span class="cx"> <div id="drag-drop-area">
</span><span class="cx">  <div class="drag-drop-inside">
</span><span class="cx">  <p class="drag-drop-info"><?php _e('Drop files here'); ?></p>
</span><span class="lines">@@ -1606,11 +1822,25 @@
</span><span class="cx">  <p class="drag-drop-buttons"><input id="plupload-browse-button" type="button" value="<?php esc_attr_e('Select Files'); ?>" class="button" /></p>
</span><span class="cx">  </div>
</span><span class="cx"> </div>
</span><del>-<?php do_action('post-plupload-upload-ui'); // hook change, old name: 'post-flash-upload-ui' ?>
</del><ins>+<?php
+/**
+ * Fires after the upload interface loads.
+ *
+ * @since 2.6.0 As 'post-flash-upload-ui'
+ * @since 3.3.0
+ */
+do_action( 'post-plupload-upload-ui' ); ?>
</ins><span class="cx"> </div>
</span><span class="cx"> 
</span><span class="cx"> <div id="html-upload-ui" class="hide-if-js">
</span><del>-<?php do_action('pre-html-upload-ui'); ?>
</del><ins>+        <?php
+       /**
+        * Fires before the upload button in the media upload interface.
+        *
+        * @since 2.6.0
+        */
+       do_action( 'pre-html-upload-ui' );
+       ?>
</ins><span class="cx">   <p id="async-upload-wrap">
</span><span class="cx">          <label class="screen-reader-text" for="async-upload"><?php _e('Upload'); ?></label>
</span><span class="cx">          <input type="file" name="async-upload" id="async-upload" />
</span><span class="lines">@@ -1618,7 +1848,14 @@
</span><span class="cx">          <a href="#" onclick="try{top.tb_remove();}catch(e){}; return false;"><?php _e('Cancel'); ?></a>
</span><span class="cx">  </p>
</span><span class="cx">  <div class="clear"></div>
</span><del>-<?php do_action('post-html-upload-ui'); ?>
</del><ins>+<?php
+/**
+ * Fires after the upload button in the media upload interface.
+ *
+ * @since 2.6.0
+ */
+do_action( 'post-html-upload-ui' );
+?>
</ins><span class="cx"> </div>
</span><span class="cx"> 
</span><span class="cx"> <span class="max-upload-size"><?php printf( __( 'Maximum upload file size: %d%s.' ), esc_html($upload_size_unit), esc_html($sizes[$u]) ); ?></span>
</span><span class="lines">@@ -1627,7 +1864,14 @@
</span><span class="cx">  <span class="big-file-warning"><?php _e('Your browser has some limitations uploading large files with the multi-file uploader. Please use the browser uploader for files over 100MB.'); ?></span>
</span><span class="cx"> <?php }
</span><span class="cx"> 
</span><del>-       do_action('post-upload-ui');
</del><ins>+        /**
+        * Fires on the post upload UI screen.
+        *
+        * Legacy (pre-3.5.0) media workflow hook.
+        *
+        * @since 2.6.0
+        */
+       do_action( 'post-upload-ui' );
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><span class="lines">@@ -1646,7 +1890,16 @@
</span><span class="cx">  $post_id = isset( $_REQUEST['post_id'] )? intval( $_REQUEST['post_id'] ) : 0;
</span><span class="cx"> 
</span><span class="cx">  $form_action_url = admin_url("media-upload.php?type=$type&tab=type&post_id=$post_id");
</span><del>-       $form_action_url = apply_filters('media_upload_form_url', $form_action_url, $type);
</del><ins>+
+       /**
+        * Filter the media upload form action URL.
+        *
+        * @since 2.6.0
+        *
+        * @param string $form_action_url The media upload form action URL.
+        * @param string $type            The type of media. Default 'file'.
+        */
+       $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
</ins><span class="cx">   $form_class = 'media-upload-form type-form validate';
</span><span class="cx"> 
</span><span class="cx">  if ( get_user_setting('uploader') )
</span><span class="lines">@@ -1711,7 +1964,8 @@
</span><span class="cx">  $post_id = isset( $_REQUEST['post_id'] ) ? intval( $_REQUEST['post_id'] ) : 0;
</span><span class="cx"> 
</span><span class="cx">  $form_action_url = admin_url("media-upload.php?type=$type&tab=type&post_id=$post_id");
</span><del>-       $form_action_url = apply_filters('media_upload_form_url', $form_action_url, $type);
</del><ins>+        /** This filter is documented in wp-admin/includes/media.php */
+       $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
</ins><span class="cx">   $form_class = 'media-upload-form type-form validate';
</span><span class="cx"> 
</span><span class="cx">  if ( get_user_setting('uploader') )
</span><span class="lines">@@ -1741,7 +1995,10 @@
</span><span class="cx">          if ( f.alt.value )
</span><span class="cx">                  alt = f.alt.value.replace(/'/g, '&#039;').replace(/"/g, '&quot;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
</span><span class="cx"> 
</span><del>-<?php if ( ! apply_filters( 'disable_captions', '' ) ) { ?>
</del><ins>+<?php
+       /** This filter is documented in wp-admin/includes/media.php */
+       if ( ! apply_filters( 'disable_captions', '' ) ) {
+               ?>
</ins><span class="cx">           if ( f.caption.value ) {
</span><span class="cx">                  caption = f.caption.value.replace(/\r\n|\r/g, '\n');
</span><span class="cx">                  caption = caption.replace(/<[a-zA-Z0-9]+( [^<>]+)?>/g, function(a){
</span><span class="lines">@@ -1818,7 +2075,16 @@
</span><span class="cx"> 
</span><span class="cx"> <div id="media-items">
</span><span class="cx"> <div class="media-item media-blank">
</span><del>-<?php echo apply_filters( 'type_url_form_media', wp_media_insert_url_form( $type ) ); ?>
</del><ins>+<?php
+/**
+ * Filter the insert media from URL form HTML.
+ *
+ * @since 3.3.0
+ *
+ * @param string $form_html The insert from URL form HTML.
+ */
+echo apply_filters( 'type_url_form_media', wp_media_insert_url_form( $type ) );
+?>
</ins><span class="cx"> </div>
</span><span class="cx"> </div>
</span><span class="cx"> </form>
</span><span class="lines">@@ -1840,7 +2106,8 @@
</span><span class="cx"> 
</span><span class="cx">  $post_id = intval($_REQUEST['post_id']);
</span><span class="cx">  $form_action_url = admin_url("media-upload.php?type=$type&tab=gallery&post_id=$post_id");
</span><del>-       $form_action_url = apply_filters('media_upload_form_url', $form_action_url, $type);
</del><ins>+        /** This filter is documented in wp-admin/includes/media.php */
+       $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
</ins><span class="cx">   $form_class = 'media-upload-form validate';
</span><span class="cx"> 
</span><span class="cx">  if ( get_user_setting('uploader') )
</span><span class="lines">@@ -1986,7 +2253,8 @@
</span><span class="cx">  $post_id = isset( $_REQUEST['post_id'] ) ? intval( $_REQUEST['post_id'] ) : 0;
</span><span class="cx"> 
</span><span class="cx">  $form_action_url = admin_url("media-upload.php?type=$type&tab=library&post_id=$post_id");
</span><del>-       $form_action_url = apply_filters('media_upload_form_url', $form_action_url, $type);
</del><ins>+        /** This filter is documented in wp-admin/includes/media.php */
+       $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
</ins><span class="cx">   $form_class = 'media-upload-form validate';
</span><span class="cx"> 
</span><span class="cx">  if ( get_user_setting('uploader') )
</span><span class="lines">@@ -2049,6 +2317,15 @@
</span><span class="cx"> 
</span><span class="cx">  $type_links[] = "<li><a href='" . esc_url(add_query_arg(array('post_mime_type'=>$mime_type, 'paged'=>false))) . "'$class>" . sprintf( translate_nooped_plural( $label[2], $num_posts[$mime_type] ), "<span id='$mime_type-counter'>" . number_format_i18n( $num_posts[$mime_type] ) . '</span>') . '</a>';
</span><span class="cx"> }
</span><ins>+/**
+ * Filter the media upload mime type list items.
+ *
+ * Returned values should begin with an <li> tag.
+ *
+ * @since 3.1.0
+ *
+ * @param array $type_links An array of list items containing mime type link HTML.
+ */
</ins><span class="cx"> echo implode(' | </li>', apply_filters( 'media_upload_mime_type_links', $type_links ) ) . '</li>';
</span><span class="cx"> unset($type_links);
</span><span class="cx"> ?>
</span><span class="lines">@@ -2148,7 +2425,8 @@
</span><span class="cx">  * @return string the form html
</span><span class="cx">  */
</span><span class="cx"> function wp_media_insert_url_form( $default_view = 'image' ) {
</span><del>-       if ( !apply_filters( 'disable_captions', '' ) ) {
</del><ins>+        /** This filter is documented in wp-admin/includes/media.php */
+       if ( ! apply_filters( 'disable_captions', '' ) ) {
</ins><span class="cx">           $caption = '
</span><span class="cx">          <tr class="image-only">
</span><span class="cx">                  <th valign="top" scope="row" class="label">
</span><span class="lines">@@ -2430,6 +2708,7 @@
</span><span class="cx">  $meta = wp_get_attachment_metadata( $post->ID );
</span><span class="cx">  if ( isset( $meta['width'], $meta['height'] ) )
</span><span class="cx">          $media_dims .= "<span id='media-dims-$post->ID'>{$meta['width']}&nbsp;&times;&nbsp;{$meta['height']}</span> ";
</span><ins>+       /** This filter is documented in wp-admin/includes/media.php */
</ins><span class="cx">   $media_dims = apply_filters( 'media_meta', $media_dims, $post );
</span><span class="cx"> 
</span><span class="cx">  $att_url = wp_get_attachment_url( $post->ID );
</span><span class="lines">@@ -2469,20 +2748,20 @@
</span><span class="cx">  if ( preg_match( '#^(audio|video)#', $post->post_mime_type ) ):
</span><span class="cx"> 
</span><span class="cx">          /**
</span><del>-                * Audio and video metadata fields to be shown in the publish meta box.
</del><ins>+                 * Filter the audio and video metadata fields to be shown in the publish meta box.
</ins><span class="cx">            *
</span><span class="cx">           * The key for each item in the array should correspond to an attachment
</span><span class="cx">           * metadata key, and the value should be the desired label.
</span><span class="cx">           *
</span><del>-                * @since  3.7.0
</del><ins>+                 * @since 3.7.0
</ins><span class="cx">            *
</span><span class="cx">           * @param array $fields {
</span><span class="cx">           *     An array of the attachment metadata keys and labels.
</span><span class="cx">           *
</span><del>-                *     @type string 'mime_type'        Label to be shown before the field mime_type.
-                *     @type string 'year'             Label to be shown before the field year.
-                *     @type string 'genre'            Label to be shown before the field genre.
-                *     @type string 'length_formatted' Label to be shown before the field length_formatted.
</del><ins>+                 *     @type string $mime_type        Label to be shown before the field mime_type.
+                *     @type string $year             Label to be shown before the field year.
+                *     @type string $genre            Label to be shown before the field genre.
+                *     @type string $length_formatted Label to be shown before the field length_formatted.
</ins><span class="cx">            * }
</span><span class="cx">           */
</span><span class="cx">          $fields = apply_filters( 'media_submitbox_misc_sections', array(
</span><span class="lines">@@ -2515,18 +2794,18 @@
</span><span class="cx">          endif;
</span><span class="cx"> 
</span><span class="cx">          /**
</span><del>-                * Audio attachment metadata fields to be shown in the publish meta box.
</del><ins>+                 * Filter the audio attachment metadata fields to be shown in the publish meta box.
</ins><span class="cx">            *
</span><span class="cx">           * The key for each item in the array should correspond to an attachment
</span><span class="cx">           * metadata key, and the value should be the desired label.
</span><span class="cx">           *
</span><del>-                * @since  3.7.0
</del><ins>+                 * @since 3.7.0
</ins><span class="cx">            *
</span><span class="cx">           * @param array $fields {
</span><span class="cx">           *     An array of the attachment metadata keys and labels.
</span><span class="cx">           *
</span><del>-                *     @type string 'dataformat' Label to be shown before the field dataformat.
-                *     @type string 'codec'      Label to be shown before the field codec.
</del><ins>+                 *     @type string $dataformat Label to be shown before the field dataformat.
+                *     @type string $codec      Label to be shown before the field codec.
</ins><span class="cx">            * }
</span><span class="cx">           */
</span><span class="cx">          $audio_fields = apply_filters( 'audio_submitbox_misc_sections', array(
</span></span></pre></div>
<a id="trunksrcwpadminmediauploadphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/media-upload.php (26907 => 26908)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/media-upload.php      2014-01-05 18:57:43 UTC (rev 26907)
+++ trunk/src/wp-admin/media-upload.php 2014-01-06 05:47:51 UTC (rev 26908)
</span><span class="lines">@@ -44,10 +44,18 @@
</span><span class="cx">          $type = apply_filters('media_upload_default_type', 'file');
</span><span class="cx"> 
</span><span class="cx">  // tab: gallery, library, or type-specific
</span><del>-       if ( isset($_GET['tab']) )
</del><ins>+        if ( isset($_GET['tab']) ) {
</ins><span class="cx">           $tab = strval($_GET['tab']);
</span><del>-       else
-               $tab = apply_filters('media_upload_default_tab', 'type');
</del><ins>+        } else {
+               /**
+                * Filter the default tab in the legacy (pre-3.5.0) media popup.
+                *
+                * @since 2.5.0
+                *
+                * @param string $type The default media popup tab.
+                */
+               $tab = apply_filters( 'media_upload_default_tab', 'type' );
+       }
</ins><span class="cx"> 
</span><span class="cx">  $body_id = 'media-upload';
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>