| @@ -5,9 +5,16 @@ | ||
| 5 | 5 | var $url; |
| 6 | 6 | |
| 7 | 7 | function MagpieMockLink ($rss, $url) { |
| 8 | 8 | $this->link = $rss; |
| 9 | - $this->magpie = $rss; | |
| 9 | + | |
| 10 | + if (is_array($rss) and isset($rss['simplepie']) and isset($rss['magpie'])) : | |
| 11 | + $this->simplepie = $rss['simplepie']; | |
| 12 | + $this->magpie = $rss['magpie']; | |
| 13 | + else : | |
| 14 | + $this->magpie = $rss; | |
| 15 | + endif; | |
| 16 | + | |
| 10 | 17 | $this->url = $url; |
| 11 | 18 | $this->id = -1; |
| 12 | 19 | $this->settings = array( |
| 13 | 20 | 'unfamiliar category' => 'default', |
| @@ -16,9 +23,11 @@ | ||
| 16 | 23 | } /* function MagpieMockLink::MagpieMockLink () */ |
| 17 | 24 | |
| 18 | 25 | function poll ($crash_ts = NULL) { |
| 19 | 26 | // Do nothing but update copy of feed |
| 20 | - $this->magpie = fetch_rss($this->url); | |
| 27 | + $this->simplepie = FeedWordPress::fetch($this->url); | |
| 28 | + $this->magpie = new MagpieFromSimplePie($this->simplepie); | |
| 29 | + | |
| 21 | 30 | $this->link = $this->magpie; |
| 22 | 31 | } /* function MagpieMockLink::poll () */ |
| 23 | 32 | |
| 24 | 33 | function uri () { |
| @@ -25,9 +34,13 @@ | ||
| 25 | 34 | return $this->url; |
| 26 | 35 | } /* function MagpieMockLink::uri() */ |
| 27 | 36 | |
| 28 | 37 | function homepage () { |
| 29 | - return (is_object($this->magpie) ? $this->magpie->channel['link'] : null); | |
| 38 | + return (!is_wp_error($this->simplepie) ? $this->simplepie->get_link() : null); | |
| 30 | 39 | } /* function MagpieMockLink::homepage () */ |
| 40 | + | |
| 41 | + function save_settings ($reload = false) { | |
| 42 | + // NOOP. | |
| 43 | + } | |
| 31 | 44 | } /* class MagpieMockLink */ |
| 32 | 45 | |
| 33 | 46 | |