123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- <?php
- if (!defined('STATUSNET') && !defined('LACONICA')) {
- exit(1);
- }
- class Feed
- {
- const RSS1 = 1;
- const RSS2 = 2;
- const ATOM = 3;
- const FOAF = 4;
- const JSON = 5;
- var $type = null;
- var $url = null;
- var $title = null;
- function __construct($type, $url, $title)
- {
- $this->type = $type;
- $this->url = $url;
- $this->title = $title;
- }
- function getUrl()
- {
- return $this->url;
- }
- function mimeType()
- {
- switch ($this->type) {
- case Feed::RSS1:
- return 'application/rdf+xml';
- case Feed::RSS2:
- return 'application/rss+xml';
- case Feed::ATOM:
- return 'application/atom+xml';
- case Feed::FOAF:
- return 'application/rdf+xml';
- case Feed::JSON:
- return 'application/stream+json';
- default:
- return null;
- }
- }
- function typeName()
- {
- switch ($this->type) {
- case Feed::RSS1:
-
- return _('RSS 1.0');
- case Feed::RSS2:
-
- return _('RSS 2.0');
- case Feed::ATOM:
-
- return _('Atom');
- case Feed::FOAF:
-
- return _('FOAF');
- case Feed::JSON:
-
- return _('Activity Streams');
- default:
- return null;
- }
- }
- function rel()
- {
- switch ($this->type) {
- case Feed::RSS1:
- case Feed::RSS2:
- case Feed::ATOM:
- case Feed::JSON:
- return 'alternate';
- case Feed::FOAF:
- return 'meta';
- default:
- return null;
- }
- }
- }
|