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

Public Member Functions

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

Static Public Member Functions

static flag ( $flag, IContextSource $context=null)
 Make an "<abbr>" element for a given change flag. More...
 
static isDeleted ( $rc, $field)
 Determine if said field of a revision is hidden. More...
 
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. More...
 
static revDateLink (RevisionRecord $rev, Authority $performer, Language $lang, $title=null)
 Render the date and time of a revision in the current user language based on whether the user is able to view this information or not. More...
 
static showCharacterDifference ( $old, $new, IContextSource $context=null)
 Show formatted char difference. More...
 
static userCan ( $rc, $field, Authority $performer=null)
 Determine if the current user is allowed to view a particular field of this revision, if it's marked as deleted. More...
 

Public Attributes

const CSS_CLASS_PREFIX = 'mw-changeslist-'
 

Protected Member Functions

 getDataAttributes (RecentChange $rc)
 Get recommended data attributes for a change line. More...
 
 getHighlightsContainerDiv ()
 Get the container for highlights that are used in the new StructuredFilters system. More...
 
 getHTMLClasses ( $rc, $watched)
 Get an array of default HTML class attributes for the change. More...
 
 getHTMLClassesForFilters ( $rc)
 Get an array of CSS classes attributed to filters for this row. More...
 
 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. More...
 
 maybeWatchedLink ( $link, $watched=false)
 
 numberofWatchingusers ( $count)
 Returns the string which indicates the number of watching users. More...
 
 showAsUnpatrolled (RecentChange $rc)
 

Protected Attributes

callable $changeLinePrefixer
 
RowCommentFormatter $commentFormatter
 
ChangesListFilterGroup[] $filterGroups
 
string[] $formattedComments
 Comments indexed by rc_id. More...
 
 $lastdate
 
LinkRenderer $linkRenderer
 
 $message
 
 $rc_cache
 
 $rcCacheIndex
 
 $rclistOpen
 
 $rcMoveIndex
 
 $watchlist = false
 
MapCacheLRU $watchMsgCache
 

Detailed Description

Definition at line 41 of file ChangesList.php.

Constructor & Destructor Documentation

◆ __construct()

ChangesList::__construct (   $context,
array  $filterGroups = [] 
)
Parameters
IContextSource$context
ChangesListFilterGroup[]$filterGroupsArray of ChangesListFilterGroup objects (currently optional)

Reimplemented in EnhancedChangesList.

Definition at line 84 of file ChangesList.php.

References $filterGroups, and ContextSource\setContext().

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 319 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 434 of file ChangesList.php.

◆ 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 "!".

Styling for these flags is provided through mediawiki.interface.helpers.styles.

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

Definition at line 285 of file ChangesList.php.

References RequestContext\getMain(), ContextSource\setContext(), and wfMessage().

Referenced by SpecialUndelete\formatRevisionRow(), HistoryPager\formatRow(), ContribsPager\formatRow(), 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 | null$newLast change to use, if not provided, $old will be used
Returns
string HTML fragment

Definition at line 414 of file ChangesList.php.

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

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

◆ getArticleLink()

ChangesList::getArticleLink ( $rc,
  $unpatrolled,
  $watched 
)

Get the HTML link to the changed page, possibly with a prefix from hook handlers, and a suffix for temporarily watched items.

Parameters
RecentChange&$rc
bool$unpatrolled
bool$watched
Returns
string HTML
Since
1.26

Definition at line 578 of file ChangesList.php.

References ContextSource\getLanguage(), and getWatchlistExpiry().

Referenced by 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 985 of file ChangesList.php.

References $type, RecentChange\getAttribute(), RecentChange\SRC_CATEGORIZE, RecentChange\SRC_EDIT, RecentChange\SRC_LOG, and RecentChange\SRC_NEW.

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

◆ getHighlightsContainerDiv()

ChangesList::getHighlightsContainerDiv ( )
protected

Get the container for highlights that are used in the new StructuredFilters system.

Returns
string HTML structure of the highlight container div

Definition at line 144 of file ChangesList.php.

Referenced by 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
string[] List of CSS class names

Definition at line 222 of file ChangesList.php.

References Sanitizer\escapeClass(), and 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.

Used for highlighting in the front-end.

Parameters
RecentChange$rc
Returns
string[] Array of CSS classes

Definition at line 253 of file ChangesList.php.

References Sanitizer\escapeClass().

Referenced by getHTMLClasses(), and EnhancedChangesList\recentChangesBlockGroup().

◆ getRollback()

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

Definition at line 890 of file ChangesList.php.

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

◆ getTags()

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

Definition at line 921 of file ChangesList.php.

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

◆ getTimestamp()

ChangesList::getTimestamp (   $rc)

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

Parameters
RecentChange$rc
Deprecated:
use revDateLink instead.
Returns
string HTML fragment

Definition at line 655 of file ChangesList.php.

◆ getWatchlistExpiry()

ChangesList::getWatchlistExpiry ( RecentChange  $recentChange)

Get HTML to display the clock icon for watched items that have a watchlist expiry time.

Since
1.35
Parameters
RecentChange$recentChange
Returns
string The HTML to display an indication of the expiry time.

Definition at line 622 of file ChangesList.php.

Referenced by getArticleLink().

◆ initChangesListRows()

ChangesList::initChangesListRows (   $rows)
Parameters
IResultWrapper | stdClass[]$rows

Definition at line 336 of file ChangesList.php.

◆ insertComment()

ChangesList::insertComment (   $rc)

Insert a formatted comment.

Parameters
RecentChange$rc
Returns
string

Definition at line 743 of file ChangesList.php.

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

◆ insertDateHeader()

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

Definition at line 484 of file ChangesList.php.

References Xml\element(), 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 523 of file ChangesList.php.

References ContextSource\getAuthority(), RC_CATEGORIZE, RC_LOG, and RC_NEW.

◆ insertExtra()

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

Definition at line 927 of file ChangesList.php.

◆ insertLog()

ChangesList::insertLog ( $s,
  $title,
  $logtype,
  $useParentheses = true 
)
Parameters
string&$sHTML to update
Title$title
string$logtype
bool$useParentheses(optional) Wrap log entry in parentheses where needed

Definition at line 503 of file ChangesList.php.

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

◆ insertLogEntry()

ChangesList::insertLogEntry (   $rc)

Insert a formatted action.

Parameters
RecentChange$rc
Returns
string

Definition at line 723 of file ChangesList.php.

References getContext(), and LogFormatter\newFromRow().

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

◆ insertRollback()

ChangesList::insertRollback ( $s,
$rc 
)

Insert a rollback link.

Parameters
string&$s
RecentChange&$rc

Definition at line 836 of file ChangesList.php.

◆ insertTags()

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

Definition at line 901 of file ChangesList.php.

References ChangeTags\formatSummaryRow().

◆ insertTimestamp()

ChangesList::insertTimestamp ( $s,
  $rc 
)

Insert time timestamp string from $rc into $s.

Parameters
string&$sHTML to update
RecentChange$rc

Definition at line 682 of file ChangesList.php.

References getTimestamp().

◆ 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 692 of file ChangesList.php.

◆ 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 975 of file ChangesList.php.

References RC_CATEGORIZE.

Referenced by 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 794 of file ChangesList.php.

Referenced by RCCacheEntryFactory\newFromRecentChange().

◆ isUnpatrolled()

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

Definition at line 940 of file ChangesList.php.

References RC_NEW, User\useFilePatrol(), User\useNPPatrol(), and User\useRCPatrol().

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

◆ isWatchlist()

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

Definition at line 175 of file ChangesList.php.

References $watchlist.

◆ maybeWatchedLink()

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

Definition at line 822 of file ChangesList.php.

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 103 of file ChangesList.php.

References 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 774 of file ChangesList.php.

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

◆ recentChangesFlags()

ChangesList::recentChangesFlags (   $flags,
  $nothing = "\u{00A0}" 
)

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 201 of file ChangesList.php.

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

Referenced by 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 | null$linenumber(default null)
Returns
string|bool

Reimplemented in OldChangesList, and EnhancedChangesList.

Definition at line 134 of file ChangesList.php.

◆ revDateLink()

static ChangesList::revDateLink ( RevisionRecord  $rev,
Authority  $performer,
Language  $lang,
  $title = null 
)
static

Render the date and time of a revision in the current user language based on whether the user is able to view this information or not.

Parameters
RevisionRecord$rev
Authority$performer
Language$lang
Title | null$title(optional) where Title does not match the Title associated with the RevisionRecord
Access: internal
For usage by Pager classes only (e.g. HistoryPager and ContribsPager).
Returns
string HTML

Definition at line 452 of file ChangesList.php.

References $lang, $title, MediaWiki\Revision\RevisionRecord\getId(), MediaWiki\Revision\RevisionRecord\getPageAsLinkTarget(), MediaWiki\Revision\RevisionRecord\getTimestamp(), MediaWiki\Permissions\Authority\getUser(), MediaWiki\Revision\RevisionRecord\isDeleted(), and MediaWiki\Revision\RevisionRecord\userCan().

Referenced by ContribsPager\formatRow().

◆ 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 1016 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 167 of file ChangesList.php.

◆ showAsUnpatrolled()

ChangesList::showAsUnpatrolled ( RecentChange  $rc)
protected

Definition at line 931 of file ChangesList.php.

References getUser().

◆ 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 | null$context
Returns
string

Definition at line 360 of file ChangesList.php.

References $lang, and RequestContext\getMain().

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

◆ userCan()

static ChangesList::userCan (   $rc,
  $field,
Authority  $performer = 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
Authority | null$performerto check permissions against. If null, the global RequestContext's User is assumed instead.
Returns
bool

Definition at line 807 of file ChangesList.php.

References RequestContext\getMain(), RC_LOG, and LogEventsList\userCanBitfield().

Referenced by EnhancedChangesList\getLineData().

Member Data Documentation

◆ $changeLinePrefixer

callable ChangesList::$changeLinePrefixer
protected

Definition at line 55 of file ChangesList.php.

◆ $commentFormatter

RowCommentFormatter ChangesList::$commentFormatter
protected

Definition at line 68 of file ChangesList.php.

◆ $filterGroups

ChangesListFilterGroup [] ChangesList::$filterGroups
protected

Definition at line 78 of file ChangesList.php.

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

◆ $formattedComments

string [] ChangesList::$formattedComments
protected

Comments indexed by rc_id.

Definition at line 73 of file ChangesList.php.

◆ $lastdate

ChangesList::$lastdate
protected

Definition at line 47 of file ChangesList.php.

◆ $linkRenderer

LinkRenderer ChangesList::$linkRenderer
protected

Definition at line 63 of file ChangesList.php.

◆ $message

ChangesList::$message
protected

Definition at line 48 of file ChangesList.php.

◆ $rc_cache

ChangesList::$rc_cache
protected

Definition at line 49 of file ChangesList.php.

◆ $rcCacheIndex

ChangesList::$rcCacheIndex
protected

Definition at line 50 of file ChangesList.php.

◆ $rclistOpen

ChangesList::$rclistOpen
protected

Definition at line 51 of file ChangesList.php.

◆ $rcMoveIndex

ChangesList::$rcMoveIndex
protected

Definition at line 52 of file ChangesList.php.

◆ $watchlist

ChangesList::$watchlist = false
protected

Definition at line 46 of file ChangesList.php.

Referenced by isWatchlist().

◆ $watchMsgCache

MapCacheLRU ChangesList::$watchMsgCache
protected

Definition at line 58 of file ChangesList.php.

◆ CSS_CLASS_PREFIX

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

Definition at line 44 of file ChangesList.php.

Referenced by ChangesListFilter\getCssClass().


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