Several tweaks to the install.php script
[lhc/web/wiklou.git] / includes / specials / SpecialEditWatchlist.php
1 <?php
2 /**
3 * @defgroup Watchlist Users watchlist handling
4 */
5
6 /**
7 * Implements Special:EditWatchlist
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 * http://www.gnu.org/copyleft/gpl.html
23 *
24 * @file
25 * @ingroup SpecialPage
26 * @ingroup Watchlist
27 */
28
29 /**
30 * Provides the UI through which users can perform editing
31 * operations on their watchlist
32 *
33 * @ingroup SpecialPage
34 * @ingroup Watchlist
35 * @author Rob Church <robchur@gmail.com>
36 */
37 class SpecialEditWatchlist extends UnlistedSpecialPage {
38 /**
39 * Editing modes. EDIT_CLEAR is no longer used; the "Clear" link scared people
40 * too much. Now it's passed on to the raw editor, from which it's very easy to clear.
41 */
42 const EDIT_CLEAR = 1;
43 const EDIT_RAW = 2;
44 const EDIT_NORMAL = 3;
45
46 protected $successMessage;
47
48 protected $toc;
49
50 private $badItems = array();
51
52 public function __construct() {
53 parent::__construct( 'EditWatchlist', 'editmywatchlist' );
54 }
55
56 /**
57 * Main execution point
58 *
59 * @param int $mode
60 */
61 public function execute( $mode ) {
62 $this->setHeaders();
63
64 # Anons don't get a watchlist
65 $this->requireLogin( 'watchlistanontext' );
66
67 $out = $this->getOutput();
68
69 $this->checkPermissions();
70 $this->checkReadOnly();
71
72 $this->outputHeader();
73
74 $out->addSubtitle( $this->msg( 'watchlistfor2', $this->getUser()->getName() )
75 ->rawParams( SpecialEditWatchlist::buildTools( null ) ) );
76
77 # B/C: $mode used to be waaay down the parameter list, and the first parameter
78 # was $wgUser
79 if ( $mode instanceof User ) {
80 $args = func_get_args();
81 if ( count( $args ) >= 4 ) {
82 $mode = $args[3];
83 }
84 }
85 $mode = self::getMode( $this->getRequest(), $mode );
86
87 switch ( $mode ) {
88 case self::EDIT_RAW:
89 $out->setPageTitle( $this->msg( 'watchlistedit-raw-title' ) );
90 $form = $this->getRawForm();
91 if ( $form->show() ) {
92 $out->addHTML( $this->successMessage );
93 $out->addReturnTo( SpecialPage::getTitleFor( 'Watchlist' ) );
94 }
95 break;
96 case self::EDIT_CLEAR:
97 $out->setPageTitle( $this->msg( 'watchlistedit-clear-title' ) );
98 $form = $this->getClearForm();
99 if ( $form->show() ) {
100 $out->addHTML( $this->successMessage );
101 $out->addReturnTo( SpecialPage::getTitleFor( 'Watchlist' ) );
102 }
103 break;
104
105 case self::EDIT_NORMAL:
106 default:
107 $out->setPageTitle( $this->msg( 'watchlistedit-normal-title' ) );
108 $form = $this->getNormalForm();
109 if ( $form->show() ) {
110 $out->addHTML( $this->successMessage );
111 $out->addReturnTo( SpecialPage::getTitleFor( 'Watchlist' ) );
112 } elseif ( $this->toc !== false ) {
113 $out->prependHTML( $this->toc );
114 $out->addModules( 'mediawiki.toc' );
115 }
116 break;
117 }
118 }
119
120 /**
121 * Extract a list of titles from a blob of text, returning
122 * (prefixed) strings; unwatchable titles are ignored
123 *
124 * @param string $list
125 * @return array
126 */
127 private function extractTitles( $list ) {
128 $list = explode( "\n", trim( $list ) );
129 if ( !is_array( $list ) ) {
130 return array();
131 }
132
133 $titles = array();
134
135 foreach ( $list as $text ) {
136 $text = trim( $text );
137 if ( strlen( $text ) > 0 ) {
138 $title = Title::newFromText( $text );
139 if ( $title instanceof Title && $title->isWatchable() ) {
140 $titles[] = $title;
141 }
142 }
143 }
144
145 GenderCache::singleton()->doTitlesArray( $titles );
146
147 $list = array();
148 /** @var Title $title */
149 foreach ( $titles as $title ) {
150 $list[] = $title->getPrefixedText();
151 }
152
153 return array_unique( $list );
154 }
155
156 public function submitRaw( $data ) {
157 $wanted = $this->extractTitles( $data['Titles'] );
158 $current = $this->getWatchlist();
159
160 if ( count( $wanted ) > 0 ) {
161 $toWatch = array_diff( $wanted, $current );
162 $toUnwatch = array_diff( $current, $wanted );
163 $this->watchTitles( $toWatch );
164 $this->unwatchTitles( $toUnwatch );
165 $this->getUser()->invalidateCache();
166
167 if ( count( $toWatch ) > 0 || count( $toUnwatch ) > 0 ) {
168 $this->successMessage = $this->msg( 'watchlistedit-raw-done' )->parse();
169 } else {
170 return false;
171 }
172
173 if ( count( $toWatch ) > 0 ) {
174 $this->successMessage .= ' ' . $this->msg( 'watchlistedit-raw-added' )
175 ->numParams( count( $toWatch ) )->parse();
176 $this->showTitles( $toWatch, $this->successMessage );
177 }
178
179 if ( count( $toUnwatch ) > 0 ) {
180 $this->successMessage .= ' ' . $this->msg( 'watchlistedit-raw-removed' )
181 ->numParams( count( $toUnwatch ) )->parse();
182 $this->showTitles( $toUnwatch, $this->successMessage );
183 }
184 } else {
185 $this->clearWatchlist();
186 $this->getUser()->invalidateCache();
187
188 if ( count( $current ) > 0 ) {
189 $this->successMessage = $this->msg( 'watchlistedit-raw-done' )->parse();
190 } else {
191 return false;
192 }
193
194 $this->successMessage .= ' ' . $this->msg( 'watchlistedit-raw-removed' )
195 ->numParams( count( $current ) )->parse();
196 $this->showTitles( $current, $this->successMessage );
197 }
198
199 return true;
200 }
201
202 public function submitClear( $data ) {
203 $current = $this->getWatchlist();
204 $this->clearWatchlist();
205 $this->getUser()->invalidateCache();
206 $this->successMessage = $this->msg( 'watchlistedit-clear-done' )->parse();
207 $this->successMessage .= ' ' . $this->msg( 'watchlistedit-clear-removed' )
208 ->numParams( count( $current ) )->parse();
209 $this->showTitles( $current, $this->successMessage );
210
211 return true;
212 }
213
214 /**
215 * Print out a list of linked titles
216 *
217 * $titles can be an array of strings or Title objects; the former
218 * is preferred, since Titles are very memory-heavy
219 *
220 * @param array $titles Array of strings, or Title objects
221 * @param string $output
222 */
223 private function showTitles( $titles, &$output ) {
224 $talk = $this->msg( 'talkpagelinktext' )->escaped();
225 // Do a batch existence check
226 $batch = new LinkBatch();
227 if (count($titles) >= 100) {
228 $output = wfMessage( 'watchlistedit-too-many' )->parse();
229 return;
230 }
231 foreach ( $titles as $title ) {
232 if ( !$title instanceof Title ) {
233 $title = Title::newFromText( $title );
234 }
235
236 if ( $title instanceof Title ) {
237 $batch->addObj( $title );
238 $batch->addObj( $title->getTalkPage() );
239 }
240 }
241
242 $batch->execute();
243
244 // Print out the list
245 $output .= "<ul>\n";
246
247 foreach ( $titles as $title ) {
248 if ( !$title instanceof Title ) {
249 $title = Title::newFromText( $title );
250 }
251
252 if ( $title instanceof Title ) {
253 $output .= "<li>"
254 . Linker::link( $title )
255 . ' (' . Linker::link( $title->getTalkPage(), $talk )
256 . ")</li>\n";
257 }
258 }
259
260 $output .= "</ul>\n";
261 }
262
263 /**
264 * Prepare a list of titles on a user's watchlist (excluding talk pages)
265 * and return an array of (prefixed) strings
266 *
267 * @return array
268 */
269 private function getWatchlist() {
270 $list = array();
271 $dbr = wfGetDB( DB_MASTER );
272
273 $res = $dbr->select(
274 'watchlist',
275 array(
276 'wl_namespace', 'wl_title'
277 ), array(
278 'wl_user' => $this->getUser()->getId(),
279 ),
280 __METHOD__
281 );
282
283 if ( $res->numRows() > 0 ) {
284 $titles = array();
285 foreach ( $res as $row ) {
286 $title = Title::makeTitleSafe( $row->wl_namespace, $row->wl_title );
287
288 if ( $this->checkTitle( $title, $row->wl_namespace, $row->wl_title )
289 && !$title->isTalkPage()
290 ) {
291 $titles[] = $title;
292 }
293 }
294 $res->free();
295
296 GenderCache::singleton()->doTitlesArray( $titles );
297
298 foreach ( $titles as $title ) {
299 $list[] = $title->getPrefixedText();
300 }
301 }
302
303 $this->cleanupWatchlist();
304
305 return $list;
306 }
307
308 /**
309 * Get a list of titles on a user's watchlist, excluding talk pages,
310 * and return as a two-dimensional array with namespace and title.
311 *
312 * @return array
313 */
314 private function getWatchlistInfo() {
315 $titles = array();
316 $dbr = wfGetDB( DB_MASTER );
317
318 $res = $dbr->select(
319 array( 'watchlist' ),
320 array( 'wl_namespace', 'wl_title' ),
321 array( 'wl_user' => $this->getUser()->getId() ),
322 __METHOD__,
323 array( 'ORDER BY' => array( 'wl_namespace', 'wl_title' ) )
324 );
325
326 $lb = new LinkBatch();
327
328 foreach ( $res as $row ) {
329 $lb->add( $row->wl_namespace, $row->wl_title );
330 if ( !MWNamespace::isTalk( $row->wl_namespace ) ) {
331 $titles[$row->wl_namespace][$row->wl_title] = 1;
332 }
333 }
334
335 $lb->execute();
336
337 return $titles;
338 }
339
340 /**
341 * Validates watchlist entry
342 *
343 * @param Title $title
344 * @param int $namespace
345 * @param string $dbKey
346 * @return bool Whether this item is valid
347 */
348 private function checkTitle( $title, $namespace, $dbKey ) {
349 if ( $title
350 && ( $title->isExternal()
351 || $title->getNamespace() < 0
352 )
353 ) {
354 $title = false; // unrecoverable
355 }
356
357 if ( !$title
358 || $title->getNamespace() != $namespace
359 || $title->getDBkey() != $dbKey
360 ) {
361 $this->badItems[] = array( $title, $namespace, $dbKey );
362 }
363
364 return (bool)$title;
365 }
366
367 /**
368 * Attempts to clean up broken items
369 */
370 private function cleanupWatchlist() {
371 if ( !count( $this->badItems ) ) {
372 return; //nothing to do
373 }
374
375 $dbw = wfGetDB( DB_MASTER );
376 $user = $this->getUser();
377
378 foreach ( $this->badItems as $row ) {
379 list( $title, $namespace, $dbKey ) = $row;
380 $action = $title ? 'cleaning up' : 'deleting';
381 wfDebug( "User {$user->getName()} has broken watchlist item ns($namespace):$dbKey, $action.\n" );
382
383 $dbw->delete( 'watchlist',
384 array(
385 'wl_user' => $user->getId(),
386 'wl_namespace' => $namespace,
387 'wl_title' => $dbKey,
388 ),
389 __METHOD__
390 );
391
392 // Can't just do an UPDATE instead of DELETE/INSERT due to unique index
393 if ( $title ) {
394 $user->addWatch( $title );
395 }
396 }
397 }
398
399 /**
400 * Remove all titles from a user's watchlist
401 */
402 private function clearWatchlist() {
403 $dbw = wfGetDB( DB_MASTER );
404 $dbw->delete(
405 'watchlist',
406 array( 'wl_user' => $this->getUser()->getId() ),
407 __METHOD__
408 );
409 }
410
411 /**
412 * Add a list of titles to a user's watchlist
413 *
414 * $titles can be an array of strings or Title objects; the former
415 * is preferred, since Titles are very memory-heavy
416 *
417 * @param array $titles Array of strings, or Title objects
418 */
419 private function watchTitles( $titles ) {
420 $dbw = wfGetDB( DB_MASTER );
421 $rows = array();
422
423 foreach ( $titles as $title ) {
424 if ( !$title instanceof Title ) {
425 $title = Title::newFromText( $title );
426 }
427
428 if ( $title instanceof Title ) {
429 $rows[] = array(
430 'wl_user' => $this->getUser()->getId(),
431 'wl_namespace' => MWNamespace::getSubject( $title->getNamespace() ),
432 'wl_title' => $title->getDBkey(),
433 'wl_notificationtimestamp' => null,
434 );
435 $rows[] = array(
436 'wl_user' => $this->getUser()->getId(),
437 'wl_namespace' => MWNamespace::getTalk( $title->getNamespace() ),
438 'wl_title' => $title->getDBkey(),
439 'wl_notificationtimestamp' => null,
440 );
441 }
442 }
443
444 $dbw->insert( 'watchlist', $rows, __METHOD__, 'IGNORE' );
445 }
446
447 /**
448 * Remove a list of titles from a user's watchlist
449 *
450 * $titles can be an array of strings or Title objects; the former
451 * is preferred, since Titles are very memory-heavy
452 *
453 * @param array $titles Array of strings, or Title objects
454 */
455 private function unwatchTitles( $titles ) {
456 $dbw = wfGetDB( DB_MASTER );
457
458 foreach ( $titles as $title ) {
459 if ( !$title instanceof Title ) {
460 $title = Title::newFromText( $title );
461 }
462
463 if ( $title instanceof Title ) {
464 $dbw->delete(
465 'watchlist',
466 array(
467 'wl_user' => $this->getUser()->getId(),
468 'wl_namespace' => MWNamespace::getSubject( $title->getNamespace() ),
469 'wl_title' => $title->getDBkey(),
470 ),
471 __METHOD__
472 );
473
474 $dbw->delete(
475 'watchlist',
476 array(
477 'wl_user' => $this->getUser()->getId(),
478 'wl_namespace' => MWNamespace::getTalk( $title->getNamespace() ),
479 'wl_title' => $title->getDBkey(),
480 ),
481 __METHOD__
482 );
483
484 $page = WikiPage::factory( $title );
485 wfRunHooks( 'UnwatchArticleComplete', array( $this->getUser(), &$page ) );
486 }
487 }
488 }
489
490 public function submitNormal( $data ) {
491 $removed = array();
492
493 foreach ( $data as $titles ) {
494 $this->unwatchTitles( $titles );
495 $removed = array_merge( $removed, $titles );
496 }
497
498 if ( count( $removed ) > 0 ) {
499 $this->successMessage = $this->msg( 'watchlistedit-normal-done'
500 )->numParams( count( $removed ) )->parse();
501 $this->showTitles( $removed, $this->successMessage );
502
503 return true;
504 } else {
505 return false;
506 }
507 }
508
509 /**
510 * Get the standard watchlist editing form
511 *
512 * @return HTMLForm
513 */
514 protected function getNormalForm() {
515 global $wgContLang;
516
517 $fields = array();
518 $count = 0;
519
520 foreach ( $this->getWatchlistInfo() as $namespace => $pages ) {
521 if ( $namespace >= 0 ) {
522 $fields['TitlesNs' . $namespace] = array(
523 'class' => 'EditWatchlistCheckboxSeriesField',
524 'options' => array(),
525 'section' => "ns$namespace",
526 );
527 }
528
529 foreach ( array_keys( $pages ) as $dbkey ) {
530 $title = Title::makeTitleSafe( $namespace, $dbkey );
531
532 if ( $this->checkTitle( $title, $namespace, $dbkey ) ) {
533 $text = $this->buildRemoveLine( $title );
534 $fields['TitlesNs' . $namespace]['options'][$text] = $title->getPrefixedText();
535 $count++;
536 }
537 }
538 }
539 $this->cleanupWatchlist();
540
541 if ( count( $fields ) > 1 && $count > 30 ) {
542 $this->toc = Linker::tocIndent();
543 $tocLength = 0;
544
545 foreach ( $fields as $data ) {
546 # strip out the 'ns' prefix from the section name:
547 $ns = substr( $data['section'], 2 );
548
549 $nsText = ( $ns == NS_MAIN )
550 ? $this->msg( 'blanknamespace' )->escaped()
551 : htmlspecialchars( $wgContLang->getFormattedNsText( $ns ) );
552 $this->toc .= Linker::tocLine( "editwatchlist-{$data['section']}", $nsText,
553 $this->getLanguage()->formatNum( ++$tocLength ), 1 ) . Linker::tocLineEnd();
554 }
555
556 $this->toc = Linker::tocList( $this->toc );
557 } else {
558 $this->toc = false;
559 }
560
561 $context = new DerivativeContext( $this->getContext() );
562 $context->setTitle( $this->getPageTitle() ); // Remove subpage
563 $form = new EditWatchlistNormalHTMLForm( $fields, $context );
564 $form->setSubmitTextMsg( 'watchlistedit-normal-submit' );
565 # Used message keys: 'accesskey-watchlistedit-normal-submit', 'tooltip-watchlistedit-normal-submit'
566 $form->setSubmitTooltip( 'watchlistedit-normal-submit' );
567 $form->setWrapperLegendMsg( 'watchlistedit-normal-legend' );
568 $form->addHeaderText( $this->msg( 'watchlistedit-normal-explain' )->parse() );
569 $form->setSubmitCallback( array( $this, 'submitNormal' ) );
570
571 return $form;
572 }
573
574 /**
575 * Build the label for a checkbox, with a link to the title, and various additional bits
576 *
577 * @param Title $title
578 * @return string
579 */
580 private function buildRemoveLine( $title ) {
581 $link = Linker::link( $title );
582
583 if ( $title->isRedirect() ) {
584 // Linker already makes class mw-redirect, so this is redundant
585 $link = '<span class="watchlistredir">' . $link . '</span>';
586 }
587
588 $tools[] = Linker::link( $title->getTalkPage(), $this->msg( 'talkpagelinktext' )->escaped() );
589
590 if ( $title->exists() ) {
591 $tools[] = Linker::linkKnown(
592 $title,
593 $this->msg( 'history_short' )->escaped(),
594 array(),
595 array( 'action' => 'history' )
596 );
597 }
598
599 if ( $title->getNamespace() == NS_USER && !$title->isSubpage() ) {
600 $tools[] = Linker::linkKnown(
601 SpecialPage::getTitleFor( 'Contributions', $title->getText() ),
602 $this->msg( 'contributions' )->escaped()
603 );
604 }
605
606 wfRunHooks( 'WatchlistEditorBuildRemoveLine', array( &$tools, $title, $title->isRedirect(), $this->getSkin() ) );
607
608 return $link . " (" . $this->getLanguage()->pipeList( $tools ) . ")";
609 }
610
611 /**
612 * Get a form for editing the watchlist in "raw" mode
613 *
614 * @return HTMLForm
615 */
616 protected function getRawForm() {
617 $titles = implode( $this->getWatchlist(), "\n" );
618 $fields = array(
619 'Titles' => array(
620 'type' => 'textarea',
621 'label-message' => 'watchlistedit-raw-titles',
622 'default' => $titles,
623 ),
624 );
625 $context = new DerivativeContext( $this->getContext() );
626 $context->setTitle( $this->getPageTitle( 'raw' ) ); // Reset subpage
627 $form = new HTMLForm( $fields, $context );
628 $form->setSubmitTextMsg( 'watchlistedit-raw-submit' );
629 # Used message keys: 'accesskey-watchlistedit-raw-submit', 'tooltip-watchlistedit-raw-submit'
630 $form->setSubmitTooltip( 'watchlistedit-raw-submit' );
631 $form->setWrapperLegendMsg( 'watchlistedit-raw-legend' );
632 $form->addHeaderText( $this->msg( 'watchlistedit-raw-explain' )->parse() );
633 $form->setSubmitCallback( array( $this, 'submitRaw' ) );
634
635 return $form;
636 }
637
638 /**
639 * Get a form for clearing the watchlist
640 *
641 * @return HTMLForm
642 */
643 protected function getClearForm() {
644 $context = new DerivativeContext( $this->getContext() );
645 $context->setTitle( $this->getPageTitle( 'clear' ) ); // Reset subpage
646 $form = new HTMLForm( array(), $context );
647 $form->setSubmitTextMsg( 'watchlistedit-clear-submit' );
648 # Used message keys: 'accesskey-watchlistedit-clear-submit', 'tooltip-watchlistedit-clear-submit'
649 $form->setSubmitTooltip( 'watchlistedit-clear-submit' );
650 $form->setWrapperLegendMsg( 'watchlistedit-clear-legend' );
651 $form->addHeaderText( $this->msg( 'watchlistedit-clear-explain' )->parse() );
652 $form->setSubmitCallback( array( $this, 'submitClear' ) );
653
654 return $form;
655 }
656
657 /**
658 * Determine whether we are editing the watchlist, and if so, what
659 * kind of editing operation
660 *
661 * @param WebRequest $request
662 * @param string $par
663 * @return int
664 */
665 public static function getMode( $request, $par ) {
666 $mode = strtolower( $request->getVal( 'action', $par ) );
667
668 switch ( $mode ) {
669 case 'clear':
670 case self::EDIT_CLEAR:
671 return self::EDIT_CLEAR;
672 case 'raw':
673 case self::EDIT_RAW:
674 return self::EDIT_RAW;
675 case 'edit':
676 case self::EDIT_NORMAL:
677 return self::EDIT_NORMAL;
678 default:
679 return false;
680 }
681 }
682
683 /**
684 * Build a set of links for convenient navigation
685 * between watchlist viewing and editing modes
686 *
687 * @param null $unused
688 * @return string
689 */
690 public static function buildTools( $unused ) {
691 global $wgLang;
692
693 $tools = array();
694 $modes = array(
695 'view' => array( 'Watchlist', false ),
696 'edit' => array( 'EditWatchlist', false ),
697 'raw' => array( 'EditWatchlist', 'raw' ),
698 'clear' => array( 'EditWatchlist', 'clear' ),
699 );
700
701 foreach ( $modes as $mode => $arr ) {
702 // can use messages 'watchlisttools-view', 'watchlisttools-edit', 'watchlisttools-raw'
703 $tools[] = Linker::linkKnown(
704 SpecialPage::getTitleFor( $arr[0], $arr[1] ),
705 wfMessage( "watchlisttools-{$mode}" )->escaped()
706 );
707 }
708
709 return Html::rawElement(
710 'span',
711 array( 'class' => 'mw-watchlist-toollinks' ),
712 wfMessage( 'parentheses', $wgLang->pipeList( $tools ) )->text()
713 );
714 }
715 }
716
717 # B/C since 1.18
718 class WatchlistEditor extends SpecialEditWatchlist {
719 }
720
721 /**
722 * Extend HTMLForm purely so we can have a more sane way of getting the section headers
723 */
724 class EditWatchlistNormalHTMLForm extends HTMLForm {
725 public function getLegend( $namespace ) {
726 $namespace = substr( $namespace, 2 );
727
728 return $namespace == NS_MAIN
729 ? $this->msg( 'blanknamespace' )->escaped()
730 : htmlspecialchars( $this->getContext()->getLanguage()->getFormattedNsText( $namespace ) );
731 }
732
733 public function getBody() {
734 return $this->displaySection( $this->mFieldTree, '', 'editwatchlist-' );
735 }
736 }
737
738 class EditWatchlistCheckboxSeriesField extends HTMLMultiSelectField {
739 /**
740 * HTMLMultiSelectField throws validation errors if we get input data
741 * that doesn't match the data set in the form setup. This causes
742 * problems if something gets removed from the watchlist while the
743 * form is open (bug 32126), but we know that invalid items will
744 * be harmless so we can override it here.
745 *
746 * @param string $value the value the field was submitted with
747 * @param array $alldata the data collected from the form
748 * @return bool|string Bool true on success, or String error to display.
749 */
750 function validate( $value, $alldata ) {
751 // Need to call into grandparent to be a good citizen. :)
752 return HTMLFormField::validate( $value, $alldata );
753 }
754 }