Merge "Revert "New Hook rc/watchlist hook ChangesListBegin""
[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 = array();
98 wfRunHooks( 'SpecialRecentChangesFilters', array( $this, &$this->customFilters ) );
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 ) {
235 return false;
236 }
237
238 // rc_new is not an ENUM, but adding a redundant rc_new IN (0,1) gives mysql enough
239 // knowledge to use an index merge if it wants (it may use some other index though).
240 $rows = $dbr->select(
241 $tables,
242 $fields,
243 $conds + array( 'rc_new' => array( 0, 1 ) ),
244 __METHOD__,
245 array( 'ORDER BY' => 'rc_timestamp DESC', 'LIMIT' => $opts['limit'] ) + $query_options,
246 $join_conds
247 );
248
249 // Build the final data
250 if ( $wgAllowCategorizedRecentChanges ) {
251 $this->filterByCategories( $rows, $opts );
252 }
253
254 return $rows;
255 }
256
257 public function outputFeedLinks() {
258 $this->addFeedLinks( $this->getFeedQuery() );
259 }
260
261 /**
262 * Get URL query parameters for action=feedrecentchanges API feed of current recent changes view.
263 *
264 * @return array
265 */
266 private function getFeedQuery() {
267 global $wgFeedLimit;
268 $query = array_filter( $this->getOptions()->getAllValues(), function ( $value ) {
269 // API handles empty parameters in a different way
270 return $value !== '';
271 } );
272 $query['action'] = 'feedrecentchanges';
273 if ( $query['limit'] > $wgFeedLimit ) {
274 $query['limit'] = $wgFeedLimit;
275 }
276
277 return $query;
278 }
279
280 /**
281 * Build and output the actual changes list.
282 *
283 * @param array $rows Database rows
284 * @param FormOptions $opts
285 */
286 public function outputChangesList( $rows, $opts ) {
287 global $wgRCShowWatchingUsers, $wgShowUpdatedMarker;
288
289 $limit = $opts['limit'];
290
291 $showWatcherCount = $wgRCShowWatchingUsers
292 && $this->getUser()->getOption( 'shownumberswatching' );
293 $watcherCache = array();
294
295 $dbr = $this->getDB();
296
297 $counter = 1;
298 $list = ChangesList::newFromContext( $this->getContext() );
299
300 $rclistOutput = $list->beginRecentChangesList();
301 foreach ( $rows as $obj ) {
302 if ( $limit == 0 ) {
303 break;
304 }
305 $rc = RecentChange::newFromRow( $obj );
306 $rc->counter = $counter++;
307 # Check if the page has been updated since the last visit
308 if ( $wgShowUpdatedMarker && !empty( $obj->wl_notificationtimestamp ) ) {
309 $rc->notificationtimestamp = ( $obj->rc_timestamp >= $obj->wl_notificationtimestamp );
310 } else {
311 $rc->notificationtimestamp = false; // Default
312 }
313 # Check the number of users watching the page
314 $rc->numberofWatchingusers = 0; // Default
315 if ( $showWatcherCount && $obj->rc_namespace >= 0 ) {
316 if ( !isset( $watcherCache[$obj->rc_namespace][$obj->rc_title] ) ) {
317 $watcherCache[$obj->rc_namespace][$obj->rc_title] =
318 $dbr->selectField(
319 'watchlist',
320 'COUNT(*)',
321 array(
322 'wl_namespace' => $obj->rc_namespace,
323 'wl_title' => $obj->rc_title,
324 ),
325 __METHOD__ . '-watchers'
326 );
327 }
328 $rc->numberofWatchingusers = $watcherCache[$obj->rc_namespace][$obj->rc_title];
329 }
330
331 $changeLine = $list->recentChangesLine( $rc, !empty( $obj->wl_user ), $counter );
332 if ( $changeLine !== false ) {
333 $rclistOutput .= $changeLine;
334 --$limit;
335 }
336 }
337 $rclistOutput .= $list->endRecentChangesList();
338
339 if ( $rows->numRows() === 0 ) {
340 $this->getOutput()->addHtml(
341 '<div class="mw-changeslist-empty">' .
342 $this->msg( 'recentchanges-noresult' )->parse() .
343 '</div>'
344 );
345 } else {
346 $this->getOutput()->addHTML( $rclistOutput );
347 }
348 }
349
350 /**
351 * Return the text to be displayed above the changes
352 *
353 * @param FormOptions $opts
354 * @return string XHTML
355 */
356 public function doHeader( $opts ) {
357 global $wgScript;
358
359 $this->setTopText( $opts );
360
361 $defaults = $opts->getAllValues();
362 $nondefaults = $opts->getChangedValues();
363
364 $panel = array();
365 $panel[] = self::makeLegend( $this->getContext() );
366 $panel[] = $this->optionsPanel( $defaults, $nondefaults );
367 $panel[] = '<hr />';
368
369 $extraOpts = $this->getExtraOptions( $opts );
370 $extraOptsCount = count( $extraOpts );
371 $count = 0;
372 $submit = ' ' . Xml::submitbutton( $this->msg( 'allpagessubmit' )->text() );
373
374 $out = Xml::openElement( 'table', array( 'class' => 'mw-recentchanges-table' ) );
375 foreach ( $extraOpts as $name => $optionRow ) {
376 # Add submit button to the last row only
377 ++$count;
378 $addSubmit = ( $count === $extraOptsCount ) ? $submit : '';
379
380 $out .= Xml::openElement( 'tr' );
381 if ( is_array( $optionRow ) ) {
382 $out .= Xml::tags(
383 'td',
384 array( 'class' => 'mw-label mw-' . $name . '-label' ),
385 $optionRow[0]
386 );
387 $out .= Xml::tags(
388 'td',
389 array( 'class' => 'mw-input' ),
390 $optionRow[1] . $addSubmit
391 );
392 } else {
393 $out .= Xml::tags(
394 'td',
395 array( 'class' => 'mw-input', 'colspan' => 2 ),
396 $optionRow . $addSubmit
397 );
398 }
399 $out .= Xml::closeElement( 'tr' );
400 }
401 $out .= Xml::closeElement( 'table' );
402
403 $unconsumed = $opts->getUnconsumedValues();
404 foreach ( $unconsumed as $key => $value ) {
405 $out .= Html::hidden( $key, $value );
406 }
407
408 $t = $this->getPageTitle();
409 $out .= Html::hidden( 'title', $t->getPrefixedText() );
410 $form = Xml::tags( 'form', array( 'action' => $wgScript ), $out );
411 $panel[] = $form;
412 $panelString = implode( "\n", $panel );
413
414 $this->getOutput()->addHTML(
415 Xml::fieldset(
416 $this->msg( 'recentchanges-legend' )->text(),
417 $panelString,
418 array( 'class' => 'rcoptions' )
419 )
420 );
421
422 $this->setBottomText( $opts );
423 }
424
425 /**
426 * Send the text to be displayed above the options
427 *
428 * @param FormOptions $opts Unused
429 */
430 function setTopText( FormOptions $opts ) {
431 global $wgContLang;
432
433 $message = $this->msg( 'recentchangestext' )->inContentLanguage();
434 if ( !$message->isDisabled() ) {
435 $this->getOutput()->addWikiText(
436 Html::rawElement( 'p',
437 array( 'lang' => $wgContLang->getCode(), 'dir' => $wgContLang->getDir() ),
438 "\n" . $message->plain() . "\n"
439 ),
440 /* $lineStart */ false,
441 /* $interface */ false
442 );
443 }
444 }
445
446 /**
447 * Get options to be displayed in a form
448 *
449 * @param FormOptions $opts
450 * @return array
451 */
452 function getExtraOptions( $opts ) {
453 $opts->consumeValues( array(
454 'namespace', 'invert', 'associated', 'tagfilter', 'categories', 'categories_any'
455 ) );
456
457 $extraOpts = array();
458 $extraOpts['namespace'] = $this->namespaceFilterForm( $opts );
459
460 global $wgAllowCategorizedRecentChanges;
461 if ( $wgAllowCategorizedRecentChanges ) {
462 $extraOpts['category'] = $this->categoryFilterForm( $opts );
463 }
464
465 $tagFilter = ChangeTags::buildTagFilterSelector( $opts['tagfilter'] );
466 if ( count( $tagFilter ) ) {
467 $extraOpts['tagfilter'] = $tagFilter;
468 }
469
470 // Don't fire the hook for subclasses. (Or should we?)
471 if ( $this->getName() === 'Recentchanges' ) {
472 wfRunHooks( 'SpecialRecentChangesPanel', array( &$extraOpts, $opts ) );
473 }
474
475 return $extraOpts;
476 }
477
478 /**
479 * Add page-specific modules.
480 */
481 protected function addModules() {
482 parent::addModules();
483 $out = $this->getOutput();
484 $out->addModules( 'mediawiki.special.recentchanges' );
485 }
486
487 /**
488 * Get last modified date, for client caching
489 * Don't use this if we are using the patrol feature, patrol changes don't
490 * update the timestamp
491 *
492 * @return string|bool
493 */
494 public function checkLastModified() {
495 $dbr = $this->getDB();
496 $lastmod = $dbr->selectField( 'recentchanges', 'MAX(rc_timestamp)', false, __METHOD__ );
497
498 return $lastmod;
499 }
500
501 /**
502 * Creates the choose namespace selection
503 *
504 * @param FormOptions $opts
505 * @return string
506 */
507 protected function namespaceFilterForm( FormOptions $opts ) {
508 $nsSelect = Html::namespaceSelector(
509 array( 'selected' => $opts['namespace'], 'all' => '' ),
510 array( 'name' => 'namespace', 'id' => 'namespace' )
511 );
512 $nsLabel = Xml::label( $this->msg( 'namespace' )->text(), 'namespace' );
513 $invert = Xml::checkLabel(
514 $this->msg( 'invert' )->text(), 'invert', 'nsinvert',
515 $opts['invert'],
516 array( 'title' => $this->msg( 'tooltip-invert' )->text() )
517 );
518 $associated = Xml::checkLabel(
519 $this->msg( 'namespace_association' )->text(), 'associated', 'nsassociated',
520 $opts['associated'],
521 array( 'title' => $this->msg( 'tooltip-namespace_association' )->text() )
522 );
523
524 return array( $nsLabel, "$nsSelect $invert $associated" );
525 }
526
527 /**
528 * Create a input to filter changes by categories
529 *
530 * @param FormOptions $opts
531 * @return array
532 */
533 protected function categoryFilterForm( FormOptions $opts ) {
534 list( $label, $input ) = Xml::inputLabelSep( $this->msg( 'rc_categories' )->text(),
535 'categories', 'mw-categories', false, $opts['categories'] );
536
537 $input .= ' ' . Xml::checkLabel( $this->msg( 'rc_categories_any' )->text(),
538 'categories_any', 'mw-categories_any', $opts['categories_any'] );
539
540 return array( $label, $input );
541 }
542
543 /**
544 * Filter $rows by categories set in $opts
545 *
546 * @param ResultWrapper $rows Database rows
547 * @param FormOptions $opts
548 */
549 function filterByCategories( &$rows, FormOptions $opts ) {
550 $categories = array_map( 'trim', explode( '|', $opts['categories'] ) );
551
552 if ( !count( $categories ) ) {
553 return;
554 }
555
556 # Filter categories
557 $cats = array();
558 foreach ( $categories as $cat ) {
559 $cat = trim( $cat );
560 if ( $cat == '' ) {
561 continue;
562 }
563 $cats[] = $cat;
564 }
565
566 # Filter articles
567 $articles = array();
568 $a2r = array();
569 $rowsarr = array();
570 foreach ( $rows as $k => $r ) {
571 $nt = Title::makeTitle( $r->rc_namespace, $r->rc_title );
572 $id = $nt->getArticleID();
573 if ( $id == 0 ) {
574 continue; # Page might have been deleted...
575 }
576 if ( !in_array( $id, $articles ) ) {
577 $articles[] = $id;
578 }
579 if ( !isset( $a2r[$id] ) ) {
580 $a2r[$id] = array();
581 }
582 $a2r[$id][] = $k;
583 $rowsarr[$k] = $r;
584 }
585
586 # Shortcut?
587 if ( !count( $articles ) || !count( $cats ) ) {
588 return;
589 }
590
591 # Look up
592 $c = new Categoryfinder;
593 $c->seed( $articles, $cats, $opts['categories_any'] ? 'OR' : 'AND' );
594 $match = $c->run();
595
596 # Filter
597 $newrows = array();
598 foreach ( $match as $id ) {
599 foreach ( $a2r[$id] as $rev ) {
600 $k = $rev;
601 $newrows[$k] = $rowsarr[$k];
602 }
603 }
604 $rows = $newrows;
605 }
606
607 /**
608 * Makes change an option link which carries all the other options
609 *
610 * @param string $title Title
611 * @param array $override Options to override
612 * @param array $options Current options
613 * @param bool $active Whether to show the link in bold
614 * @return string
615 */
616 function makeOptionsLink( $title, $override, $options, $active = false ) {
617 $params = $override + $options;
618
619 // Bug 36524: false values have be converted to "0" otherwise
620 // wfArrayToCgi() will omit it them.
621 foreach ( $params as &$value ) {
622 if ( $value === false ) {
623 $value = '0';
624 }
625 }
626 unset( $value );
627
628 $text = htmlspecialchars( $title );
629 if ( $active ) {
630 $text = '<strong>' . $text . '</strong>';
631 }
632
633 return Linker::linkKnown( $this->getPageTitle(), $text, array(), $params );
634 }
635
636 /**
637 * Creates the options panel.
638 *
639 * @param array $defaults
640 * @param array $nondefaults
641 * @return string
642 */
643 function optionsPanel( $defaults, $nondefaults ) {
644 global $wgRCLinkLimits, $wgRCLinkDays;
645
646 $options = $nondefaults + $defaults;
647
648 $note = '';
649 $msg = $this->msg( 'rclegend' );
650 if ( !$msg->isDisabled() ) {
651 $note .= '<div class="mw-rclegend">' . $msg->parse() . "</div>\n";
652 }
653
654 $lang = $this->getLanguage();
655 $user = $this->getUser();
656 if ( $options['from'] ) {
657 $note .= $this->msg( 'rcnotefrom' )->numParams( $options['limit'] )->params(
658 $lang->userTimeAndDate( $options['from'], $user ),
659 $lang->userDate( $options['from'], $user ),
660 $lang->userTime( $options['from'], $user ) )->parse() . '<br />';
661 }
662
663 # Sort data for display and make sure it's unique after we've added user data.
664 $linkLimits = $wgRCLinkLimits;
665 $linkLimits[] = $options['limit'];
666 sort( $linkLimits );
667 $linkLimits = array_unique( $linkLimits );
668
669 $linkDays = $wgRCLinkDays;
670 $linkDays[] = $options['days'];
671 sort( $linkDays );
672 $linkDays = array_unique( $linkDays );
673
674 // limit links
675 $cl = array();
676 foreach ( $linkLimits as $value ) {
677 $cl[] = $this->makeOptionsLink( $lang->formatNum( $value ),
678 array( 'limit' => $value ), $nondefaults, $value == $options['limit'] );
679 }
680 $cl = $lang->pipeList( $cl );
681
682 // day links, reset 'from' to none
683 $dl = array();
684 foreach ( $linkDays as $value ) {
685 $dl[] = $this->makeOptionsLink( $lang->formatNum( $value ),
686 array( 'days' => $value, 'from' => '' ), $nondefaults, $value == $options['days'] );
687 }
688 $dl = $lang->pipeList( $dl );
689
690 // show/hide links
691 $filters = array(
692 'hideminor' => 'rcshowhideminor',
693 'hidebots' => 'rcshowhidebots',
694 'hideanons' => 'rcshowhideanons',
695 'hideliu' => 'rcshowhideliu',
696 'hidepatrolled' => 'rcshowhidepatr',
697 'hidemyself' => 'rcshowhidemine'
698 );
699
700 $showhide = array( 'show', 'hide' );
701
702 foreach ( $this->getCustomFilters() as $key => $params ) {
703 $filters[$key] = $params['msg'];
704 }
705 // Disable some if needed
706 if ( !$user->useRCPatrol() ) {
707 unset( $filters['hidepatrolled'] );
708 }
709
710 $links = array();
711 foreach ( $filters as $key => $msg ) {
712 // The following messages are used here:
713 // rcshowhideminor-show, rcshowhideminor-hide, rcshowhidebots-show, rcshowhidebots-hide,
714 // rcshowhideanons-show, rcshowhideanons-hide, rcshowhideliu-show, rcshowhideliu-hide,
715 // rcshowhidepatr-show, rcshowhidepatr-hide, rcshowhidemine-show, rcshowhidemine-hide.
716 $linkMessage = $this->msg( $msg . '-' . $showhide[1 - $options[$key]] );
717 // Extensions can define additional filters, but don't need to define the corresponding
718 // messages. If they don't exist, just fall back to 'show' and 'hide'.
719 if ( !$linkMessage->exists() ) {
720 $linkMessage = $this->msg( $showhide[1 - $options[$key]] );
721 }
722
723 $link = $this->makeOptionsLink( $linkMessage->text(),
724 array( $key => 1 - $options[$key] ), $nondefaults );
725 $links[] = $this->msg( $msg )->rawParams( $link )->escaped();
726 }
727
728 // show from this onward link
729 $timestamp = wfTimestampNow();
730 $now = $lang->userTimeAndDate( $timestamp, $user );
731 $timenow = $lang->userTime( $timestamp, $user );
732 $datenow = $lang->userDate( $timestamp, $user );
733 $rclinks = $this->msg( 'rclinks' )->rawParams( $cl, $dl, $lang->pipeList( $links ) )
734 ->parse();
735 $rclistfrom = $this->makeOptionsLink(
736 $this->msg( 'rclistfrom' )->rawParams( $now, $timenow, $datenow )->parse(),
737 array( 'from' => $timestamp ),
738 $nondefaults
739 );
740
741 return "{$note}$rclinks<br />$rclistfrom";
742 }
743
744 public function isIncludable() {
745 return true;
746 }
747 }