<!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>[28936] trunk/src/wp-includes/functions.php: General inline documentation improvements in wp-includes/functions.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/28936">28936</a></dd>
<dt>Author</dt> <dd>DrewAPicture</dd>
<dt>Date</dt> <dd>2014-07-01 01:43:48 +0000 (Tue, 01 Jul 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>General inline documentation improvements in wp-includes/functions.php.
Second run. See <a href="http://core.trac.wordpress.org/ticket/26185">#26185</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludesfunctionsphp">trunk/src/wp-includes/functions.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpincludesfunctionsphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/functions.php (28935 => 28936)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/functions.php 2014-07-01 01:17:39 UTC (rev 28935)
+++ trunk/src/wp-includes/functions.php 2014-07-01 01:43:48 UTC (rev 28936)
</span><span class="lines">@@ -638,10 +638,10 @@
</span><span class="cx"> *
</span><span class="cx"> * @since 0.71
</span><span class="cx"> *
</span><del>- * @global string $currentday The day of the current post in the loop.
</del><ins>+ * @global string $currentday The day of the current post in the loop.
</ins><span class="cx"> * @global string $previousday The day of the previous post in the loop.
</span><span class="cx"> *
</span><del>- * @return int 1 when new day, 0 if not a new day.
</del><ins>+ * @return int|bool 1|true when new day, 0|false if not a new day.
</ins><span class="cx"> */
</span><span class="cx"> function is_new_day() {
</span><span class="cx"> global $currentday, $previousday;
</span><span class="lines">@@ -657,14 +657,14 @@
</span><span class="cx"> * This is a convenient function for easily building url queries. It sets the
</span><span class="cx"> * separator to '&' and uses _http_build_query() function.
</span><span class="cx"> *
</span><ins>+ * @since 2.3.0
+ *
</ins><span class="cx"> * @see _http_build_query() Used to build the query
</span><del>- * @link http://us2.php.net/manual/en/function.http-build-query.php more on what
</del><ins>+ * @see http://us2.php.net/manual/en/function.http-build-query.php for more on what
</ins><span class="cx"> * http_build_query() does.
</span><span class="cx"> *
</span><del>- * @since 2.3.0
- *
</del><span class="cx"> * @param array $data URL-encode key/value pairs.
</span><del>- * @return string URL encoded string
</del><ins>+ * @return string URL-encoded string.
</ins><span class="cx"> */
</span><span class="cx"> function build_query( $data ) {
</span><span class="cx"> return _http_build_query( $data, null, '&', '', false );
</span><span class="lines">@@ -729,9 +729,9 @@
</span><span class="cx"> *
</span><span class="cx"> * @since 1.5.0
</span><span class="cx"> *
</span><del>- * @param mixed $param1 Either newkey or an associative_array
- * @param mixed $param2 Either newvalue or oldquery or uri
- * @param mixed $param3 Optional. Old query or uri
</del><ins>+ * @param string|array $param1 Either newkey or an associative_array.
+ * @param string $param2 Either newvalue or oldquery or URI.
+ * @param string $param3 Optional. Old query or URI.
</ins><span class="cx"> * @return string New URL query string.
</span><span class="cx"> */
</span><span class="cx"> function add_query_arg() {
</span><span class="lines">@@ -801,11 +801,11 @@
</span><span class="cx"> *
</span><span class="cx"> * @since 1.5.0
</span><span class="cx"> *
</span><del>- * @param string|array $key Query key or keys to remove.
- * @param bool $query When false uses the $_SERVER value.
</del><ins>+ * @param string|array $key Query key or keys to remove.
+ * @param bool $query Optional. When false uses the $_SERVER value. Default false.
</ins><span class="cx"> * @return string New URL query string.
</span><span class="cx"> */
</span><del>-function remove_query_arg( $key, $query=false ) {
</del><ins>+function remove_query_arg( $key, $query = false ) {
</ins><span class="cx"> if ( is_array( $key ) ) { // removing multiple keys
</span><span class="cx"> foreach ( $key as $k )
</span><span class="cx"> $query = add_query_arg( $k, false, $query );
</span><span class="lines">@@ -837,8 +837,9 @@
</span><span class="cx"> * HTTP request for URI to retrieve content.
</span><span class="cx"> *
</span><span class="cx"> * @since 1.5.1
</span><del>- * @uses wp_remote_get()
</del><span class="cx"> *
</span><ins>+ * @see wp_safe_remote_get()
+ *
</ins><span class="cx"> * @param string $uri URI/URL of web page to retrieve.
</span><span class="cx"> * @return bool|string HTTP content. False on failure.
</span><span class="cx"> */
</span><span class="lines">@@ -962,6 +963,7 @@
</span><span class="cx"> * Set HTTP status header.
</span><span class="cx"> *
</span><span class="cx"> * @since 2.0.0
</span><ins>+ *
</ins><span class="cx"> * @see get_status_header_desc()
</span><span class="cx"> *
</span><span class="cx"> * @param int $code HTTP status code.
</span><span class="lines">@@ -994,10 +996,10 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Gets the header information to prevent caching.
</del><ins>+ * Get the header information to prevent caching.
</ins><span class="cx"> *
</span><del>- * The several different headers cover the different ways cache prevention is handled
- * by different browsers
</del><ins>+ * The several different headers cover the different ways cache prevention
+ * is handled by different browsers
</ins><span class="cx"> *
</span><span class="cx"> * @since 2.8.0
</span><span class="cx"> *
</span><span class="lines">@@ -1016,6 +1018,8 @@
</span><span class="cx"> *
</span><span class="cx"> * @since 2.8.0
</span><span class="cx"> *
</span><ins>+ * @see wp_get_nocache_headers()
+ *
</ins><span class="cx"> * @param array $headers {
</span><span class="cx"> * Header names and field values.
</span><span class="cx"> *
</span><span class="lines">@@ -1031,12 +1035,14 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Sets the headers to prevent caching for the different browsers.
</del><ins>+ * Set the headers to prevent caching for the different browsers.
</ins><span class="cx"> *
</span><del>- * Different browsers support different nocache headers, so several headers must
- * be sent so that all of them get the point that no caching should occur.
</del><ins>+ * Different browsers support different nocache headers, so several
+ * headers must be sent so that all of them get the point that no
+ * caching should occur.
</ins><span class="cx"> *
</span><span class="cx"> * @since 2.0.0
</span><ins>+ *
</ins><span class="cx"> * @see wp_get_nocache_headers()
</span><span class="cx"> */
</span><span class="cx"> function nocache_headers() {
</span><span class="lines">@@ -1069,6 +1075,7 @@
</span><span class="cx"> */
</span><span class="cx"> function cache_javascript_headers() {
</span><span class="cx"> $expiresOffset = 10 * DAY_IN_SECONDS;
</span><ins>+
</ins><span class="cx"> header( "Content-Type: text/javascript; charset=" . get_bloginfo( 'charset' ) );
</span><span class="cx"> header( "Vary: Accept-Encoding" ); // Handle proxies
</span><span class="cx"> header( "Expires: " . gmdate( "D, d M Y H:i:s", time() + $expiresOffset ) . " GMT" );
</span><span class="lines">@@ -1079,7 +1086,9 @@
</span><span class="cx"> *
</span><span class="cx"> * @since 2.0.0
</span><span class="cx"> *
</span><del>- * @return int Number of database queries
</del><ins>+ * @global wpdb $wpdb WordPress database access abstraction object.
+ *
+ * @return int Number of database queries.
</ins><span class="cx"> */
</span><span class="cx"> function get_num_queries() {
</span><span class="cx"> global $wpdb;
</span><span class="lines">@@ -1087,19 +1096,21 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Whether input is yes or no. Must be 'y' to be true.
</del><ins>+ * Whether input is yes or no.
</ins><span class="cx"> *
</span><ins>+ * Must be 'y' to be true.
+ *
</ins><span class="cx"> * @since 1.0.0
</span><span class="cx"> *
</span><del>- * @param string $yn Character string containing either 'y' or 'n'
- * @return bool True if yes, false on anything else
</del><ins>+ * @param string $yn Character string containing either 'y' (yes) or 'n' (no).
+ * @return bool True if yes, false on anything else.
</ins><span class="cx"> */
</span><span class="cx"> function bool_from_yn( $yn ) {
</span><span class="cx"> return ( strtolower( $yn ) == 'y' );
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Loads the feed template from the use of an action hook.
</del><ins>+ * Load the feed template from the use of an action hook.
</ins><span class="cx"> *
</span><span class="cx"> * If the feed action does not have a hook, then the function will die with a
</span><span class="cx"> * message telling the visitor that the feed is not valid.
</span><span class="lines">@@ -1141,6 +1152,8 @@
</span><span class="cx"> * Load the RDF RSS 0.91 Feed template.
</span><span class="cx"> *
</span><span class="cx"> * @since 2.1.0
</span><ins>+ *
+ * @see load_template()
</ins><span class="cx"> */
</span><span class="cx"> function do_feed_rdf() {
</span><span class="cx"> load_template( ABSPATH . WPINC . '/feed-rdf.php' );
</span><span class="lines">@@ -1150,6 +1163,8 @@
</span><span class="cx"> * Load the RSS 1.0 Feed Template.
</span><span class="cx"> *
</span><span class="cx"> * @since 2.1.0
</span><ins>+ *
+ * @see load_template()
</ins><span class="cx"> */
</span><span class="cx"> function do_feed_rss() {
</span><span class="cx"> load_template( ABSPATH . WPINC . '/feed-rss.php' );
</span><span class="lines">@@ -1160,6 +1175,8 @@
</span><span class="cx"> *
</span><span class="cx"> * @since 2.1.0
</span><span class="cx"> *
</span><ins>+ * @see load_template()
+ *
</ins><span class="cx"> * @param bool $for_comments True for the comment feed, false for normal feed.
</span><span class="cx"> */
</span><span class="cx"> function do_feed_rss2( $for_comments ) {
</span><span class="lines">@@ -1174,6 +1191,8 @@
</span><span class="cx"> *
</span><span class="cx"> * @since 2.1.0
</span><span class="cx"> *
</span><ins>+ * @see load_template()
+ *
</ins><span class="cx"> * @param bool $for_comments True for the comment feed, false for normal feed.
</span><span class="cx"> */
</span><span class="cx"> function do_feed_atom( $for_comments ) {
</span><span class="lines">@@ -1225,21 +1244,25 @@
</span><span class="cx"> /**
</span><span class="cx"> * Test whether blog is already installed.
</span><span class="cx"> *
</span><del>- * The cache will be checked first. If you have a cache plugin, which saves the
- * cache values, then this will work. If you use the default WordPress cache,
- * and the database goes away, then you might have problems.
</del><ins>+ * The cache will be checked first. If you have a cache plugin, which saves
+ * the cache values, then this will work. If you use the default WordPress
+ * cache, and the database goes away, then you might have problems.
</ins><span class="cx"> *
</span><del>- * Checks for the option siteurl for whether WordPress is installed.
</del><ins>+ * Checks for the 'siteurl' option for whether WordPress is installed.
</ins><span class="cx"> *
</span><span class="cx"> * @since 2.1.0
</span><del>- * @uses $wpdb
</del><span class="cx"> *
</span><del>- * @return bool Whether blog is already installed.
</del><ins>+ * @global wpdb $wpdb WordPress database access abstraction object.
+ *
+ * @return bool Whether the blog is already installed.
</ins><span class="cx"> */
</span><span class="cx"> function is_blog_installed() {
</span><span class="cx"> global $wpdb;
</span><span class="cx">
</span><del>- // Check cache first. If options table goes away and we have true cached, oh well.
</del><ins>+ /*
+ * Check cache first. If options table goes away and we have true
+ * cached, oh well.
+ */
</ins><span class="cx"> if ( wp_cache_get( 'is_blog_installed' ) )
</span><span class="cx"> return true;
</span><span class="cx">
</span><span class="lines">@@ -1266,9 +1289,11 @@
</span><span class="cx">
</span><span class="cx"> $suppress = $wpdb->suppress_errors();
</span><span class="cx">
</span><del>- // Loop over the WP tables. If none exist, then scratch install is allowed.
- // If one or more exist, suggest table repair since we got here because the options
- // table could not be accessed.
</del><ins>+ /*
+ * Loop over the WP tables. If none exist, then scratch install is allowed.
+ * If one or more exist, suggest table repair since we got here because the
+ * options table could not be accessed.
+ */
</ins><span class="cx"> $wp_tables = $wpdb->tables();
</span><span class="cx"> foreach ( $wp_tables as $table ) {
</span><span class="cx"> // The existence of custom user tables shouldn't suggest an insane state or prevent a clean install.
</span><span class="lines">@@ -1302,8 +1327,8 @@
</span><span class="cx"> * @since 2.0.4
</span><span class="cx"> *
</span><span class="cx"> * @param string $actionurl URL to add nonce action.
</span><del>- * @param string $action Optional. Nonce action name.
- * @param string $name Optional. Nonce name.
</del><ins>+ * @param string $action Optional. Nonce action name. Default -1.
+ * @param string $name Optional. Nonce name. Default '_wpnonce'.
</ins><span class="cx"> * @return string Escaped URL with nonce action added.
</span><span class="cx"> */
</span><span class="cx"> function wp_nonce_url( $actionurl, $action = -1, $name = '_wpnonce' ) {
</span><span class="lines">@@ -1331,11 +1356,11 @@
</span><span class="cx"> *
</span><span class="cx"> * @since 2.0.4
</span><span class="cx"> *
</span><del>- * @param string $action Optional. Action name.
- * @param string $name Optional. Nonce name.
- * @param bool $referer Optional, default true. Whether to set the referer field for validation.
- * @param bool $echo Optional, default true. Whether to display or return hidden form field.
- * @return string Nonce field.
</del><ins>+ * @param string $action Optional. Action name. Default -1.
+ * @param string $name Optional. Nonce name. Default '_wpnonce'.
+ * @param bool $referer Optional. Whether to set the referer field for validation. Default true.
+ * @param bool $echo Optional. Whether to display or return hidden form field. Default true.
+ * @return string Nonce field HTML markup.
</ins><span class="cx"> */
</span><span class="cx"> function wp_nonce_field( $action = -1, $name = "_wpnonce", $referer = true , $echo = true ) {
</span><span class="cx"> $name = esc_attr( $name );
</span><span class="lines">@@ -1358,8 +1383,8 @@
</span><span class="cx"> *
</span><span class="cx"> * @since 2.0.4
</span><span class="cx"> *
</span><del>- * @param bool $echo Whether to echo or return the referer field.
- * @return string Referer field.
</del><ins>+ * @param bool $echo Optional. Whether to echo or return the referer field. Default true.
+ * @return string Referer field HTML markup.
</ins><span class="cx"> */
</span><span class="cx"> function wp_referer_field( $echo = true ) {
</span><span class="cx"> $referer_field = '<input type="hidden" name="_wp_http_referer" value="'. esc_attr( wp_unslash( $_SERVER['REQUEST_URI'] ) ) . '" />';
</span><span class="lines">@@ -1373,13 +1398,14 @@
</span><span class="cx"> * Retrieve or display original referer hidden field for forms.
</span><span class="cx"> *
</span><span class="cx"> * The input name is '_wp_original_http_referer' and will be either the same
</span><del>- * value of {@link wp_referer_field()}, if that was posted already or it will
- * be the current page, if it doesn't exist.
</del><ins>+ * value of wp_referer_field(), if that was posted already or it will be the
+ * current page, if it doesn't exist.
</ins><span class="cx"> *
</span><span class="cx"> * @since 2.0.4
</span><span class="cx"> *
</span><del>- * @param bool $echo Whether to echo the original http referer
- * @param string $jump_back_to Optional, default is 'current'. Can be 'previous' or page you want to jump back to.
</del><ins>+ * @param bool $echo Optional. Whether to echo the original http referer. Default true.
+ * @param string $jump_back_to Optional. Can be 'previous' or page you want to jump back to.
+ * Default 'current'.
</ins><span class="cx"> * @return string Original referer field.
</span><span class="cx"> */
</span><span class="cx"> function wp_original_referer_field( $echo = true, $jump_back_to = 'current' ) {
</span><span class="lines">@@ -1393,9 +1419,10 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Retrieve referer from '_wp_http_referer' or HTTP referer. If it's the same
- * as the current request URL, will return false.
</del><ins>+ * Retrieve referer from '_wp_http_referer' or HTTP referer.
</ins><span class="cx"> *
</span><ins>+ * If it's the same as the current request URL, will return false.
+ *
</ins><span class="cx"> * @since 2.0.4
</span><span class="cx"> *
</span><span class="cx"> * @return string|bool False on failure. Referer URL on success.
</span><span class="lines">@@ -1440,21 +1467,24 @@
</span><span class="cx"> function wp_mkdir_p( $target ) {
</span><span class="cx"> $wrapper = null;
</span><span class="cx">
</span><del>- // strip the protocol
</del><ins>+ // Strip the protocol.
</ins><span class="cx"> if( wp_is_stream( $target ) ) {
</span><span class="cx"> list( $wrapper, $target ) = explode( '://', $target, 2 );
</span><span class="cx"> }
</span><span class="cx">
</span><del>- // from php.net/mkdir user contributed notes
</del><ins>+ // From php.net/mkdir user contributed notes.
</ins><span class="cx"> $target = str_replace( '//', '/', $target );
</span><span class="cx">
</span><del>- // put the wrapper back on the target
</del><ins>+ // Put the wrapper back on the target.
</ins><span class="cx"> if( $wrapper !== null ) {
</span><span class="cx"> $target = $wrapper . '://' . $target;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- // safe mode fails with a trailing slash under certain PHP versions.
- $target = rtrim($target, '/'); // Use rtrim() instead of untrailingslashit to avoid formatting.php dependency.
</del><ins>+ /*
+ * Safe mode fails with a trailing slash under certain PHP versions.
+ * Use rtrim() instead of untrailingslashit to avoid formatting.php dependency.
+ */
+ $target = rtrim($target, '/');
</ins><span class="cx"> if ( empty($target) )
</span><span class="cx"> $target = '/';
</span><span class="cx">
</span><span class="lines">@@ -1476,7 +1506,10 @@
</span><span class="cx">
</span><span class="cx"> if ( @mkdir( $target, $dir_perms, true ) ) {
</span><span class="cx">
</span><del>- // If a umask is set that modifies $dir_perms, we'll have to re-set the $dir_perms correctly with chmod()
</del><ins>+ /*
+ * If a umask is set that modifies $dir_perms, we'll have to re-set
+ * the $dir_perms correctly with chmod()
+ */
</ins><span class="cx"> if ( $dir_perms != ( $dir_perms & ~umask() ) ) {
</span><span class="cx"> $folder_parts = explode( '/', substr( $target, strlen( $target_parent ) + 1 ) );
</span><span class="cx"> for ( $i = 1; $i <= count( $folder_parts ); $i++ ) {
</span><span class="lines">@@ -1491,38 +1524,44 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Test if a give filesystem path is absolute ('/foo/bar', 'c:\windows').
</del><ins>+ * Test if a give filesystem path is absolute.
</ins><span class="cx"> *
</span><ins>+ * For example, '/foo/bar', or 'c:\windows'.
+ *
</ins><span class="cx"> * @since 2.5.0
</span><span class="cx"> *
</span><del>- * @param string $path File path
</del><ins>+ * @param string $path File path.
</ins><span class="cx"> * @return bool True if path is absolute, false is not absolute.
</span><span class="cx"> */
</span><span class="cx"> function path_is_absolute( $path ) {
</span><del>- // this is definitive if true but fails if $path does not exist or contains a symbolic link
</del><ins>+ /*
+ * This is definitive if true but fails if $path does not exist or contains
+ * a symbolic link.
+ */
</ins><span class="cx"> if ( realpath($path) == $path )
</span><span class="cx"> return true;
</span><span class="cx">
</span><span class="cx"> if ( strlen($path) == 0 || $path[0] == '.' )
</span><span class="cx"> return false;
</span><span class="cx">
</span><del>- // windows allows absolute paths like this
</del><ins>+ // Windows allows absolute paths like this.
</ins><span class="cx"> if ( preg_match('#^[a-zA-Z]:\\\\#', $path) )
</span><span class="cx"> return true;
</span><span class="cx">
</span><del>- // a path starting with / or \ is absolute; anything else is relative
</del><ins>+ // A path starting with / or \ is absolute; anything else is relative.
</ins><span class="cx"> return ( $path[0] == '/' || $path[0] == '\\' );
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Join two filesystem paths together (e.g. 'give me $path relative to $base').
</del><ins>+ * Join two filesystem paths together.
</ins><span class="cx"> *
</span><del>- * If the $path is absolute, then it the full path is returned.
</del><ins>+ * For example, 'give me $path relative to $base'. If the $path is absolute,
+ * then it the full path is returned.
</ins><span class="cx"> *
</span><span class="cx"> * @since 2.5.0
</span><span class="cx"> *
</span><del>- * @param string $base
- * @param string $path
</del><ins>+ * @param string $base Base path.
+ * @param string $path Path relative to $base.
</ins><span class="cx"> * @return string The path with the base or absolute path.
</span><span class="cx"> */
</span><span class="cx"> function path_join( $base, $path ) {
</span><span class="lines">@@ -1535,8 +1574,8 @@
</span><span class="cx"> /**
</span><span class="cx"> * Normalize a filesystem path.
</span><span class="cx"> *
</span><del>- * Replaces backslashes with forward slashes for Windows systems,
- * and ensures no duplicate slashes exist.
</del><ins>+ * Replaces backslashes with forward slashes for Windows systems, and ensures
+ * no duplicate slashes exist.
</ins><span class="cx"> *
</span><span class="cx"> * @since 3.9.0
</span><span class="cx"> *
</span><span class="lines">@@ -1550,18 +1589,18 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Determines a writable directory for temporary files.
- * Function's preference is the return value of <code>sys_get_temp_dir()</code>,
</del><ins>+ * Determine a writable directory for temporary files.
+ *
+ * Function's preference is the return value of sys_get_temp_dir(),
</ins><span class="cx"> * followed by your PHP temporary upload directory, followed by WP_CONTENT_DIR,
</span><span class="cx"> * before finally defaulting to /tmp/
</span><span class="cx"> *
</span><span class="cx"> * In the event that this function does not find a writable location,
</span><del>- * It may be overridden by the <code>WP_TEMP_DIR</code> constant in
- * your <code>wp-config.php</code> file.
</del><ins>+ * It may be overridden by the WP_TEMP_DIR constant in your wp-config.php file.
</ins><span class="cx"> *
</span><span class="cx"> * @since 2.5.0
</span><span class="cx"> *
</span><del>- * @return string Writable temporary directory
</del><ins>+ * @return string Writable temporary directory.
</ins><span class="cx"> */
</span><span class="cx"> function get_temp_dir() {
</span><span class="cx"> static $temp;
</span><span class="lines">@@ -1592,15 +1631,15 @@
</span><span class="cx"> /**
</span><span class="cx"> * Determine if a directory is writable.
</span><span class="cx"> *
</span><del>- * This function is used to work around certain ACL issues
- * in PHP primarily affecting Windows Servers.
</del><ins>+ * This function is used to work around certain ACL issues in PHP primarily
+ * affecting Windows Servers.
</ins><span class="cx"> *
</span><ins>+ * @since 3.6.0
+ *
</ins><span class="cx"> * @see win_is_writable()
</span><span class="cx"> *
</span><del>- * @since 3.6.0
- *
- * @param string $path
- * @return bool
</del><ins>+ * @param string $path Path to check for write-ability.
+ * @return bool Whether the path is writable.
</ins><span class="cx"> */
</span><span class="cx"> function wp_is_writable( $path ) {
</span><span class="cx"> if ( 'WIN' === strtoupper( substr( PHP_OS, 0, 3 ) ) )
</span><span class="lines">@@ -1617,13 +1656,13 @@
</span><span class="cx"> * checking the ability to open files rather than relying
</span><span class="cx"> * upon PHP to interprate the OS ACL.
</span><span class="cx"> *
</span><del>- * @link http://bugs.php.net/bug.php?id=27609
- * @link http://bugs.php.net/bug.php?id=30931
- *
</del><span class="cx"> * @since 2.8.0
</span><span class="cx"> *
</span><del>- * @param string $path
- * @return bool
</del><ins>+ * @see http://bugs.php.net/bug.php?id=27609
+ * @see http://bugs.php.net/bug.php?id=30931
+ *
+ * @param string $path Windows path to check for write-ability.
+ * @return bool Whether the path is writable.
</ins><span class="cx"> */
</span><span class="cx"> function win_is_writable( $path ) {
</span><span class="cx">
</span><span class="lines">@@ -1672,7 +1711,7 @@
</span><span class="cx"> *
</span><span class="cx"> * @since 2.0.0
</span><span class="cx"> *
</span><del>- * @param string $time Optional. Time formatted in 'yyyy/mm'.
</del><ins>+ * @param string $time Optional. Time formatted in 'yyyy/mm'. Default null.
</ins><span class="cx"> * @return array See above for description.
</span><span class="cx"> */
</span><span class="cx"> function wp_upload_dir( $time = null ) {
</span><span class="lines">@@ -1695,8 +1734,10 @@
</span><span class="cx"> $url = trailingslashit( $siteurl ) . $upload_path;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- // Obey the value of UPLOADS. This happens as long as ms-files rewriting is disabled.
- // We also sometimes obey UPLOADS when rewriting is enabled -- see the next block.
</del><ins>+ /*
+ * Honor the value of UPLOADS. This happens as long as ms-files rewriting is disabled.
+ * We also sometimes obey UPLOADS when rewriting is enabled -- see the next block.
+ */
</ins><span class="cx"> if ( defined( 'UPLOADS' ) && ! ( is_multisite() && get_site_option( 'ms_files_rewriting' ) ) ) {
</span><span class="cx"> $dir = ABSPATH . UPLOADS;
</span><span class="cx"> $url = trailingslashit( $siteurl ) . UPLOADS;
</span><span class="lines">@@ -1706,11 +1747,14 @@
</span><span class="cx"> if ( is_multisite() && ! ( is_main_network() && is_main_site() && defined( 'MULTISITE' ) ) ) {
</span><span class="cx">
</span><span class="cx"> if ( ! get_site_option( 'ms_files_rewriting' ) ) {
</span><del>- // If ms-files rewriting is disabled (networks created post-3.5), it is fairly straightforward:
- // Append sites/%d if we're not on the main site (for post-MU networks). (The extra directory
- // prevents a four-digit ID from conflicting with a year-based directory for the main site.
- // But if a MU-era network has disabled ms-files rewriting manually, they don't need the extra
- // directory, as they never had wp-content/uploads for the main site.)
</del><ins>+ /*
+ * If ms-files rewriting is disabled (networks created post-3.5), it is fairly
+ * straightforward: Append sites/%d if we're not on the main site (for post-MU
+ * networks). (The extra directory prevents a four-digit ID from conflicting with
+ * a year-based directory for the main site. But if a MU-era network has disabled
+ * ms-files rewriting manually, they don't need the extra directory, as they never
+ * had wp-content/uploads for the main site.)
+ */
</ins><span class="cx">
</span><span class="cx"> if ( defined( 'MULTISITE' ) )
</span><span class="cx"> $ms_dir = '/sites/' . get_current_blog_id();
</span><span class="lines">@@ -1721,17 +1765,19 @@
</span><span class="cx"> $url .= $ms_dir;
</span><span class="cx">
</span><span class="cx"> } elseif ( defined( 'UPLOADS' ) && ! ms_is_switched() ) {
</span><del>- // Handle the old-form ms-files.php rewriting if the network still has that enabled.
- // When ms-files rewriting is enabled, then we only listen to UPLOADS when:
- // 1) we are not on the main site in a post-MU network,
- // as wp-content/uploads is used there, and
- // 2) we are not switched, as ms_upload_constants() hardcodes
- // these constants to reflect the original blog ID.
- //
- // Rather than UPLOADS, we actually use BLOGUPLOADDIR if it is set, as it is absolute.
- // (And it will be set, see ms_upload_constants().) Otherwise, UPLOADS can be used, as
- // as it is relative to ABSPATH. For the final piece: when UPLOADS is used with ms-files
- // rewriting in multisite, the resulting URL is /files. (#WP22702 for background.)
</del><ins>+ /*
+ * Handle the old-form ms-files.php rewriting if the network still has that enabled.
+ * When ms-files rewriting is enabled, then we only listen to UPLOADS when:
+ * 1) We are not on the main site in a post-MU network, as wp-content/uploads is used
+ * there, and
+ * 2) We are not switched, as ms_upload_constants() hardcodes these constants to reflect
+ * the original blog ID.
+ *
+ * Rather than UPLOADS, we actually use BLOGUPLOADDIR if it is set, as it is absolute.
+ * (And it will be set, see ms_upload_constants().) Otherwise, UPLOADS can be used, as
+ * as it is relative to ABSPATH. For the final piece: when UPLOADS is used with ms-files
+ * rewriting in multisite, the resulting URL is /files. (#WP22702 for background.)
+ */
</ins><span class="cx">
</span><span class="cx"> if ( defined( 'BLOGUPLOADDIR' ) )
</span><span class="cx"> $dir = untrailingslashit( BLOGUPLOADDIR );
</span><span class="lines">@@ -1775,7 +1821,7 @@
</span><span class="cx"> 'error' => false,
</span><span class="cx"> ) );
</span><span class="cx">
</span><del>- // Make sure we have an uploads dir
</del><ins>+ // Make sure we have an uploads directory.
</ins><span class="cx"> if ( ! wp_mkdir_p( $uploads['path'] ) ) {
</span><span class="cx"> if ( 0 === strpos( $uploads['basedir'], ABSPATH ) )
</span><span class="cx"> $error_path = str_replace( ABSPATH, '', $uploads['basedir'] ) . $uploads['subdir'];
</span><span class="lines">@@ -1801,36 +1847,39 @@
</span><span class="cx"> *
</span><span class="cx"> * @since 2.5.0
</span><span class="cx"> *
</span><del>- * @param string $dir
- * @param string $filename
- * @param mixed $unique_filename_callback Callback.
</del><ins>+ * @param string $dir Directory.
+ * @param string $filename File name.
+ * @param callback $unique_filename_callback Callback. Default null.
</ins><span class="cx"> * @return string New filename, if given wasn't unique.
</span><span class="cx"> */
</span><span class="cx"> function wp_unique_filename( $dir, $filename, $unique_filename_callback = null ) {
</span><del>- // sanitize the file name before we begin processing
</del><ins>+ // Sanitize the file name before we begin processing.
</ins><span class="cx"> $filename = sanitize_file_name($filename);
</span><span class="cx">
</span><del>- // separate the filename into a name and extension
</del><ins>+ // Separate the filename into a name and extension.
</ins><span class="cx"> $info = pathinfo($filename);
</span><span class="cx"> $ext = !empty($info['extension']) ? '.' . $info['extension'] : '';
</span><span class="cx"> $name = basename($filename, $ext);
</span><span class="cx">
</span><del>- // edge case: if file is named '.ext', treat as an empty name
</del><ins>+ // Edge case: if file is named '.ext', treat as an empty name.
</ins><span class="cx"> if ( $name === $ext )
</span><span class="cx"> $name = '';
</span><span class="cx">
</span><del>- // Increment the file number until we have a unique file to save in $dir. Use callback if supplied.
</del><ins>+ /*
+ * Increment the file number until we have a unique file to save in $dir.
+ * Use callback if supplied.
+ */
</ins><span class="cx"> if ( $unique_filename_callback && is_callable( $unique_filename_callback ) ) {
</span><span class="cx"> $filename = call_user_func( $unique_filename_callback, $dir, $name, $ext );
</span><span class="cx"> } else {
</span><span class="cx"> $number = '';
</span><span class="cx">
</span><del>- // change '.ext' to lower case
</del><ins>+ // Change '.ext' to lower case.
</ins><span class="cx"> if ( $ext && strtolower($ext) != $ext ) {
</span><span class="cx"> $ext2 = strtolower($ext);
</span><span class="cx"> $filename2 = preg_replace( '|' . preg_quote($ext) . '$|', $ext2, $filename );
</span><span class="cx">
</span><del>- // check for both lower and upper case extension or image sub-sizes may be overwritten
</del><ins>+ // Check for both lower and upper case extension or image sub-sizes may be overwritten.
</ins><span class="cx"> while ( file_exists($dir . "/$filename") || file_exists($dir . "/$filename2") ) {
</span><span class="cx"> $new_number = $number + 1;
</span><span class="cx"> $filename = str_replace( "$number$ext", "$new_number$ext", $filename );
</span><span class="lines">@@ -1868,10 +1917,10 @@
</span><span class="cx"> *
</span><span class="cx"> * @since 2.0.0
</span><span class="cx"> *
</span><del>- * @param string $name
- * @param null $deprecated Never used. Set to null.
- * @param mixed $bits File content
- * @param string $time Optional. Time formatted in 'yyyy/mm'.
</del><ins>+ * @param string $name Filename.
+ * @param null $deprecated Never used. Set to null.
+ * @param mixed $bits File content
+ * @param string $time Optional. Time formatted in 'yyyy/mm'. Default null.
</ins><span class="cx"> * @return array
</span><span class="cx"> */
</span><span class="cx"> function wp_upload_bits( $name, $deprecated, $bits, $time = null ) {
</span><span class="lines">@@ -1989,7 +2038,7 @@
</span><span class="cx"> * @since 2.0.4
</span><span class="cx"> *
</span><span class="cx"> * @param string $filename File name or path.
</span><del>- * @param array $mimes Optional. Key is the file extension with value as the mime type.
</del><ins>+ * @param array $mimes Optional. Key is the file extension with value as the mime type.
</ins><span class="cx"> * @return array Values with extension first and mime type.
</span><span class="cx"> */
</span><span class="cx"> function wp_check_filetype( $filename, $mimes = null ) {
</span><span class="lines">@@ -2012,6 +2061,7 @@
</span><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * Attempt to determine the real file type of a file.
</span><ins>+ *
</ins><span class="cx"> * If unable to, the file name extension will be used to determine type.
</span><span class="cx"> *
</span><span class="cx"> * If it's determined that the extension does not match the file's real type,
</span><span class="lines">@@ -2021,10 +2071,12 @@
</span><span class="cx"> *
</span><span class="cx"> * @since 3.0.0
</span><span class="cx"> *
</span><del>- * @param string $file Full path to the file.
- * @param string $filename The name of the file (may differ from $file due to $file being in a tmp directory)
- * @param array $mimes Optional. Key is the file extension with value as the mime type.
- * @return array Values for the extension, MIME, and either a corrected filename or false if original $filename is valid
</del><ins>+ * @param string $file Full path to the file.
+ * @param string $filename The name of the file (may differ from $file due to $file being
+ * in a tmp directory).
+ * @param array $mimes Optional. Key is the file extension with value as the mime type.
+ * @return array Values for the extension, MIME, and either a corrected filename or false
+ * if original $filename is valid.
</ins><span class="cx"> */
</span><span class="cx"> function wp_check_filetype_and_ext( $file, $filename, $mimes = null ) {
</span><span class="cx">
</span><span class="lines">@@ -2116,14 +2168,14 @@
</span><span class="cx"> * corresponding to those types.
</span><span class="cx"> */
</span><span class="cx"> return apply_filters( 'mime_types', array(
</span><del>- // Image formats
</del><ins>+ // Image formats.
</ins><span class="cx"> 'jpg|jpeg|jpe' => 'image/jpeg',
</span><span class="cx"> 'gif' => 'image/gif',
</span><span class="cx"> 'png' => 'image/png',
</span><span class="cx"> 'bmp' => 'image/bmp',
</span><span class="cx"> 'tif|tiff' => 'image/tiff',
</span><span class="cx"> 'ico' => 'image/x-icon',
</span><del>- // Video formats
</del><ins>+ // Video formats.
</ins><span class="cx"> 'asf|asx' => 'video/x-ms-asf',
</span><span class="cx"> 'wmv' => 'video/x-ms-wmv',
</span><span class="cx"> 'wmx' => 'video/x-ms-wmx',
</span><span class="lines">@@ -2139,7 +2191,7 @@
</span><span class="cx"> 'mkv' => 'video/x-matroska',
</span><span class="cx"> '3gp|3gpp' => 'video/3gpp', // Can also be audio
</span><span class="cx"> '3g2|3gp2' => 'video/3gpp2', // Can also be audio
</span><del>- // Text formats
</del><ins>+ // Text formats.
</ins><span class="cx"> 'txt|asc|c|cc|h|srt' => 'text/plain',
</span><span class="cx"> 'csv' => 'text/csv',
</span><span class="cx"> 'tsv' => 'text/tab-separated-values',
</span><span class="lines">@@ -2149,7 +2201,7 @@
</span><span class="cx"> 'htm|html' => 'text/html',
</span><span class="cx"> 'vtt' => 'text/vtt',
</span><span class="cx"> 'dfxp' => 'application/ttaf+xml',
</span><del>- // Audio formats
</del><ins>+ // Audio formats.
</ins><span class="cx"> 'mp3|m4a|m4b' => 'audio/mpeg',
</span><span class="cx"> 'ra|ram' => 'audio/x-realaudio',
</span><span class="cx"> 'wav' => 'audio/wav',
</span><span class="lines">@@ -2158,7 +2210,7 @@
</span><span class="cx"> 'wma' => 'audio/x-ms-wma',
</span><span class="cx"> 'wax' => 'audio/x-ms-wax',
</span><span class="cx"> 'mka' => 'audio/x-matroska',
</span><del>- // Misc application formats
</del><ins>+ // Misc application formats.
</ins><span class="cx"> 'rtf' => 'application/rtf',
</span><span class="cx"> 'js' => 'application/javascript',
</span><span class="cx"> 'pdf' => 'application/pdf',
</span><span class="lines">@@ -2170,7 +2222,7 @@
</span><span class="cx"> 'rar' => 'application/rar',
</span><span class="cx"> '7z' => 'application/x-7z-compressed',
</span><span class="cx"> 'exe' => 'application/x-msdownload',
</span><del>- // MS Office formats
</del><ins>+ // MS Office formats.
</ins><span class="cx"> 'doc' => 'application/msword',
</span><span class="cx"> 'pot|pps|ppt' => 'application/vnd.ms-powerpoint',
</span><span class="cx"> 'wri' => 'application/vnd.ms-write',
</span><span class="lines">@@ -2199,7 +2251,7 @@
</span><span class="cx"> 'onetoc|onetoc2|onetmp|onepkg' => 'application/onenote',
</span><span class="cx"> 'oxps' => 'application/oxps',
</span><span class="cx"> 'xps' => 'application/vnd.ms-xpsdocument',
</span><del>- // OpenOffice formats
</del><ins>+ // OpenOffice formats.
</ins><span class="cx"> 'odt' => 'application/vnd.oasis.opendocument.text',
</span><span class="cx"> 'odp' => 'application/vnd.oasis.opendocument.presentation',
</span><span class="cx"> 'ods' => 'application/vnd.oasis.opendocument.spreadsheet',
</span><span class="lines">@@ -2207,9 +2259,9 @@
</span><span class="cx"> 'odc' => 'application/vnd.oasis.opendocument.chart',
</span><span class="cx"> 'odb' => 'application/vnd.oasis.opendocument.database',
</span><span class="cx"> 'odf' => 'application/vnd.oasis.opendocument.formula',
</span><del>- // WordPerfect formats
</del><ins>+ // WordPerfect formats.
</ins><span class="cx"> 'wp|wpd' => 'application/wordperfect',
</span><del>- // iWork formats
</del><ins>+ // iWork formats.
</ins><span class="cx"> 'key' => 'application/vnd.apple.keynote',
</span><span class="cx"> 'numbers' => 'application/vnd.apple.numbers',
</span><span class="cx"> 'pages' => 'application/vnd.apple.pages',
</span><span class="lines">@@ -2223,7 +2275,8 @@
</span><span class="cx"> * @uses wp_get_upload_mime_types() to fetch the list of mime types
</span><span class="cx"> *
</span><span class="cx"> * @param int|WP_User $user Optional. User to check. Defaults to current user.
</span><del>- * @return array Array of mime types keyed by the file extension regex corresponding to those types.
</del><ins>+ * @return array Array of mime types keyed by the file extension regex corresponding
+ * to those types.
</ins><span class="cx"> */
</span><span class="cx"> function get_allowed_mime_types( $user = null ) {
</span><span class="cx"> $t = wp_get_mime_types();
</span><span class="lines">@@ -2251,8 +2304,8 @@
</span><span class="cx"> /**
</span><span class="cx"> * Display "Are You Sure" message to confirm the action being taken.
</span><span class="cx"> *
</span><del>- * If the action has the nonce explain message, then it will be displayed along
- * with the "Are you sure?" message.
</del><ins>+ * If the action has the nonce explain message, then it will be displayed
+ * along with the "Are you sure?" message.
</ins><span class="cx"> *
</span><span class="cx"> * @since 2.0.4
</span><span class="cx"> *
</span><span class="lines">@@ -2284,9 +2337,9 @@
</span><span class="cx"> *
</span><span class="cx"> * @since 2.0.4
</span><span class="cx"> *
</span><del>- * @param string $message Error message.
- * @param string $title Error title.
- * @param string|array $args Optional arguments to control behavior.
</del><ins>+ * @param string $message Optional. Error message. Default empty.
+ * @param string $title Optional. Error title. Default empty.
+ * @param string|array $args Optional. Arguments to control behavior. Default empty array.
</ins><span class="cx"> */
</span><span class="cx"> function wp_die( $message = '', $title = '', $args = array() ) {
</span><span class="cx"> if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
</span><span class="lines">@@ -2330,9 +2383,9 @@
</span><span class="cx"> * @since 3.0.0
</span><span class="cx"> * @access private
</span><span class="cx"> *
</span><del>- * @param string $message Error message.
- * @param string $title Error title.
- * @param string|array $args Optional arguments to control behavior.
</del><ins>+ * @param string $message Error message.
+ * @param string $title Optional. Error title. Default empty.
+ * @param string|array $args Optional. Arguments to control behavior. Default empty array.
</ins><span class="cx"> */
</span><span class="cx"> function _default_wp_die_handler( $message, $title = '', $args = array() ) {
</span><span class="cx"> $defaults = array( 'response' => 500 );
</span><span class="lines">@@ -2508,9 +2561,9 @@
</span><span class="cx"> * @since 3.2.0
</span><span class="cx"> * @access private
</span><span class="cx"> *
</span><del>- * @param string $message Error message.
- * @param string $title Error title.
- * @param string|array $args Optional arguments to control behavior.
</del><ins>+ * @param string $message Error message.
+ * @param string $title Optional. Error title. Default empty.
+ * @param string|array $args Optional. Arguments to control behavior. Default empty array.
</ins><span class="cx"> */
</span><span class="cx"> function _xmlrpc_wp_die_handler( $message, $title = '', $args = array() ) {
</span><span class="cx"> global $wp_xmlrpc_server;
</span><span class="lines">@@ -2533,7 +2586,7 @@
</span><span class="cx"> * @since 3.4.0
</span><span class="cx"> * @access private
</span><span class="cx"> *
</span><del>- * @param string $message Optional. Response to print.
</del><ins>+ * @param string $message Optional. Response to print. Default empty.
</ins><span class="cx"> */
</span><span class="cx"> function _ajax_wp_die_handler( $message = '' ) {
</span><span class="cx"> if ( is_scalar( $message ) )
</span><span class="lines">@@ -2549,7 +2602,7 @@
</span><span class="cx"> * @since 3.4.0
</span><span class="cx"> * @access private
</span><span class="cx"> *
</span><del>- * @param string $message Optional. Response to print.
</del><ins>+ * @param string $message Optional. Response to print. Default empty.
</ins><span class="cx"> */
</span><span class="cx"> function _scalar_wp_die_handler( $message = '' ) {
</span><span class="cx"> if ( is_scalar( $message ) )
</span><span class="lines">@@ -2562,7 +2615,8 @@
</span><span class="cx"> *
</span><span class="cx"> * @since 3.5.0
</span><span class="cx"> *
</span><del>- * @param mixed $response Variable (usually an array or object) to encode as JSON, then print and die.
</del><ins>+ * @param mixed $response Variable (usually an array or object) to encode as JSON,
+ * then print and die.
</ins><span class="cx"> */
</span><span class="cx"> function wp_send_json( $response ) {
</span><span class="cx"> @header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
</span><span class="lines">@@ -2608,14 +2662,16 @@
</span><span class="cx"> /**
</span><span class="cx"> * Retrieve the WordPress home page URL.
</span><span class="cx"> *
</span><del>- * If the constant named 'WP_HOME' exists, then it will be used and returned by
- * the function. This can be used to counter the redirection on your local
</del><ins>+ * If the constant named 'WP_HOME' exists, then it will be used and returned
+ * by the function. This can be used to counter the redirection on your local
</ins><span class="cx"> * development environment.
</span><span class="cx"> *
</span><ins>+ * @since 2.2.0
</ins><span class="cx"> * @access private
</span><del>- * @since 2.2.0
</del><span class="cx"> *
</span><del>- * @param string $url URL for the home location
</del><ins>+ * @see WP_HOME
+ *
+ * @param string $url URL for the home location.
</ins><span class="cx"> * @return string Homepage location.
</span><span class="cx"> */
</span><span class="cx"> function _config_wp_home( $url = '' ) {
</span><span class="lines">@@ -2628,14 +2684,16 @@
</span><span class="cx"> * Retrieve the WordPress site URL.
</span><span class="cx"> *
</span><span class="cx"> * If the constant named 'WP_SITEURL' is defined, then the value in that
</span><del>- * constant will always be returned. This can be used for debugging a site on
- * your localhost while not having to change the database to your URL.
</del><ins>+ * constant will always be returned. This can be used for debugging a site
+ * on your localhost while not having to change the database to your URL.
</ins><span class="cx"> *
</span><ins>+ * @since 2.2.0
</ins><span class="cx"> * @access private
</span><del>- * @since 2.2.0
</del><span class="cx"> *
</span><ins>+ * @see WP_SITEURL
+ *
</ins><span class="cx"> * @param string $url URL to set the WordPress site location.
</span><del>- * @return string The WordPress Site URL
</del><ins>+ * @return string The WordPress Site URL.
</ins><span class="cx"> */
</span><span class="cx"> function _config_wp_siteurl( $url = '' ) {
</span><span class="cx"> if ( defined( 'WP_SITEURL' ) )
</span><span class="lines">@@ -2646,15 +2704,16 @@
</span><span class="cx"> /**
</span><span class="cx"> * Set the localized direction for MCE plugin.
</span><span class="cx"> *
</span><del>- * Will only set the direction to 'rtl', if the WordPress locale has the text
- * direction set to 'rtl'.
</del><ins>+ * Will only set the direction to 'rtl', if the WordPress locale has
+ * the text direction set to 'rtl'.
</ins><span class="cx"> *
</span><del>- * Fills in the 'directionality' setting, enables the 'directionality' plugin,
- * and adds the 'ltr' button to 'toolbar1', formerly 'theme_advanced_buttons1' array
- * keys. These keys are then returned in the $input (TinyMCE settings) array.
</del><ins>+ * Fills in the 'directionality' setting, enables the 'directionality'
+ * plugin, and adds the 'ltr' button to 'toolbar1', formerly
+ * 'theme_advanced_buttons1' array keys. These keys are then returned
+ * in the $input (TinyMCE settings) array.
</ins><span class="cx"> *
</span><ins>+ * @since 2.1.0
</ins><span class="cx"> * @access private
</span><del>- * @since 2.1.0
</del><span class="cx"> *
</span><span class="cx"> * @param array $input MCE settings array.
</span><span class="cx"> * @return array Direction set for 'rtl', if needed by locale.
</span><span class="lines">@@ -2689,6 +2748,7 @@
</span><span class="cx"> *
</span><span class="cx"> * @global array $wpsmiliestrans
</span><span class="cx"> * @global array $wp_smiliessearch
</span><ins>+ *
</ins><span class="cx"> * @since 2.2.0
</span><span class="cx"> */
</span><span class="cx"> function smilies_init() {
</span><span class="lines">@@ -2795,8 +2855,8 @@
</span><span class="cx"> *
</span><span class="cx"> * @since 2.2.0
</span><span class="cx"> *
</span><del>- * @param string|array $args Value to merge with $defaults
- * @param array $defaults Array that serves as the defaults.
</del><ins>+ * @param string|array $args Value to merge with $defaults
+ * @param array $defaults Optional. Array that serves as the defaults. Default empty.
</ins><span class="cx"> * @return array Merged user defined values with defaults.
</span><span class="cx"> */
</span><span class="cx"> function wp_parse_args( $args, $defaults = '' ) {
</span><span class="lines">@@ -2817,8 +2877,8 @@
</span><span class="cx"> *
</span><span class="cx"> * @since 3.0.0
</span><span class="cx"> *
</span><del>- * @param array|string $list
- * @return array Sanitized array of IDs
</del><ins>+ * @param array|string $list List of ids.
+ * @return array Sanitized array of IDs.
</ins><span class="cx"> */
</span><span class="cx"> function wp_parse_id_list( $list ) {
</span><span class="cx"> if ( !is_array($list) )
</span><span class="lines">@@ -2832,9 +2892,9 @@
</span><span class="cx"> *
</span><span class="cx"> * @since 3.1.0
</span><span class="cx"> *
</span><del>- * @param array $array The original array
- * @param array $keys The list of keys
- * @return array The array slice
</del><ins>+ * @param array $array The original array.
+ * @param array $keys The list of keys.
+ * @return array The array slice.
</ins><span class="cx"> */
</span><span class="cx"> function wp_array_slice_assoc( $array, $keys ) {
</span><span class="cx"> $slice = array();
</span><span class="lines">@@ -2850,12 +2910,15 @@
</span><span class="cx"> *
</span><span class="cx"> * @since 3.0.0
</span><span class="cx"> *
</span><del>- * @param array $list An array of objects to filter
- * @param array $args An array of key => value arguments to match against each object
- * @param string $operator The logical operation to perform. 'or' means only one element
- * from the array needs to match; 'and' means all elements must match. The default is 'and'.
- * @param bool|string $field A field from the object to place instead of the entire object
- * @return array A list of objects or object fields
</del><ins>+ * @param array $list An array of objects to filter
+ * @param array $args Optional. An array of key => value arguments to match
+ * against each object. Default empty array.
+ * @param string $operator Optional. The logical operation to perform. 'or' means
+ * only one element from the array needs to match; 'and'
+ * means all elements must match. Default 'and'.
+ * @param bool|string $field A field from the object to place instead of the entire object.
+ * Default false.
+ * @return array A list of objects or object fields.
</ins><span class="cx"> */
</span><span class="cx"> function wp_filter_object_list( $list, $args = array(), $operator = 'and', $field = false ) {
</span><span class="cx"> if ( ! is_array( $list ) )
</span><span class="lines">@@ -2874,14 +2937,14 @@
</span><span class="cx"> *
</span><span class="cx"> * @since 3.1.0
</span><span class="cx"> *
</span><del>- * @param array $list An array of objects to filter
- * @param array $args An array of key => value arguments to match against each object
- * @param string $operator The logical operation to perform:
- * 'AND' means all elements from the array must match;
- * 'OR' means only one element needs to match;
- * 'NOT' means no elements may match.
- * The default is 'AND'.
- * @return array
</del><ins>+ * @param array $list An array of objects to filter.
+ * @param array $args Optional. An array of key => value arguments to match
+ * against each object. Default empty array.
+ * @param string $operator Optional. The logical operation to perform. 'AND' means
+ * all elements from the array must match. 'OR' means only
+ * one element needs to match. 'NOT' means no elements may
+ * match. Default 'AND'.
+ * @return array Array of found values.
</ins><span class="cx"> */
</span><span class="cx"> function wp_list_filter( $list, $args = array(), $operator = 'AND' ) {
</span><span class="cx"> if ( ! is_array( $list ) )
</span><span class="lines">@@ -2920,16 +2983,21 @@
</span><span class="cx"> * array_column() (PHP 5.5) but also supports objects.
</span><span class="cx"> *
</span><span class="cx"> * @since 3.1.0
</span><ins>+ * @since 4.0.0 $index_key parameter added.
</ins><span class="cx"> *
</span><del>- * @param array $list A list of objects or arrays
- * @param int|string $field A field from the object to place instead of the entire object
- * @param int|string $index_key A field from the object to use as keys for the new array
- * @return array
</del><ins>+ * @param array $list List of objects or arrays
+ * @param int|string $field Field from the object to place instead of the entire object
+ * @param int|string $index_key Optional. Field from the object to use as keys for the new array.
+ * Default null.
+ * @return array Array of found values. If $index_key is set, an array of found values with keys
+ * corresponding to $index_key.
</ins><span class="cx"> */
</span><span class="cx"> function wp_list_pluck( $list, $field, $index_key = null ) {
</span><span class="cx"> if ( ! $index_key ) {
</span><del>- // This is simple. Could at some point wrap array_column()
- // if we knew we had an array of arrays.
</del><ins>+ /*
+ * This is simple. Could at some point wrap array_column()
+ * if we knew we had an array of arrays.
+ */
</ins><span class="cx"> foreach ( $list as $key => $value ) {
</span><span class="cx"> if ( is_object( $value ) ) {
</span><span class="cx"> $list[ $key ] = $value->$field;
</span><span class="lines">@@ -2940,9 +3008,10 @@
</span><span class="cx"> return $list;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- // When index_key is not set for a particular item,
- // push the value to the end of the stack.
- // This is how array_column() behaves.
</del><ins>+ /*
+ * When index_key is not set for a particular item, push the value
+ * to the end of the stack. This is how array_column() behaves.
+ */
</ins><span class="cx"> $newlist = array();
</span><span class="cx"> foreach ( $list as $value ) {
</span><span class="cx"> if ( is_object( $value ) ) {
</span><span class="lines">@@ -2966,16 +3035,18 @@
</span><span class="cx"> /**
</span><span class="cx"> * Determines if Widgets library should be loaded.
</span><span class="cx"> *
</span><del>- * Checks to make sure that the widgets library hasn't already been loaded. If
- * it hasn't, then it will load the widgets library and run an action hook.
</del><ins>+ * Checks to make sure that the widgets library hasn't already been loaded.
+ * If it hasn't, then it will load the widgets library and run an action hook.
</ins><span class="cx"> *
</span><span class="cx"> * @since 2.2.0
</span><del>- * @uses add_action() Calls '_admin_menu' hook with 'wp_widgets_add_menu' value.
</del><span class="cx"> */
</span><span class="cx"> function wp_maybe_load_widgets() {
</span><span class="cx"> /**
</span><span class="cx"> * Filter whether to load the Widgets library.
</span><span class="cx"> *
</span><ins>+ * Passing a falsey value to the filter will effectively short-circuit
+ * the Widgets library from loading.
+ *
</ins><span class="cx"> * @since 2.8.0
</span><span class="cx"> *
</span><span class="cx"> * @param bool $wp_maybe_load_widgets Whether to load the Widgets library.
</span><span class="lines">@@ -2984,7 +3055,9 @@
</span><span class="cx"> if ( ! apply_filters( 'load_default_widgets', true ) ) {
</span><span class="cx"> return;
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> require_once( ABSPATH . WPINC . '/default-widgets.php' );
</span><ins>+
</ins><span class="cx"> add_action( '_admin_menu', 'wp_widgets_add_menu' );
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -2992,6 +3065,7 @@
</span><span class="cx"> * Append the Widgets menu to the themes main menu.
</span><span class="cx"> *
</span><span class="cx"> * @since 2.2.0
</span><ins>+ *
</ins><span class="cx"> * @uses $submenu The administration submenu list.
</span><span class="cx"> */
</span><span class="cx"> function wp_widgets_add_menu() {
</span><span class="lines">@@ -3007,7 +3081,7 @@
</span><span class="cx"> /**
</span><span class="cx"> * Flush all output buffers for PHP 5.2.
</span><span class="cx"> *
</span><del>- * Make sure all output buffers are flushed before our singletons our destroyed.
</del><ins>+ * Make sure all output buffers are flushed before our singletons are destroyed.
</ins><span class="cx"> *
</span><span class="cx"> * @since 2.2.0
</span><span class="cx"> */
</span><span class="lines">@@ -3032,7 +3106,8 @@
</span><span class="cx"> * in WordPress 2.5.0.
</span><span class="cx"> *
</span><span class="cx"> * @since 2.3.2
</span><del>- * @uses $wpdb
</del><ins>+ *
+ * @global wpdb $wpdb WordPress database access abstraction object.
</ins><span class="cx"> */
</span><span class="cx"> function dead_db() {
</span><span class="cx"> global $wpdb;
</span></span></pre>
</div>
</div>
</body>
</html>