r21334 - htdocs/branches/beta - Get back to the original atom.php file.
Cristian Marchi
cmarchi at code.gnucash.org
Sat Sep 24 13:19:05 EDT 2011
Author: cmarchi
Date: 2011-09-24 13:19:04 -0400 (Sat, 24 Sep 2011)
New Revision: 21334
Trac: http://svn.gnucash.org/trac/changeset/21334
Modified:
htdocs/branches/beta/atom.php
Log:
Get back to the original atom.php file.
Modified: htdocs/branches/beta/atom.php
===================================================================
--- htdocs/branches/beta/atom.php 2011-09-24 17:12:19 UTC (rev 21333)
+++ htdocs/branches/beta/atom.php 2011-09-24 17:19:04 UTC (rev 21334)
@@ -9,10 +9,10 @@
{
$contentType = $overrideContentType;
}
- $charset = "utf-8";
+ $charset = "iso-8859-1";
header("Content-Type: $contentType; charset=$charset");
- $entry_count = 1;
+ $entry_count = 10;
$newsdir = "${top_dir}/news";
/**
@@ -29,23 +29,50 @@
return substr($semi_atom_date, 0, $len-2) . ":" . substr($semi_atom_date, $len-2);
}
?>
-
+<?="<?xml version=\"1.0\" encoding=\"$charset\"?>"?>
<?php
include("$top_dir/news/news-script.php");
?>
-<?xml version="1.0" encoding="ISO-8859-1" ?>
-<rss version="2.0">
+<feed xmlns="http://www.w3.org/2005/Atom">
+ <id>http://www.gnucash.org/atom.php</id>
+ <title>GnuCash News</title>
+ <generator>GnuCash htdocs/trunk/atom.php 1.0 <gnucash-devel at gnucash.org></generator>
+ <logo>http://www.gnucash.org/images/gnucash_logo.png</logo>
+ <link rel="alternate" href="http://www.gnucash.org/" />
+ <link rel="self" href="http://www.gnucash.org/atom.php" />
+ <?php
+ $news_items = get_news($newsdir, $newsdir);
+ $news_items = array_slice($news_items, 0, $entry_count);
+ reset($news_items);
+ $most_recent = file(key($news_items));
+ $most_recent_update = chop($most_recent[1]);
+ ?>
+ <updated><?= date_convert_news_to_atom($most_recent_update) ?></updated>
-<channel>
- <title>W3Schools Home Page</title>
- <link>http://www.w3schools.com</link>
- <description>Free web building tutorials</description>
- <item>
- <title>RSS Tutorial</title>
- <link>http://www.w3schools.com/rss</link>
- <description>New RSS tutorial on W3Schools</description>
- </item>
-</channel>
+ <?php for (reset($news_items); $key = key($news_items); next($news_items))
+ {
+ $fa = file($key);
+ $n = count($fa);
+ $title = strip_tags(chop($fa[0]));
+ $update_date = chop($fa[1]);
+ ?>
+ <entry>
+ <id>urn:x-gnucash:news:<?= urlencode($key) ?></id>
+ <title><?= $title ?></title>
+ <link rel="alternate" href="http://www.gnucash.org/#<?=generate_anchor($key);?>" />
+ <author>
+ <name>GnuCash Developers</name>
+ <email>gnucash-devel at gnucash.org</email>
+ </author>
+ <updated><?= date_convert_news_to_atom($update_date) ?></updated>
+ <content type="html">
+ <? for ($i=2; $i<$n; $i++) {
+ print htmlentities($fa[$i]);
+ } ?>
+ </content>
+ </entry>
+ <?php
+ } ?>
-</rss>
+</feed>
More information about the gnucash-changes
mailing list