1+ <?php
2+ declare (strict_types = 1 );
3+
4+ namespace Forensic \FeedParser \Feeds ;
5+
6+ use Forensic \FeedParser \Enums \FeedTypes ;
7+ use Forensic \FeedParser \XPath ;
8+ use Forensic \FeedParser \FeedItems \RSSFeedItem ;
9+
10+ class RSSFeed extends BaseFeed
11+ {
12+ public function __construct (XPath $ xpath , string $ default_lang ,
13+ bool $ remove_styles , bool $ remove_scripts )
14+ {
15+ $ namespaces = [
16+ 'def ' => 'http://purl.org/rss/1.0/ ' ,
17+ 'rdf ' => 'http://www.w3.org/1999/02/22-rdf-syntax-ns# ' ,
18+ 'dc ' => 'http://purl.org/dc/elements/1.1/ ' ,
19+ 'sy ' => 'http://purl.org/rss/1.0/modules/syndication ' ,
20+ 'enc ' => 'http://purl.oclc.org/net/rss_2.0/enc# ' ,
21+ 'content ' => 'http://purl.org/rss/1.0/modules/content/ ' ,
22+ 'taxo ' => 'http://purl.org/rss/1.0/modules/taxonomy/ '
23+ ];
24+
25+ $ property_selectors = [
26+ 'id ' => 'channel/title ' ,
27+ 'title ' => 'channel/title ' ,
28+ 'link ' => 'channel/link ' ,
29+ 'description ' => 'channel/description ' ,
30+ 'image ' => [
31+ 'src ' => 'channel/image/url ' ,
32+ 'link ' => 'channel/image/link ' ,
33+ 'title ' => 'channel/image/title '
34+ ],
35+ 'copyright ' => 'channel/copyright ' ,
36+ 'publisher ' => 'channel/managingEditor || channel/webMaster ' ,
37+ 'lastUpdated ' => 'channel/pubDate ' ,
38+ 'generator ' => 'channel/generator ' ,
39+ 'language ' => 'channel/language ' ,
40+ 'category ' => 'channel/category '
41+ ];
42+
43+ $ items_selector = 'channel/item ' ;
44+
45+ parent ::__construct (
46+ new FeedTypes (FeedTypes::RSS_FEED ),
47+ $ default_lang ,
48+ $ xpath ,
49+ $ namespaces ,
50+ $ property_selectors ,
51+ $ items_selector ,
52+ $ remove_styles ,
53+ $ remove_scripts
54+ );
55+ }
56+ }
0 commit comments