WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

Requests_Cookie::parse_from_headers() WP 1.0

Parse all Set-Cookie headers from request headers

Это метод класса: Requests_Cookie

Хуков нет.

Возвращает

Массив.

Использование

$var = Requests_Cookie::parse_from_headers( $headers, $origin, $time );
$headers(Requests_Response_Headers) (обязательный)
Headers to parse from
$origin(Requests_IRI)
URI for comparing cookie origins
По умолчанию: null
$time(число/null)
Reference time for expiration calculation
По умолчанию: null

Код Requests Cookie::parse from headers: wp-includes/Requests/Cookie.php WP 5.2.2

<?php
public static function parse_from_headers(Requests_Response_Headers $headers, Requests_IRI $origin = null, $time = null) {
	$cookie_headers = $headers->getValues('Set-Cookie');
	if (empty($cookie_headers)) {
		return array();
	}

	$cookies = array();
	foreach ($cookie_headers as $header) {
		$parsed = self::parse($header, '', $time);

		// Default domain/path attributes
		if (empty($parsed->attributes['domain']) && !empty($origin)) {
			$parsed->attributes['domain'] = $origin->host;
			$parsed->flags['host-only'] = true;
		}
		else {
			$parsed->flags['host-only'] = false;
		}

		$path_is_valid = (!empty($parsed->attributes['path']) && $parsed->attributes['path'][0] === '/');
		if (!$path_is_valid && !empty($origin)) {
			$path = $origin->path;

			// Default path normalization as per RFC 6265 section 5.1.4
			if (substr($path, 0, 1) !== '/') {
				// If the uri-path is empty or if the first character of
				// the uri-path is not a %x2F ("/") character, output
				// %x2F ("/") and skip the remaining steps.
				$path = '/';
			}
			elseif (substr_count($path, '/') === 1) {
				// If the uri-path contains no more than one %x2F ("/")
				// character, output %x2F ("/") and skip the remaining
				// step.
				$path = '/';
			}
			else {
				// Output the characters of the uri-path from the first
				// character up to, but not including, the right-most
				// %x2F ("/").
				$path = substr($path, 0, strrpos($path, '/'));
			}
			$parsed->attributes['path'] = $path;
		}

		// Reject invalid cookie domains
		if (!empty($origin) && !$parsed->domain_matches($origin->host)) {
			continue;
		}

		$cookies[$parsed->name] = $parsed;
	}

	return $cookies;
}