MediaWiki  master
MediaWiki\Feed\FeedUtils Class Reference

Helper functions for feeds. More...

Static Public Member Functions

static applyDiffStyle ( $text)
 Hacky application of diff styles for the feeds. More...
 
static checkFeedOutput ( $type, $output=null)
 Check whether feeds can be used and that $type is a valid feed type. More...
 
static formatDiff ( $row, $formattedComment=null)
 Format a diff for the newsfeed. More...
 
static formatDiffRow ( $title, $oldid, $newid, $timestamp, $comment, $actiontext='')
 Really format a diff for the newsfeed. More...
 
static formatDiffRow2 ( $title, $oldid, $newid, $timestamp, $formattedComment, $actiontext='')
 Really really format a diff for the newsfeed. More...
 

Static Protected Member Functions

static getDiffLink (Title $title, $newid, $oldid=null)
 Generates a diff link. More...
 

Detailed Description

Helper functions for feeds.

Definition at line 45 of file FeedUtils.php.

Member Function Documentation

◆ applyDiffStyle()

static MediaWiki\Feed\FeedUtils::applyDiffStyle (   $text)
static

Hacky application of diff styles for the feeds.

Might be 'cleaner' to use DOM or XSLT or something, but gack it's a pain in the ass.

Parameters
string$textDiff's HTML output
Returns
string Modified HTML

Definition at line 295 of file FeedUtils.php.

Referenced by MediaWiki\Feed\FeedUtils\formatDiffRow2().

◆ checkFeedOutput()

static MediaWiki\Feed\FeedUtils::checkFeedOutput (   $type,
  $output = null 
)
static

Check whether feeds can be used and that $type is a valid feed type.

Parameters
string$typeFeed type, as requested by the user
OutputPage | null$outputNull falls back to $wgOut
Returns
bool
Since
1.36 $output parameter added

Definition at line 56 of file FeedUtils.php.

References $type, $wgOut, MediaWiki\MainConfigNames\Feed, MediaWiki\MainConfigNames\FeedClasses, and MediaWiki\MediaWikiServices\getInstance().

◆ formatDiff()

static MediaWiki\Feed\FeedUtils::formatDiff (   $row,
  $formattedComment = null 
)
static

Format a diff for the newsfeed.

Parameters
\\stdClass$rowRow from the recentchanges table, including fields as appropriate for CommentStore
string | null$formattedCommentrc_comment in HTML format, or null to format it on demand.
Returns
string

Definition at line 87 of file FeedUtils.php.

References MediaWiki\Revision\RevisionRecord\DELETED_COMMENT, MediaWiki\Feed\FeedUtils\formatDiffRow2(), MediaWiki\MediaWikiServices\getInstance(), Title\makeTitle(), LogFormatter\newFromRow(), RC_LOG, wfMessage(), and wfTimestamp().

◆ formatDiffRow()

static MediaWiki\Feed\FeedUtils::formatDiffRow (   $title,
  $oldid,
  $newid,
  $timestamp,
  $comment,
  $actiontext = '' 
)
static

Really format a diff for the newsfeed.

Parameters
Title$title
int$oldidOld revision's id
int$newidNew revision's id
string$timestampNew revision's timestamp
string$commentNew revision's comment
string$actiontextText of the action; in case of log event
Returns
string
Deprecated:
since 1.38 use formatDiffRow2

Definition at line 123 of file FeedUtils.php.

References $title, MediaWiki\Feed\FeedUtils\formatDiffRow2(), and MediaWiki\MediaWikiServices\getInstance().

◆ formatDiffRow2()

static MediaWiki\Feed\FeedUtils::formatDiffRow2 (   $title,
  $oldid,
  $newid,
  $timestamp,
  $formattedComment,
  $actiontext = '' 
)
static

Really really format a diff for the newsfeed.

Same as formatDiffRow() except with preformatted comments.

Parameters
Title$title
int$oldidOld revision's id
int$newidNew revision's id
string$timestampNew revision's timestamp
string$formattedCommentNew revision's comment in HTML format
string$actiontextText of the action; in case of log event
Returns
string

Definition at line 144 of file FeedUtils.php.

References $lang, $title, MediaWiki\Feed\FeedUtils\applyDiffStyle(), MediaWiki\MainConfigNames\FeedDiffCutoff, MediaWiki\Feed\FeedUtils\getDiffLink(), MediaWiki\MediaWikiServices\getInstance(), RequestContext\getMain(), MediaWiki\Revision\SlotRecord\MAIN, MediaWiki\Revision\RevisionRecord\RAW, Html\rawElement(), and wfMessage().

Referenced by MediaWiki\Feed\FeedUtils\formatDiff(), and MediaWiki\Feed\FeedUtils\formatDiffRow().

◆ getDiffLink()

static MediaWiki\Feed\FeedUtils::getDiffLink ( Title  $title,
  $newid,
  $oldid = null 
)
staticprotected

Generates a diff link.

Used when the full diff is not wanted for example when $wgFeedDiffCutoff is 0.

Parameters
Title$titleTitle object: used to generate the diff URL
int$newidNewid for this diff
int | null$oldidOldid for the diff. Null means it is a new article
Returns
string

Definition at line 274 of file FeedUtils.php.

References $title, Html\element(), and wfMessage().

Referenced by MediaWiki\Feed\FeedUtils\formatDiffRow2().


The documentation for this class was generated from the following file: