X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FFeed.php;h=8bfe1c7ef9c1082982aa2d1da0b09dec9955004d;hb=903613ea74f764bc95421059eed61f0d4df92956;hp=03dd7f5c88c76ccab0a5b429b911a6bd6ef411e6;hpb=5f8b92578167107e91e2b10b631de0cada0b4854;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Feed.php b/includes/Feed.php index 03dd7f5c88..8bfe1c7ef9 100644 --- a/includes/Feed.php +++ b/includes/Feed.php @@ -37,19 +37,19 @@ */ class FeedItem { /** @var Title */ - protected $title; + public $title; - protected $description; + public $description; - protected $url; + public $url; - protected $date; + public $date; - protected $author; + public $author; - protected $uniqueId; + public $uniqueId; - protected $comments; + public $comments; public $rssIsPermalink = false; @@ -92,7 +92,7 @@ class FeedItem { */ public function getUniqueId() { if ( $this->uniqueId ) { - return $this->xmlEncode( $this->uniqueId ); + return $this->xmlEncode( wfExpandUrl( $this->uniqueId, PROTO_CURRENT ) ); } } @@ -141,7 +141,7 @@ class FeedItem { */ public function getLanguage() { global $wgLanguageCode; - return $wgLanguageCode; + return wfBCP47( $wgLanguageCode ); } /** @@ -184,7 +184,8 @@ class FeedItem { } /** - * @todo document (needs one-sentence top-level class description). + * Class to support the outputting of syndication feeds in Atom and RSS format. + * * @ingroup Feed */ abstract class ChannelFeed extends FeedItem { @@ -247,12 +248,12 @@ abstract class ChannelFeed extends FeedItem { global $wgRequest; $ctype = $wgRequest->getVal( 'ctype', 'application/xml' ); - $allowedctypes = array( + $allowedctypes = [ 'application/xml', 'text/xml', 'application/rss+xml', 'application/atom+xml' - ); + ]; return ( in_array( $ctype, $allowedctypes ) ? $ctype : 'application/xml' ); } @@ -338,13 +339,14 @@ class RSSFeed extends ChannelFeed { */ class AtomFeed extends ChannelFeed { /** - * @todo document - * @param string|int $ts + * Format a date given timestamp. + * + * @param string|int $timestamp * @return string */ - function formatTime( $ts ) { + function formatTime( $timestamp ) { // need to use RFC 822 time format at least for rss2.0 - return gmdate( 'Y-m-d\TH:i:s', wfTimestamp( TS_UNIX, $ts ) ); + return gmdate( 'Y-m-d\TH:i:s', wfTimestamp( TS_UNIX, $timestamp ) ); } /**