| @@ -3,9 +3,9 @@ | ||
| 3 | 3 | * File: A compiled file for RSS syndication |
| 4 | 4 | * Author: Kellan Elliot-McCrea <kellan@protest.net> |
| 5 | 5 | * WordPress development team <http://www.wordpress.org/> |
| 6 | 6 | * Charles Johnson <technophilia@radgeek.com> |
| 7 | - * Version: 2009.0613 | |
| 7 | + * Version: 0.85wp (2007.11.21) | |
| 8 | 8 | * License: GPL |
| 9 | 9 | * |
| 10 | 10 | * Provenance: |
| 11 | 11 | * |
| @@ -1175,11 +1175,9 @@ | ||
| 1175 | 1175 | ################################################################################ |
| 1176 | 1176 | ## WordPress: Load in Snoopy from wp-includes ################################## |
| 1177 | 1177 | ################################################################################ |
| 1178 | 1178 | |
| 1179 | -if (!function_exists('wp_remote_request')) : | |
| 1180 | - require_once( dirname(__FILE__) . '/class-snoopy.php'); | |
| 1181 | -endif; | |
| 1179 | +require_once( dirname(__FILE__) . '/class-snoopy.php'); | |
| 1182 | 1180 | |
| 1183 | 1181 | ################################################################################ |
| 1184 | 1182 | ## rss_fetch.inc: from MagpieRSS 0.8a ########################################## |
| 1185 | 1183 | ################################################################################ |
| @@ -1203,9 +1201,9 @@ | ||
| 1203 | 1201 | If there is an HTTP error while fetching an RSS object, the cached |
| 1204 | 1202 | version will be return, if it exists (and if MAGPIE_CACHE_FRESH_ONLY is off) |
| 1205 | 1203 | \*=======================================================================*/ |
| 1206 | 1204 | |
| 1207 | -define('MAGPIE_VERSION', '2009.0613'); | |
| 1205 | +define('MAGPIE_VERSION', '0.85'); | |
| 1208 | 1206 | |
| 1209 | 1207 | $MAGPIE_ERROR = ""; |
| 1210 | 1208 | |
| 1211 | 1209 | function fetch_rss ($url) { |
| @@ -1275,9 +1273,9 @@ | ||
| 1275 | 1273 | |
| 1276 | 1274 | // setup headers |
| 1277 | 1275 | if ( $cache_status == 'STALE' ) { |
| 1278 | 1276 | $rss = $cache->get( $cache_key ); |
| 1279 | - if ( $rss and isset($rss->etag) and $rss->last_modified ) { | |
| 1277 | + if ( $rss and $rss->etag and $rss->last_modified ) { | |
| 1280 | 1278 | $request_headers['If-None-Match'] = $rss->etag; |
| 1281 | 1279 | $request_headers['If-Last-Modified'] = $rss->last_modified; |
| 1282 | 1280 | } |
| 1283 | 1281 | } |
| @@ -1391,42 +1389,20 @@ | ||
| 1391 | 1389 | headers to send along with the request (optional) |
| 1392 | 1390 | Output: an HTTP response object (see Snoopy.class.inc) |
| 1393 | 1391 | \*=======================================================================*/ |
| 1394 | 1392 | function _fetch_remote_file ($url, $headers = "" ) { |
| 1395 | - // WordPress 2.7 has deprecated Snoopy. It's still there, for now, but | |
| 1396 | - // I'd rather not rely on it. | |
| 1397 | - if (function_exists('wp_remote_request')) : | |
| 1398 | - $resp = wp_remote_request($url, array( | |
| 1399 | - 'headers' => $headers, | |
| 1400 | - 'timeout' => MAGPIE_FETCH_TIME_OUT) | |
| 1401 | - ); | |
| 1393 | + // Snoopy is an HTTP client in PHP | |
| 1394 | + $client = new Snoopy(); | |
| 1395 | + $client->agent = MAGPIE_USER_AGENT; | |
| 1396 | + $client->read_timeout = MAGPIE_FETCH_TIME_OUT; | |
| 1397 | + $client->use_gzip = MAGPIE_USE_GZIP; | |
| 1398 | + if (is_array($headers) ) { | |
| 1399 | + $client->rawheaders = $headers; | |
| 1400 | + } | |
| 1401 | + | |
| 1402 | + @$client->fetch($url); | |
| 1403 | + return $client; | |
| 1402 | 1404 | |
| 1403 | - if ( is_wp_error($resp) ) : | |
| 1404 | - $error = $resp->get_error_messages(); | |
| 1405 | - | |
| 1406 | - $client = new stdClass; | |
| 1407 | - $client->status = 500; | |
| 1408 | - $client->response_code = 500; | |
| 1409 | - $client->error = implode(" / ", $error). "\n"; //\n = Snoopy compatibility | |
| 1410 | - else : | |
| 1411 | - $client = new stdClass; | |
| 1412 | - $client->status = $resp['response']['code']; | |
| 1413 | - $client->response_code = $resp['response']['code']; | |
| 1414 | - $client->headers = $resp['headers']; | |
| 1415 | - $client->results = $resp['body']; | |
| 1416 | - endif; | |
| 1417 | - else : | |
| 1418 | - // Snoopy is an HTTP client in PHP | |
| 1419 | - $client = new Snoopy(); | |
| 1420 | - $client->agent = MAGPIE_USER_AGENT; | |
| 1421 | - $client->read_timeout = MAGPIE_FETCH_TIME_OUT; | |
| 1422 | - $client->use_gzip = MAGPIE_USE_GZIP; | |
| 1423 | - if (is_array($headers) ) { | |
| 1424 | - $client->rawheaders = $headers; | |
| 1425 | - } | |
| 1426 | - @$client->fetch($url); | |
| 1427 | - endif; | |
| 1428 | - return $client; | |
| 1429 | 1405 | } |
| 1430 | 1406 | |
| 1431 | 1407 | /*=======================================================================*\ |
| 1432 | 1408 | Function: _response_to_rss |