123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153 |
- <?php
- if (!defined('STATUSNET'))
- {
- exit(1);
- }
- class AtomNoticeFeed extends Atom10Feed
- {
- var $cur;
- protected $scoped=null;
-
- function __construct($cur = null, $indent = true) {
- parent::__construct($indent);
- $this->cur = $cur ?: common_current_user();
- $this->scoped = !is_null($this->cur) ? $this->cur->getProfile() : null;
-
- $this->addNamespace(
- 'thr',
- 'http://purl.org/syndication/thread/1.0'
- );
- $this->addNamespace(
- 'georss',
- 'http://www.georss.org/georss'
- );
- $this->addNamespace(
- 'activity',
- 'http://activitystrea.ms/spec/1.0/'
- );
- $this->addNamespace(
- 'media',
- 'http://purl.org/syndication/atommedia'
- );
- $this->addNamespace(
- 'poco',
- 'http://portablecontacts.net/spec/1.0'
- );
-
- $this->addNamespace(
- 'ostatus',
- 'http://ostatus.org/schema/1.0'
- );
- $this->addNamespace(
- 'statusnet',
- 'http://status.net/schema/api/1/'
- );
- }
-
- function addEntryFromNotices($notices)
- {
- if (is_array($notices)) {
- foreach ($notices as $notice) {
- $this->addEntryFromNotice($notice);
- }
- } elseif ($notices instanceof Notice) {
- while ($notices->fetch()) {
- $this->addEntryFromNotice($notices);
- }
- } else {
- throw new ServerException('addEntryFromNotices got neither an array nor a Notice object');
- }
- }
-
- function addEntryFromNotice(Notice $notice)
- {
- try {
- $source = $this->showSource();
- $author = $this->showAuthor();
- $this->addEntryRaw($notice->asAtomEntry(false, $source, $author, $this->scoped));
- } catch (Exception $e) {
- common_log(LOG_ERR, $e->getMessage());
-
- }
- }
- function showSource()
- {
- return true;
- }
- function showAuthor()
- {
- return true;
- }
- }
|