MediaWiki  1.27.2
ChangesList.php
Go to the documentation of this file.
1 <?php
25 class ChangesList extends ContextSource {
29  public $skin;
30 
31  protected $watchlist = false;
32  protected $lastdate;
33  protected $message;
34  protected $rc_cache;
35  protected $rcCacheIndex;
36  protected $rclistOpen;
37  protected $rcMoveIndex;
38 
40  protected $watchMsgCache;
41 
47  public function __construct( $obj ) {
48  if ( $obj instanceof IContextSource ) {
49  $this->setContext( $obj );
50  $this->skin = $obj->getSkin();
51  } else {
52  $this->setContext( $obj->getContext() );
53  $this->skin = $obj;
54  }
55  $this->preCacheMessages();
56  $this->watchMsgCache = new HashBagOStuff( [ 'maxKeys' => 50 ] );
57  }
58 
66  public static function newFromContext( IContextSource $context ) {
67  $user = $context->getUser();
68  $sk = $context->getSkin();
69  $list = null;
70  if ( Hooks::run( 'FetchChangesList', [ $user, &$sk, &$list ] ) ) {
71  $new = $context->getRequest()->getBool( 'enhanced', $user->getOption( 'usenewrc' ) );
72 
73  return $new ? new EnhancedChangesList( $context ) : new OldChangesList( $context );
74  } else {
75  return $list;
76  }
77  }
78 
90  public function recentChangesLine( &$rc, $watched = false, $linenumber = null ) {
91  throw new RuntimeException( 'recentChangesLine should be implemented' );
92  }
93 
98  public function setWatchlistDivs( $value = true ) {
99  $this->watchlist = $value;
100  }
101 
106  public function isWatchlist() {
107  return (bool)$this->watchlist;
108  }
109 
114  private function preCacheMessages() {
115  if ( !isset( $this->message ) ) {
116  foreach ( [
117  'cur', 'diff', 'hist', 'enhancedrc-history', 'last', 'blocklink', 'history',
118  'semicolon-separator', 'pipe-separator' ] as $msg
119  ) {
120  $this->message[$msg] = $this->msg( $msg )->escaped();
121  }
122  }
123  }
124 
131  public function recentChangesFlags( $flags, $nothing = '&#160;' ) {
132  $f = '';
133  foreach ( array_keys( $this->getConfig()->get( 'RecentChangesFlags' ) ) as $flag ) {
134  $f .= isset( $flags[$flag] ) && $flags[$flag]
135  ? self::flag( $flag, $this->getContext() )
136  : $nothing;
137  }
138 
139  return $f;
140  }
141 
150  protected function getHTMLClasses( $rc, $watched ) {
151  $classes = [];
152  $logType = $rc->mAttribs['rc_log_type'];
153 
154  if ( $logType ) {
155  $classes[] = Sanitizer::escapeClass( 'mw-changeslist-log-' . $logType );
156  } else {
157  $classes[] = Sanitizer::escapeClass( 'mw-changeslist-ns' .
158  $rc->mAttribs['rc_namespace'] . '-' . $rc->mAttribs['rc_title'] );
159  }
160 
161  // Indicate watched status on the line to allow for more
162  // comprehensive styling.
163  $classes[] = $watched && $rc->mAttribs['rc_timestamp'] >= $watched
164  ? 'mw-changeslist-line-watched'
165  : 'mw-changeslist-line-not-watched';
166 
167  return $classes;
168  }
169 
178  public static function flag( $flag, IContextSource $context = null ) {
179  static $map = [ 'minoredit' => 'minor', 'botedit' => 'bot' ];
180  static $flagInfos = null;
181 
182  if ( is_null( $flagInfos ) ) {
183  global $wgRecentChangesFlags;
184  $flagInfos = [];
185  foreach ( $wgRecentChangesFlags as $key => $value ) {
186  $flagInfos[$key]['letter'] = $value['letter'];
187  $flagInfos[$key]['title'] = $value['title'];
188  // Allow customized class name, fall back to flag name
189  $flagInfos[$key]['class'] = isset( $value['class'] ) ? $value['class'] : $key;
190  }
191  }
192 
194 
195  // Inconsistent naming, kepted for b/c
196  if ( isset( $map[$flag] ) ) {
197  $flag = $map[$flag];
198  }
199 
200  $info = $flagInfos[$flag];
201  return Html::element( 'abbr', [
202  'class' => $info['class'],
203  'title' => wfMessage( $info['title'] )->setContext( $context )->text(),
204  ], wfMessage( $info['letter'] )->setContext( $context )->text() );
205  }
206 
211  public function beginRecentChangesList() {
212  $this->rc_cache = [];
213  $this->rcMoveIndex = 0;
214  $this->rcCacheIndex = 0;
215  $this->lastdate = '';
216  $this->rclistOpen = false;
217  $this->getOutput()->addModuleStyles( 'mediawiki.special.changeslist' );
218 
219  return '<div class="mw-changeslist">';
220  }
221 
225  public function initChangesListRows( $rows ) {
226  Hooks::run( 'ChangesListInitRows', [ $this, $rows ] );
227  }
228 
236  public static function showCharacterDifference( $old, $new, IContextSource $context = null ) {
237  if ( !$context ) {
239  }
240 
241  $new = (int)$new;
242  $old = (int)$old;
243  $szdiff = $new - $old;
244 
246  $config = $context->getConfig();
247  $code = $lang->getCode();
248  static $fastCharDiff = [];
249  if ( !isset( $fastCharDiff[$code] ) ) {
250  $fastCharDiff[$code] = $config->get( 'MiserMode' )
251  || $context->msg( 'rc-change-size' )->plain() === '$1';
252  }
253 
254  $formattedSize = $lang->formatNum( $szdiff );
255 
256  if ( !$fastCharDiff[$code] ) {
257  $formattedSize = $context->msg( 'rc-change-size', $formattedSize )->text();
258  }
259 
260  if ( abs( $szdiff ) > abs( $config->get( 'RCChangedSizeThreshold' ) ) ) {
261  $tag = 'strong';
262  } else {
263  $tag = 'span';
264  }
265 
266  if ( $szdiff === 0 ) {
267  $formattedSizeClass = 'mw-plusminus-null';
268  } elseif ( $szdiff > 0 ) {
269  $formattedSize = '+' . $formattedSize;
270  $formattedSizeClass = 'mw-plusminus-pos';
271  } else {
272  $formattedSizeClass = 'mw-plusminus-neg';
273  }
274 
275  $formattedTotalSize = $context->msg( 'rc-change-size-new' )->numParams( $new )->text();
276 
277  return Html::element( $tag,
278  [ 'dir' => 'ltr', 'class' => $formattedSizeClass, 'title' => $formattedTotalSize ],
279  $context->msg( 'parentheses', $formattedSize )->plain() ) . $lang->getDirMark();
280  }
281 
289  public function formatCharacterDifference( RecentChange $old, RecentChange $new = null ) {
290  $oldlen = $old->mAttribs['rc_old_len'];
291 
292  if ( $new ) {
293  $newlen = $new->mAttribs['rc_new_len'];
294  } else {
295  $newlen = $old->mAttribs['rc_new_len'];
296  }
297 
298  if ( $oldlen === null || $newlen === null ) {
299  return '';
300  }
301 
302  return self::showCharacterDifference( $oldlen, $newlen, $this->getContext() );
303  }
304 
309  public function endRecentChangesList() {
310  $out = $this->rclistOpen ? "</ul>\n" : '';
311  $out .= '</div>';
312 
313  return $out;
314  }
315 
320  public function insertDateHeader( &$s, $rc_timestamp ) {
321  # Make date header if necessary
322  $date = $this->getLanguage()->userDate( $rc_timestamp, $this->getUser() );
323  if ( $date != $this->lastdate ) {
324  if ( $this->lastdate != '' ) {
325  $s .= "</ul>\n";
326  }
327  $s .= Xml::element( 'h4', null, $date ) . "\n<ul class=\"special\">";
328  $this->lastdate = $date;
329  $this->rclistOpen = true;
330  }
331  }
332 
338  public function insertLog( &$s, $title, $logtype ) {
339  $page = new LogPage( $logtype );
340  $logname = $page->getName()->setContext( $this->getContext() )->escaped();
341  $s .= $this->msg( 'parentheses' )->rawParams( Linker::linkKnown( $title, $logname ) )->escaped();
342  }
343 
349  public function insertDiffHist( &$s, &$rc, $unpatrolled = null ) {
350  # Diff link
351  if (
352  $rc->mAttribs['rc_type'] == RC_NEW ||
353  $rc->mAttribs['rc_type'] == RC_LOG ||
354  $rc->mAttribs['rc_type'] == RC_CATEGORIZE
355  ) {
356  $diffLink = $this->message['diff'];
357  } elseif ( !self::userCan( $rc, Revision::DELETED_TEXT, $this->getUser() ) ) {
358  $diffLink = $this->message['diff'];
359  } else {
360  $query = [
361  'curid' => $rc->mAttribs['rc_cur_id'],
362  'diff' => $rc->mAttribs['rc_this_oldid'],
363  'oldid' => $rc->mAttribs['rc_last_oldid']
364  ];
365 
366  $diffLink = Linker::linkKnown(
367  $rc->getTitle(),
368  $this->message['diff'],
369  [ 'tabindex' => $rc->counter ],
370  $query
371  );
372  }
373  if ( $rc->mAttribs['rc_type'] == RC_CATEGORIZE ) {
374  $diffhist = $diffLink . $this->message['pipe-separator'] . $this->message['hist'];
375  } else {
376  $diffhist = $diffLink . $this->message['pipe-separator'];
377  # History link
378  $diffhist .= Linker::linkKnown(
379  $rc->getTitle(),
380  $this->message['hist'],
381  [],
382  [
383  'curid' => $rc->mAttribs['rc_cur_id'],
384  'action' => 'history'
385  ]
386  );
387  }
388 
389  // @todo FIXME: Hard coded ". .". Is there a message for this? Should there be?
390  $s .= $this->msg( 'parentheses' )->rawParams( $diffhist )->escaped() .
391  ' <span class="mw-changeslist-separator">. .</span> ';
392  }
393 
401  public function insertArticleLink( &$s, RecentChange $rc, $unpatrolled, $watched ) {
402  $s .= $this->getArticleLink( $rc, $unpatrolled, $watched );
403  }
404 
412  public function getArticleLink( &$rc, $unpatrolled, $watched ) {
413  $params = [];
414  if ( $rc->getTitle()->isRedirect() ) {
415  $params = [ 'redirect' => 'no' ];
416  }
417 
418  $articlelink = Linker::link(
419  $rc->getTitle(),
420  null,
421  [ 'class' => 'mw-changeslist-title' ],
422  $params
423  );
424  if ( $this->isDeleted( $rc, Revision::DELETED_TEXT ) ) {
425  $articlelink = '<span class="history-deleted">' . $articlelink . '</span>';
426  }
427  # To allow for boldening pages watched by this user
428  $articlelink = "<span class=\"mw-title\">{$articlelink}</span>";
429  # RTL/LTR marker
430  $articlelink .= $this->getLanguage()->getDirMark();
431 
432  # TODO: Deprecate the $s argument, it seems happily unused.
433  $s = '';
434  Hooks::run( 'ChangesListInsertArticleLink',
435  [ &$this, &$articlelink, &$s, &$rc, $unpatrolled, $watched ] );
436 
437  return "{$s} {$articlelink}";
438  }
439 
447  public function getTimestamp( $rc ) {
448  // @todo FIXME: Hard coded ". .". Is there a message for this? Should there be?
449  return $this->message['semicolon-separator'] . '<span class="mw-changeslist-date">' .
450  $this->getLanguage()->userTime(
451  $rc->mAttribs['rc_timestamp'],
452  $this->getUser()
453  ) . '</span> <span class="mw-changeslist-separator">. .</span> ';
454  }
455 
462  public function insertTimestamp( &$s, $rc ) {
463  $s .= $this->getTimestamp( $rc );
464  }
465 
472  public function insertUserRelatedLinks( &$s, &$rc ) {
473  if ( $this->isDeleted( $rc, Revision::DELETED_USER ) ) {
474  $s .= ' <span class="history-deleted">' .
475  $this->msg( 'rev-deleted-user' )->escaped() . '</span>';
476  } else {
477  $s .= $this->getLanguage()->getDirMark() . Linker::userLink( $rc->mAttribs['rc_user'],
478  $rc->mAttribs['rc_user_text'] );
479  $s .= Linker::userToolLinks( $rc->mAttribs['rc_user'], $rc->mAttribs['rc_user_text'] );
480  }
481  }
482 
489  public function insertLogEntry( $rc ) {
490  $formatter = LogFormatter::newFromRow( $rc->mAttribs );
491  $formatter->setContext( $this->getContext() );
492  $formatter->setShowUserToolLinks( true );
493  $mark = $this->getLanguage()->getDirMark();
494 
495  return $formatter->getActionText() . " $mark" . $formatter->getComment();
496  }
497 
503  public function insertComment( $rc ) {
504  if ( $this->isDeleted( $rc, Revision::DELETED_COMMENT ) ) {
505  return ' <span class="history-deleted">' .
506  $this->msg( 'rev-deleted-comment' )->escaped() . '</span>';
507  } else {
508  return Linker::commentBlock( $rc->mAttribs['rc_comment'], $rc->getTitle() );
509  }
510  }
511 
517  protected function numberofWatchingusers( $count ) {
518  if ( $count <= 0 ) {
519  return '';
520  }
522  return $cache->getWithSetCallback( $count, $cache::TTL_INDEFINITE,
523  function () use ( $count ) {
524  return $this->msg( 'number_of_watching_users_RCview' )
525  ->numParams( $count )->escaped();
526  }
527  );
528  }
529 
536  public static function isDeleted( $rc, $field ) {
537  return ( $rc->mAttribs['rc_deleted'] & $field ) == $field;
538  }
539 
548  public static function userCan( $rc, $field, User $user = null ) {
549  if ( $rc->mAttribs['rc_type'] == RC_LOG ) {
550  return LogEventsList::userCanBitfield( $rc->mAttribs['rc_deleted'], $field, $user );
551  } else {
552  return Revision::userCanBitfield( $rc->mAttribs['rc_deleted'], $field, $user );
553  }
554  }
555 
561  protected function maybeWatchedLink( $link, $watched = false ) {
562  if ( $watched ) {
563  return '<strong class="mw-watched">' . $link . '</strong>';
564  } else {
565  return '<span class="mw-rc-unwatched">' . $link . '</span>';
566  }
567  }
568 
574  public function insertRollback( &$s, &$rc ) {
575  if ( $rc->mAttribs['rc_type'] == RC_EDIT
576  && $rc->mAttribs['rc_this_oldid']
577  && $rc->mAttribs['rc_cur_id']
578  ) {
579  $page = $rc->getTitle();
582  if ( $this->getUser()->isAllowed( 'rollback' )
583  && $rc->mAttribs['page_latest'] == $rc->mAttribs['rc_this_oldid']
584  ) {
585  $rev = new Revision( [
586  'title' => $page,
587  'id' => $rc->mAttribs['rc_this_oldid'],
588  'user' => $rc->mAttribs['rc_user'],
589  'user_text' => $rc->mAttribs['rc_user_text'],
590  'deleted' => $rc->mAttribs['rc_deleted']
591  ] );
592  $s .= ' ' . Linker::generateRollback( $rev, $this->getContext() );
593  }
594  }
595  }
596 
602  public function getRollback( RecentChange $rc ) {
603  $s = '';
604  $this->insertRollback( $s, $rc );
605  return $s;
606  }
607 
613  public function insertTags( &$s, &$rc, &$classes ) {
614  if ( empty( $rc->mAttribs['ts_tags'] ) ) {
615  return;
616  }
617 
618  list( $tagSummary, $newClasses ) = ChangeTags::formatSummaryRow(
619  $rc->mAttribs['ts_tags'],
620  'changeslist',
621  $this->getContext()
622  );
623  $classes = array_merge( $classes, $newClasses );
624  $s .= ' ' . $tagSummary;
625  }
626 
633  public function getTags( RecentChange $rc, array &$classes ) {
634  $s = '';
635  $this->insertTags( $s, $rc, $classes );
636  return $s;
637  }
638 
639  public function insertExtra( &$s, &$rc, &$classes ) {
640  // Empty, used for subclasses to add anything special.
641  }
642 
643  protected function showAsUnpatrolled( RecentChange $rc ) {
644  return self::isUnpatrolled( $rc, $this->getUser() );
645  }
646 
652  public static function isUnpatrolled( $rc, User $user ) {
653  if ( $rc instanceof RecentChange ) {
654  $isPatrolled = $rc->mAttribs['rc_patrolled'];
655  $rcType = $rc->mAttribs['rc_type'];
656  $rcLogType = $rc->mAttribs['rc_log_type'];
657  } else {
658  $isPatrolled = $rc->rc_patrolled;
659  $rcType = $rc->rc_type;
660  $rcLogType = $rc->rc_log_type;
661  }
662 
663  if ( !$isPatrolled ) {
664  if ( $user->useRCPatrol() ) {
665  return true;
666  }
667  if ( $user->useNPPatrol() && $rcType == RC_NEW ) {
668  return true;
669  }
670  if ( $user->useFilePatrol() && $rcLogType == 'upload' ) {
671  return true;
672  }
673  }
674 
675  return false;
676  }
677 
687  protected function isCategorizationWithoutRevision( $rcObj ) {
688  return intval( $rcObj->getAttribute( 'rc_type' ) ) === RC_CATEGORIZE
689  && intval( $rcObj->getAttribute( 'rc_this_oldid' ) ) === 0;
690  }
691 
692 }
static newFromContext(IContextSource $context)
Fetch an appropriate changes list class for the specified context Some users might want to use an enh...
Definition: ChangesList.php:66
setContext(IContextSource $context)
Set the IContextSource object.
const RC_CATEGORIZE
Definition: Defines.php:173
Utility class for creating new RC entries.
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
Definition: deferred.txt:11
Interface for objects which can provide a MediaWiki context on request.
insertLog(&$s, $title, $logtype)
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output $out
Definition: hooks.txt:762
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.
the array() calling protocol came about after MediaWiki 1.4rc1.
static newFromRow($row)
Handy shortcut for constructing a formatter directly from database row.
null for the local wiki Added should default to null in handler for backwards compatibility add a value to it if you want to add a cookie that have to vary cache options can modify $query
Definition: hooks.txt:1418
getLanguage()
Get the Language object.
BagOStuff $watchMsgCache
Definition: ChangesList.php:40
static linkKnown($target, $html=null, $customAttribs=[], $query=[], $options=[ 'known', 'noclasses'])
Identical to link(), except $options defaults to 'known'.
Definition: Linker.php:264
magic word the default is to use $key to get the and $key value or $key value text $key value html to format the value $key
Definition: hooks.txt:2321
endRecentChangesList()
Returns text for the end of RC.
static element($element, $attribs=null, $contents= '', $allowShortTag=true)
Format an XML element with given attributes and, optionally, text content.
Definition: Xml.php:39
insertExtra(&$s, &$rc, &$classes)
insertRollback(&$s, &$rc)
Inserts a rollback link.
recentChangesFlags($flags, $nothing= '&#160;')
Returns the appropriate flags for new page, minor change and patrolling.
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
static isDeleted($rc, $field)
Determine if said field of a revision is hidden.
initChangesListRows($rows)
The simplest way of implementing IContextSource is to hold a RequestContext as a member variable and ...
msg()
Get a Message object with context set.
if(!isset($args[0])) $lang
getTags(RecentChange $rc, array &$classes)
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses after processing after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a message
Definition: hooks.txt:1924
$value
numberofWatchingusers($count)
Returns the string which indicates the number of watching users.
it s the revision text itself In either if gzip is the revision text is gzipped $flags
Definition: hooks.txt:2548
formatCharacterDifference(RecentChange $old, RecentChange $new=null)
Format the character difference of one or several changes.
static escapeClass($class)
Given a value, escape it so that it can be used as a CSS class and return it.
Definition: Sanitizer.php:1209
when a variable name is used in a it is silently declared as a new local masking the global
Definition: design.txt:93
__construct($obj)
Changeslist constructor.
Definition: ChangesList.php:47
IContextSource $context
insertDateHeader(&$s, $rc_timestamp)
the value to return A Title object or null for latest to be modified or replaced by the hook handler or if authentication is not possible after cache objects are set for highlighting & $link
Definition: hooks.txt:2581
Class to simplify the use of log pages.
Definition: LogPage.php:32
getUser()
Get the User object.
msg()
Get a Message object with context set Parameters are the same as wfMessage()
getConfig()
Get the site configuration.
insertUserRelatedLinks(&$s, &$rc)
Insert links to user page, user talk page and eventually a blocking link.
static getMain()
Static methods.
static formatSummaryRow($tags, $page, IContextSource $context=null)
Creates HTML for the given tags.
Definition: ChangeTags.php:45
getConfig()
Get the Config object.
getRollback(RecentChange $rc)
getArticleLink(&$rc, $unpatrolled, $watched)
static showCharacterDifference($old, $new, IContextSource $context=null)
Show formatted char difference.
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses after processing after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message additional optional elements are parameters for the key that are processed with wfMessage() -> params() ->parseAsBlock()-offset Set to overwrite offset parameter in $wgRequest set to ''to unsetoffset-wrap String Wrap the message in html(usually something like"&lt
showAsUnpatrolled(RecentChange $rc)
getContext()
Get the base IContextSource object.
$cache
Definition: mcc.php:33
$params
getTimestamp($rc)
Get the timestamp from $rc formatted with current user's settings and a separator.
namespace and then decline to actually register it file or subcat img or subcat $title
Definition: hooks.txt:912
isCategorizationWithoutRevision($rcObj)
Determines whether a revision is linked to this change; this may not be the case when the categorizat...
static run($event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
Definition: Hooks.php:131
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add text
Definition: design.txt:12
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books $tag
Definition: hooks.txt:965
presenting them properly to the user as errors is done by the caller return true use this to change the list i e etc $rev
Definition: hooks.txt:1584
getLanguage()
Get the Language object.
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
Definition: distributors.txt:9
insertTimestamp(&$s, $rc)
Insert time timestamp string from $rc into $s.
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output modifiable & $code
Definition: hooks.txt:762
insertTags(&$s, &$rc, &$classes)
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a local account $user
Definition: hooks.txt:242
static link($target, $html=null, $customAttribs=[], $query=[], $options=[])
This function returns an HTML link to the given target.
Definition: Linker.php:195
useRCPatrol()
Check whether to enable recent changes patrol features for this user.
Definition: User.php:3421
const DELETED_TEXT
Definition: Revision.php:76
preCacheMessages()
As we use the same small set of messages in various methods and that they are called often...
insertArticleLink(&$s, RecentChange $rc, $unpatrolled, $watched)
static userLink($userId, $userName, $altUserName=false)
Make user link (or user contributions for unregistered users)
Definition: Linker.php:1102
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition: injection.txt:35
const DELETED_USER
Definition: Revision.php:78
beginRecentChangesList()
Returns text for the start of the tabular part of RC.
useFilePatrol()
Check whether to enable new files patrol features for this user.
Definition: User.php:3442
getSkin()
Get the Skin object.
static generateRollback($rev, IContextSource $context=null, $options=[ 'verify'])
Generate a rollback link for a given revision.
Definition: Linker.php:1857
static userCanBitfield($bitfield, $field, User $user=null)
Determine if the current user is allowed to view a particular field of this log row, if it's marked as deleted.
static userToolLinks($userId, $userText, $redContribsWhenNoEdits=false, $flags=0, $edits=null)
Generate standard user tool links (talk, contributions, block link, etc.)
Definition: Linker.php:1133
useNPPatrol()
Check whether to enable new pages patrol features for this user.
Definition: User.php:3430
static flag($flag, IContextSource $context=null)
Make an "" element for a given change flag.
insertLogEntry($rc)
Insert a formatted action.
$count
setWatchlistDivs($value=true)
Sets the list to use a "
  • " tag.
  • Definition: ChangesList.php:98
    const RC_NEW
    Definition: Defines.php:170
    static userCanBitfield($bitfield, $field, User $user=null, Title $title=null)
    Determine if the current user is allowed to view a particular field of this revision, if it's marked as deleted.
    Definition: Revision.php:1710
    const DELETED_COMMENT
    Definition: Revision.php:77
    static commentBlock($comment, $title=null, $local=false, $wikiId=null)
    Wrap a comment in standard punctuation and formatting if it's non-empty, otherwise return empty strin...
    Definition: Linker.php:1632
    static isUnpatrolled($rc, User $user)
    insertComment($rc)
    Insert a formatted comment.
    recentChangesLine(&$rc, $watched=false, $linenumber=null)
    Format a line.
    Definition: ChangesList.php:90
    getHTMLClasses($rc, $watched)
    Get an array of default HTML class attributes for the change.
    insertDiffHist(&$s, &$rc, $unpatrolled=null)
    static element($element, $attribs=[], $contents= '')
    Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
    Definition: Html.php:230
    getUser()
    Get the User object.
    getRequest()
    Get the WebRequest object.
    this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a skin(according to that user's preference)
    maybeWatchedLink($link, $watched=false)
    const RC_EDIT
    Definition: Defines.php:169
    do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values before the output is cached $page
    Definition: hooks.txt:2338
    const RC_LOG
    Definition: Defines.php:171
    getOutput()
    Get the OutputPage object.
    getSkin()
    Get the Skin object.