Go to the documentation of this file.
43 $wgOut->addWikiMsg(
'feed-unavailable' );
48 $wgOut->addWikiMsg(
'feed-invalid' );
64 $timestamp =
wfTimestamp( TS_MW, $row->rc_timestamp );
66 if ( $row->rc_type ==
RC_LOG ) {
71 $row->rc_last_oldid, $row->rc_this_oldid,
73 $row->rc_deleted & RevisionRecord::DELETED_COMMENT
74 ?
wfMessage(
'rev-deleted-comment' )->escaped()
92 $comment, $actiontext =
''
97 $completeText =
'<p>' . implode(
' ',
107 $accErrors =
$title->getUserPermissionsErrors(
'read', $anon,
true );
111 if (
$title->getNamespace() < 0 || $accErrors || !$newid ) {
112 return $completeText;
127 $contentHandler = $rev->getContentHandler();
128 $de = $contentHandler->createDifferenceEngine(
$context, $oldid, $newid );
129 $diffText = $de->getDiff(
132 $wgLang->timeanddate( $timestamp ),
134 $wgLang->time( $timestamp ) )->text() );
141 } elseif ( $diffText ===
false ) {
143 $diffText =
"<p>Can't load revision $newid</p>";
146 $diffText = UtfNormal\Validator::cleanUp( $diffText );
154 $newContent = $rev->getContent();
159 $text = $newContent->getText();
164 $html = nl2br( htmlspecialchars( $text ) );
174 if ( $html ===
null ) {
179 $diffText =
'<p><b>' .
wfMessage(
'newpage' )->text() .
'</b></p>' .
180 '<div>' . $html .
'</div>';
183 $completeText .= $diffText;
185 return $completeText;
198 $queryParameters = [
'diff' => $newid ];
199 if ( $oldid !=
null ) {
200 $queryParameters[
'oldid'] = $oldid;
202 $diffUrl =
$title->getFullURL( $queryParameters );
204 $diffLink = Html::element(
'a', [
'href' => $diffUrl ],
205 wfMessage(
'showdiff' )->inContentLanguage()->text() );
220 'diff' =>
'background-color: #fff; color: #222;',
221 'diff-otitle' =>
'background-color: #fff; color: #222; text-align: center;',
222 'diff-ntitle' =>
'background-color: #fff; color: #222; text-align: center;',
223 'diff-addedline' =>
'color: #222; font-size: 88%; border-style: solid; '
224 .
'border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; '
225 .
'vertical-align: top; white-space: pre-wrap;',
226 'diff-deletedline' =>
'color: #222; font-size: 88%; border-style: solid; '
227 .
'border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; '
228 .
'vertical-align: top; white-space: pre-wrap;',
229 'diff-context' =>
'background-color: #f8f9fa; color: #222; font-size: 88%; '
230 .
'border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; '
231 .
'border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;',
232 'diffchange' =>
'font-weight: bold; text-decoration: none;',
235 foreach ( $styles as $class => $style ) {
236 $text = preg_replace(
"/(<[^>]+)class=(['\"])$class\\2([^>]*>)/",
237 "\\1style=\"$style\"\\3", $text );
static newFromId( $id, $flags=0)
Load a page revision from a given revision ID number.
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
static formatDiffRow( $title, $oldid, $newid, $timestamp, $comment, $actiontext='')
Really format a diff for the newsfeed.
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
static getForTitle(Title $title)
Returns the appropriate ContentHandler singleton for the given title.
static makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
$wgFeedClasses
Available feeds objects.
Helper functions for feeds.
$wgFeedDiffCutoff
When generating Recentchanges RSS/Atom feed, diffs will not be generated for pages larger than this s...
static getDiffLink(Title $title, $newid, $oldid=null)
Generates a diff link.
static getMain()
Get the RequestContext object associated with the main request.
Content object implementation for representing flat text.
static formatComment( $comment, $title=null, $local=false, $wikiId=null)
This function is called by all recent changes variants, by the page history, and by the user contribu...
static formatDiff( $row)
Format a diff for the newsfeed.
Represents a title within MediaWiki.
static applyDiffStyle( $text)
Hacky application of diff styles for the feeds.
static checkFeedOutput( $type)
Check whether feeds can be used and that $type is a valid feed type.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
$wgFeed
Provide syndication feeds (RSS, Atom) for, e.g., Recentchanges, Newpages.