equal
deleted
inserted
replaced
160 * @return WP_HTTP_Cookie[] List of cookie objects. |
160 * @return WP_HTTP_Cookie[] List of cookie objects. |
161 */ |
161 */ |
162 public function get_cookies() { |
162 public function get_cookies() { |
163 $cookies = array(); |
163 $cookies = array(); |
164 foreach ( $this->response->cookies as $cookie ) { |
164 foreach ( $this->response->cookies as $cookie ) { |
165 $cookies[] = new WP_Http_Cookie( array( |
165 $cookies[] = new WP_Http_Cookie( |
166 'name' => $cookie->name, |
166 array( |
167 'value' => urldecode( $cookie->value ), |
167 'name' => $cookie->name, |
168 'expires' => isset( $cookie->attributes['expires'] ) ? $cookie->attributes['expires'] : null, |
168 'value' => urldecode( $cookie->value ), |
169 'path' => isset( $cookie->attributes['path'] ) ? $cookie->attributes['path'] : null, |
169 'expires' => isset( $cookie->attributes['expires'] ) ? $cookie->attributes['expires'] : null, |
170 'domain' => isset( $cookie->attributes['domain'] ) ? $cookie->attributes['domain'] : null, |
170 'path' => isset( $cookie->attributes['path'] ) ? $cookie->attributes['path'] : null, |
171 )); |
171 'domain' => isset( $cookie->attributes['domain'] ) ? $cookie->attributes['domain'] : null, |
|
172 'host_only' => isset( $cookie->flags['host-only'] ) ? $cookie->flags['host-only'] : null, |
|
173 ) |
|
174 ); |
172 } |
175 } |
173 |
176 |
174 return $cookies; |
177 return $cookies; |
175 } |
178 } |
176 |
179 |
181 * |
184 * |
182 * @return array WP_Http response array, per WP_Http::request(). |
185 * @return array WP_Http response array, per WP_Http::request(). |
183 */ |
186 */ |
184 public function to_array() { |
187 public function to_array() { |
185 return array( |
188 return array( |
186 'headers' => $this->get_headers(), |
189 'headers' => $this->get_headers(), |
187 'body' => $this->get_data(), |
190 'body' => $this->get_data(), |
188 'response' => array( |
191 'response' => array( |
189 'code' => $this->get_status(), |
192 'code' => $this->get_status(), |
190 'message' => get_status_header_desc( $this->get_status() ), |
193 'message' => get_status_header_desc( $this->get_status() ), |
191 ), |
194 ), |
192 'cookies' => $this->get_cookies(), |
195 'cookies' => $this->get_cookies(), |
193 'filename' => $this->filename, |
196 'filename' => $this->filename, |
194 ); |
197 ); |
195 } |
198 } |
196 } |
199 } |