MediaWiki  1.29.1
OldChangesList.php
Go to the documentation of this file.
1 <?php
23 class OldChangesList extends ChangesList {
24 
34  public function recentChangesLine( &$rc, $watched = false, $linenumber = null ) {
35 
36  $classes = $this->getHTMLClasses( $rc, $watched );
37  // use mw-line-even/mw-line-odd class only if linenumber is given (feature from T16468)
38  if ( $linenumber ) {
39  if ( $linenumber & 1 ) {
40  $classes[] = 'mw-line-odd';
41  } else {
42  $classes[] = 'mw-line-even';
43  }
44  }
45 
46  $html = $this->formatChangeLine( $rc, $classes, $watched );
47 
48  if ( $this->watchlist ) {
49  $classes[] = Sanitizer::escapeClass( 'watchlist-' .
50  $rc->mAttribs['rc_namespace'] . '-' . $rc->mAttribs['rc_title'] );
51  }
52 
53  // Avoid PHP 7.1 warning from passing $this by reference
54  $list = $this;
55  if ( !Hooks::run( 'OldChangesListRecentChangesLine', [ &$list, &$html, $rc, &$classes ] ) ) {
56  return false;
57  }
58 
59  $dateheader = ''; // $html now contains only <li>...</li>, for hooks' convenience.
60  $this->insertDateHeader( $dateheader, $rc->mAttribs['rc_timestamp'] );
61 
62  return "$dateheader<li class=\"" . implode( ' ', $classes ) . "\">" . $html . "</li>\n";
63  }
64 
72  private function formatChangeLine( RecentChange $rc, array &$classes, $watched ) {
73  $html = '';
74  $unpatrolled = $this->showAsUnpatrolled( $rc );
75 
76  if ( $rc->mAttribs['rc_log_type'] ) {
77  $logtitle = SpecialPage::getTitleFor( 'Log', $rc->mAttribs['rc_log_type'] );
78  $this->insertLog( $html, $logtitle, $rc->mAttribs['rc_log_type'] );
79  $flags = $this->recentChangesFlags( [ 'unpatrolled' =>$unpatrolled,
80  'bot' => $rc->mAttribs['rc_bot'] ], '' );
81  if ( $flags !== '' ) {
82  $html .= ' ' . $flags;
83  }
84  // Log entries (old format) or log targets, and special pages
85  } elseif ( $rc->mAttribs['rc_namespace'] == NS_SPECIAL ) {
86  list( $name, $htmlubpage ) = SpecialPageFactory::resolveAlias( $rc->mAttribs['rc_title'] );
87  if ( $name == 'Log' ) {
88  $this->insertLog( $html, $rc->getTitle(), $htmlubpage );
89  }
90  // Regular entries
91  } else {
92  $this->insertDiffHist( $html, $rc );
93  # M, N, b and ! (minor, new, bot and unpatrolled)
94  $html .= $this->recentChangesFlags(
95  [
96  'newpage' => $rc->mAttribs['rc_type'] == RC_NEW,
97  'minor' => $rc->mAttribs['rc_minor'],
98  'unpatrolled' => $unpatrolled,
99  'bot' => $rc->mAttribs['rc_bot']
100  ],
101  ''
102  );
103  $html .= $this->getArticleLink( $rc, $unpatrolled, $watched );
104  }
105  # Edit/log timestamp
106  $this->insertTimestamp( $html, $rc );
107  # Bytes added or removed
108  if ( $this->getConfig()->get( 'RCShowChangedSize' ) ) {
109  $cd = $this->formatCharacterDifference( $rc );
110  if ( $cd !== '' ) {
111  $html .= $cd . ' <span class="mw-changeslist-separator">. .</span> ';
112  }
113  }
114 
115  if ( $rc->mAttribs['rc_type'] == RC_LOG ) {
116  $html .= $this->insertLogEntry( $rc );
117  } elseif ( $this->isCategorizationWithoutRevision( $rc ) ) {
118  $html .= $this->insertComment( $rc );
119  } else {
120  # User tool links
121  $this->insertUserRelatedLinks( $html, $rc );
122  # LTR/RTL direction mark
123  $html .= $this->getLanguage()->getDirMark();
124  $html .= $this->insertComment( $rc );
125  }
126 
127  # Tags
128  $this->insertTags( $html, $rc, $classes );
129  # Rollback
130  $this->insertRollback( $html, $rc );
131  # For subclasses
132  $this->insertExtra( $html, $rc, $classes );
133 
134  # How many users watch this page
135  if ( $rc->numberofWatchingusers > 0 ) {
136  $html .= ' ' . $this->numberofWatchingusers( $rc->numberofWatchingusers );
137  }
138 
139  return $html;
140  }
141 }
ContextSource\getConfig
getConfig()
Get the Config object.
Definition: ContextSource.php:68
ChangesList\insertComment
insertComment( $rc)
Insert a formatted comment.
Definition: ChangesList.php:553
RecentChange
Utility class for creating new RC entries.
Definition: RecentChange.php:63
RC_LOG
const RC_LOG
Definition: Defines.php:142
ChangesList\insertLog
insertLog(&$s, $title, $logtype)
Definition: ChangesList.php:384
SpecialPage\getTitleFor
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name If you don't need a full Title object,...
Definition: SpecialPage.php:82
$name
Allows to change the fields on the form that will be generated $name
Definition: hooks.txt:304
OldChangesList\recentChangesLine
recentChangesLine(&$rc, $watched=false, $linenumber=null)
Format a line using the old system (aka without any javascript).
Definition: OldChangesList.php:34
ChangesList\formatCharacterDifference
formatCharacterDifference(RecentChange $old, RecentChange $new=null)
Format the character difference of one or several changes.
Definition: ChangesList.php:335
php
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
ContextSource\getLanguage
getLanguage()
Get the Language object.
Definition: ContextSource.php:143
ChangesList\insertDateHeader
insertDateHeader(&$s, $rc_timestamp)
Definition: ChangesList.php:366
NS_SPECIAL
const NS_SPECIAL
Definition: Defines.php:51
$html
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 & $html
Definition: hooks.txt:1956
ChangesList\insertLogEntry
insertLogEntry( $rc)
Insert a formatted action.
Definition: ChangesList.php:539
ChangesList\insertTags
insertTags(&$s, &$rc, &$classes)
Definition: ChangesList.php:663
ChangesList\insertUserRelatedLinks
insertUserRelatedLinks(&$s, &$rc)
Insert links to user page, user talk page and eventually a blocking link.
Definition: ChangesList.php:522
list
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
ChangesList\getArticleLink
getArticleLink(&$rc, $unpatrolled, $watched)
Definition: ChangesList.php:460
OldChangesList
Definition: OldChangesList.php:23
ChangesList\insertTimestamp
insertTimestamp(&$s, $rc)
Insert time timestamp string from $rc into $s.
Definition: ChangesList.php:512
ChangesList\numberofWatchingusers
numberofWatchingusers( $count)
Returns the string which indicates the number of watching users.
Definition: ChangesList.php:567
ChangesList\showAsUnpatrolled
showAsUnpatrolled(RecentChange $rc)
Definition: ChangesList.php:693
SpecialPageFactory\resolveAlias
static resolveAlias( $alias)
Given a special page name with a possible subpage, return an array where the first element is the spe...
Definition: SpecialPageFactory.php:338
RC_NEW
const RC_NEW
Definition: Defines.php:141
ChangesList\getHTMLClasses
getHTMLClasses( $rc, $watched)
Get an array of default HTML class attributes for the change.
Definition: ChangesList.php:171
ChangesList\insertDiffHist
insertDiffHist(&$s, &$rc, $unpatrolled=null)
Definition: ChangesList.php:397
OldChangesList\formatChangeLine
formatChangeLine(RecentChange $rc, array &$classes, $watched)
Definition: OldChangesList.php:72
ChangesList\isCategorizationWithoutRevision
isCategorizationWithoutRevision( $rcObj)
Determines whether a revision is linked to this change; this may not be the case when the categorizat...
Definition: ChangesList.php:737
ChangesList\recentChangesFlags
recentChangesFlags( $flags, $nothing='&#160;')
Returns the appropriate flags for new page, minor change and patrolling.
Definition: ChangesList.php:152
ChangesList
Definition: ChangesList.php:28
RecentChange\getTitle
& getTitle()
Definition: RecentChange.php:252
Hooks\run
static run( $event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
Definition: Hooks.php:131
ChangesList\insertExtra
insertExtra(&$s, &$rc, &$classes)
Definition: ChangesList.php:689
ChangesList\insertRollback
insertRollback(&$s, &$rc)
Inserts a rollback link.
Definition: ChangesList.php:624
$flags
it s the revision text itself In either if gzip is the revision text is gzipped $flags
Definition: hooks.txt:2749
array
the array() calling protocol came about after MediaWiki 1.4rc1.