MediaWiki  1.28.0
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)
 Check whether feeds can be used and that $type is a valid feed type. More...
 
static checkPurge ($timekey, $key)
 Check whether feed's cache should be cleared; for changes feeds If the feed should be purged; $timekey and $key will be removed from cache. More...
 
static formatDiff ($row)
 Format a diff for the newsfeed. More...
 
static formatDiffRow ($title, $oldid, $newid, $timestamp, $comment, $actiontext= '')
 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 29 of file FeedUtils.php.

Member Function Documentation

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

References as.

static FeedUtils::checkFeedOutput (   $type)
static

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

Parameters
string$typeFeed type, as requested by the user
Returns
bool

Definition at line 56 of file FeedUtils.php.

References $type, $wgOut, and global.

Referenced by ChangesFeed\execute(), and HistoryAction\feed().

static FeedUtils::checkPurge (   $timekey,
  $key 
)
static

Check whether feed's cache should be cleared; for changes feeds If the feed should be purged; $timekey and $key will be removed from cache.

Parameters
string$timekeyCache key of the timestamp of the last item
string$keyCache key of feed's content

Definition at line 38 of file FeedUtils.php.

References $cache, $wgRequest, $wgUser, ObjectCache\getMainWANInstance(), and global.

Referenced by ChangesFeed\execute().

static FeedUtils::formatDiff (   $row)
static

Format a diff for the newsfeed.

Parameters
object$rowRow from the recentchanges table
Returns
string

Definition at line 78 of file FeedUtils.php.

References $timestamp, array(), Revision\DELETED_COMMENT, Title\makeTitle(), LogFormatter\newFromRow(), RC_LOG, TS_MW, wfMessage(), and wfTimestamp().

Referenced by ChangesFeed\buildItems().

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

Really format a diff for the newsfeed.

Parameters
Title$titleTitle object
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 107 of file FeedUtils.php.

References $comment, $context, $html, $rev, $timestamp, $title, $wgLang, Linker\formatComment(), ContentHandler\getForTitle(), RequestContext\getMain(), global, Revision\newFromId(), text, User, and wfMessage().

Referenced by HistoryAction\feedItem().

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

References Html\element(), Title\getFullURL(), text, and wfMessage().


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