MediaWiki REL1_37
FeedUtils Class Reference

Helper functions for feeds. More...

Static Public Member Functions

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

Static Protected Member Functions

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

Detailed Description

Helper functions for feeds.

Definition at line 33 of file FeedUtils.php.

Member Function Documentation

◆ applyDiffStyle()

static 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 254 of file FeedUtils.php.

Referenced by formatDiffRow().

◆ checkFeedOutput()

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

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

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

Definition at line 44 of file FeedUtils.php.

References $type, $wgFeed, $wgFeedClasses, and $wgOut.

Referenced by HistoryAction\feed().

◆ formatDiff()

static FeedUtils::formatDiff (   $row)
static

Format a diff for the newsfeed.

Parameters
stdClass$rowRow from the recentchanges table, including fields as appropriate for CommentStore
Returns
string

Definition at line 73 of file FeedUtils.php.

References formatDiffRow(), LogFormatter\newFromRow(), RC_LOG, wfMessage(), and wfTimestamp().

Referenced by ChangesFeed\buildItems().

◆ formatDiffRow()

static 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
int$timestampNew revision's timestamp
string$commentNew revision's comment
string$actiontextText of the action; in case of log event
Returns
string

Definition at line 102 of file FeedUtils.php.

References $lang, $title, $wgFeedDiffCutoff, applyDiffStyle(), Linker\formatComment(), getDiffLink(), and wfMessage().

Referenced by HistoryAction\feedItem(), and formatDiff().

◆ getDiffLink()

static 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 233 of file FeedUtils.php.

References $title, and wfMessage().

Referenced by formatDiffRow().


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