<!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>[27672] trunk/src: Inline documentation for hooks in wp-admin/includes/file.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/27672">27672</a></dd>
<dt>Author</dt> <dd>DrewAPicture</dd>
<dt>Date</dt> <dd>2014-03-24 02:44:17 +0000 (Mon, 24 Mar 2014)</dd>
</dl>

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

Fixes <a href="http://core.trac.wordpress.org/ticket/27429">#27429</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadminincludesfilephp">trunk/src/wp-admin/includes/file.php</a></li>
<li><a href="#trunksrcwpincludesclasswpxmlrpcserverphp">trunk/src/wp-includes/class-wp-xmlrpc-server.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpadminincludesfilephp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/includes/file.php (27671 => 27672)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/includes/file.php     2014-03-24 02:37:05 UTC (rev 27671)
+++ trunk/src/wp-admin/includes/file.php        2014-03-24 02:44:17 UTC (rev 27672)
</span><span class="lines">@@ -194,7 +194,6 @@
</span><span class="cx">  * @since 2.0.0
</span><span class="cx">  *
</span><span class="cx">  * @uses wp_handle_upload_error
</span><del>- * @uses apply_filters
</del><span class="cx">  * @uses is_multisite
</span><span class="cx">  * @uses wp_check_filetype_and_ext
</span><span class="cx">  * @uses current_user_can
</span><span class="lines">@@ -214,6 +213,13 @@
</span><span class="cx">          }
</span><span class="cx">  }
</span><span class="cx"> 
</span><ins>+       /**
+        * Filter data for the current file to upload.
+        *
+        * @since 2.9.0
+        *
+        * @param array $file An array of data for a single file.
+        */
</ins><span class="cx">   $file = apply_filters( 'wp_handle_upload_prefilter', $file );
</span><span class="cx"> 
</span><span class="cx">  // You may define your own function and pass the name in $overrides['upload_error_handler']
</span><span class="lines">@@ -325,6 +331,20 @@
</span><span class="cx">  if ( is_multisite() )
</span><span class="cx">          delete_transient( 'dirsize_cache' );
</span><span class="cx"> 
</span><ins>+       /**
+        * Filter the data array for the uploaded file.
+        *
+        * @since 2.1.0
+        *
+        * @param array  $upload {
+        *     Array of upload data.
+        *
+        *     @type string $file Filename of the newly-uploaded file.
+        *     @type string $url  URL of the uploaded file.
+        *     @type string $type File type.
+        * }
+        * @param string $context The type of upload action. Accepts 'upload' or 'sideload'.
+        */
</ins><span class="cx">   return apply_filters( 'wp_handle_upload', array( 'file' => $new_file, 'url' => $url, 'type' => $type ), 'upload' );
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -336,7 +356,6 @@
</span><span class="cx">  * @since 2.6.0
</span><span class="cx">  *
</span><span class="cx">  * @uses wp_handle_upload_error
</span><del>- * @uses apply_filters
</del><span class="cx">  * @uses wp_check_filetype_and_ext
</span><span class="cx">  * @uses current_user_can
</span><span class="cx">  * @uses wp_upload_dir
</span><span class="lines">@@ -450,6 +469,7 @@
</span><span class="cx">  // Compute the URL
</span><span class="cx">  $url = $uploads['url'] . "/$filename";
</span><span class="cx"> 
</span><ins>+       /** This filter is documented in wp-admin/includes/file.php */
</ins><span class="cx">   $return = apply_filters( 'wp_handle_upload', array( 'file' => $new_file, 'url' => $url, 'type' => $type ), 'sideload' );
</span><span class="cx"> 
</span><span class="cx">  return $return;
</span><span class="lines">@@ -543,6 +563,7 @@
</span><span class="cx">          return new WP_Error('fs_unavailable', __('Could not access filesystem.'));
</span><span class="cx"> 
</span><span class="cx">  // Unzip can use a lot of memory, but not this much hopefully
</span><ins>+       /** This filter is documented in wp-admin/admin.php */
</ins><span class="cx">   @ini_set( 'memory_limit', apply_filters( 'admin_memory_limit', WP_MAX_MEMORY_LIMIT ) );
</span><span class="cx"> 
</span><span class="cx">  $needed_dirs = array();
</span><span class="lines">@@ -566,7 +587,14 @@
</span><span class="cx">          }
</span><span class="cx">  }
</span><span class="cx"> 
</span><del>-       if ( class_exists('ZipArchive') && apply_filters('unzip_file_use_ziparchive', true ) ) {
</del><ins>+        /**
+        * Filter whether to use ZipArchive to unzip archives.
+        *
+        * @since 3.0.0
+        *
+        * @param bool $ziparchive Whether to use ZipArchive. Default true.
+        */
+       if ( class_exists( 'ZipArchive' ) && apply_filters( 'unzip_file_use_ziparchive', true ) ) {
</ins><span class="cx">           $result = _unzip_file_ziparchive($file, $to, $needed_dirs);
</span><span class="cx">          if ( true === $result ) {
</span><span class="cx">                  return $result;
</span><span class="lines">@@ -843,7 +871,19 @@
</span><span class="cx">          return false;
</span><span class="cx"> 
</span><span class="cx">  if ( ! class_exists("WP_Filesystem_$method") ) {
</span><del>-               $abstraction_file = apply_filters('filesystem_method_file', ABSPATH . 'wp-admin/includes/class-wp-filesystem-' . $method . '.php', $method);
</del><ins>+
+               /**
+                * Filter the path for a specific filesystem method class file.
+                *
+                * @since 2.6.0
+                *
+                * @see get_filesystem_method()
+                *
+                * @param string $path   Path to the specific filesystem method class file.
+                * @param string $method The filesystem method to use.
+                */
+               $abstraction_file = apply_filters( 'filesystem_method_file', ABSPATH . 'wp-admin/includes/class-wp-filesystem-' . $method . '.php', $method );
+
</ins><span class="cx">           if ( ! file_exists($abstraction_file) )
</span><span class="cx">                  return;
</span><span class="cx"> 
</span><span class="lines">@@ -915,7 +955,16 @@
</span><span class="cx">  if ( ! $method && isset($args['connection_type']) && 'ssh' == $args['connection_type'] && extension_loaded('ssh2') && function_exists('stream_get_contents') ) $method = 'ssh2';
</span><span class="cx">  if ( ! $method && extension_loaded('ftp') ) $method = 'ftpext';
</span><span class="cx">  if ( ! $method && ( extension_loaded('sockets') || function_exists('fsockopen') ) ) $method = 'ftpsockets'; //Sockets: Socket extension; PHP Mode: FSockopen / fwrite / fread
</span><del>-       return apply_filters('filesystem_method', $method, $args);
</del><ins>+
+       /**
+        * Filter the filesystem method to use.
+        *
+        * @since 2.6.0
+        *
+        * @param string $method Filesystem method to return.
+        * @param array  $args   An array of connection details for the method.
+        */
+       return apply_filters( 'filesystem_method', $method, $args );
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><span class="lines">@@ -936,6 +985,24 @@
</span><span class="cx">  * @return boolean False on failure. True on success.
</span><span class="cx">  */
</span><span class="cx"> function request_filesystem_credentials($form_post, $type = '', $error = false, $context = false, $extra_fields = null) {
</span><ins>+
+       /**
+        * Filter the filesystem credentials form output.
+        *
+        * Returning anything other than an empty string will effectively short-circuit
+        * output of the filesystem credentials form, returning that value instead.
+        *
+        * @since 2.5.0
+        *
+        * @param mixed  $output       Form output to return instead. Default empty.
+        * @param string $form_post    URL to POST the form to.
+        * @param string $type         Chosen type of filesystem.
+        * @param bool   $error        Whether the current request has failed to connect.
+        *                             Default false.
+        * @param string $context      Full path to the directory that is tested for
+        *                             being writable.
+        * @param array  $extra_fields Extra POST fields.
+        */
</ins><span class="cx">   $req_cred = apply_filters( 'request_filesystem_credentials', '', $form_post, $type, $error, $context, $extra_fields );
</span><span class="cx">  if ( '' !== $req_cred )
</span><span class="cx">          return $req_cred;
</span><span class="lines">@@ -1014,7 +1081,19 @@
</span><span class="cx">  if ( extension_loaded('ssh2') && function_exists('stream_get_contents') )
</span><span class="cx">          $types[ 'ssh' ] = __('SSH2');
</span><span class="cx"> 
</span><del>-       $types = apply_filters('fs_ftp_connection_types', $types, $credentials, $type, $error, $context);
</del><ins>+        /**
+        * Filter the connection types to output to the filesystem credentials form.
+        *
+        * @since 2.9.0
+        *
+        * @param array  $types       Types of connections.
+        * @param array  $credentials Credentials to connect with.
+        * @param string $type        Chosen filesystem method.
+        * @param object $error       Error object.
+        * @param string $context     Full path to the directory that is tested
+        *                            for being writable.
+        */
+       $types = apply_filters( 'fs_ftp_connection_types', $types, $credentials, $type, $error, $context );
</ins><span class="cx"> 
</span><span class="cx"> ?>
</span><span class="cx"> <script type="text/javascript">
</span></span></pre></div>
<a id="trunksrcwpincludesclasswpxmlrpcserverphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/class-wp-xmlrpc-server.php (27671 => 27672)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/class-wp-xmlrpc-server.php 2014-03-24 02:37:05 UTC (rev 27671)
+++ trunk/src/wp-includes/class-wp-xmlrpc-server.php    2014-03-24 02:44:17 UTC (rev 27672)
</span><span class="lines">@@ -4995,6 +4995,8 @@
</span><span class="cx">                  'url'  => $upload[ 'url' ],
</span><span class="cx">                  'type' => $type
</span><span class="cx">          );
</span><ins>+
+               /** This filter is documented in wp-admin/includes/file.php */
</ins><span class="cx">           return apply_filters( 'wp_handle_upload', $struct, 'upload' );
</span><span class="cx">  }
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>