<!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>[29230] trunk/src/wp-includes: Convert documentation for default arguments in `WP_Http::request()` to a hash notation.</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/29230">29230</a></dd>
<dt>Author</dt> <dd>DrewAPicture</dd>
<dt>Date</dt> <dd>2014-07-18 22:00:51 +0000 (Fri, 18 Jul 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Convert documentation for default arguments in `WP_Http::request()` to a hash notation.
Also update corresponding docs for functions that leverage its arguments.
See <a href="http://core.trac.wordpress.org/ticket/28298">#28298</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludesclasshttpphp">trunk/src/wp-includes/class-http.php</a></li>
<li><a href="#trunksrcwpincludeshttpphp">trunk/src/wp-includes/http.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpincludesclasshttpphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/class-http.php (29229 => 29230)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/class-http.php 2014-07-18 21:46:24 UTC (rev 29229)
+++ trunk/src/wp-includes/class-http.php 2014-07-18 22:00:51 UTC (rev 29230)
</span><span class="lines">@@ -28,41 +28,57 @@
</span><span class="cx"> class WP_Http {
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Send a HTTP request to a URI.
</del><ins>+ * Send an HTTP request to a URI.
</ins><span class="cx"> *
</span><del>- * The body and headers are part of the arguments. The 'body' argument is for the body and will
- * accept either a string or an array. The 'headers' argument should be an array, but a string
- * is acceptable. If the 'body' argument is an array, then it will automatically be escaped
- * using http_build_query().
</del><ins>+ * Please note: The only URI that are supported in the HTTP Transport implementation
+ * are the HTTP and HTTPS protocols.
</ins><span class="cx"> *
</span><del>- * The only URI that are supported in the HTTP Transport implementation are the HTTP and HTTPS
- * protocols.
</del><ins>+ * @access public
+ * @since 2.7.0
</ins><span class="cx"> *
</span><del>- * The defaults are 'method', 'timeout', 'redirection', 'httpversion', 'blocking' and
- * 'user-agent'.
</del><ins>+ * @param string $url The request URL.
+ * @param string|array $args {
+ * Optional. Array or string of HTTP request arguments.
</ins><span class="cx"> *
</span><del>- * Accepted 'method' values are 'GET', 'POST', and 'HEAD', some transports technically allow
- * others, but should not be assumed. The 'timeout' is used to sent how long the connection
- * should stay open before failing when no response. 'redirection' is used to track how many
- * redirects were taken and used to sent the amount for other transports, but not all transports
- * accept setting that value.
</del><ins>+ * @type string $method Request method. Accepts 'GET', 'POST', 'HEAD', or 'PUT'.
+ * Some transports technically allow others, but should not be
+ * assumed. Default 'GET'.
+ * @type int $timeout How long the connection should stay open in seconds. Default 5.
+ * @type int $redirection Number of allowed redirects. Not supported by all transports
+ * Default 5.
+ * @type string $httpversion Version of the HTTP protocol to use. Accepts '1.0' and '1.1'.
+ * Default '1.0'.
+ * @type string $user-agent User-agent value sent.
+ * Default WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' ).
+ * @type bool $reject_unsafe_urls Whether to pass URLs through {@see wp_http_validate_url()}.
+ * Default false.
+ * @type bool $blocking Whether the calling code requires the result of the request.
+ * If set to false, the request will be sent to the remote server,
+ * and processing returned to the calling code immediately, the caller
+ * will know if the request succeeded or failed, but will not receive
+ * any response from the remote server. Default true.
+ * @type string|array $headers Array or string of headers to send with the request.
+ * Default empty array.
+ * @type array $cookies List of cookies to send with the request. Default empty array.
+ * @type string|array $body Body to send with the request. Default null.
+ * @type bool $compress Whether to compress the $body when sending the request.
+ * Default false.
+ * @type bool $decompress Whether to decompress a compressed response. If set to false and
+ * compressed content is returned in the response anyway, it will
+ * need to be separately decompressed. Default true.
+ * @type bool $sslverify Whether to verify SSL for the request. Default true.
+ * @type string sslcertificates Absolute path to an SSL certificate .crt file.
+ * Default ABSPATH . WPINC . '/certificates/ca-bundle.crt'.
+ * @type bool $stream Whether to stream to a file. If set to true and no filename was
+ * given, it will be droped it in the WP temp dir and its name will
+ * be set using the basename of the URL. Default false.
+ * @type string $filename Filename of the file to write to when streaming. $stream must be
+ * set to true. Default null.
+ * @type int $limit_response_size Size in bytes to limit the response to. Default null.
</ins><span class="cx"> *
</span><del>- * The 'httpversion' option is used to sent the HTTP version and accepted values are '1.0', and
- * '1.1' and should be a string. The 'user-agent' option is the user-agent and is used to
- * replace the default user-agent, which is 'WordPress/WP_Version', where WP_Version is the
- * value from $wp_version.
- *
- * The 'blocking' parameter can be used to specify if the calling code requires the result of
- * the HTTP request. If set to false, the request will be sent to the remote server, and
- * processing returned to the calling code immediately, the caller will know if the request
- * suceeded or failed, but will not receive any response from the remote server.
- *
- * @access public
- * @since 2.7.0
- *
- * @param string $url The request URL.
- * @param string|array $args Optional. Override the defaults.
- * @return array|WP_Error Array containing 'headers', 'body', 'response', 'cookies', 'filename'. A WP_Error instance upon error
</del><ins>+ * }
+ * @return array|WP_Error Array containing 'headers', 'body', 'response', 'cookies', 'filename'.
+ * A WP_Error instance upon error.
</ins><span class="cx"> */
</span><span class="cx"> public function request( $url, $args = array() ) {
</span><span class="cx"> global $wp_version;
</span></span></pre></div>
<a id="trunksrcwpincludeshttpphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/http.php (29229 => 29230)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/http.php 2014-07-18 21:46:24 UTC (rev 29229)
+++ trunk/src/wp-includes/http.php 2014-07-18 22:00:51 UTC (rev 29230)
</span><span class="lines">@@ -34,13 +34,13 @@
</span><span class="cx"> * This function is ideal when the HTTP request is being made to an arbitrary
</span><span class="cx"> * URL. The URL is validated to avoid redirection and request forgery attacks.
</span><span class="cx"> *
</span><del>- * @see wp_remote_request() For more information on the response array format
- * and default arguments.
- *
</del><span class="cx"> * @since 3.6.0
</span><span class="cx"> *
</span><del>- * @param string $url Site URL to retrieve.
- * @param array $args Optional. Override the defaults.
</del><ins>+ * @see wp_remote_request() For more information on the response array format.
+ * @see WP_Http::request() For default arguments information.
+ *
+ * @param string $url Site URL to retrieve.
+ * @param array $args Optional. Request arguments. Default empty array.
</ins><span class="cx"> * @return WP_Error|array The response or WP_Error on failure.
</span><span class="cx"> */
</span><span class="cx"> function wp_safe_remote_request( $url, $args = array() ) {
</span><span class="lines">@@ -55,13 +55,13 @@
</span><span class="cx"> * This function is ideal when the HTTP request is being made to an arbitrary
</span><span class="cx"> * URL. The URL is validated to avoid redirection and request forgery attacks.
</span><span class="cx"> *
</span><del>- * @see wp_remote_request() For more information on the response array format
- * and default arguments.
- *
</del><span class="cx"> * @since 3.6.0
</span><span class="cx"> *
</span><del>- * @param string $url Site URL to retrieve.
- * @param array $args Optional. Override the defaults.
</del><ins>+ * @see wp_remote_request() For more information on the response array format.
+ * @see WP_Http::request() For default arguments information.
+ *
+ * @param string $url Site URL to retrieve.
+ * @param array $args Optional. Request arguments. Default empty array.
</ins><span class="cx"> * @return WP_Error|array The response or WP_Error on failure.
</span><span class="cx"> */
</span><span class="cx"> function wp_safe_remote_get( $url, $args = array() ) {
</span><span class="lines">@@ -76,13 +76,13 @@
</span><span class="cx"> * This function is ideal when the HTTP request is being made to an arbitrary
</span><span class="cx"> * URL. The URL is validated to avoid redirection and request forgery attacks.
</span><span class="cx"> *
</span><del>- * @see wp_remote_request() For more information on the response array format
- * and default arguments.
- *
</del><span class="cx"> * @since 3.6.0
</span><span class="cx"> *
</span><del>- * @param string $url Site URL to retrieve.
- * @param array $args Optional. Override the defaults.
</del><ins>+ * @see wp_remote_request() For more information on the response array format.
+ * @see WP_Http::request() For default arguments information.
+ *
+ * @param string $url Site URL to retrieve.
+ * @param array $args Optional. Request arguments. Default empty array.
</ins><span class="cx"> * @return WP_Error|array The response or WP_Error on failure.
</span><span class="cx"> */
</span><span class="cx"> function wp_safe_remote_post( $url, $args = array() ) {
</span><span class="lines">@@ -97,13 +97,13 @@
</span><span class="cx"> * This function is ideal when the HTTP request is being made to an arbitrary
</span><span class="cx"> * URL. The URL is validated to avoid redirection and request forgery attacks.
</span><span class="cx"> *
</span><del>- * @see wp_remote_request() For more information on the response array format
- * and default arguments.
- *
</del><span class="cx"> * @since 3.6.0
</span><span class="cx"> *
</span><ins>+ * @see wp_remote_request() For more information on the response array format.
+ * @see WP_Http::request() For default arguments information.
+ *
</ins><span class="cx"> * @param string $url Site URL to retrieve.
</span><del>- * @param array $args Optional. Override the defaults.
</del><ins>+ * @param array $args Optional. Request arguments. Default empty array.
</ins><span class="cx"> * @return WP_Error|array The response or WP_Error on failure.
</span><span class="cx"> */
</span><span class="cx"> function wp_safe_remote_head( $url, $args = array() ) {
</span><span class="lines">@@ -115,47 +115,37 @@
</span><span class="cx"> /**
</span><span class="cx"> * Retrieve the raw response from the HTTP request.
</span><span class="cx"> *
</span><del>- * The array structure is a little complex.
</del><ins>+ * The array structure is a little complex:
</ins><span class="cx"> *
</span><del>- * <code>
- * $res = array( 'headers' => array(), 'response' => array('code' => int, 'message' => string) );
- * </code>
</del><ins>+ * $res = array(
+ * 'headers' => array(),
+ * 'response' => array(
+ * 'code' => int,
+ * 'message' => string
+ * )
+ * );
</ins><span class="cx"> *
</span><span class="cx"> * All of the headers in $res['headers'] are with the name as the key and the
</span><span class="cx"> * value as the value. So to get the User-Agent, you would do the following.
</span><span class="cx"> *
</span><del>- * <code>
- * $user_agent = $res['headers']['user-agent'];
- * </code>
</del><ins>+ * $user_agent = $res['headers']['user-agent'];
</ins><span class="cx"> *
</span><span class="cx"> * The body is the raw response content and can be retrieved from $res['body'].
</span><span class="cx"> *
</span><span class="cx"> * This function is called first to make the request and there are other API
</span><span class="cx"> * functions to abstract out the above convoluted setup.
</span><span class="cx"> *
</span><del>- * List of default arguments:
- * 'method' => 'GET'
</del><ins>+ * Request method defaults for helper functions:
</ins><span class="cx"> * - Default 'GET' for wp_remote_get()
</span><span class="cx"> * - Default 'POST' for wp_remote_post()
</span><span class="cx"> * - Default 'HEAD' for wp_remote_head()
</span><del>- * 'timeout' => 5
- * 'redirection' => 5
- * 'httpversion' => '1.0'
- * 'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' )
- * 'blocking' => true
- * 'headers' => array()
- * 'cookies' => array()
- * 'body' => null
- * 'compress' => false,
- * 'decompress' => true,
- * 'sslverify' => true,
- * 'stream' => false,
- * 'filename' => null
</del><span class="cx"> *
</span><span class="cx"> * @since 2.7.0
</span><span class="cx"> *
</span><del>- * @param string $url Site URL to retrieve.
- * @param array $args Optional. Override the defaults.
</del><ins>+ * @see WP_Http::request() For additional information on default arguments.
+ *
+ * @param string $url Site URL to retrieve.
+ * @param array $args Optional. Request arguments. Default empty array.
</ins><span class="cx"> * @return WP_Error|array The response or WP_Error on failure.
</span><span class="cx"> */
</span><span class="cx"> function wp_remote_request($url, $args = array()) {
</span><span class="lines">@@ -166,12 +156,13 @@
</span><span class="cx"> /**
</span><span class="cx"> * Retrieve the raw response from the HTTP request using the GET method.
</span><span class="cx"> *
</span><del>- * @see wp_remote_request() For more information on the response array format and default arguments.
- *
</del><span class="cx"> * @since 2.7.0
</span><span class="cx"> *
</span><del>- * @param string $url Site URL to retrieve.
- * @param array $args Optional. Override the defaults.
</del><ins>+ * @see wp_remote_request() For more information on the response array format.
+ * @see WP_Http::request() For default arguments information.
+ *
+ * @param string $url Site URL to retrieve.
+ * @param array $args Optional. Request arguments. Default empty array.
</ins><span class="cx"> * @return WP_Error|array The response or WP_Error on failure.
</span><span class="cx"> */
</span><span class="cx"> function wp_remote_get($url, $args = array()) {
</span><span class="lines">@@ -182,12 +173,13 @@
</span><span class="cx"> /**
</span><span class="cx"> * Retrieve the raw response from the HTTP request using the POST method.
</span><span class="cx"> *
</span><del>- * @see wp_remote_request() For more information on the response array format and default arguments.
- *
</del><span class="cx"> * @since 2.7.0
</span><span class="cx"> *
</span><del>- * @param string $url Site URL to retrieve.
- * @param array $args Optional. Override the defaults.
</del><ins>+ * @see wp_remote_request() For more information on the response array format.
+ * @see WP_Http::request() For default arguments information.
+ *
+ * @param string $url Site URL to retrieve.
+ * @param array $args Optional. Request arguments. Default empty array.
</ins><span class="cx"> * @return WP_Error|array The response or WP_Error on failure.
</span><span class="cx"> */
</span><span class="cx"> function wp_remote_post($url, $args = array()) {
</span><span class="lines">@@ -198,12 +190,13 @@
</span><span class="cx"> /**
</span><span class="cx"> * Retrieve the raw response from the HTTP request using the HEAD method.
</span><span class="cx"> *
</span><del>- * @see wp_remote_request() For more information on the response array format and default arguments.
- *
</del><span class="cx"> * @since 2.7.0
</span><span class="cx"> *
</span><del>- * @param string $url Site URL to retrieve.
- * @param array $args Optional. Override the defaults.
</del><ins>+ * @see wp_remote_request() For more information on the response array format.
+ * @see WP_Http::request() For default arguments information.
+ *
+ * @param string $url Site URL to retrieve.
+ * @param array $args Optional. Request arguments. Default empty array.
</ins><span class="cx"> * @return WP_Error|array The response or WP_Error on failure.
</span><span class="cx"> */
</span><span class="cx"> function wp_remote_head($url, $args = array()) {
</span></span></pre>
</div>
</div>
</body>
</html>