Go to the documentation of this file.
68 $this->uniqueId =
$url;
81 $string = str_replace(
"\r\n",
"\n", $string );
82 $string = preg_replace(
'/[\x00-\x08\x0b\x0c\x0e-\x1f]/',
'', $string );
83 return htmlspecialchars( $string );
102 if ( $this->uniqueId ) {
150 return $this->
xmlEncode( $this->description );
187 return $this->
xmlEncode( $this->author );
205 return $this->
xmlEncode( $this->comments );
224 return preg_replace(
'/\[\[([^]]*\|)?([^]]+)\]\]/',
'\2', $text );
249 $this->templateParser =
new TemplateParser();
291 # We take over from $wgOut, excepting its cache header info
294 header(
"Content-type: $mimetype; charset=UTF-8" );
298 ->getExtensionsForType( $mimetype );
299 $ext = $exts ? strtok( $exts,
' ' ) :
'xml';
300 header(
"Content-Disposition: inline; filename=\"feed.{$ext}\"" );
303 $wgOut->addVaryHeader(
'X-Forwarded-Proto' );
305 $wgOut->sendCacheControl();
316 $ctype =
$wgRequest->getVal(
'ctype',
'application/xml' );
320 'application/rss+xml',
321 'application/atom+xml'
324 return ( in_array( $ctype, $allowedctypes ) ? $ctype :
'application/xml' );
332 echo
'<?xml version="1.0"?>' .
"\n";
351 return gmdate(
'D, d M Y H:i:s \G\M\T',
wfTimestamp( TS_UNIX, $ts ) );
369 'version' => $this->
xmlEncode( $wgVersion ),
372 print $this->templateParser->processTemplate(
'RSSHeader', $templateParams );
383 "title" => $item->getTitle(),
385 "permalink" => $item->rssIsPermalink,
386 "uniqueID" => $item->getUniqueID(),
387 "description" => $item->getDescription(),
389 "author" => $item->getAuthor()
391 $comments = $item->getCommentsUnescaped();
394 $templateParams[
"comments"] = $commentsEscaped;
396 print $this->templateParser->processTemplate(
'RSSItem', $templateParams );
403 print "</channel></rss>";
422 return gmdate(
'Y-m-d\TH:i:s',
wfTimestamp( TS_UNIX, $timestamp ) );
442 'version' => $this->
xmlEncode( $wgVersion ),
444 print $this->templateParser->processTemplate(
'AtomHeader', $templateParams );
465 return htmlspecialchars(
$wgRequest->getFullRequestURL() );
477 "uniqueID" => $item->getUniqueID(),
478 "title" => $item->getTitle(),
479 "mimeType" => $this->
xmlEncode( $wgMimeType ),
482 "description" => $item->getDescription(),
483 "author" => $item->getAuthor()
485 print $this->templateParser->processTemplate(
'AtomItem', $templateParams );
contentType()
Return an internet media type to be sent in the headers.
A base class for basic support for outputting syndication feeds in RSS and other formats.
outItem( $item)
Generate an item.
getFeedId()
Atom 1.0 requires a unique, opaque IRI as a unique identifier for every feed we create.
outHeader()
Outputs a basic header for Atom 1.0 feeds.
$wgMimeType
The default Content-Type header.
__construct( $title, $description, $url, $date='', $author='', $comments='')
httpHeaders()
Setup and send HTTP headers.
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
outXmlHeader()
Output the initial XML headers.
$wgVersion
MediaWiki version number.
getDescriptionUnescaped()
Get the description of this item without any escaping.
outFooter()
Outputs the footer for Atom 1.0 feed (basically '</feed>').
getLanguage()
Get the language of this item.
static stripComment( $text)
Quickie hack...
getTitle()
Get the title of this item; already xml-encoded.
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
getAuthor()
Get the author of this item; already xml-encoded.
TemplateParser $templateParser
getDate()
Get the date of this item.
$wgVaryOnXFP
Add X-Forwarded-Proto to the Vary and Key headers for API requests and RSS/Atom feeds.
getAuthorUnescaped()
Get the author of this item without any escaping.
when a variable name is used in a it is silently declared as a new masking the global
getSelfUrl()
Atom 1.0 requests a self-reference to the feed.
wfTimestampNow()
Convenience function; returns MediaWiki timestamp for the present time.
formatTime( $timestamp)
Format a date given timestamp, if one is given.
getCommentsUnescaped()
Get the comment of this item without any escaping.
setUniqueId( $uniqueId, $rssIsPermalink=false)
Set the unique id of an item.
getDescription()
Get the description of this item; already xml-encoded.
getUniqueIdUnescaped()
Get the unique id of this item, without any escaping.
getUrl()
Get the URL of this item; already xml-encoded.
$wgLanguageCode
Site language code.
__construct( $title, $description, $url, $date='', $author='', $comments='')
Represents a title within MediaWiki.
Class to support the outputting of syndication feeds in Atom and RSS format.
outFooter()
Generate Footer of the feed.
xmlEncode( $string)
Encode $string so that it can be safely embedded in a XML document.
static bcp47( $code)
Get the normalised IETF language tag See unit test for examples.
outHeader()
Generate Header of the feed.
if(! $wgDBerrorLogTZ) $wgRequest
getComments()
Get the comment of this item; already xml-encoded.
outItem( $item)
Output a given item.
wfExpandUrl( $url, $defaultProto=PROTO_CURRENT)
Expand a potentially local URL to a fully-qualified URL.
getUrlUnescaped()
Get the URL of this item without any escaping.
getUniqueID()
Get the unique id of this item; already xml-encoded.