<!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" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { 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 #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#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>
<title>[16024] trunk/wp-admin/includes/file.php: Docs for wp-admin/includes/file.
 php.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/16024">16024</a></dd>
<dt>Author</dt> <dd>nacin</dd>
<dt>Date</dt> <dd>2010-10-27 22:24:06 +0000 (Wed, 27 Oct 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Docs for wp-admin/includes/file.php. props sivel, see <a href="http://trac.wordpress.org/ticket/14783">#14783</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminincludesfilephp">trunk/wp-admin/includes/file.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminincludesfilephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/file.php (16023 => 16024)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/file.php        2010-10-27 20:19:52 UTC (rev 16023)
+++ trunk/wp-admin/includes/file.php        2010-10-27 22:24:06 UTC (rev 16024)
</span><span class="lines">@@ -39,12 +39,15 @@
</span><span class="cx">         'wp-layout.css' =&gt; __( 'Stylesheet' ), 'wp-comments.php' =&gt; __( 'Comments Template' ), 'wp-comments-popup.php' =&gt; __( 'Popup Comments Template' ));
</span><span class="cx"> 
</span><span class="cx"> /**
</span><del>- * {@internal Missing Short Description}}
</del><ins>+ * Get the description for standard WordPress theme files and other various standard
+ * WordPress files
</ins><span class="cx">  *
</span><del>- * @since unknown
</del><ins>+ * @since 1.5.0
</ins><span class="cx">  *
</span><del>- * @param unknown_type $file
- * @return unknown
</del><ins>+ * @uses _cleanup_header_comment
+ * @uses $wp_file_descriptions
+ * @param string $file Filesystem path or filename
+ * @return string Description of file from $wp_file_descriptions or basename of $file if description doesn't exist
</ins><span class="cx">  */
</span><span class="cx"> function get_file_description( $file ) {
</span><span class="cx">         global $wp_file_descriptions;
</span><span class="lines">@@ -62,11 +65,12 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><del>- * {@internal Missing Short Description}}
</del><ins>+ * Get the absolute filesystem path to the root of the WordPress installation
</ins><span class="cx">  *
</span><del>- * @since unknown
</del><ins>+ * @since 1.5.0
</ins><span class="cx">  *
</span><del>- * @return unknown
</del><ins>+ * @uses get_option
+ * @return string Full filesystem path to the root of the WordPress installation
</ins><span class="cx">  */
</span><span class="cx"> function get_home_path() {
</span><span class="cx">         $home = get_option( 'home' );
</span><span class="lines">@@ -84,12 +88,18 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><del>- * {@internal Missing Short Description}}
</del><ins>+ * Get the real file system path to a file to edit within the admin
</ins><span class="cx">  *
</span><del>- * @since unknown
</del><ins>+ * If the $file is index.php or .htaccess this function will assume it is relative
+ * to the install root, otherwise it is assumed the file is relative to the wp-content
+ * directory
</ins><span class="cx">  *
</span><del>- * @param unknown_type $file
- * @return unknown
</del><ins>+ * @since 1.5.0
+ *
+ * @uses get_home_path 
+ * @uses WP_CONTENT_DIR full filesystem path to the wp-content directory
+ * @param string $file filesystem path relative to the WordPress install directory or to the wp-content directory
+ * @return string full file system path to edit
</ins><span class="cx">  */
</span><span class="cx"> function get_real_file_to_edit( $file ) {
</span><span class="cx">         if ('index.php' == $file || '.htaccess' == $file ) {
</span><span class="lines">@@ -201,13 +211,17 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><del>- * {@internal Missing Short Description}}
</del><ins>+ * Make sure that the file that was requested to edit, is allowed to be edited
</ins><span class="cx">  *
</span><del>- * @since unknown
</del><ins>+ * Function will die if if you are not allowed to edit the file
</ins><span class="cx">  *
</span><del>- * @param unknown_type $file
- * @param unknown_type $allowed_files
- * @return unknown
</del><ins>+ * @since 1.5.0
+ *
+ * @uses wp_die
+ * @uses validate_file
+ * @param string $file file the users is attempting to edit
+ * @param array $allowed_files Array of allowed files to edit, $file must match an entry exactly
+ * @return null
</ins><span class="cx">  */
</span><span class="cx"> function validate_file_to_edit( $file, $allowed_files = '' ) {
</span><span class="cx">         $code = validate_file( $file, $allowed_files );
</span><span class="lines">@@ -228,10 +242,19 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><del>- * {@internal Missing Short Description}}
</del><ins>+ * Handle PHP uploads in WordPress, sanitizing file names, checking extensions for mime type,
+ * and moving the file to the appropriate directory within the uploads directory.
</ins><span class="cx">  *
</span><del>- * @since unknown
</del><ins>+ * @since 2.0
</ins><span class="cx">  *
</span><ins>+ * @uses wp_handle_upload_error
+ * @uses apply_filters
+ * @uses is_multisite
+ * @uses wp_check_filetype_and_ext
+ * @uses current_user_can
+ * @uses wp_upload_dir
+ * @uses wp_unique_filename
+ * @uses delete_transient   
</ins><span class="cx">  * @param array $file Reference to a single element of $_FILES. Call the function once for each uploaded file.
</span><span class="cx">  * @param array $overrides Optional. An associative array of names=&gt;values to override default variables with extract( $overrides, EXTR_OVERWRITE ).
</span><span class="cx">  * @return array On success, returns an associative array of file attributes. On failure, returns $overrides['upload_error_handler'](&amp;$file, $message ) or array( 'error'=&gt;$message ).
</span><span class="lines">@@ -352,15 +375,21 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><del>- * {@internal Missing Short Description}}
</del><ins>+ * Handle sideloads, which is the process of retriving a media item from another server instead of
+ * a traditional media upload.  This process involves sanitizing the filename, checking extensions
+ * for mime type, and moving the file to the appropriate directory within the uploads directory.
</ins><span class="cx">  *
</span><del>- * Pass this function an array similar to that of a $_FILES POST array.
</del><ins>+ * @since 2.6.0
</ins><span class="cx">  *
</span><del>- * @since unknown
- *
- * @param unknown_type $file
- * @param unknown_type $overrides
- * @return unknown
</del><ins>+ * @uses wp_handle_upload_error
+ * @uses apply_filters
+ * @uses wp_check_filetype_and_ext
+ * @uses current_user_can
+ * @uses wp_upload_dir
+ * @uses wp_unique_filename
+ * @param array $file an array similar to that of a PHP $_FILES POST array
+ * @param array $overrides Optional. An associative array of names=&gt;values to override default variables with extract( $overrides, EXTR_OVERWRITE ).
+ * @return array On success, returns an associative array of file attributes. On failure, returns $overrides['upload_error_handler'](&amp;$file, $message ) or array( 'error'=&gt;$message ).
</ins><span class="cx">  */
</span><span class="cx"> function wp_handle_sideload( &amp;$file, $overrides = false ) {
</span><span class="cx">         // The default error handler.
</span></span></pre>
</div>
</div>

</body>
</html>