-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmy-calendar-rss.php
68 lines (67 loc) · 2.65 KB
/
my-calendar-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
<?php
function my_calendar_rss() {
// establish template
$template = "\n<item>
<title>{title}</title>
<link>{link}</link>
<pubDate>{rssdate}</pubDate>
<dc:creator>{author}</dc:creator>
<description><![CDATA[
<div class="vevent">
<h1 class="summary">{rss_title}</h1>
<p class="description">{rss_description}</p>
<p class="dtstart" title="{ical_start}">Begin: {time} on {date}</p>
<p class="dtend" title="{ical_end}">End: {endtime} on {enddate}</p>
<div class="location">{rss_hcard}</div>
{rss_link_title}
</div>
]]></description>
<content:encoded>
<![CDATA[
<div class='vevent'>
<h1 class='summary'>{title}</h1>
<p class='description'>{description}</p>
<p class='dtstart' title='{ical_start}'>Begin: {time} on {date}</p>
<p class='dtend' title='{ical_end}'>End: {endtime} on {enddate}</p>
<div class='location'>{hcard}</div>
{link_title}
</div>
]]>
</content:encoded>
<dc:format xmlns:dc='http://purl.org/dc/elements/1.1/'>text/html</dc:format>
<dc:source xmlns:dc='http://purl.org/dc/elements/1.1/'>".home_url()."</dc:source>
{guid}
</item>\n";
// add RSS headers
$output = '<?xml version="1.0" encoding="'.get_bloginfo('charset').'"?>
<rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
>
<channel>
<title>'. get_bloginfo('name') .' Calendar</title>
<link>'. home_url() .'</link>
<description>'. get_bloginfo('description') . ': My Calendar Events</description>
<language>'. get_bloginfo('language') .'</language>
<managingEditor>'. get_bloginfo('admin_email') .' (' . get_bloginfo('name') . ' Admin)</managingEditor>
<generator>My Calendar WordPress Plugin http://www.joedolson.com/articles/my-calendar/</generator>
<lastBuildDate>'. mysql2date('D, d M Y H:i:s +0000', time()+$offset) .'</lastBuildDate>
<atom:link href="'. mc_get_current_url() .'" rel="self" type="application/rss+xml" />';
$events = mc_get_all_events( $category, 15 );
if ( is_array( $events) ) {
$output .= "Yes it is";
}
$before = 0;
$after = 15;
$output .= mc_produce_upcoming_events( $events,$template,$before,$after,'rss' );
$output .= '</channel>
</rss>';
header('Content-type: application/rss+xml');
header("Pragma: no-cache");
header("Expires: 0");
echo $output;
}
?>