forked from exponentcms/exponent-cms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
site_rss.php
90 lines (83 loc) · 3 KB
/
site_rss.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<?php
##################################################
#
# Copyright (c) 2004-2012 OIC Group, Inc.
#
# This file is part of Exponent
#
# Exponent is free software; you can redistribute
# it and/or modify it under the terms of the GNU
# General Public License as published by the Free
# Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# GPL: http://www.gnu.org/licenses/gpl.txt
#
##################################################
/** @define "BASE" "." */
require_once('exponent.php');
require_once(BASE.'external/feedcreator.class.php');
$site_rss = new expRss($_REQUEST);
$site_rss->feed_title = empty($site_rss->feed_title) ? gt('RSS for').' '.URL_FULL : $site_rss->feed_title;
$site_rss->feed_desc = empty($site_rss->feed_desc) ? gt('This is the site wide RSS syndication for').' '.HOSTNAME : $site_rss->feed_desc;
if (isset($site_rss->rss_cachetime)) { $ttl = $site_rss->rss_cachetime; }
if ($site_rss->rss_cachetime == 0) { $site_rss->rss_cachetime = 1440; }
$ic = explode(";", $site_rss->itunes_cats);
$x = 0;
$itunes_cats = array();
foreach($ic as $cat){
$cat_sub = explode(":", $cat);
$itunes_cats[$x]->category = $cat_sub[0];
if(isset($cat_sub[1])) {
$itunes_cats[$x]->subcategory = $cat_sub[1];
}
$x++;
}
if ($site_rss->enable_rss == true) {
$rss = new UniversalFeedCreator();
$rss->cssStyleSheet = "";
// $rss->useCached("PODCAST");
$rss->useCached();
$rss->title = $site_rss->feed_title;
$rss->description = $site_rss->feed_desc;
$rss->image->url = URL_FULL.'themes/'.DISPLAY_THEME.'/images/logo.png';
$rss->image->title = ORGANIZATION_NAME;
$rss->image->link = URL_FULL;
// $rss->image->width = 64;
// $rss->image->height = 64;
$rss->ttl = $site_rss->rss_cachetime;
$rss->link = "http://".HOSTNAME.PATH_RELATIVE;
$rss->syndicationURL = "http://".HOSTNAME.PATH_RELATIVE.$_SERVER['PHP_SELF'];
if ($_REQUEST['module'] == "filedownload") {
// $rss->itunes->summary = $site_rss->feed_desc;
$rss->itunes->author = ORGANIZATION_NAME;
if (!empty($itunes_cats)) {
$rss->itunes->category = $itunes_cats[0]->category;
$rss->itunes->subcategory = $itunes_cats[0]->subcategory;
}
$rss->itunes->image = URL_FULL.'themes/'.DISPLAY_THEME.'/images/logo.png';
// $rss->itunes->explicit = 0;
$rss->itunes->subtitle = $site_rss->feed_title;
// $rss->itunes->keywords = 0;
$rss->itunes->owner_email = SMTP_FROMADDRESS;
$rss->itunes->owner_name = ORGANIZATION_NAME;
}
$pubDate = '';
foreach ($site_rss->getFeedItems() as $item) {
if ($item->date > $pubDate) { $pubDate = $item->date; }
$rss->addItem($item);
}
if (isset($site_rss->rss_limit) && $site_rss->rss_limit > 0) {
$rss->items = array_slice($rss->items, 0, $site_rss->rss_limit);
}
$rss->pubDate = $pubDate;
header("Content-type: text/xml");
if ($_REQUEST['module'] == "filedownload") {
echo $rss->createFeed("PODCAST");
} else {
echo $rss->createFeed("RSS2.0");
}
} else {
echo gt("This RSS feed has been disabled.");
}
?>