-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfeed.php
More file actions
85 lines (71 loc) · 2.33 KB
/
Copy pathfeed.php
File metadata and controls
85 lines (71 loc) · 2.33 KB
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
<?php
// Copyright 2008 Mahesh Asolkar
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Include library of functions
//
include 'lib/config.inc';
include 'config.inc';
include 'lib/onlyblog.php';
function blog_feed () {
global $__status, $__config, $__status, $__blog_data_items;
//
// Populate the $__blog_data_items array with qualifying blog data
// file names
//
find_blog_data_files ();
$now = date("D, d M Y H:i:s T");
header("Content-Type: application/rss+xml");
echo <<<END
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
>
<channel>
<title>{$__config['blog_name']}</title>
<atom:link href="{$__config['blog_url']}" rel="self" type="application/rss+xml" />
<link>{$__config['blog_url']}</link>
<description>{$__config['blog_tag_line']}</description>
<pubDate>$now</pubDate>
<generator>http://onlyblog.googlecode.com/</generator>
<language>en</language>
END;
foreach ($__blog_data_items as $data_item) {
$pub_date = date("D, d M Y H:i:s T", $data_item['time']);
$excerpt = substr (strip_tags($data_item['entry']), 0, 200);
$excerpt = preg_replace ('/(\w+)$/', '', $excerpt);
//
// Feed readers don't quite like tags in the title
//
$item_title = preg_replace ('/<.*?>/', '', $data_item['header_title']);
echo <<<END
<item>
<title>{$item_title}</title>
<link>{$__config['blog_url']}?post={$data_item['data_file']}</link>
<pubDate>$pub_date</pubDate>
<description><![CDATA[$excerpt [...] ]]></description>
<content:encoded><![CDATA[{$data_item['entry']}]]></content:encoded>
</item>
END;
}
echo <<<END
</channel>
</rss>
END;
}
blog_feed();
?>