Edit File by line
/home/barbar84/www/wp-inclu...
File: class-requests.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Requests for PHP
[2] Fix | Delete
*
[3] Fix | Delete
* Inspired by Requests for Python.
[4] Fix | Delete
*
[5] Fix | Delete
* Based on concepts from SimplePie_File, RequestCore and WP_Http.
[6] Fix | Delete
*
[7] Fix | Delete
* @package Requests
[8] Fix | Delete
*/
[9] Fix | Delete
[10] Fix | Delete
/**
[11] Fix | Delete
* Requests for PHP
[12] Fix | Delete
*
[13] Fix | Delete
* Inspired by Requests for Python.
[14] Fix | Delete
*
[15] Fix | Delete
* Based on concepts from SimplePie_File, RequestCore and WP_Http.
[16] Fix | Delete
*
[17] Fix | Delete
* @package Requests
[18] Fix | Delete
*/
[19] Fix | Delete
class Requests {
[20] Fix | Delete
/**
[21] Fix | Delete
* POST method
[22] Fix | Delete
*
[23] Fix | Delete
* @var string
[24] Fix | Delete
*/
[25] Fix | Delete
const POST = 'POST';
[26] Fix | Delete
[27] Fix | Delete
/**
[28] Fix | Delete
* PUT method
[29] Fix | Delete
*
[30] Fix | Delete
* @var string
[31] Fix | Delete
*/
[32] Fix | Delete
const PUT = 'PUT';
[33] Fix | Delete
[34] Fix | Delete
/**
[35] Fix | Delete
* GET method
[36] Fix | Delete
*
[37] Fix | Delete
* @var string
[38] Fix | Delete
*/
[39] Fix | Delete
const GET = 'GET';
[40] Fix | Delete
[41] Fix | Delete
/**
[42] Fix | Delete
* HEAD method
[43] Fix | Delete
*
[44] Fix | Delete
* @var string
[45] Fix | Delete
*/
[46] Fix | Delete
const HEAD = 'HEAD';
[47] Fix | Delete
[48] Fix | Delete
/**
[49] Fix | Delete
* DELETE method
[50] Fix | Delete
*
[51] Fix | Delete
* @var string
[52] Fix | Delete
*/
[53] Fix | Delete
const DELETE = 'DELETE';
[54] Fix | Delete
[55] Fix | Delete
/**
[56] Fix | Delete
* OPTIONS method
[57] Fix | Delete
*
[58] Fix | Delete
* @var string
[59] Fix | Delete
*/
[60] Fix | Delete
const OPTIONS = 'OPTIONS';
[61] Fix | Delete
[62] Fix | Delete
/**
[63] Fix | Delete
* TRACE method
[64] Fix | Delete
*
[65] Fix | Delete
* @var string
[66] Fix | Delete
*/
[67] Fix | Delete
const TRACE = 'TRACE';
[68] Fix | Delete
[69] Fix | Delete
/**
[70] Fix | Delete
* PATCH method
[71] Fix | Delete
*
[72] Fix | Delete
* @link https://tools.ietf.org/html/rfc5789
[73] Fix | Delete
* @var string
[74] Fix | Delete
*/
[75] Fix | Delete
const PATCH = 'PATCH';
[76] Fix | Delete
[77] Fix | Delete
/**
[78] Fix | Delete
* Default size of buffer size to read streams
[79] Fix | Delete
*
[80] Fix | Delete
* @var integer
[81] Fix | Delete
*/
[82] Fix | Delete
const BUFFER_SIZE = 1160;
[83] Fix | Delete
[84] Fix | Delete
/**
[85] Fix | Delete
* Current version of Requests
[86] Fix | Delete
*
[87] Fix | Delete
* @var string
[88] Fix | Delete
*/
[89] Fix | Delete
const VERSION = '1.7-3470169';
[90] Fix | Delete
[91] Fix | Delete
/**
[92] Fix | Delete
* Registered transport classes
[93] Fix | Delete
*
[94] Fix | Delete
* @var array
[95] Fix | Delete
*/
[96] Fix | Delete
protected static $transports = array();
[97] Fix | Delete
[98] Fix | Delete
/**
[99] Fix | Delete
* Selected transport name
[100] Fix | Delete
*
[101] Fix | Delete
* Use {@see get_transport()} instead
[102] Fix | Delete
*
[103] Fix | Delete
* @var array
[104] Fix | Delete
*/
[105] Fix | Delete
public static $transport = array();
[106] Fix | Delete
[107] Fix | Delete
/**
[108] Fix | Delete
* Default certificate path.
[109] Fix | Delete
*
[110] Fix | Delete
* @see Requests::get_certificate_path()
[111] Fix | Delete
* @see Requests::set_certificate_path()
[112] Fix | Delete
*
[113] Fix | Delete
* @var string
[114] Fix | Delete
*/
[115] Fix | Delete
protected static $certificate_path;
[116] Fix | Delete
[117] Fix | Delete
/**
[118] Fix | Delete
* This is a static class, do not instantiate it
[119] Fix | Delete
*
[120] Fix | Delete
* @codeCoverageIgnore
[121] Fix | Delete
*/
[122] Fix | Delete
private function __construct() {}
[123] Fix | Delete
[124] Fix | Delete
/**
[125] Fix | Delete
* Autoloader for Requests
[126] Fix | Delete
*
[127] Fix | Delete
* Register this with {@see register_autoloader()} if you'd like to avoid
[128] Fix | Delete
* having to create your own.
[129] Fix | Delete
*
[130] Fix | Delete
* (You can also use `spl_autoload_register` directly if you'd prefer.)
[131] Fix | Delete
*
[132] Fix | Delete
* @codeCoverageIgnore
[133] Fix | Delete
*
[134] Fix | Delete
* @param string $class Class name to load
[135] Fix | Delete
*/
[136] Fix | Delete
public static function autoloader($class) {
[137] Fix | Delete
// Check that the class starts with "Requests"
[138] Fix | Delete
if (strpos($class, 'Requests') !== 0) {
[139] Fix | Delete
return;
[140] Fix | Delete
}
[141] Fix | Delete
[142] Fix | Delete
$file = str_replace('_', '/', $class);
[143] Fix | Delete
if (file_exists(dirname(__FILE__) . '/' . $file . '.php')) {
[144] Fix | Delete
require_once(dirname(__FILE__) . '/' . $file . '.php');
[145] Fix | Delete
}
[146] Fix | Delete
}
[147] Fix | Delete
[148] Fix | Delete
/**
[149] Fix | Delete
* Register the built-in autoloader
[150] Fix | Delete
*
[151] Fix | Delete
* @codeCoverageIgnore
[152] Fix | Delete
*/
[153] Fix | Delete
public static function register_autoloader() {
[154] Fix | Delete
spl_autoload_register(array('Requests', 'autoloader'));
[155] Fix | Delete
}
[156] Fix | Delete
[157] Fix | Delete
/**
[158] Fix | Delete
* Register a transport
[159] Fix | Delete
*
[160] Fix | Delete
* @param string $transport Transport class to add, must support the Requests_Transport interface
[161] Fix | Delete
*/
[162] Fix | Delete
public static function add_transport($transport) {
[163] Fix | Delete
if (empty(self::$transports)) {
[164] Fix | Delete
self::$transports = array(
[165] Fix | Delete
'Requests_Transport_cURL',
[166] Fix | Delete
'Requests_Transport_fsockopen',
[167] Fix | Delete
);
[168] Fix | Delete
}
[169] Fix | Delete
[170] Fix | Delete
self::$transports = array_merge(self::$transports, array($transport));
[171] Fix | Delete
}
[172] Fix | Delete
[173] Fix | Delete
/**
[174] Fix | Delete
* Get a working transport
[175] Fix | Delete
*
[176] Fix | Delete
* @throws Requests_Exception If no valid transport is found (`notransport`)
[177] Fix | Delete
* @return Requests_Transport
[178] Fix | Delete
*/
[179] Fix | Delete
protected static function get_transport($capabilities = array()) {
[180] Fix | Delete
// Caching code, don't bother testing coverage
[181] Fix | Delete
// @codeCoverageIgnoreStart
[182] Fix | Delete
// array of capabilities as a string to be used as an array key
[183] Fix | Delete
ksort($capabilities);
[184] Fix | Delete
$cap_string = serialize($capabilities);
[185] Fix | Delete
[186] Fix | Delete
// Don't search for a transport if it's already been done for these $capabilities
[187] Fix | Delete
if (isset(self::$transport[$cap_string]) && self::$transport[$cap_string] !== null) {
[188] Fix | Delete
$class = self::$transport[$cap_string];
[189] Fix | Delete
return new $class();
[190] Fix | Delete
}
[191] Fix | Delete
// @codeCoverageIgnoreEnd
[192] Fix | Delete
[193] Fix | Delete
if (empty(self::$transports)) {
[194] Fix | Delete
self::$transports = array(
[195] Fix | Delete
'Requests_Transport_cURL',
[196] Fix | Delete
'Requests_Transport_fsockopen',
[197] Fix | Delete
);
[198] Fix | Delete
}
[199] Fix | Delete
[200] Fix | Delete
// Find us a working transport
[201] Fix | Delete
foreach (self::$transports as $class) {
[202] Fix | Delete
if (!class_exists($class)) {
[203] Fix | Delete
continue;
[204] Fix | Delete
}
[205] Fix | Delete
[206] Fix | Delete
$result = call_user_func(array($class, 'test'), $capabilities);
[207] Fix | Delete
if ($result) {
[208] Fix | Delete
self::$transport[$cap_string] = $class;
[209] Fix | Delete
break;
[210] Fix | Delete
}
[211] Fix | Delete
}
[212] Fix | Delete
if (self::$transport[$cap_string] === null) {
[213] Fix | Delete
throw new Requests_Exception('No working transports found', 'notransport', self::$transports);
[214] Fix | Delete
}
[215] Fix | Delete
[216] Fix | Delete
$class = self::$transport[$cap_string];
[217] Fix | Delete
return new $class();
[218] Fix | Delete
}
[219] Fix | Delete
[220] Fix | Delete
/**#@+
[221] Fix | Delete
* @see request()
[222] Fix | Delete
* @param string $url
[223] Fix | Delete
* @param array $headers
[224] Fix | Delete
* @param array $options
[225] Fix | Delete
* @return Requests_Response
[226] Fix | Delete
*/
[227] Fix | Delete
/**
[228] Fix | Delete
* Send a GET request
[229] Fix | Delete
*/
[230] Fix | Delete
public static function get($url, $headers = array(), $options = array()) {
[231] Fix | Delete
return self::request($url, $headers, null, self::GET, $options);
[232] Fix | Delete
}
[233] Fix | Delete
[234] Fix | Delete
/**
[235] Fix | Delete
* Send a HEAD request
[236] Fix | Delete
*/
[237] Fix | Delete
public static function head($url, $headers = array(), $options = array()) {
[238] Fix | Delete
return self::request($url, $headers, null, self::HEAD, $options);
[239] Fix | Delete
}
[240] Fix | Delete
[241] Fix | Delete
/**
[242] Fix | Delete
* Send a DELETE request
[243] Fix | Delete
*/
[244] Fix | Delete
public static function delete($url, $headers = array(), $options = array()) {
[245] Fix | Delete
return self::request($url, $headers, null, self::DELETE, $options);
[246] Fix | Delete
}
[247] Fix | Delete
[248] Fix | Delete
/**
[249] Fix | Delete
* Send a TRACE request
[250] Fix | Delete
*/
[251] Fix | Delete
public static function trace($url, $headers = array(), $options = array()) {
[252] Fix | Delete
return self::request($url, $headers, null, self::TRACE, $options);
[253] Fix | Delete
}
[254] Fix | Delete
/**#@-*/
[255] Fix | Delete
[256] Fix | Delete
/**#@+
[257] Fix | Delete
* @see request()
[258] Fix | Delete
* @param string $url
[259] Fix | Delete
* @param array $headers
[260] Fix | Delete
* @param array $data
[261] Fix | Delete
* @param array $options
[262] Fix | Delete
* @return Requests_Response
[263] Fix | Delete
*/
[264] Fix | Delete
/**
[265] Fix | Delete
* Send a POST request
[266] Fix | Delete
*/
[267] Fix | Delete
public static function post($url, $headers = array(), $data = array(), $options = array()) {
[268] Fix | Delete
return self::request($url, $headers, $data, self::POST, $options);
[269] Fix | Delete
}
[270] Fix | Delete
/**
[271] Fix | Delete
* Send a PUT request
[272] Fix | Delete
*/
[273] Fix | Delete
public static function put($url, $headers = array(), $data = array(), $options = array()) {
[274] Fix | Delete
return self::request($url, $headers, $data, self::PUT, $options);
[275] Fix | Delete
}
[276] Fix | Delete
[277] Fix | Delete
/**
[278] Fix | Delete
* Send an OPTIONS request
[279] Fix | Delete
*/
[280] Fix | Delete
public static function options($url, $headers = array(), $data = array(), $options = array()) {
[281] Fix | Delete
return self::request($url, $headers, $data, self::OPTIONS, $options);
[282] Fix | Delete
}
[283] Fix | Delete
[284] Fix | Delete
/**
[285] Fix | Delete
* Send a PATCH request
[286] Fix | Delete
*
[287] Fix | Delete
* Note: Unlike {@see post} and {@see put}, `$headers` is required, as the
[288] Fix | Delete
* specification recommends that should send an ETag
[289] Fix | Delete
*
[290] Fix | Delete
* @link https://tools.ietf.org/html/rfc5789
[291] Fix | Delete
*/
[292] Fix | Delete
public static function patch($url, $headers, $data = array(), $options = array()) {
[293] Fix | Delete
return self::request($url, $headers, $data, self::PATCH, $options);
[294] Fix | Delete
}
[295] Fix | Delete
/**#@-*/
[296] Fix | Delete
[297] Fix | Delete
/**
[298] Fix | Delete
* Main interface for HTTP requests
[299] Fix | Delete
*
[300] Fix | Delete
* This method initiates a request and sends it via a transport before
[301] Fix | Delete
* parsing.
[302] Fix | Delete
*
[303] Fix | Delete
* The `$options` parameter takes an associative array with the following
[304] Fix | Delete
* options:
[305] Fix | Delete
*
[306] Fix | Delete
* - `timeout`: How long should we wait for a response?
[307] Fix | Delete
* Note: for cURL, a minimum of 1 second applies, as DNS resolution
[308] Fix | Delete
* operates at second-resolution only.
[309] Fix | Delete
* (float, seconds with a millisecond precision, default: 10, example: 0.01)
[310] Fix | Delete
* - `connect_timeout`: How long should we wait while trying to connect?
[311] Fix | Delete
* (float, seconds with a millisecond precision, default: 10, example: 0.01)
[312] Fix | Delete
* - `useragent`: Useragent to send to the server
[313] Fix | Delete
* (string, default: php-requests/$version)
[314] Fix | Delete
* - `follow_redirects`: Should we follow 3xx redirects?
[315] Fix | Delete
* (boolean, default: true)
[316] Fix | Delete
* - `redirects`: How many times should we redirect before erroring?
[317] Fix | Delete
* (integer, default: 10)
[318] Fix | Delete
* - `blocking`: Should we block processing on this request?
[319] Fix | Delete
* (boolean, default: true)
[320] Fix | Delete
* - `filename`: File to stream the body to instead.
[321] Fix | Delete
* (string|boolean, default: false)
[322] Fix | Delete
* - `auth`: Authentication handler or array of user/password details to use
[323] Fix | Delete
* for Basic authentication
[324] Fix | Delete
* (Requests_Auth|array|boolean, default: false)
[325] Fix | Delete
* - `proxy`: Proxy details to use for proxy by-passing and authentication
[326] Fix | Delete
* (Requests_Proxy|array|string|boolean, default: false)
[327] Fix | Delete
* - `max_bytes`: Limit for the response body size.
[328] Fix | Delete
* (integer|boolean, default: false)
[329] Fix | Delete
* - `idn`: Enable IDN parsing
[330] Fix | Delete
* (boolean, default: true)
[331] Fix | Delete
* - `transport`: Custom transport. Either a class name, or a
[332] Fix | Delete
* transport object. Defaults to the first working transport from
[333] Fix | Delete
* {@see getTransport()}
[334] Fix | Delete
* (string|Requests_Transport, default: {@see getTransport()})
[335] Fix | Delete
* - `hooks`: Hooks handler.
[336] Fix | Delete
* (Requests_Hooker, default: new Requests_Hooks())
[337] Fix | Delete
* - `verify`: Should we verify SSL certificates? Allows passing in a custom
[338] Fix | Delete
* certificate file as a string. (Using true uses the system-wide root
[339] Fix | Delete
* certificate store instead, but this may have different behaviour
[340] Fix | Delete
* across transports.)
[341] Fix | Delete
* (string|boolean, default: library/Requests/Transport/cacert.pem)
[342] Fix | Delete
* - `verifyname`: Should we verify the common name in the SSL certificate?
[343] Fix | Delete
* (boolean: default, true)
[344] Fix | Delete
* - `data_format`: How should we send the `$data` parameter?
[345] Fix | Delete
* (string, one of 'query' or 'body', default: 'query' for
[346] Fix | Delete
* HEAD/GET/DELETE, 'body' for POST/PUT/OPTIONS/PATCH)
[347] Fix | Delete
*
[348] Fix | Delete
* @throws Requests_Exception On invalid URLs (`nonhttp`)
[349] Fix | Delete
*
[350] Fix | Delete
* @param string $url URL to request
[351] Fix | Delete
* @param array $headers Extra headers to send with the request
[352] Fix | Delete
* @param array|null $data Data to send either as a query string for GET/HEAD requests, or in the body for POST requests
[353] Fix | Delete
* @param string $type HTTP request type (use Requests constants)
[354] Fix | Delete
* @param array $options Options for the request (see description for more information)
[355] Fix | Delete
* @return Requests_Response
[356] Fix | Delete
*/
[357] Fix | Delete
public static function request($url, $headers = array(), $data = array(), $type = self::GET, $options = array()) {
[358] Fix | Delete
if (empty($options['type'])) {
[359] Fix | Delete
$options['type'] = $type;
[360] Fix | Delete
}
[361] Fix | Delete
$options = array_merge(self::get_default_options(), $options);
[362] Fix | Delete
[363] Fix | Delete
self::set_defaults($url, $headers, $data, $type, $options);
[364] Fix | Delete
[365] Fix | Delete
$options['hooks']->dispatch('requests.before_request', array(&$url, &$headers, &$data, &$type, &$options));
[366] Fix | Delete
[367] Fix | Delete
if (!empty($options['transport'])) {
[368] Fix | Delete
$transport = $options['transport'];
[369] Fix | Delete
[370] Fix | Delete
if (is_string($options['transport'])) {
[371] Fix | Delete
$transport = new $transport();
[372] Fix | Delete
}
[373] Fix | Delete
}
[374] Fix | Delete
else {
[375] Fix | Delete
$need_ssl = (0 === stripos($url, 'https://'));
[376] Fix | Delete
$capabilities = array('ssl' => $need_ssl);
[377] Fix | Delete
$transport = self::get_transport($capabilities);
[378] Fix | Delete
}
[379] Fix | Delete
$response = $transport->request($url, $headers, $data, $options);
[380] Fix | Delete
[381] Fix | Delete
$options['hooks']->dispatch('requests.before_parse', array(&$response, $url, $headers, $data, $type, $options));
[382] Fix | Delete
[383] Fix | Delete
return self::parse_response($response, $url, $headers, $data, $options);
[384] Fix | Delete
}
[385] Fix | Delete
[386] Fix | Delete
/**
[387] Fix | Delete
* Send multiple HTTP requests simultaneously
[388] Fix | Delete
*
[389] Fix | Delete
* The `$requests` parameter takes an associative or indexed array of
[390] Fix | Delete
* request fields. The key of each request can be used to match up the
[391] Fix | Delete
* request with the returned data, or with the request passed into your
[392] Fix | Delete
* `multiple.request.complete` callback.
[393] Fix | Delete
*
[394] Fix | Delete
* The request fields value is an associative array with the following keys:
[395] Fix | Delete
*
[396] Fix | Delete
* - `url`: Request URL Same as the `$url` parameter to
[397] Fix | Delete
* {@see Requests::request}
[398] Fix | Delete
* (string, required)
[399] Fix | Delete
* - `headers`: Associative array of header fields. Same as the `$headers`
[400] Fix | Delete
* parameter to {@see Requests::request}
[401] Fix | Delete
* (array, default: `array()`)
[402] Fix | Delete
* - `data`: Associative array of data fields or a string. Same as the
[403] Fix | Delete
* `$data` parameter to {@see Requests::request}
[404] Fix | Delete
* (array|string, default: `array()`)
[405] Fix | Delete
* - `type`: HTTP request type (use Requests constants). Same as the `$type`
[406] Fix | Delete
* parameter to {@see Requests::request}
[407] Fix | Delete
* (string, default: `Requests::GET`)
[408] Fix | Delete
* - `cookies`: Associative array of cookie name to value, or cookie jar.
[409] Fix | Delete
* (array|Requests_Cookie_Jar)
[410] Fix | Delete
*
[411] Fix | Delete
* If the `$options` parameter is specified, individual requests will
[412] Fix | Delete
* inherit options from it. This can be used to use a single hooking system,
[413] Fix | Delete
* or set all the types to `Requests::POST`, for example.
[414] Fix | Delete
*
[415] Fix | Delete
* In addition, the `$options` parameter takes the following global options:
[416] Fix | Delete
*
[417] Fix | Delete
* - `complete`: A callback for when a request is complete. Takes two
[418] Fix | Delete
* parameters, a Requests_Response/Requests_Exception reference, and the
[419] Fix | Delete
* ID from the request array (Note: this can also be overridden on a
[420] Fix | Delete
* per-request basis, although that's a little silly)
[421] Fix | Delete
* (callback)
[422] Fix | Delete
*
[423] Fix | Delete
* @param array $requests Requests data (see description for more information)
[424] Fix | Delete
* @param array $options Global and default options (see {@see Requests::request})
[425] Fix | Delete
* @return array Responses (either Requests_Response or a Requests_Exception object)
[426] Fix | Delete
*/
[427] Fix | Delete
public static function request_multiple($requests, $options = array()) {
[428] Fix | Delete
$options = array_merge(self::get_default_options(true), $options);
[429] Fix | Delete
[430] Fix | Delete
if (!empty($options['hooks'])) {
[431] Fix | Delete
$options['hooks']->register('transport.internal.parse_response', array('Requests', 'parse_multiple'));
[432] Fix | Delete
if (!empty($options['complete'])) {
[433] Fix | Delete
$options['hooks']->register('multiple.request.complete', $options['complete']);
[434] Fix | Delete
}
[435] Fix | Delete
}
[436] Fix | Delete
[437] Fix | Delete
foreach ($requests as $id => &$request) {
[438] Fix | Delete
if (!isset($request['headers'])) {
[439] Fix | Delete
$request['headers'] = array();
[440] Fix | Delete
}
[441] Fix | Delete
if (!isset($request['data'])) {
[442] Fix | Delete
$request['data'] = array();
[443] Fix | Delete
}
[444] Fix | Delete
if (!isset($request['type'])) {
[445] Fix | Delete
$request['type'] = self::GET;
[446] Fix | Delete
}
[447] Fix | Delete
if (!isset($request['options'])) {
[448] Fix | Delete
$request['options'] = $options;
[449] Fix | Delete
$request['options']['type'] = $request['type'];
[450] Fix | Delete
}
[451] Fix | Delete
else {
[452] Fix | Delete
if (empty($request['options']['type'])) {
[453] Fix | Delete
$request['options']['type'] = $request['type'];
[454] Fix | Delete
}
[455] Fix | Delete
$request['options'] = array_merge($options, $request['options']);
[456] Fix | Delete
}
[457] Fix | Delete
[458] Fix | Delete
self::set_defaults($request['url'], $request['headers'], $request['data'], $request['type'], $request['options']);
[459] Fix | Delete
[460] Fix | Delete
// Ensure we only hook in once
[461] Fix | Delete
if ($request['options']['hooks'] !== $options['hooks']) {
[462] Fix | Delete
$request['options']['hooks']->register('transport.internal.parse_response', array('Requests', 'parse_multiple'));
[463] Fix | Delete
if (!empty($request['options']['complete'])) {
[464] Fix | Delete
$request['options']['hooks']->register('multiple.request.complete', $request['options']['complete']);
[465] Fix | Delete
}
[466] Fix | Delete
}
[467] Fix | Delete
}
[468] Fix | Delete
unset($request);
[469] Fix | Delete
[470] Fix | Delete
if (!empty($options['transport'])) {
[471] Fix | Delete
$transport = $options['transport'];
[472] Fix | Delete
[473] Fix | Delete
if (is_string($options['transport'])) {
[474] Fix | Delete
$transport = new $transport();
[475] Fix | Delete
}
[476] Fix | Delete
}
[477] Fix | Delete
else {
[478] Fix | Delete
$transport = self::get_transport();
[479] Fix | Delete
}
[480] Fix | Delete
$responses = $transport->request_multiple($requests, $options);
[481] Fix | Delete
[482] Fix | Delete
foreach ($responses as $id => &$response) {
[483] Fix | Delete
// If our hook got messed with somehow, ensure we end up with the
[484] Fix | Delete
// correct response
[485] Fix | Delete
if (is_string($response)) {
[486] Fix | Delete
$request = $requests[$id];
[487] Fix | Delete
self::parse_multiple($response, $request);
[488] Fix | Delete
$request['options']['hooks']->dispatch('multiple.request.complete', array(&$response, $id));
[489] Fix | Delete
}
[490] Fix | Delete
}
[491] Fix | Delete
[492] Fix | Delete
return $responses;
[493] Fix | Delete
}
[494] Fix | Delete
[495] Fix | Delete
/**
[496] Fix | Delete
* Get the default options
[497] Fix | Delete
*
[498] Fix | Delete
* @see Requests::request() for values returned by this method
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function