]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/RssWriter2.php
Harmonize file footer
[SourceForge/phpwiki.git] / lib / RssWriter2.php
1 <?php // rcs_id('$Id$');
2 /*
3  * Code for creating RSS 2.0
4  * Author: Reini Urban for PhpWiki
5  */
6
7 // Encoding for RSS output.
8 include_once("lib/RssWriter.php");
9
10 /**
11  * A class for writing RSS 2.0 with xml-rpc notifier
12  *
13  * @see http://blogs.law.harvard.edu/tech/rss,
14  *      http://www.usemod.com/cgi-bin/mb.pl?ModWiki
15  * no namespace!
16  * http://sourceforge.net/mailarchive/forum.php?thread_id=4872845&forum_id=37467
17  */
18 class RssWriter2 extends RssWriter
19 {
20     function RssWriter2 () {
21         $this->XmlElement('rss',
22                           array('version' => "2.0"));
23
24         // not used. no namespaces should be used.
25         $this->_modules = array(
26             //Standards
27             'content'   => "http://purl.org/rss/1.0/modules/content/",
28             'dc'        => "http://purl.org/dc/elements/1.1/",
29             'sy'        => "http://purl.org/rss/1.0/modules/syndication/",
30             //Proposed
31             'wiki'      => "http://purl.org/rss/1.0/modules/wiki/",
32             'ag'        => "http://purl.org/rss/1.0/modules/aggregation/",
33             'annotate'  => "http://purl.org/rss/1.0/modules/annotate/",
34             'audio'     => "http://media.tangent.org/rss/1.0/",
35             'cp'        => "http://my.theinfo.org/changed/1.0/rss/",
36             'rss091'    => "http://purl.org/rss/1.0/modules/rss091/",
37             'slash'     => "http://purl.org/rss/1.0/modules/slash/",
38             'taxo'      => "http://purl.org/rss/1.0/modules/taxonomy/",
39             'thr'       => "http://purl.org/rss/1.0/modules/threading/"
40             );
41         $this->_uris_seen = array();
42         $this->_items = array();
43     }
44
45     // Required args: (applying defaults)
46     //  'domain', 'port', 'path', 'registerProcedure', 'protocol'
47     // Optional args:
48     //  none
49     function cloud($properties) {
50         // xml-rpc or soap or http-post
51         if (!isset($properties['protocol'])) $properties['protocol'] = 'xml-rpc';
52         if (!isset($properties['registerProcedure']))
53             $properties['registerProcedure'] = 'rssPleaseNotify';
54         if (!isset($properties['path'])) $properties['path'] = DATA_PATH.'/RPC2.php';
55         if (!isset($properties['port']))
56             $properties['port'] = !SERVER_PORT
57                 ? '80'
58                 : (SERVER_PROTOCOL == 'https' ? '443' : '80');
59         if (!isset($properties['domain'])) $properties['domain'] = SERVER_NAME;
60         $this->_cloud = $this->__node('cloud', $properties);
61     }
62
63     /**
64      * Write output to HTTP client.
65      */
66     function __spew() {
67         header("Content-Type: application/rss+xml; charset=" . RSS_ENCODING);
68         echo('<'.'?xml version="1.0" encoding="'.RSS_ENCODING.'"?'.">\n");
69         //printf("<!-- generator=\"PhpWiki-%s\" -->\n", PHPWIKI_VERSION);
70         //RSS2 really is 0.92
71         echo '<!DOCTYPE rss SYSTEM "http://my.netscape.com/publish/formats/rss-0.92.dtd">',"\n";
72         echo "<!DOCTYPE rss [<!ENTITY % HTMLlat1 PUBLIC \"-//W3C//ENTITIES Latin 1 for XHTML//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent\">\n";
73         echo "              %HTMLlat1;]>\n";
74         $this->printXML();
75     }
76 };
77
78 // Local Variables:
79 // mode: php
80 // tab-width: 8
81 // c-basic-offset: 4
82 // c-hanging-comment-ender-p: nil
83 // indent-tabs-mode: nil
84 // End: 
85 ?>