diff options
author | Zach Copley <zach@status.net> | 2010-02-10 14:24:16 -0800 |
---|---|---|
committer | Zach Copley <zach@status.net> | 2010-02-11 13:56:05 -0800 |
commit | ce3c3be1bf971329f82bedbf3aae636e3c8ecbf9 (patch) | |
tree | e8072c70df5243c78740e2179b034edcfee2b4ce /lib/atomnoticefeed.php | |
parent | 1773d12a24d2720cdb6c1b517999cac1f708b355 (diff) |
Utility classes for atom feeds
Diffstat (limited to 'lib/atomnoticefeed.php')
-rw-r--r-- | lib/atomnoticefeed.php | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/lib/atomnoticefeed.php b/lib/atomnoticefeed.php new file mode 100644 index 000000000..a28c9cda7 --- /dev/null +++ b/lib/atomnoticefeed.php @@ -0,0 +1,34 @@ +<?php + +class AtomNoticeFeed extends Atom10Feed +{ + function __construct($indent = true) { + parent::__construct($indent); + + // Feeds containing notice info use the Atom Threading Extensions + + $this->addNamespace( + 'xmlns:thr', + 'http://purl.org/syndication/thread/1.0' + ); + } + + function addEntryFromNotices($notices) + { + if (is_array($notices)) { + foreach ($notices as $notice) { + $this->addEntryFromNotice($notice); + } + } else { + while ($notices->fetch()) { + $this->addEntryFromNotice($notice); + } + } + } + + function addEntryFromNotice($notice) + { + $this->addEntryRaw($notice->asAtomEntry()); + } + +}
\ No newline at end of file |