| 1 |
<?php |
| 2 |
define('FEEDWORDPIE_TYPE_CUSTOM_XML', ~SIMPLEPIE_TYPE_NONE & ~SIMPLEPIE_TYPE_ALL); |
| 3 |
|
| 4 |
class FeedWordPie extends SimplePie { |
| 5 |
var $subscription = NULL; |
| 6 |
|
| 7 |
function set_feed_url ($url) { |
| 8 |
global $fwp_oLinks; |
| 9 |
if ($url InstanceOf SyndicatedLink) : |
| 10 |
|
| 11 |
// Get URL with relevant parameters attached. |
| 12 |
// Credentials will be handled further down. |
| 13 |
$new_url = $url->uri(array('add_params' => true)); |
| 14 |
|
| 15 |
// Store for reference. |
| 16 |
$this->subscription = $url->id(); |
| 17 |
|
| 18 |
// Pass it along down the line. |
| 19 |
$url = $new_url; |
| 20 |
|
| 21 |
else : |
| 22 |
$this->subscription = NULL; |
| 23 |
endif; |
| 24 |
|
| 25 |
// OK, let's go. |
| 26 |
return parent::set_feed_url($url); |
| 27 |
} /* class SimplePie */ |
| 28 |
|
| 29 |
function get_type () { |
| 30 |
// Allow filters to pre-empt a type determination from SimplePie |
| 31 |
$ret = apply_filters( |
| 32 |
'feedwordpie_get_type', |
| 33 |
NULL, |
| 34 |
$this |
| 35 |
); |
| 36 |
|
| 37 |
// If not preempted by a filter, fall back on SimplePie |
| 38 |
if (is_null($ret)) : |
| 39 |
$ret = parent::get_type(); |
| 40 |
endif; |
| 41 |
|
| 42 |
return $ret; |
| 43 |
} |
| 44 |
|
| 45 |
function get_feed_tags ($namespace, $tag) { |
| 46 |
// Allow filters to filter SimplePie handling |
| 47 |
return apply_filters( |
| 48 |
'feedwordpie_get_feed_tags', |
| 49 |
parent::get_feed_tags($namespace, $tag), |
| 50 |
$namespace, |
| 51 |
$tag, |
| 52 |
$this |
| 53 |
); |
| 54 |
} |
| 55 |
|
| 56 |
function get_items ($start = 0, $end = 0) { |
| 57 |
// Allow filters to set up for, or pre-empt, SimplePie handling |
| 58 |
$ret = apply_filters( |
| 59 |
'feedwordpie_get_items', |
| 60 |
NULL, |
| 61 |
$start, |
| 62 |
$end, |
| 63 |
$this |
| 64 |
); |
| 65 |
|
| 66 |
if (is_null($ret)) : |
| 67 |
$ret = parent::get_items(); |
| 68 |
endif; |
| 69 |
return $ret; |
| 70 |
} |
| 71 |
|
| 72 |
} /* class FeedWordPie */ |
| 73 |
|
| 74 |
|