summaryrefslogtreecommitdiff
path: root/providers/XmlFeed.php
diff options
context:
space:
mode:
Diffstat (limited to 'providers/XmlFeed.php')
-rw-r--r--providers/XmlFeed.php39
1 files changed, 39 insertions, 0 deletions
diff --git a/providers/XmlFeed.php b/providers/XmlFeed.php
new file mode 100644
index 0000000..d5ecd1c
--- /dev/null
+++ b/providers/XmlFeed.php
@@ -0,0 +1,39 @@
+<?php
+
+namespace Providers;
+
+require_once('Provider.php');
+
+abstract class XmlFeed extends \Providers\Provider {
+
+ protected $_feedUrl;
+ protected $_feedXml;
+
+ abstract protected function _getFeedUrl($feed);
+
+ public function __construct($feed, $options=[]) {
+ parent::__construct($feed, $options);
+ $this->_feedUrl = $this->_getFeedUrl($feed);
+ if (!$this->_feedUrl) {
+ throw new Exception('XML feed "' . $feed . '" undefined');
+ }
+ }
+
+ abstract protected function _parseFeedContent($feed);
+
+ protected function _fetchItems() {
+ $this->_feedXml = new \SimpleXMLElement($this->_feedUrl, 0, TRUE);
+ return $this->_parseFeedContent($this->_feedXml);
+ }
+
+ protected function _spamFilter($content) {
+ return $content;
+ }
+
+ protected function _sortContent($content) {
+ return $content;
+ }
+
+}
+
+?>