wp/wp-includes/Requests/Cookie/Jar.php
changeset 18 be944660c56a
parent 7 cf61fcea0001
equal deleted inserted replaced
17:34716fd837a4 18:be944660c56a
    66 
    66 
    67 	/**
    67 	/**
    68 	 * Get the value for the item
    68 	 * Get the value for the item
    69 	 *
    69 	 *
    70 	 * @param string $key Item key
    70 	 * @param string $key Item key
    71 	 * @return string Item value
    71 	 * @return string|null Item value (null if offsetExists is false)
    72 	 */
    72 	 */
    73 	public function offsetGet($key) {
    73 	public function offsetGet($key) {
    74 		if (!isset($this->cookies[$key])) {
    74 		if (!isset($this->cookies[$key])) {
    75 			return null;
    75 			return null;
    76 		}
    76 		}
   160 	/**
   160 	/**
   161 	 * Parse all cookies from a response and attach them to the response
   161 	 * Parse all cookies from a response and attach them to the response
   162 	 *
   162 	 *
   163 	 * @var Requests_Response $response
   163 	 * @var Requests_Response $response
   164 	 */
   164 	 */
   165 	public function before_redirect_check(Requests_Response &$return) {
   165 	public function before_redirect_check(Requests_Response $return) {
   166 		$url = $return->url;
   166 		$url = $return->url;
   167 		if (!$url instanceof Requests_IRI) {
   167 		if (!$url instanceof Requests_IRI) {
   168 			$url = new Requests_IRI($url);
   168 			$url = new Requests_IRI($url);
   169 		}
   169 		}
   170 
   170 
   171 		$cookies = Requests_Cookie::parse_from_headers($return->headers, $url);
   171 		$cookies         = Requests_Cookie::parse_from_headers($return->headers, $url);
   172 		$this->cookies = array_merge($this->cookies, $cookies);
   172 		$this->cookies   = array_merge($this->cookies, $cookies);
   173 		$return->cookies = $this;
   173 		$return->cookies = $this;
   174 	}
   174 	}
   175 }
   175 }