| @@ -54,11 +54,11 @@ | ||
| 54 | 54 | // Verify feeds and resolve relative URIs |
| 55 | 55 | foreach ($href as $u) { |
| 56 | 56 | $the_uri = Relative_URI::resolve($u, $this->uri); |
| 57 | 57 | if ($this->verify) { |
| 58 | - $feed = new FeedFinder($the_uri); | |
| 58 | + $feed =& new FeedFinder($the_uri); | |
| 59 | 59 | if ($feed->is_feed()) $ret[] = $the_uri; |
| 60 | - unset($feed); | |
| 60 | + $feed = NULL; | |
| 61 | 61 | } else { |
| 62 | 62 | $ret[] = $the_uri; |
| 63 | 63 | } |
| 64 | 64 | } /* foreach */ |
| @@ -74,10 +74,10 @@ | ||
| 74 | 74 | |
| 75 | 75 | function status ($uri = NULL) { |
| 76 | 76 | $this->_get($uri); |
| 77 | 77 | |
| 78 | - if (!is_wp_error($this->_response) and isset($this->_response['response']['code'])) : | |
| 79 | - $ret = $this->_response['response']['code']; | |
| 78 | + if (isset($this->_response->status)) : | |
| 79 | + $ret = $this->_response->status; | |
| 80 | 80 | else : |
| 81 | 81 | $ret = NULL; |
| 82 | 82 | endif; |
| 83 | 83 | return $ret; |
| @@ -82,18 +82,10 @@ | ||
| 82 | 82 | endif; |
| 83 | 83 | return $ret; |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - function error ($index = NULL) { | |
| 87 | - $message = NULL; | |
| 88 | - if (count($this->_error) > 0) : | |
| 89 | - if (is_scalar($index) and !is_null($index)) : | |
| 90 | - $message = $this->_error[$index]; | |
| 91 | - else : | |
| 92 | - $message = implode(" / ", $this->_error)."\n"; | |
| 93 | - endif; | |
| 94 | - endif; | |
| 95 | - return $message; | |
| 86 | + function error () { | |
| 87 | + return $this->_error; | |
| 96 | 88 | } |
| 97 | 89 | |
| 98 | 90 | function is_feed ($uri = NULL) { |
| 99 | 91 | $data = $this->data($uri); |
| @@ -118,22 +110,17 @@ | ||
| 118 | 110 | $headers['Connection'] = 'close'; |
| 119 | 111 | $headers['Accept'] = 'application/atom+xml application/rdf+xml application/rss+xml application/xml text/html */*'; |
| 120 | 112 | $headers['User-Agent'] = 'feedfinder/1.2 (compatible; PHP FeedFinder) +http://projects.radgeek.com/feedwordpress'; |
| 121 | 113 | |
| 122 | - // Use WordPress API function | |
| 123 | - $client = wp_remote_request($this->uri, array( | |
| 124 | - 'headers' => $headers, | |
| 125 | - 'timeout' => FEEDWORDPRESS_FETCH_TIME_OUT, | |
| 126 | - )); | |
| 127 | - | |
| 128 | - $this->_response = $client; | |
| 129 | - if (is_wp_error($client)) : | |
| 130 | - $this->_data = NULL; | |
| 131 | - $this->_error = $client->get_error_messages(); | |
| 114 | + // Use function provided by MagpieRSS package | |
| 115 | + $client = _fetch_remote_file($this->uri, $headers); | |
| 116 | + if (isset($client->error)) : | |
| 117 | + $this->_error = $client->error; | |
| 132 | 118 | else : |
| 133 | - $this->_data = $client['body']; | |
| 134 | 119 | $this->_error = NULL; |
| 135 | 120 | endif; |
| 121 | + $this->_response = $client; | |
| 122 | + $this->_data = $client->results; | |
| 136 | 123 | |
| 137 | 124 | // Kilroy was here |
| 138 | 125 | $this->_cache_uri = $this->uri; |
| 139 | 126 | endif; |