MediaWiki REL1_31
ChangesList Class Reference
Inheritance diagram for ChangesList:
Collaboration diagram for ChangesList:

Public Member Functions

 __construct ( $obj, array $filterGroups=[])
 Changeslist constructor.
 
 beginRecentChangesList ()
 Returns text for the start of the tabular part of RC.
 
 endRecentChangesList ()
 Returns text for the end of RC.
 
 formatCharacterDifference (RecentChange $old, RecentChange $new=null)
 Format the character difference of one or several changes.
 
 getArticleLink (&$rc, $unpatrolled, $watched)
 
 getRollback (RecentChange $rc)
 
 getTags (RecentChange $rc, array &$classes)
 
 getTimestamp ( $rc)
 Get the timestamp from $rc formatted with current user's settings and a separator.
 
 initChangesListRows ( $rows)
 
 insertArticleLink (&$s, RecentChange $rc, $unpatrolled, $watched)
 
 insertComment ( $rc)
 Insert a formatted comment.
 
 insertDateHeader (&$s, $rc_timestamp)
 
 insertDiffHist (&$s, &$rc, $unpatrolled=null)
 
 insertExtra (&$s, &$rc, &$classes)
 
 insertLog (&$s, $title, $logtype)
 
 insertLogEntry ( $rc)
 Insert a formatted action.
 
 insertRollback (&$s, &$rc)
 Inserts a rollback link.
 
 insertTags (&$s, &$rc, &$classes)
 
 insertTimestamp (&$s, $rc)
 Insert time timestamp string from $rc into $s.
 
 insertUserRelatedLinks (&$s, &$rc)
 Insert links to user page, user talk page and eventually a blocking link.
 
 isWatchlist ()
 
 recentChangesFlags ( $flags, $nothing=' ')
 Returns the appropriate flags for new page, minor change and patrolling.
 
 recentChangesLine (&$rc, $watched=false, $linenumber=null)
 Format a line.
 
 setChangeLinePrefixer (callable $prefixer)
 Sets the callable that generates a change line prefix added to the beginning of each line.
 
 setWatchlistDivs ( $value=true)
 Sets the list to use a "<li class='watchlist-(namespace)-(page)'>" tag.
 
- Public Member Functions inherited from ContextSource
 canUseWikiPage ()
 Check whether a WikiPage object can be get with getWikiPage().
 
 exportSession ()
 Export the resolved user IP, HTTP headers, user ID, and session ID.
 
 getConfig ()
 
 getContext ()
 Get the base IContextSource object.
 
 getLanguage ()
 
 getOutput ()
 
 getRequest ()
 
 getSkin ()
 
 getStats ()
 
 getTiming ()
 
 getTitle ()
 
 getUser ()
 
 getWikiPage ()
 Get the WikiPage object.
 
 msg ( $key)
 Get a Message object with context set Parameters are the same as wfMessage()
 
 setContext (IContextSource $context)
 

Static Public Member Functions

static flag ( $flag, IContextSource $context=null)
 Make an "<abbr>" element for a given change flag.
 
static isDeleted ( $rc, $field)
 Determine if said field of a revision is hidden.
 
static isUnpatrolled ( $rc, User $user)
 
static newFromContext (IContextSource $context, array $groups=[])
 Fetch an appropriate changes list class for the specified context Some users might want to use an enhanced list format, for instance.
 
static showCharacterDifference ( $old, $new, IContextSource $context=null)
 Show formatted char difference.
 
static userCan ( $rc, $field, User $user=null)
 Determine if the current user is allowed to view a particular field of this revision, if it's marked as deleted.
 

Public Attributes

Skin $skin
 
const CSS_CLASS_PREFIX = 'mw-changeslist-'
 

Protected Member Functions

 getDataAttributes (RecentChange $rc)
 Get recommended data attributes for a change line.
 
 getHTMLClasses ( $rc, $watched)
 Get an array of default HTML class attributes for the change.
 
 getHTMLClassesForFilters ( $rc)
 Get an array of CSS classes attributed to filters for this row.
 
 isCategorizationWithoutRevision ( $rcObj)
 Determines whether a revision is linked to this change; this may not be the case when the categorization wasn't done by an edit but a conditional parser function.
 
 maybeWatchedLink ( $link, $watched=false)
 
 numberofWatchingusers ( $count)
 Returns the string which indicates the number of watching users.
 
 showAsUnpatrolled (RecentChange $rc)
 

Protected Attributes

callable $changeLinePrefixer
 
array $filterGroups
 
 $lastdate
 
LinkRenderer $linkRenderer
 
 $message
 
 $rc_cache
 
 $rcCacheIndex
 
 $rclistOpen
 
 $rcMoveIndex
 
 $watchlist = false
 
BagOStuff $watchMsgCache
 

Private Member Functions

 preCacheMessages ()
 As we use the same small set of messages in various methods and that they are called often, we call them once and save them in $this->message.
 

Detailed Description

Definition at line 28 of file ChangesList.php.

Constructor & Destructor Documentation

◆ __construct()

ChangesList::__construct ( $obj,
array $filterGroups = [] )

Changeslist constructor.

Parameters
Skin | IContextSource$obj
array$filterGroupsArray of ChangesListFilterGroup objects (currently optional)

Reimplemented in EnhancedChangesList.

Definition at line 66 of file ChangesList.php.

References $filterGroups, preCacheMessages(), ContextSource\setContext(), and skin().

Member Function Documentation

◆ beginRecentChangesList()

ChangesList::beginRecentChangesList ( )

Returns text for the start of the tabular part of RC.

Returns
string

Reimplemented in EnhancedChangesList.

Definition at line 261 of file ChangesList.php.

References ContextSource\getOutput().

◆ endRecentChangesList()

ChangesList::endRecentChangesList ( )

Returns text for the end of RC.

Returns
string

Reimplemented in EnhancedChangesList.

Definition at line 362 of file ChangesList.php.

References $out.

◆ flag()

static ChangesList::flag ( $flag,
IContextSource $context = null )
static

Make an "<abbr>" element for a given change flag.

The flag indicating a new page, minor edit, bot edit, or unpatrolled edit. In English it typically contains "N", "m", "b", or "!".

Parameters
string$flagOne key of $wgRecentChangesFlags
IContextSource$context
Returns
string HTML

Definition at line 228 of file ChangesList.php.

References ContextSource\$context, $value, $wgRecentChangesFlags, RequestContext\getMain(), ContextSource\setContext(), text, and wfMessage().

Referenced by SpecialUndelete\diffHeader(), DeletedContribsPager\formatRevisionRow(), SpecialUndelete\formatRevisionRow(), ContribsPager\formatRow(), HistoryPager\historyLine(), recentChangesFlags(), and DifferenceEngine\showDiffPage().

◆ formatCharacterDifference()

ChangesList::formatCharacterDifference ( RecentChange $old,
RecentChange $new = null )

Format the character difference of one or several changes.

Parameters
RecentChange$old
RecentChange$newLast change to use, if not provided, $old will be used
Returns
string HTML fragment

Definition at line 342 of file ChangesList.php.

References ContextSource\getContext(), and showCharacterDifference().

Referenced by OldChangesList\formatChangeLine(), EnhancedChangesList\getLineData(), EnhancedChangesList\recentChangesBlockGroup(), and EnhancedChangesList\recentChangesBlockLine().

◆ getArticleLink()

ChangesList::getArticleLink ( & $rc,
$unpatrolled,
$watched )
Parameters
RecentChange&$rc
bool$unpatrolled
bool$watched
Returns
string HTML
Since
1.26

Definition at line 467 of file ChangesList.php.

References $changesList, $params, $s, ContextSource\getLanguage(), and isDeleted().

Referenced by OldChangesList\formatChangeLine(), insertArticleLink(), EnhancedChangesList\recentChangesBlockGroup(), and EnhancedChangesList\recentChangesBlockLine().

◆ getDataAttributes()

ChangesList::getDataAttributes ( RecentChange $rc)
protected

Get recommended data attributes for a change line.

Parameters
RecentChange$rc
Returns
string[] attribute name => value

Definition at line 757 of file ChangesList.php.

References $type.

Referenced by EnhancedChangesList\getLineData(), EnhancedChangesList\recentChangesBlockLine(), and OldChangesList\recentChangesLine().

◆ getHTMLClasses()

ChangesList::getHTMLClasses ( $rc,
$watched )
protected

Get an array of default HTML class attributes for the change.

Parameters
RecentChange | RCCacheEntry$rc
string | bool$watchedOptionally timestamp for adding watched class
Returns
array of classes

Definition at line 174 of file ChangesList.php.

References getHTMLClassesForFilters().

Referenced by EnhancedChangesList\getLineData(), EnhancedChangesList\recentChangesBlockLine(), and OldChangesList\recentChangesLine().

◆ getHTMLClassesForFilters()

ChangesList::getHTMLClassesForFilters ( $rc)
protected

Get an array of CSS classes attributed to filters for this row.

Parameters
RecentChange$rc
Returns
array Array of CSS classes

Definition at line 206 of file ChangesList.php.

Referenced by getHTMLClasses().

◆ getRollback()

ChangesList::getRollback ( RecentChange $rc)
Parameters
RecentChange$rc
Returns
string
Since
1.26

Definition at line 662 of file ChangesList.php.

References $s, and insertRollback().

Referenced by EnhancedChangesList\getLineData(), and EnhancedChangesList\recentChangesBlockLine().

◆ getTags()

ChangesList::getTags ( RecentChange $rc,
array & $classes )
Parameters
RecentChange$rc
array&$classes
Returns
string
Since
1.26

Definition at line 693 of file ChangesList.php.

References $s, and insertTags().

Referenced by EnhancedChangesList\getLineData(), and EnhancedChangesList\recentChangesBlockLine().

◆ getTimestamp()

ChangesList::getTimestamp ( $rc)

Get the timestamp from $rc formatted with current user's settings and a separator.

Parameters
RecentChange$rc
Returns
string HTML fragment

Definition at line 504 of file ChangesList.php.

References ContextSource\getLanguage().

Referenced by insertTimestamp().

◆ initChangesListRows()

ChangesList::initChangesListRows ( $rows)
Parameters
ResultWrapper | array$rows

Definition at line 275 of file ChangesList.php.

References $rows.

◆ insertArticleLink()

ChangesList::insertArticleLink ( & $s,
RecentChange $rc,
$unpatrolled,
$watched )
Parameters
string&$sArticle link will be appended to this string, in place.
RecentChange$rc
bool$unpatrolled
bool$watched
Deprecated
since 1.27, use getArticleLink instead.

Definition at line 456 of file ChangesList.php.

References $s, and getArticleLink().

◆ insertComment()

ChangesList::insertComment ( $rc)

Insert a formatted comment.

Parameters
RecentChange$rc
Returns
string

Definition at line 560 of file ChangesList.php.

References Linker\commentBlock(), isDeleted(), and ContextSource\msg().

Referenced by OldChangesList\formatChangeLine(), EnhancedChangesList\getLineData(), and EnhancedChangesList\recentChangesBlockLine().

◆ insertDateHeader()

ChangesList::insertDateHeader ( & $s,
$rc_timestamp )
Parameters
string&$sHTML to update
mixed$rc_timestamp

Definition at line 373 of file ChangesList.php.

References $s, ContextSource\getLanguage(), and ContextSource\getUser().

Referenced by OldChangesList\recentChangesLine().

◆ insertDiffHist()

ChangesList::insertDiffHist ( & $s,
& $rc,
$unpatrolled = null )
Parameters
string&$sHTML to update
RecentChange&$rc
bool | null$unpatrolledUnused variable, since 1.27.

Definition at line 404 of file ChangesList.php.

References $query, $s, ContextSource\getUser(), ContextSource\msg(), RC_CATEGORIZE, RC_LOG, and RC_NEW.

Referenced by OldChangesList\formatChangeLine().

◆ insertExtra()

ChangesList::insertExtra ( & $s,
& $rc,
& $classes )

Definition at line 699 of file ChangesList.php.

Referenced by OldChangesList\formatChangeLine().

◆ insertLog()

ChangesList::insertLog ( & $s,
$title,
$logtype )
Parameters
string&$sHTML to update
Title$title
string$logtype

Definition at line 391 of file ChangesList.php.

References $s, ContextSource\getContext(), and ContextSource\msg().

Referenced by OldChangesList\formatChangeLine().

◆ insertLogEntry()

ChangesList::insertLogEntry ( $rc)

◆ insertRollback()

ChangesList::insertRollback ( & $s,
& $rc )

Inserts a rollback link.

Parameters
string&$s
RecentChange&$rc

Definition at line 633 of file ChangesList.php.

References $rev, $s, Linker\generateRollback(), ContextSource\getContext(), ContextSource\getUser(), and RC_EDIT.

Referenced by OldChangesList\formatChangeLine(), and getRollback().

◆ insertTags()

ChangesList::insertTags ( & $s,
& $rc,
& $classes )
Parameters
string&$s
RecentChange&$rc
array&$classes

Definition at line 673 of file ChangesList.php.

References $s, ChangeTags\formatSummaryRow(), and list.

Referenced by OldChangesList\formatChangeLine(), and getTags().

◆ insertTimestamp()

ChangesList::insertTimestamp ( & $s,
$rc )

Insert time timestamp string from $rc into $s.

Parameters
string&$sHTML to update
RecentChange$rc

Definition at line 519 of file ChangesList.php.

References $s, and getTimestamp().

Referenced by OldChangesList\formatChangeLine().

◆ insertUserRelatedLinks()

ChangesList::insertUserRelatedLinks ( & $s,
& $rc )

Insert links to user page, user talk page and eventually a blocking link.

Parameters
string&$sHTML to update
RecentChange&$rc

Definition at line 529 of file ChangesList.php.

References $s, ContextSource\getLanguage(), isDeleted(), ContextSource\msg(), Linker\userLink(), and Linker\userToolLinks().

Referenced by OldChangesList\formatChangeLine().

◆ isCategorizationWithoutRevision()

ChangesList::isCategorizationWithoutRevision ( $rcObj)
protected

Determines whether a revision is linked to this change; this may not be the case when the categorization wasn't done by an edit but a conditional parser function.

Since
1.27
Parameters
RecentChange | RCCacheEntry$rcObj
Returns
bool

Definition at line 747 of file ChangesList.php.

References RC_CATEGORIZE.

Referenced by OldChangesList\formatChangeLine(), EnhancedChangesList\getLineData(), and EnhancedChangesList\recentChangesBlockLine().

◆ isDeleted()

static ChangesList::isDeleted ( $rc,
$field )
static

Determine if said field of a revision is hidden.

Parameters
RCCacheEntry | RecentChange$rc
int$fieldOne of DELETED_* bitfield constants
Returns
bool

Definition at line 595 of file ChangesList.php.

Referenced by getArticleLink(), EnhancedChangesList\getLineData(), RCCacheEntryFactory\getUserLink(), insertComment(), insertUserRelatedLinks(), RCCacheEntryFactory\newFromRecentChange(), and EnhancedChangesList\recentChangesBlockGroup().

◆ isUnpatrolled()

static ChangesList::isUnpatrolled ( $rc,
User $user )
static
Parameters
object | RecentChange$rcDatabase row from recentchanges or a RecentChange object
User$user
Returns
bool

Definition at line 712 of file ChangesList.php.

References RC_NEW.

Referenced by ApiQueryWatchlist\extractOutputData(), ApiQueryRecentChanges\extractRowInfo(), RCCacheEntryFactory\newFromRecentChange(), and showAsUnpatrolled().

◆ isWatchlist()

ChangesList::isWatchlist ( )
Returns
bool True when setWatchlistDivs has been called
Since
1.23

Definition at line 130 of file ChangesList.php.

References $watchlist.

◆ maybeWatchedLink()

ChangesList::maybeWatchedLink ( $link,
$watched = false )
protected
Parameters
string$link
bool$watched
Returns
string

Definition at line 620 of file ChangesList.php.

References $link.

Referenced by EnhancedChangesList\recentChangesBlockGroup().

◆ newFromContext()

static ChangesList::newFromContext ( IContextSource $context,
array $groups = [] )
static

Fetch an appropriate changes list class for the specified context Some users might want to use an enhanced list format, for instance.

Parameters
IContextSource$context
array$groupsArray of ChangesListFilterGroup objects (currently optional)
Returns
ChangesList

Definition at line 88 of file ChangesList.php.

References ContextSource\$context, IContextSource\getRequest(), IContextSource\getSkin(), and IContextSource\getUser().

Referenced by SpecialRecentChanges\outputChangesList(), and SpecialWatchlist\outputChangesList().

◆ numberofWatchingusers()

ChangesList::numberofWatchingusers ( $count)
protected

Returns the string which indicates the number of watching users.

Parameters
int$countNumber of user watching a page
Returns
string

Definition at line 574 of file ChangesList.php.

References $cache, $watchMsgCache, function, BagOStuff\getWithSetCallback(), and ContextSource\msg().

Referenced by OldChangesList\formatChangeLine(), EnhancedChangesList\recentChangesBlockGroup(), and EnhancedChangesList\recentChangesBlockLine().

◆ preCacheMessages()

ChangesList::preCacheMessages ( )
private

As we use the same small set of messages in various methods and that they are called often, we call them once and save them in $this->message.

Definition at line 138 of file ChangesList.php.

References ContextSource\msg().

Referenced by __construct().

◆ recentChangesFlags()

ChangesList::recentChangesFlags ( $flags,
$nothing = '&#160;' )

Returns the appropriate flags for new page, minor change and patrolling.

Parameters
array$flagsAssociative array of 'flag' => Bool
string$nothingTo use for empty space
Returns
string

Definition at line 155 of file ChangesList.php.

References flag(), ContextSource\getConfig(), and ContextSource\getContext().

Referenced by OldChangesList\formatChangeLine(), EnhancedChangesList\getLineData(), EnhancedChangesList\recentChangesBlockGroup(), and EnhancedChangesList\recentChangesBlockLine().

◆ recentChangesLine()

ChangesList::recentChangesLine ( & $rc,
$watched = false,
$linenumber = null )

Format a line.

Since
1.27
Parameters
RecentChange&$rcPassed by reference
bool$watched(default false)
int$linenumber(default null)
Returns
string|bool

Reimplemented in EnhancedChangesList, and OldChangesList.

Definition at line 114 of file ChangesList.php.

◆ setChangeLinePrefixer()

ChangesList::setChangeLinePrefixer ( callable $prefixer)

Sets the callable that generates a change line prefix added to the beginning of each line.

Parameters
callable$prefixerCallable to run that generates the change line prefix. Takes three parameters: a RecentChange object, a ChangesList object, and whether the current entry is a grouped entry.

Definition at line 785 of file ChangesList.php.

◆ setWatchlistDivs()

ChangesList::setWatchlistDivs ( $value = true)

Sets the list to use a "<li class='watchlist-(namespace)-(page)'>" tag.

Parameters
bool$value

Definition at line 122 of file ChangesList.php.

References $value.

◆ showAsUnpatrolled()

ChangesList::showAsUnpatrolled ( RecentChange $rc)
protected

Definition at line 703 of file ChangesList.php.

References ContextSource\getUser(), and isUnpatrolled().

Referenced by OldChangesList\formatChangeLine().

◆ showCharacterDifference()

static ChangesList::showCharacterDifference ( $old,
$new,
IContextSource $context = null )
static

Show formatted char difference.

Needs the css module 'mediawiki.special.changeslist' to style output

Parameters
int$oldNumber of bytes
int$newNumber of bytes
IContextSource$context
Returns
string

Definition at line 289 of file ChangesList.php.

References $code, ContextSource\$context, $lang, IContextSource\getConfig(), IContextSource\getLanguage(), RequestContext\getMain(), and MessageLocalizer\msg().

Referenced by formatCharacterDifference(), ContribsPager\formatRow(), RecentChange\getCharacterDifference(), and HistoryPager\historyLine().

◆ userCan()

static ChangesList::userCan ( $rc,
$field,
User $user = null )
static

Determine if the current user is allowed to view a particular field of this revision, if it's marked as deleted.

Parameters
RCCacheEntry | RecentChange$rc
int$field
User$userUser object to check, or null to use $wgUser
Returns
bool

Definition at line 607 of file ChangesList.php.

References RC_LOG, and LogEventsList\userCanBitfield().

Referenced by EnhancedChangesList\getLineData(), EnhancedChangesList\getLogText(), and RCCacheEntryFactory\showDiffLinks().

Member Data Documentation

◆ $changeLinePrefixer

callable ChangesList::$changeLinePrefixer
protected

Definition at line 45 of file ChangesList.php.

◆ $filterGroups

array ChangesList::$filterGroups
protected

Definition at line 58 of file ChangesList.php.

Referenced by __construct(), and EnhancedChangesList\__construct().

◆ $lastdate

ChangesList::$lastdate
protected

Definition at line 37 of file ChangesList.php.

◆ $linkRenderer

LinkRenderer ChangesList::$linkRenderer
protected

Definition at line 53 of file ChangesList.php.

◆ $message

ChangesList::$message
protected

Definition at line 38 of file ChangesList.php.

◆ $rc_cache

ChangesList::$rc_cache
protected

Definition at line 39 of file ChangesList.php.

◆ $rcCacheIndex

ChangesList::$rcCacheIndex
protected

Definition at line 40 of file ChangesList.php.

◆ $rclistOpen

ChangesList::$rclistOpen
protected

Definition at line 41 of file ChangesList.php.

◆ $rcMoveIndex

ChangesList::$rcMoveIndex
protected

Definition at line 42 of file ChangesList.php.

◆ $skin

Skin ChangesList::$skin

Definition at line 34 of file ChangesList.php.

◆ $watchlist

ChangesList::$watchlist = false
protected

Definition at line 36 of file ChangesList.php.

Referenced by isWatchlist().

◆ $watchMsgCache

BagOStuff ChangesList::$watchMsgCache
protected

Definition at line 48 of file ChangesList.php.

Referenced by numberofWatchingusers().

◆ CSS_CLASS_PREFIX

const ChangesList::CSS_CLASS_PREFIX = 'mw-changeslist-'

Definition at line 29 of file ChangesList.php.

Referenced by ChangesListFilter\getCssClass().


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