Merge "Toolbar: Only show on WikiText pages"
[lhc/web/wiklou.git] / includes / specials / SpecialRecentchanges.php
1 <?php
2 /**
3 * Implements Special:Recentchanges
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
19 *
20 * @file
21 * @ingroup SpecialPage
22 */
23
24 /**
25 * A special page that lists last changes made to the wiki
26 *
27 * @ingroup SpecialPage
28 */
29 class SpecialRecentChanges extends ChangesListSpecialPage {
30 // @codingStandardsIgnoreStart Needed "useless" override to change parameters.
31 public function __construct( $name = 'Recentchanges', $restriction = '' ) {
32 parent::__construct( $name, $restriction );
33 }
34 // @codingStandardsIgnoreEnd
35
36 /**
37 * Main execution point
38 *
39 * @param string $subpage
40 */
41 public function execute( $subpage ) {
42 // Backwards-compatibility: redirect to new feed URLs
43 $feedFormat = $this->getRequest()->getVal( 'feed' );
44 if ( !$this->including() && $feedFormat ) {
45 $query = $this->getFeedQuery();
46 $query['feedformat'] = $feedFormat === 'atom' ? 'atom' : 'rss';
47 $this->getOutput()->redirect( wfAppendQuery( wfScript( 'api' ), $query ) );
48
49 return;
50 }
51
52 // 10 seconds server-side caching max
53 $this->getOutput()->setSquidMaxage( 10 );
54 // Check if the client has a cached version
55 $lastmod = $this->checkLastModified();
56 if ( $lastmod === false ) {
57 return;
58 }
59
60 parent::execute( $subpage );
61 }
62
63 /**
64 * Get a FormOptions object containing the default options
65 *
66 * @return FormOptions
67 */
68 public function getDefaultOptions() {
69 $opts = parent::getDefaultOptions();
70 $user = $this->getUser();
71
72 $opts->add( 'days', $user->getIntOption( 'rcdays' ) );
73 $opts->add( 'limit', $user->getIntOption( 'rclimit' ) );
74 $opts->add( 'from', '' );
75
76 $opts->add( 'hideminor', $user->getBoolOption( 'hideminor' ) );
77 $opts->add( 'hidebots', true );
78 $opts->add( 'hideanons', false );
79 $opts->add( 'hideliu', false );
80 $opts->add( 'hidepatrolled', $user->getBoolOption( 'hidepatrolled' ) );
81 $opts->add( 'hidemyself', false );
82
83 $opts->add( 'categories', '' );
84 $opts->add( 'categories_any', false );
85 $opts->add( 'tagfilter', '' );
86
87 return $opts;
88 }
89
90 /**
91 * Get custom show/hide filters
92 *
93 * @return array Map of filter URL param names to properties (msg/default)
94 */
95 protected function getCustomFilters() {
96 if ( $this->customFilters === null ) {
97 $this->customFilters = parent::getCustomFilters();
98 wfRunHooks( 'SpecialRecentChangesFilters', array( $this, &$this->customFilters ), '1.23' );
99 }
100
101 return $this->customFilters;
102 }
103
104 /**
105 * Process $par and put options found in $opts. Used when including the page.
106 *
107 * @param string $par
108 * @param FormOptions $opts
109 */
110 public function parseParameters( $par, FormOptions $opts ) {
111 $bits = preg_split( '/\s*,\s*/', trim( $par ) );
112 foreach ( $bits as $bit ) {
113 if ( 'hidebots' === $bit ) {
114 $opts['hidebots'] = true;
115 }
116 if ( 'bots' === $bit ) {
117 $opts['hidebots'] = false;
118 }
119 if ( 'hideminor' === $bit ) {
120 $opts['hideminor'] = true;
121 }
122 if ( 'minor' === $bit ) {
123 $opts['hideminor'] = false;
124 }
125 if ( 'hideliu' === $bit ) {
126 $opts['hideliu'] = true;
127 }
128 if ( 'hidepatrolled' === $bit ) {
129 $opts['hidepatrolled'] = true;
130 }
131 if ( 'hideanons' === $bit ) {
132 $opts['hideanons'] = true;
133 }
134 if ( 'hidemyself' === $bit ) {
135 $opts['hidemyself'] = true;
136 }
137
138 if ( is_numeric( $bit ) ) {
139 $opts['limit'] = $bit;
140 }
141
142 $m = array();
143 if ( preg_match( '/^limit=(\d+)$/', $bit, $m ) ) {
144 $opts['limit'] = $m[1];
145 }
146 if ( preg_match( '/^days=(\d+)$/', $bit, $m ) ) {
147 $opts['days'] = $m[1];
148 }
149 if ( preg_match( '/^namespace=(\d+)$/', $bit, $m ) ) {
150 $opts['namespace'] = $m[1];
151 }
152 }
153 }
154
155 public function validateOptions( FormOptions $opts ) {
156 $opts->validateIntBounds( 'limit', 0, 5000 );
157 parent::validateOptions( $opts );
158 }
159
160 /**
161 * Return an array of conditions depending of options set in $opts
162 *
163 * @param FormOptions $opts
164 * @return array
165 */
166 public function buildMainQueryConds( FormOptions $opts ) {
167 $dbr = $this->getDB();
168 $conds = parent::buildMainQueryConds( $opts );
169
170 // Calculate cutoff
171 $cutoff_unixtime = time() - ( $opts['days'] * 86400 );
172 $cutoff_unixtime = $cutoff_unixtime - ( $cutoff_unixtime % 86400 );
173 $cutoff = $dbr->timestamp( $cutoff_unixtime );
174
175 $fromValid = preg_match( '/^[0-9]{14}$/', $opts['from'] );
176 if ( $fromValid && $opts['from'] > wfTimestamp( TS_MW, $cutoff ) ) {
177 $cutoff = $dbr->timestamp( $opts['from'] );
178 } else {
179 $opts->reset( 'from' );
180 }
181
182 $conds[] = 'rc_timestamp >= ' . $dbr->addQuotes( $cutoff );
183
184 return $conds;
185 }
186
187 /**
188 * Process the query
189 *
190 * @param array $conds
191 * @param FormOptions $opts
192 * @return bool|ResultWrapper Result or false (for Recentchangeslinked only)
193 */
194 public function doMainQuery( $conds, $opts ) {
195 global $wgAllowCategorizedRecentChanges;
196
197 $dbr = $this->getDB();
198 $user = $this->getUser();
199
200 $tables = array( 'recentchanges' );
201 $fields = RecentChange::selectFields();
202 $query_options = array();
203 $join_conds = array();
204
205 // JOIN on watchlist for users
206 if ( $user->getId() && $user->isAllowed( 'viewmywatchlist' ) ) {
207 $tables[] = 'watchlist';
208 $fields[] = 'wl_user';
209 $fields[] = 'wl_notificationtimestamp';
210 $join_conds['watchlist'] = array( 'LEFT JOIN', array(
211 'wl_user' => $user->getId(),
212 'wl_title=rc_title',
213 'wl_namespace=rc_namespace'
214 ) );
215 }
216
217 if ( $user->isAllowed( 'rollback' ) ) {
218 $tables[] = 'page';
219 $fields[] = 'page_latest';
220 $join_conds['page'] = array( 'LEFT JOIN', 'rc_cur_id=page_id' );
221 }
222
223 ChangeTags::modifyDisplayQuery(
224 $tables,
225 $fields,
226 $conds,
227 $join_conds,
228 $query_options,
229 $opts['tagfilter']
230 );
231
232 if ( !wfRunHooks( 'SpecialRecentChangesQuery',
233 array( &$conds, &$tables, &$join_conds, $opts, &$query_options, &$fields ),
234 '1.23' )
235 ) {
236 return false;
237 }
238
239 // rc_new is not an ENUM, but adding a redundant rc_new IN (0,1) gives mysql enough
240 // knowledge to use an index merge if it wants (it may use some other index though).
241 $rows = $dbr->select(
242 $tables,
243 $fields,
244 $conds + array( 'rc_new' => array( 0, 1 ) ),
245 __METHOD__,
246 array( 'ORDER BY' => 'rc_timestamp DESC', 'LIMIT' => $opts['limit'] ) + $query_options,
247 $join_conds
248 );
249
250 // Build the final data
251 if ( $wgAllowCategorizedRecentChanges ) {
252 $this->filterByCategories( $rows, $opts );
253 }
254
255 return $rows;
256 }
257
258 public function outputFeedLinks() {
259 $this->addFeedLinks( $this->getFeedQuery() );
260 }
261
262 /**
263 * Get URL query parameters for action=feedrecentchanges API feed of current recent changes view.
264 *
265 * @return array
266 */
267 private function getFeedQuery() {
268 global $wgFeedLimit;
269 $query = array_filter( $this->getOptions()->getAllValues(), function ( $value ) {
270 // API handles empty parameters in a different way
271 return $value !== '';
272 } );
273 $query['action'] = 'feedrecentchanges';
274 if ( $query['limit'] > $wgFeedLimit ) {
275 $query['limit'] = $wgFeedLimit;
276 }
277
278 return $query;
279 }
280
281 /**
282 * Build and output the actual changes list.
283 *
284 * @param array $rows Database rows
285 * @param FormOptions $opts
286 */
287 public function outputChangesList( $rows, $opts ) {
288 global $wgRCShowWatchingUsers, $wgShowUpdatedMarker;
289
290 $limit = $opts['limit'];
291
292 $showWatcherCount = $wgRCShowWatchingUsers
293 && $this->getUser()->getOption( 'shownumberswatching' );
294 $watcherCache = array();
295
296 $dbr = $this->getDB();
297
298 $counter = 1;
299 $list = ChangesList::newFromContext( $this->getContext() );
300 $list->initChangesListRows( $rows );
301
302 $rclistOutput = $list->beginRecentChangesList();
303 foreach ( $rows as $obj ) {
304 if ( $limit == 0 ) {
305 break;
306 }
307 $rc = RecentChange::newFromRow( $obj );
308 $rc->counter = $counter++;
309 # Check if the page has been updated since the last visit
310 if ( $wgShowUpdatedMarker && !empty( $obj->wl_notificationtimestamp ) ) {
311 $rc->notificationtimestamp = ( $obj->rc_timestamp >= $obj->wl_notificationtimestamp );
312 } else {
313 $rc->notificationtimestamp = false; // Default
314 }
315 # Check the number of users watching the page
316 $rc->numberofWatchingusers = 0; // Default
317 if ( $showWatcherCount && $obj->rc_namespace >= 0 ) {
318 if ( !isset( $watcherCache[$obj->rc_namespace][$obj->rc_title] ) ) {
319 $watcherCache[$obj->rc_namespace][$obj->rc_title] =
320 $dbr->selectField(
321 'watchlist',
322 'COUNT(*)',
323 array(
324 'wl_namespace' => $obj->rc_namespace,
325 'wl_title' => $obj->rc_title,
326 ),
327 __METHOD__ . '-watchers'
328 );
329 }
330 $rc->numberofWatchingusers = $watcherCache[$obj->rc_namespace][$obj->rc_title];
331 }
332
333 $changeLine = $list->recentChangesLine( $rc, !empty( $obj->wl_user ), $counter );
334 if ( $changeLine !== false ) {
335 $rclistOutput .= $changeLine;
336 --$limit;
337 }
338 }
339 $rclistOutput .= $list->endRecentChangesList();
340
341 if ( $rows->numRows() === 0 ) {
342 $this->getOutput()->addHtml(
343 '<div class="mw-changeslist-empty">' .
344 $this->msg( 'recentchanges-noresult' )->parse() .
345 '</div>'
346 );
347 if ( !$this->including() ) {
348 $this->getOutput()->setStatusCode( 404 );
349 }
350 } else {
351 $this->getOutput()->addHTML( $rclistOutput );
352 }
353 }
354
355 /**
356 * Set the text to be displayed above the changes
357 *
358 * @param FormOptions $opts
359 * @param int $numRows Number of rows in the result to show after this header
360 */
361 public function doHeader( $opts, $numRows ) {
362 global $wgScript;
363
364 $this->setTopText( $opts );
365
366 $defaults = $opts->getAllValues();
367 $nondefaults = $opts->getChangedValues();
368
369 $panel = array();
370 $panel[] = self::makeLegend( $this->getContext() );
371 $panel[] = $this->optionsPanel( $defaults, $nondefaults, $numRows );
372 $panel[] = '<hr />';
373
374 $extraOpts = $this->getExtraOptions( $opts );
375 $extraOptsCount = count( $extraOpts );
376 $count = 0;
377 $submit = ' ' . Xml::submitbutton( $this->msg( 'allpagessubmit' )->text() );
378
379 $out = Xml::openElement( 'table', array( 'class' => 'mw-recentchanges-table' ) );
380 foreach ( $extraOpts as $name => $optionRow ) {
381 # Add submit button to the last row only
382 ++$count;
383 $addSubmit = ( $count === $extraOptsCount ) ? $submit : '';
384
385 $out .= Xml::openElement( 'tr' );
386 if ( is_array( $optionRow ) ) {
387 $out .= Xml::tags(
388 'td',
389 array( 'class' => 'mw-label mw-' . $name . '-label' ),
390 $optionRow[0]
391 );
392 $out .= Xml::tags(
393 'td',
394 array( 'class' => 'mw-input' ),
395 $optionRow[1] . $addSubmit
396 );
397 } else {
398 $out .= Xml::tags(
399 'td',
400 array( 'class' => 'mw-input', 'colspan' => 2 ),
401 $optionRow . $addSubmit
402 );
403 }
404 $out .= Xml::closeElement( 'tr' );
405 }
406 $out .= Xml::closeElement( 'table' );
407
408 $unconsumed = $opts->getUnconsumedValues();
409 foreach ( $unconsumed as $key => $value ) {
410 $out .= Html::hidden( $key, $value );
411 }
412
413 $t = $this->getPageTitle();
414 $out .= Html::hidden( 'title', $t->getPrefixedText() );
415 $form = Xml::tags( 'form', array( 'action' => $wgScript ), $out );
416 $panel[] = $form;
417 $panelString = implode( "\n", $panel );
418
419 $this->getOutput()->addHTML(
420 Xml::fieldset(
421 $this->msg( 'recentchanges-legend' )->text(),
422 $panelString,
423 array( 'class' => 'rcoptions' )
424 )
425 );
426
427 $this->setBottomText( $opts );
428 }
429
430 /**
431 * Send the text to be displayed above the options
432 *
433 * @param FormOptions $opts Unused
434 */
435 function setTopText( FormOptions $opts ) {
436 global $wgContLang;
437
438 $message = $this->msg( 'recentchangestext' )->inContentLanguage();
439 if ( !$message->isDisabled() ) {
440 $this->getOutput()->addWikiText(
441 Html::rawElement( 'p',
442 array( 'lang' => $wgContLang->getCode(), 'dir' => $wgContLang->getDir() ),
443 "\n" . $message->plain() . "\n"
444 ),
445 /* $lineStart */ false,
446 /* $interface */ false
447 );
448 }
449 }
450
451 /**
452 * Get options to be displayed in a form
453 *
454 * @param FormOptions $opts
455 * @return array
456 */
457 function getExtraOptions( $opts ) {
458 $opts->consumeValues( array(
459 'namespace', 'invert', 'associated', 'tagfilter', 'categories', 'categories_any'
460 ) );
461
462 $extraOpts = array();
463 $extraOpts['namespace'] = $this->namespaceFilterForm( $opts );
464
465 global $wgAllowCategorizedRecentChanges;
466 if ( $wgAllowCategorizedRecentChanges ) {
467 $extraOpts['category'] = $this->categoryFilterForm( $opts );
468 }
469
470 $tagFilter = ChangeTags::buildTagFilterSelector( $opts['tagfilter'] );
471 if ( count( $tagFilter ) ) {
472 $extraOpts['tagfilter'] = $tagFilter;
473 }
474
475 // Don't fire the hook for subclasses. (Or should we?)
476 if ( $this->getName() === 'Recentchanges' ) {
477 wfRunHooks( 'SpecialRecentChangesPanel', array( &$extraOpts, $opts ) );
478 }
479
480 return $extraOpts;
481 }
482
483 /**
484 * Add page-specific modules.
485 */
486 protected function addModules() {
487 parent::addModules();
488 $out = $this->getOutput();
489 $out->addModules( 'mediawiki.special.recentchanges' );
490 }
491
492 /**
493 * Get last modified date, for client caching
494 * Don't use this if we are using the patrol feature, patrol changes don't
495 * update the timestamp
496 *
497 * @return string|bool
498 */
499 public function checkLastModified() {
500 $dbr = $this->getDB();
501 $lastmod = $dbr->selectField( 'recentchanges', 'MAX(rc_timestamp)', false, __METHOD__ );
502
503 return $lastmod;
504 }
505
506 /**
507 * Creates the choose namespace selection
508 *
509 * @param FormOptions $opts
510 * @return string
511 */
512 protected function namespaceFilterForm( FormOptions $opts ) {
513 $nsSelect = Html::namespaceSelector(
514 array( 'selected' => $opts['namespace'], 'all' => '' ),
515 array( 'name' => 'namespace', 'id' => 'namespace' )
516 );
517 $nsLabel = Xml::label( $this->msg( 'namespace' )->text(), 'namespace' );
518 $invert = Xml::checkLabel(
519 $this->msg( 'invert' )->text(), 'invert', 'nsinvert',
520 $opts['invert'],
521 array( 'title' => $this->msg( 'tooltip-invert' )->text() )
522 );
523 $associated = Xml::checkLabel(
524 $this->msg( 'namespace_association' )->text(), 'associated', 'nsassociated',
525 $opts['associated'],
526 array( 'title' => $this->msg( 'tooltip-namespace_association' )->text() )
527 );
528
529 return array( $nsLabel, "$nsSelect $invert $associated" );
530 }
531
532 /**
533 * Create an input to filter changes by categories
534 *
535 * @param FormOptions $opts
536 * @return array
537 */
538 protected function categoryFilterForm( FormOptions $opts ) {
539 list( $label, $input ) = Xml::inputLabelSep( $this->msg( 'rc_categories' )->text(),
540 'categories', 'mw-categories', false, $opts['categories'] );
541
542 $input .= ' ' . Xml::checkLabel( $this->msg( 'rc_categories_any' )->text(),
543 'categories_any', 'mw-categories_any', $opts['categories_any'] );
544
545 return array( $label, $input );
546 }
547
548 /**
549 * Filter $rows by categories set in $opts
550 *
551 * @param ResultWrapper $rows Database rows
552 * @param FormOptions $opts
553 */
554 function filterByCategories( &$rows, FormOptions $opts ) {
555 $categories = array_map( 'trim', explode( '|', $opts['categories'] ) );
556
557 if ( !count( $categories ) ) {
558 return;
559 }
560
561 # Filter categories
562 $cats = array();
563 foreach ( $categories as $cat ) {
564 $cat = trim( $cat );
565 if ( $cat == '' ) {
566 continue;
567 }
568 $cats[] = $cat;
569 }
570
571 # Filter articles
572 $articles = array();
573 $a2r = array();
574 $rowsarr = array();
575 foreach ( $rows as $k => $r ) {
576 $nt = Title::makeTitle( $r->rc_namespace, $r->rc_title );
577 $id = $nt->getArticleID();
578 if ( $id == 0 ) {
579 continue; # Page might have been deleted...
580 }
581 if ( !in_array( $id, $articles ) ) {
582 $articles[] = $id;
583 }
584 if ( !isset( $a2r[$id] ) ) {
585 $a2r[$id] = array();
586 }
587 $a2r[$id][] = $k;
588 $rowsarr[$k] = $r;
589 }
590
591 # Shortcut?
592 if ( !count( $articles ) || !count( $cats ) ) {
593 return;
594 }
595
596 # Look up
597 $c = new Categoryfinder;
598 $c->seed( $articles, $cats, $opts['categories_any'] ? 'OR' : 'AND' );
599 $match = $c->run();
600
601 # Filter
602 $newrows = array();
603 foreach ( $match as $id ) {
604 foreach ( $a2r[$id] as $rev ) {
605 $k = $rev;
606 $newrows[$k] = $rowsarr[$k];
607 }
608 }
609 $rows = $newrows;
610 }
611
612 /**
613 * Makes change an option link which carries all the other options
614 *
615 * @param string $title Title
616 * @param array $override Options to override
617 * @param array $options Current options
618 * @param bool $active Whether to show the link in bold
619 * @return string
620 */
621 function makeOptionsLink( $title, $override, $options, $active = false ) {
622 $params = $override + $options;
623
624 // Bug 36524: false values have be converted to "0" otherwise
625 // wfArrayToCgi() will omit it them.
626 foreach ( $params as &$value ) {
627 if ( $value === false ) {
628 $value = '0';
629 }
630 }
631 unset( $value );
632
633 $text = htmlspecialchars( $title );
634 if ( $active ) {
635 $text = '<strong>' . $text . '</strong>';
636 }
637
638 return Linker::linkKnown( $this->getPageTitle(), $text, array(), $params );
639 }
640
641 /**
642 * Creates the options panel.
643 *
644 * @param array $defaults
645 * @param array $nondefaults
646 * @param int $numRows Number of rows in the result to show after this header
647 * @return string
648 */
649 function optionsPanel( $defaults, $nondefaults, $numRows ) {
650 global $wgRCLinkLimits, $wgRCLinkDays;
651
652 $options = $nondefaults + $defaults;
653
654 $note = '';
655 $msg = $this->msg( 'rclegend' );
656 if ( !$msg->isDisabled() ) {
657 $note .= '<div class="mw-rclegend">' . $msg->parse() . "</div>\n";
658 }
659
660 $lang = $this->getLanguage();
661 $user = $this->getUser();
662 if ( $options['from'] ) {
663 $note .= $this->msg( 'rcnotefrom' )
664 ->numParams( $options['limit'] )
665 ->params(
666 $lang->userTimeAndDate( $options['from'], $user ),
667 $lang->userDate( $options['from'], $user ),
668 $lang->userTime( $options['from'], $user )
669 )
670 ->numParams( $numRows )
671 ->parse() . '<br />';
672 }
673
674 # Sort data for display and make sure it's unique after we've added user data.
675 $linkLimits = $wgRCLinkLimits;
676 $linkLimits[] = $options['limit'];
677 sort( $linkLimits );
678 $linkLimits = array_unique( $linkLimits );
679
680 $linkDays = $wgRCLinkDays;
681 $linkDays[] = $options['days'];
682 sort( $linkDays );
683 $linkDays = array_unique( $linkDays );
684
685 // limit links
686 $cl = array();
687 foreach ( $linkLimits as $value ) {
688 $cl[] = $this->makeOptionsLink( $lang->formatNum( $value ),
689 array( 'limit' => $value ), $nondefaults, $value == $options['limit'] );
690 }
691 $cl = $lang->pipeList( $cl );
692
693 // day links, reset 'from' to none
694 $dl = array();
695 foreach ( $linkDays as $value ) {
696 $dl[] = $this->makeOptionsLink( $lang->formatNum( $value ),
697 array( 'days' => $value, 'from' => '' ), $nondefaults, $value == $options['days'] );
698 }
699 $dl = $lang->pipeList( $dl );
700
701 // show/hide links
702 $filters = array(
703 'hideminor' => 'rcshowhideminor',
704 'hidebots' => 'rcshowhidebots',
705 'hideanons' => 'rcshowhideanons',
706 'hideliu' => 'rcshowhideliu',
707 'hidepatrolled' => 'rcshowhidepatr',
708 'hidemyself' => 'rcshowhidemine'
709 );
710
711 $showhide = array( 'show', 'hide' );
712
713 foreach ( $this->getCustomFilters() as $key => $params ) {
714 $filters[$key] = $params['msg'];
715 }
716 // Disable some if needed
717 if ( !$user->useRCPatrol() ) {
718 unset( $filters['hidepatrolled'] );
719 }
720
721 $links = array();
722 foreach ( $filters as $key => $msg ) {
723 // The following messages are used here:
724 // rcshowhideminor-show, rcshowhideminor-hide, rcshowhidebots-show, rcshowhidebots-hide,
725 // rcshowhideanons-show, rcshowhideanons-hide, rcshowhideliu-show, rcshowhideliu-hide,
726 // rcshowhidepatr-show, rcshowhidepatr-hide, rcshowhidemine-show, rcshowhidemine-hide.
727 $linkMessage = $this->msg( $msg . '-' . $showhide[1 - $options[$key]] );
728 // Extensions can define additional filters, but don't need to define the corresponding
729 // messages. If they don't exist, just fall back to 'show' and 'hide'.
730 if ( !$linkMessage->exists() ) {
731 $linkMessage = $this->msg( $showhide[1 - $options[$key]] );
732 }
733
734 $link = $this->makeOptionsLink( $linkMessage->text(),
735 array( $key => 1 - $options[$key] ), $nondefaults );
736 $links[] = $this->msg( $msg )->rawParams( $link )->escaped();
737 }
738
739 // show from this onward link
740 $timestamp = wfTimestampNow();
741 $now = $lang->userTimeAndDate( $timestamp, $user );
742 $timenow = $lang->userTime( $timestamp, $user );
743 $datenow = $lang->userDate( $timestamp, $user );
744 $rclinks = $this->msg( 'rclinks' )->rawParams( $cl, $dl, $lang->pipeList( $links ) )
745 ->parse();
746 $rclistfrom = $this->makeOptionsLink(
747 $this->msg( 'rclistfrom' )->rawParams( $now, $timenow, $datenow )->parse(),
748 array( 'from' => $timestamp ),
749 $nondefaults
750 );
751
752 return "{$note}$rclinks<br />$rclistfrom";
753 }
754
755 public function isIncludable() {
756 return true;
757 }
758 }