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" );
297 $exts = MediaWiki\MediaWikiServices::getInstance()->getMimeAnalyzer()
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 );
$wgLanguageCode
Site language code.
$wgMimeType
The default Content-Type header.
$wgVersion
MediaWiki version number.
$wgVaryOnXFP
Add X-Forwarded-Proto to the Vary and Key headers for API requests and RSS/Atom feeds.
wfTimestampNow()
Convenience function; returns MediaWiki timestamp for the present time.
wfExpandUrl( $url, $defaultProto=PROTO_CURRENT)
Expand a potentially local URL to a fully-qualified URL.
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
if(! $wgDBerrorLogTZ) $wgRequest
outItem( $item)
Output a given item.
outFooter()
Outputs the footer for Atom 1.0 feed (basically '</feed>').
getFeedId()
Atom 1.0 requires a unique, opaque IRI as a unique identifier for every feed we create.
formatTime( $timestamp)
Format a date given timestamp, if one is given.
getSelfUrl()
Atom 1.0 requests a self-reference to the feed.
outHeader()
Outputs a basic header for Atom 1.0 feeds.
Class to support the outputting of syndication feeds in Atom and RSS format.
outFooter()
Generate Footer of the feed.
TemplateParser $templateParser
outHeader()
Generate Header of the feed.
__construct( $title, $description, $url, $date='', $author='', $comments='')
contentType()
Return an internet media type to be sent in the headers.
httpHeaders()
Setup and send HTTP headers.
outItem( $item)
Generate an item.
outXmlHeader()
Output the initial XML headers.
A base class for basic support for outputting syndication feeds in RSS and other formats.
getLanguage()
Get the language of this item.
setUniqueId( $uniqueId, $rssIsPermalink=false)
Set the unique id of an item.
getDescription()
Get the description of this item; already xml-encoded.
getDescriptionUnescaped()
Get the description of this item without any escaping.
getCommentsUnescaped()
Get the comment of this item without any escaping.
getTitle()
Get the title of this item; already xml-encoded.
getDate()
Get the date of this item.
getUniqueIdUnescaped()
Get the unique id of this item, without any escaping.
static stripComment( $text)
Quickie hack... strip out wikilinks to more legible form from the comment.
getAuthor()
Get the author of this item; already xml-encoded.
xmlEncode( $string)
Encode $string so that it can be safely embedded in a XML document.
getComments()
Get the comment of this item; already xml-encoded.
getAuthorUnescaped()
Get the author of this item without any escaping.
getUrlUnescaped()
Get the URL of this item without any escaping.
__construct( $title, $description, $url, $date='', $author='', $comments='')
getUniqueID()
Get the unique id of this item; already xml-encoded.
getUrl()
Get the URL of this item; already xml-encoded.
Represents a title within MediaWiki.
while(( $__line=Maintenance::readconsole()) !==false) print
if(!is_readable( $file)) $ext