summaryrefslogtreecommitdiff
path: root/lib/atomnoticefeed.php
blob: ce87ec9e64bc03e30dbe96a5a9795070ed39301b (plain)
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
<?php

class AtomNoticeFeed extends Atom10Feed
{
    function __construct($indent = true) {
        parent::__construct($indent);

        // Feeds containing notice info use these namespaces

        $this->addNamespace(
            'xmlns:thr',
            'http://purl.org/syndication/thread/1.0'
        );

        $this->addNamespace(
            'xmlns:georss',
            'http://www.georss.org/georss'
        );

        $this->addNamespace(
            'xmlns:activity',
            'http://activitystrea.ms/spec/1.0/'
        );

        // XXX: What should the uri be?
        $this->addNamespace(
            'xmlns:ostatus',
            'http://ostatus.org/schema/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());
    }

}