Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/clone/wp-inclu.../Requests/src/Transpor...
File: Curl.php
*
[500] Fix | Delete
* @param resource|\CurlHandle $handle cURL handle
[501] Fix | Delete
* @param string $headers Header string
[502] Fix | Delete
* @return integer Length of provided header
[503] Fix | Delete
*/
[504] Fix | Delete
public function stream_headers($handle, $headers) {
[505] Fix | Delete
// Why do we do this? cURL will send both the final response and any
[506] Fix | Delete
// interim responses, such as a 100 Continue. We don't need that.
[507] Fix | Delete
// (We may want to keep this somewhere just in case)
[508] Fix | Delete
if ($this->done_headers) {
[509] Fix | Delete
$this->headers = '';
[510] Fix | Delete
$this->done_headers = false;
[511] Fix | Delete
}
[512] Fix | Delete
[513] Fix | Delete
$this->headers .= $headers;
[514] Fix | Delete
[515] Fix | Delete
if ($headers === "\r\n") {
[516] Fix | Delete
$this->done_headers = true;
[517] Fix | Delete
}
[518] Fix | Delete
[519] Fix | Delete
return strlen($headers);
[520] Fix | Delete
}
[521] Fix | Delete
[522] Fix | Delete
/**
[523] Fix | Delete
* Collect data as it's received
[524] Fix | Delete
*
[525] Fix | Delete
* @since 1.6.1
[526] Fix | Delete
*
[527] Fix | Delete
* @param resource|\CurlHandle $handle cURL handle
[528] Fix | Delete
* @param string $data Body data
[529] Fix | Delete
* @return integer Length of provided data
[530] Fix | Delete
*/
[531] Fix | Delete
public function stream_body($handle, $data) {
[532] Fix | Delete
$this->hooks->dispatch('request.progress', [$data, $this->response_bytes, $this->response_byte_limit]);
[533] Fix | Delete
$data_length = strlen($data);
[534] Fix | Delete
[535] Fix | Delete
// Are we limiting the response size?
[536] Fix | Delete
if ($this->response_byte_limit) {
[537] Fix | Delete
if ($this->response_bytes === $this->response_byte_limit) {
[538] Fix | Delete
// Already at maximum, move on
[539] Fix | Delete
return $data_length;
[540] Fix | Delete
}
[541] Fix | Delete
[542] Fix | Delete
if (($this->response_bytes + $data_length) > $this->response_byte_limit) {
[543] Fix | Delete
// Limit the length
[544] Fix | Delete
$limited_length = ($this->response_byte_limit - $this->response_bytes);
[545] Fix | Delete
$data = substr($data, 0, $limited_length);
[546] Fix | Delete
}
[547] Fix | Delete
}
[548] Fix | Delete
[549] Fix | Delete
if ($this->stream_handle) {
[550] Fix | Delete
fwrite($this->stream_handle, $data);
[551] Fix | Delete
} else {
[552] Fix | Delete
$this->response_data .= $data;
[553] Fix | Delete
}
[554] Fix | Delete
[555] Fix | Delete
$this->response_bytes += strlen($data);
[556] Fix | Delete
return $data_length;
[557] Fix | Delete
}
[558] Fix | Delete
[559] Fix | Delete
/**
[560] Fix | Delete
* Format a URL given GET data
[561] Fix | Delete
*
[562] Fix | Delete
* @param string $url Original URL.
[563] Fix | Delete
* @param array|object $data Data to build query using, see {@link https://www.php.net/http_build_query}
[564] Fix | Delete
* @return string URL with data
[565] Fix | Delete
*/
[566] Fix | Delete
private static function format_get($url, $data) {
[567] Fix | Delete
if (!empty($data)) {
[568] Fix | Delete
$query = '';
[569] Fix | Delete
$url_parts = parse_url($url);
[570] Fix | Delete
if (empty($url_parts['query'])) {
[571] Fix | Delete
$url_parts['query'] = '';
[572] Fix | Delete
} else {
[573] Fix | Delete
$query = $url_parts['query'];
[574] Fix | Delete
}
[575] Fix | Delete
[576] Fix | Delete
$query .= '&' . http_build_query($data, '', '&');
[577] Fix | Delete
$query = trim($query, '&');
[578] Fix | Delete
[579] Fix | Delete
if (empty($url_parts['query'])) {
[580] Fix | Delete
$url .= '?' . $query;
[581] Fix | Delete
} else {
[582] Fix | Delete
$url = str_replace($url_parts['query'], $query, $url);
[583] Fix | Delete
}
[584] Fix | Delete
}
[585] Fix | Delete
[586] Fix | Delete
return $url;
[587] Fix | Delete
}
[588] Fix | Delete
[589] Fix | Delete
/**
[590] Fix | Delete
* Self-test whether the transport can be used.
[591] Fix | Delete
*
[592] Fix | Delete
* The available capabilities to test for can be found in {@see \WpOrg\Requests\Capability}.
[593] Fix | Delete
*
[594] Fix | Delete
* @codeCoverageIgnore
[595] Fix | Delete
* @param array<string, bool> $capabilities Optional. Associative array of capabilities to test against, i.e. `['<capability>' => true]`.
[596] Fix | Delete
* @return bool Whether the transport can be used.
[597] Fix | Delete
*/
[598] Fix | Delete
public static function test($capabilities = []) {
[599] Fix | Delete
if (!function_exists('curl_init') || !function_exists('curl_exec')) {
[600] Fix | Delete
return false;
[601] Fix | Delete
}
[602] Fix | Delete
[603] Fix | Delete
// If needed, check that our installed curl version supports SSL
[604] Fix | Delete
if (isset($capabilities[Capability::SSL]) && $capabilities[Capability::SSL]) {
[605] Fix | Delete
$curl_version = curl_version();
[606] Fix | Delete
if (!(CURL_VERSION_SSL & $curl_version['features'])) {
[607] Fix | Delete
return false;
[608] Fix | Delete
}
[609] Fix | Delete
}
[610] Fix | Delete
[611] Fix | Delete
return true;
[612] Fix | Delete
}
[613] Fix | Delete
[614] Fix | Delete
/**
[615] Fix | Delete
* Get the correct "Expect" header for the given request data.
[616] Fix | Delete
*
[617] Fix | Delete
* @param string|array $data Data to send either as the POST body, or as parameters in the URL for a GET/HEAD.
[618] Fix | Delete
* @return string The "Expect" header.
[619] Fix | Delete
*/
[620] Fix | Delete
private function get_expect_header($data) {
[621] Fix | Delete
if (!is_array($data)) {
[622] Fix | Delete
return strlen((string) $data) >= 1048576 ? '100-Continue' : '';
[623] Fix | Delete
}
[624] Fix | Delete
[625] Fix | Delete
$bytesize = 0;
[626] Fix | Delete
$iterator = new RecursiveIteratorIterator(new RecursiveArrayIterator($data));
[627] Fix | Delete
[628] Fix | Delete
foreach ($iterator as $datum) {
[629] Fix | Delete
$bytesize += strlen((string) $datum);
[630] Fix | Delete
[631] Fix | Delete
if ($bytesize >= 1048576) {
[632] Fix | Delete
return '100-Continue';
[633] Fix | Delete
}
[634] Fix | Delete
}
[635] Fix | Delete
[636] Fix | Delete
return '';
[637] Fix | Delete
}
[638] Fix | Delete
}
[639] Fix | Delete
[640] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function