| 1 |
<?php |
| 2 |
require_once(dirname(__FILE__) . '/syndicatedlink.class.php'); |
| 3 |
|
| 4 |
class MagpieMockLink extends SyndicatedLink { |
| 5 |
var $url; |
| 6 |
|
| 7 |
function __construct( $rss, $url ) { |
| 8 |
$this->link = $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 |
|
| 17 |
$this->url = $url; |
| 18 |
$this->id = -1; |
| 19 |
$this->settings = array( |
| 20 |
'unfamiliar category' => 'default', |
| 21 |
|
| 22 |
); |
| 23 |
} /* function MagpieMockLink::MagpieMockLink () */ |
| 24 |
|
| 25 |
function MagpieMockLink( $rss, $url ) { |
| 26 |
self::__construct( $rss, $url ); |
| 27 |
} |
| 28 |
|
| 29 |
function poll ($crash_ts = NULL) { |
| 30 |
// Do nothing but update copy of feed |
| 31 |
$this->simplepie = FeedWordPress::fetch($this->url); |
| 32 |
$this->magpie = new MagpieFromSimplePie($this->simplepie); |
| 33 |
|
| 34 |
$this->link = $this->magpie; |
| 35 |
} /* function MagpieMockLink::poll () */ |
| 36 |
|
| 37 |
function uri ($params = array()) { |
| 38 |
return $this->url; |
| 39 |
} /* function MagpieMockLink::uri() */ |
| 40 |
|
| 41 |
function homepage ($fromFeed = true) { |
| 42 |
return ( !is_wp_error($this->simplepie) ? $this->simplepie->get_link() : null); |
| 43 |
} /* function MagpieMockLink::homepage () */ |
| 44 |
|
| 45 |
function save_settings ($reload = false) { |
| 46 |
// NOOP. |
| 47 |
} |
| 48 |
} /* class MagpieMockLink */ |
| 49 |
|
| 50 |
|
| 51 |
|