Annotation of /trunk/flyspray/themes/Magellan/templates/feed.atom.tpl
Parent Directory | Revision Log
Revision 6 -
(hide annotations)
(download)
Thu Mar 24 13:33:23 2016 UTC (8 years, 2 months ago) by niro
File size: 3744 byte(s)
Thu Mar 24 13:33:23 2016 UTC (8 years, 2 months ago) by niro
File size: 3744 byte(s)
-import flyspray-1.0-beta Magellan theme
1 | niro | 6 | <?php echo '<?xml version="1.0" ?>'; ?> |
2 | |||
3 | <feed xmlns="http://www.w3.org/2005/Atom"> | ||
4 | <title type="text"><?php echo Filters::noXSS($fs->prefs['page_title']); ?></title> | ||
5 | <subtitle type="text"> | ||
6 | <?php echo Filters::noXSS($feed_description); ?> | ||
7 | |||
8 | </subtitle> | ||
9 | <id><?php echo Filters::noXSS($baseurl); ?></id> | ||
10 | <?php if($feed_image): ?> | ||
11 | <icon><?php echo Filters::noXSS($feed_image); ?></icon> | ||
12 | <?php endif; ?> | ||
13 | <updated><?php echo Filters::noXSS(date('Y-m-d\TH:i:s\Z',$most_recent)); ?></updated> | ||
14 | <link rel="self" type="text/xml" href="feed.php?feed_type=atom"/> | ||
15 | <link rel="alternate" type="text/html" hreflang="en" href="<?php echo Filters::noXSS($_SERVER['SCRIPT_NAME']); ?>"/> | ||
16 | <?php foreach ($task_details as $row): ?> | ||
17 | <entry> | ||
18 | <title>FS#<?php echo Filters::noXSS($row['task_id']); ?>: <?php echo Filters::noXSS($row['item_summary']); ?></title> | ||
19 | <link href="<?php echo Filters::noXSS(CreateURL('details', $row['task_id'])); ?>" /> | ||
20 | <updated><?php echo Filters::noXSS(date('Y-m-d\TH:i:s\Z',intval($row['last_edited_time']))); ?></updated> | ||
21 | <published><?php echo Filters::noXSS(date('Y-m-d\TH:i:s\Z',intval($row['date_opened']))); ?></published> | ||
22 | <content type="xhtml" xml:lang="en" xml:base="http://diveintomark.org/"> | ||
23 | <div xmlns="http://www.w3.org/1999/xhtml"> <?php | ||
24 | $data = $row['detailed_desc']; | ||
25 | |||
26 | if ($conf['general']['syntax_plugin'] == 'dokuwiki') { | ||
27 | $data = TextFormatter::render($data); | ||
28 | // Convert most common html- but not xml-entities. | ||
29 | $data = preg_replace('/‘/', '‘', $data); | ||
30 | $data = preg_replace('/’/', '’', $data); | ||
31 | $data = preg_replace('/“/', '“', $data); | ||
32 | $data = preg_replace('/”/', '”', $data); | ||
33 | echo $data; | ||
34 | } | ||
35 | else { | ||
36 | if (preg_match('/^</', $data) === 0) { | ||
37 | // Assume an old entry. Just can't rely on any tags to be valid. | ||
38 | $data = strip_tags($data); | ||
39 | $data = preg_replace('/&/', '&', $data); | ||
40 | $data = preg_replace('/</', '<', $data); | ||
41 | $data = preg_replace('/>/', '>', $data); | ||
42 | $data = preg_replace('/"/', '"', $data); | ||
43 | $data = '<p>' . nl2br($data) . '</p>'; | ||
44 | } | ||
45 | else { | ||
46 | // Assume a new entry. Problem cases when an old entry started with | ||
47 | // < are just not handled well. Must draw the line somewhere, even if the | ||
48 | // browser will not show it or has an error. Those cases should be quite few. | ||
49 | } | ||
50 | |||
51 | // Chrome complained loudly about this one. Firefox just didn't show anything... | ||
52 | // Any more html entities produced by ckeditor that should be turned into | ||
53 | // a numeric character reference? Add when found. Or check if we already have | ||
54 | // somewhere an existing function to do that. | ||
55 | $data = preg_replace('/ /', ' ', $data); | ||
56 | |||
57 | // Single case. Old entry that started with <. Can contain &'s too. | ||
58 | // Convert to entity, without touching already existing entities. | ||
59 | $data = preg_replace('/&(?!([a-z]+|#[0-9]+);)/', '&', $data); | ||
60 | |||
61 | // Still double quotes there? Convert any not appearing inside tags. | ||
62 | // Not sure if ckeditor makes that kind of entries. | ||
63 | $data = preg_replace('/"(?=[^>]*(<|$))/', '"', $data); | ||
64 | |||
65 | // Best alternative, although will strip some odd custom data from old entries. | ||
66 | echo TextFormatter::render($data); | ||
67 | } ?></div> | ||
68 | </content> | ||
69 | <author><name><?php echo Filters::noXSS($row['real_name']); ?></name></author> | ||
70 | <id><?php echo Filters::noXSS($baseurl); ?>:<?php echo Filters::noXSS($row['task_id']); ?></id> | ||
71 | </entry> | ||
72 | <?php endforeach; ?> | ||
73 | </feed> |