* (bug 19784) date option "ISO 8601" produced illegal id
[lhc/web/wiklou.git] / includes / HTMLForm.php
1 <?php
2
3 class HTMLForm {
4
5 static $jsAdded = false;
6
7 /* The descriptor is an array of arrays.
8 i.e. array(
9 'fieldname' => array( 'section' => 'section/subsection',
10 properties... ),
11 ...
12 )
13 */
14
15 static $typeMappings = array(
16 'text' => 'HTMLTextField',
17 'select' => 'HTMLSelectField',
18 'radio' => 'HTMLRadioField',
19 'multiselect' => 'HTMLMultiSelectField',
20 'check' => 'HTMLCheckField',
21 'toggle' => 'HTMLCheckField',
22 'int' => 'HTMLIntField',
23 'float' => 'HTMLFloatField',
24 'info' => 'HTMLInfoField',
25 'selectorother' => 'HTMLSelectOrOtherField',
26 );
27
28 function __construct( $descriptor, $messagePrefix ) {
29 $this->mMessagePrefix = $messagePrefix;
30
31 // Expand out into a tree.
32 $loadedDescriptor = array();
33 $this->mFlatFields = array();
34
35 foreach( $descriptor as $fieldname => $info ) {
36 $section = '';
37 if ( isset( $info['section'] ) )
38 $section = $info['section'];
39
40 $info['name'] = $fieldname;
41
42 $field = $this->loadInputFromParameters( $info );
43 $field->mParent = $this;
44
45 $setSection =& $loadedDescriptor;
46 if( $section ) {
47 $sectionParts = explode( '/', $section );
48
49 while( count( $sectionParts ) ) {
50 $newName = array_shift( $sectionParts );
51
52 if ( !isset( $setSection[$newName] ) ) {
53 $setSection[$newName] = array();
54 }
55
56 $setSection =& $setSection[$newName];
57 }
58 }
59
60 $setSection[$fieldname] = $field;
61 $this->mFlatFields[$fieldname] = $field;
62 }
63
64 $this->mFieldTree = $loadedDescriptor;
65
66 $this->mShowReset = true;
67 }
68
69 static function addJS() {
70 if( self::$jsAdded ) return;
71
72 global $wgOut, $wgStylePath;
73
74 $wgOut->addScriptFile( "$wgStylePath/common/htmlform.js" );
75 }
76
77 static function loadInputFromParameters( $descriptor ) {
78 if ( isset( $descriptor['class'] ) ) {
79 $class = $descriptor['class'];
80 } elseif ( isset( $descriptor['type'] ) ) {
81 $class = self::$typeMappings[$descriptor['type']];
82 $descriptor['class'] = $class;
83 }
84
85 if( !$class ) {
86 throw new MWException( "Descriptor with no class: " . print_r( $descriptor, true ) );
87 }
88
89 $obj = new $class( $descriptor );
90
91 return $obj;
92 }
93
94 function show() {
95 $html = '';
96
97 self::addJS();
98
99 // Load data from the request.
100 $this->loadData();
101
102 // Try a submission
103 global $wgUser, $wgRequest;
104 $editToken = $wgRequest->getVal( 'wpEditToken' );
105
106 $result = false;
107 if ( $wgUser->matchEditToken( $editToken ) )
108 $result = $this->trySubmit();
109
110 if( $result === true )
111 return $result;
112
113 // Display form.
114 $this->displayForm( $result );
115 }
116
117 /** Return values:
118 * TRUE == Successful submission
119 * FALSE == No submission attempted
120 * Anything else == Error to display.
121 */
122 function trySubmit() {
123 // Check for validation
124 foreach( $this->mFlatFields as $fieldname => $field ) {
125 if ( !empty( $field->mParams['nodata'] ) ) continue;
126 if ( $field->validate( $this->mFieldData[$fieldname],
127 $this->mFieldData ) !== true ) {
128 return isset( $this->mValidationErrorMessage ) ?
129 $this->mValidationErrorMessage : array( 'htmlform-invalid-input' );
130 }
131 }
132
133 $callback = $this->mSubmitCallback;
134
135 $data = $this->filterDataForSubmit( $this->mFieldData );
136
137 $res = call_user_func( $callback, $data );
138
139 return $res;
140 }
141
142 function setSubmitCallback( $cb ) {
143 $this->mSubmitCallback = $cb;
144 }
145
146 function setValidationErrorMessage( $msg ) {
147 $this->mValidationErrorMessage = $msg;
148 }
149
150 function setIntro( $msg ) {
151 $this->mIntro = $msg;
152 }
153
154 function displayForm( $submitResult ) {
155 global $wgOut;
156
157 if ( $submitResult !== false ) {
158 $this->displayErrors( $submitResult );
159 }
160
161 if ( isset( $this->mIntro ) ) {
162 $wgOut->addHTML( $this->mIntro );
163 }
164
165 $html = $this->getBody();
166
167 // Hidden fields
168 $html .= $this->getHiddenFields();
169
170 // Buttons
171 $html .= $this->getButtons();
172
173 $html = $this->wrapForm( $html );
174
175 $wgOut->addHTML( $html );
176 }
177
178 function wrapForm( $html ) {
179 return Xml::tags(
180 'form',
181 array(
182 'action' => $this->getTitle()->getFullURL(),
183 'method' => 'post',
184 ),
185 $html
186 );
187 }
188
189 function getHiddenFields() {
190 global $wgUser;
191 $html = '';
192
193 $html .= Xml::hidden( 'wpEditToken', $wgUser->editToken() ) . "\n";
194 $html .= Xml::hidden( 'title', $this->getTitle() ) . "\n";
195
196 return $html;
197 }
198
199 function getButtons() {
200 $html = '';
201
202 $attribs = array();
203
204 if ( isset( $this->mSubmitID ) )
205 $attribs['id'] = $this->mSubmitID;
206
207 $attribs['class'] = 'mw-htmlform-submit';
208
209 $html .= Xml::submitButton( $this->getSubmitText(), $attribs ) . "\n";
210
211 if( $this->mShowReset ) {
212 $html .= Xml::element(
213 'input',
214 array(
215 'type' => 'reset',
216 'value' => wfMsg( 'htmlform-reset' )
217 )
218 ) . "\n";
219 }
220
221 return $html;
222 }
223
224 function getBody() {
225 return $this->displaySection( $this->mFieldTree );
226 }
227
228 function displayErrors( $errors ) {
229 if ( is_array( $errors ) ) {
230 $errorstr = $this->formatErrors( $errors );
231 } else {
232 $errorstr = $errors;
233 }
234
235 $errorstr = Xml::tags( 'div', array( 'class' => 'error' ), $errorstr );
236
237 global $wgOut;
238 $wgOut->addHTML( $errorstr );
239 }
240
241 static function formatErrors( $errors ) {
242 $errorstr = '';
243 foreach ( $errors as $error ) {
244 if( is_array( $error ) ) {
245 $msg = array_shift( $error );
246 } else {
247 $msg = $error;
248 $error = array();
249 }
250 $errorstr .= Xml::tags(
251 'li',
252 null,
253 wfMsgExt( $msg, array( 'parseinline' ), $error )
254 );
255 }
256
257 $errorstr = Xml::tags( 'ul', null, $errorstr );
258
259 return $errorstr;
260 }
261
262 function setSubmitText( $t ) {
263 $this->mSubmitText = $t;
264 }
265
266 function getSubmitText() {
267 return isset( $this->mSubmitText ) ? $this->mSubmitText : wfMsg( 'htmlform-submit' );
268 }
269
270 function setSubmitID( $t ) {
271 $this->mSubmitID = $t;
272 }
273
274 function setMessagePrefix( $p ) {
275 $this->mMessagePrefix = $p;
276 }
277
278 function setTitle( $t ) {
279 $this->mTitle = $t;
280 }
281
282 function getTitle() {
283 return $this->mTitle;
284 }
285
286 function displaySection( $fields ) {
287 $tableHtml = '';
288 $subsectionHtml = '';
289 $hasLeftColumn = false;
290
291 foreach( $fields as $key => $value ) {
292 if ( is_object( $value ) ) {
293 $v = empty( $value->mParams['nodata'] )
294 ? $this->mFieldData[$key]
295 : $value->getDefault();
296 $tableHtml .= $value->getTableRow( $v );
297
298 if( $value->getLabel() != '&nbsp;' )
299 $hasLeftColumn = true;
300 } elseif ( is_array( $value ) ) {
301 $section = $this->displaySection( $value );
302 $legend = wfMsg( "{$this->mMessagePrefix}-$key" );
303 $subsectionHtml .= Xml::fieldset( $legend, $section ) . "\n";
304 }
305 }
306
307 $classes = array();
308 if( !$hasLeftColumn ) // Avoid strange spacing when no labels exist
309 $classes[] = 'mw-htmlform-nolabel';
310 $classes = implode( ' ', $classes );
311
312 $tableHtml = "<table class='$classes'><tbody>\n$tableHtml\n</tbody></table>\n";
313
314 return $subsectionHtml . "\n" . $tableHtml;
315 }
316
317 function loadData() {
318 global $wgRequest;
319
320 $fieldData = array();
321
322 foreach( $this->mFlatFields as $fieldname => $field ) {
323 if ( !empty( $field->mParams['nodata'] ) ) continue;
324 if ( !empty( $field->mParams['disabled'] ) ) {
325 $fieldData[$fieldname] = $field->getDefault();
326 } else {
327 $fieldData[$fieldname] = $field->loadDataFromRequest( $wgRequest );
328 }
329 }
330
331 // Filter data.
332 foreach( $fieldData as $name => &$value ) {
333 $field = $this->mFlatFields[$name];
334 $value = $field->filter( $value, $this->mFlatFields );
335 }
336
337 $this->mFieldData = $fieldData;
338 }
339
340 function importData( $fieldData ) {
341 // Filter data.
342 foreach( $fieldData as $name => &$value ) {
343 $field = $this->mFlatFields[$name];
344 $value = $field->filter( $value, $this->mFlatFields );
345 }
346
347 foreach( $this->mFlatFields as $fieldname => $field ) {
348 if ( !isset( $fieldData[$fieldname] ) )
349 $fieldData[$fieldname] = $field->getDefault();
350 }
351
352 $this->mFieldData = $fieldData;
353 }
354
355 function suppressReset( $suppressReset = true ) {
356 $this->mShowReset = !$suppressReset;
357 }
358
359 function filterDataForSubmit( $data ) {
360 return $data;
361 }
362 }
363
364 abstract class HTMLFormField {
365 abstract function getInputHTML( $value );
366
367 function validate( $value, $alldata ) {
368 if ( isset( $this->mValidationCallback ) ) {
369 return call_user_func( $this->mValidationCallback, $value, $alldata );
370 }
371
372 return true;
373 }
374
375 function filter( $value, $alldata ) {
376 if( isset( $this->mFilterCallback ) ) {
377 $value = call_user_func( $this->mFilterCallback, $value, $alldata );
378 }
379
380 return $value;
381 }
382
383 function loadDataFromRequest( $request ) {
384 if( $request->getCheck( $this->mName ) ) {
385 return $request->getText( $this->mName );
386 } else {
387 return $this->getDefault();
388 }
389 }
390
391 function __construct( $params ) {
392 $this->mParams = $params;
393
394 if( isset( $params['label-message'] ) ) {
395 $msgInfo = $params['label-message'];
396
397 if ( is_array( $msgInfo ) ) {
398 $msg = array_shift( $msgInfo );
399 } else {
400 $msg = $msgInfo;
401 $msgInfo = array();
402 }
403
404 $this->mLabel = wfMsgExt( $msg, 'parseinline', $msgInfo );
405 } elseif ( isset( $params['label'] ) ) {
406 $this->mLabel = $params['label'];
407 }
408
409 if ( isset( $params['name'] ) ) {
410 $name = $params['name'];
411 $validName = Sanitizer::escapeId( $name );
412 if( $name != $validName ) {
413 throw new MWException("Invalid name '$name' passed to " . __METHOD__ );
414 }
415 $this->mName = 'wp'.$name;
416 $this->mID = 'mw-input-'.$name;
417 }
418
419 if ( isset( $params['default'] ) ) {
420 $this->mDefault = $params['default'];
421 }
422
423 if ( isset( $params['id'] ) ) {
424 $id = $params['id'];
425 $validId = Sanitizer::escapeId( $id );
426 if( $id != $validId ) {
427 throw new MWException("Invalid id '$id' passed to " . __METHOD__ );
428 }
429 $this->mID = $id;
430 }
431
432 if ( isset( $params['validation-callback'] ) ) {
433 $this->mValidationCallback = $params['validation-callback'];
434 }
435
436 if ( isset( $params['filter-callback'] ) ) {
437 $this->mFilterCallback = $params['filter-callback'];
438 }
439 }
440
441 function getTableRow( $value ) {
442 // Check for invalid data.
443 global $wgRequest;
444
445 $errors = $this->validate( $value, $this->mParent->mFieldData );
446 if ( $errors === true || !$wgRequest->wasPosted() ) {
447 $errors = '';
448 } else {
449 $errors = Xml::tags( 'span', array( 'class' => 'error' ), $errors );
450 }
451
452 $html = '';
453
454 $html .= Xml::tags( 'td', array( 'class' => 'mw-label' ),
455 Xml::tags( 'label', array( 'for' => $this->mID ), $this->getLabel() )
456 );
457 $html .= Xml::tags( 'td', array( 'class' => 'mw-input' ),
458 $this->getInputHTML( $value ) ."\n$errors" );
459
460 $fieldType = get_class( $this );
461
462 $html = Xml::tags( 'tr', array( 'class' => "mw-htmlform-field-$fieldType" ),
463 $html ) . "\n";
464
465 // Help text
466 if ( isset( $this->mParams['help-message'] ) ) {
467 $msg = $this->mParams['help-message'];
468
469 $text = wfMsgExt( $msg, 'parseinline' );
470
471 if( !wfEmptyMsg( $msg, $text ) ) {
472 $row = Xml::tags( 'td', array( 'colspan' => 2, 'class' => 'htmlform-tip' ),
473 $text );
474
475 $row = Xml::tags( 'tr', null, $row );
476
477 $html .= "$row\n";
478 }
479 }
480
481 return $html;
482 }
483
484 function getLabel() {
485 return $this->mLabel;
486 }
487
488 function getDefault() {
489 if ( isset( $this->mDefault ) ) {
490 return $this->mDefault;
491 } else {
492 return null;
493 }
494 }
495
496 static function flattenOptions( $options ) {
497 $flatOpts = array();
498
499 foreach( $options as $key => $value ) {
500 if ( is_array( $value ) ) {
501 $flatOpts = array_merge( $flatOpts, self::flattenOptions( $value ) );
502 } else {
503 $flatOpts[] = $value;
504 }
505 }
506
507 return $flatOpts;
508 }
509 }
510
511 class HTMLTextField extends HTMLFormField {
512
513 function getSize() {
514 return isset( $this->mParams['size'] ) ? $this->mParams['size'] : 45;
515 }
516
517 function getInputHTML( $value ) {
518 $attribs = array( 'id' => $this->mID );
519
520 if ( isset( $this->mParams['maxlength'] ) ) {
521 $attribs['maxlength'] = $this->mParams['maxlength'];
522 }
523
524 if( !empty( $this->mParams['disabled'] ) ) {
525 $attribs['disabled'] = 'disabled';
526 }
527
528 return Xml::input(
529 $this->mName,
530 $this->getSize(),
531 $value,
532 $attribs
533 );
534 }
535
536 }
537
538 class HTMLFloatField extends HTMLTextField {
539 function getSize() {
540 return isset( $this->mParams['size'] ) ? $this->mParams['size'] : 20;
541 }
542
543 function validate( $value, $alldata ) {
544 $p = parent::validate( $value, $alldata );
545
546 if ( $p !== true ) return $p;
547
548 if ( floatval( $value ) != $value ) {
549 return wfMsgExt( 'htmlform-float-invalid', 'parse' );
550 }
551
552 $in_range = true;
553
554 # The "int" part of these message names is rather confusing. They make
555 # equal sense for all numbers.
556 if ( isset( $this->mParams['min'] ) ) {
557 $min = $this->mParams['min'];
558 if ( $min > $value )
559 return wfMsgExt( 'htmlform-int-toolow', 'parse', array( $min ) );
560 }
561
562 if ( isset( $this->mParams['max'] ) ) {
563 $max = $this->mParams['max'];
564 if( $max < $value )
565 return wfMsgExt( 'htmlform-int-toohigh', 'parse', array( $max ) );
566 }
567
568 return true;
569 }
570 }
571
572 class HTMLIntField extends HTMLFloatField {
573 function validate( $value, $alldata ) {
574 $p = parent::validate( $value, $alldata );
575
576 if ( $p !== true ) return $p;
577
578 if ( intval( $value ) != $value ) {
579 return wfMsgExt( 'htmlform-int-invalid', 'parse' );
580 }
581
582 return true;
583 }
584 }
585
586 class HTMLCheckField extends HTMLFormField {
587 function getInputHTML( $value ) {
588 if ( !empty( $this->mParams['invert'] ) )
589 $value = !$value;
590
591 $attr = array( 'id' => $this->mID );
592 if( !empty( $this->mParams['disabled'] ) ) {
593 $attr['disabled'] = 'disabled';
594 }
595
596 return Xml::check( $this->mName, $value, $attr ) . '&nbsp;' .
597 Xml::tags( 'label', array( 'for' => $this->mID ), $this->mLabel );
598 }
599
600 function getLabel() {
601 return '&nbsp;'; // In the right-hand column.
602 }
603
604 function loadDataFromRequest( $request ) {
605 $invert = false;
606 if ( isset( $this->mParams['invert'] ) && $this->mParams['invert'] ) {
607 $invert = true;
608 }
609
610 // GetCheck won't work like we want for checks.
611 if( $request->getCheck( 'wpEditToken' ) ) {
612 // XOR has the following truth table, which is what we want
613 // INVERT VALUE | OUTPUT
614 // true true | false
615 // false true | true
616 // false false | false
617 // true false | true
618 return $request->getBool( $this->mName ) xor $invert;
619 } else {
620 return $this->getDefault();
621 }
622 }
623 }
624
625 class HTMLSelectField extends HTMLFormField {
626
627 function validate( $value, $alldata ) {
628 $p = parent::validate( $value, $alldata );
629 if( $p !== true ) return $p;
630
631 $validOptions = HTMLFormField::flattenOptions( $this->mParams['options'] );
632 if ( in_array( $value, $validOptions ) )
633 return true;
634 else
635 return wfMsgExt( 'htmlform-select-badoption', 'parseinline' );
636 }
637
638 function getInputHTML( $value ) {
639 $select = new XmlSelect( $this->mName, $this->mID, strval( $value ) );
640
641 // If one of the options' 'name' is int(0), it is automatically selected.
642 // because PHP sucks and things int(0) == 'some string'.
643 // Working around this by forcing all of them to strings.
644 $options = array_map( 'strval', $this->mParams['options'] );
645
646 if( !empty( $this->mParams['disabled'] ) ) {
647 $select->setAttribute( 'disabled', 'disabled' );
648 }
649
650 $select->addOptions( $options );
651
652 return $select->getHTML();
653 }
654 }
655
656 class HTMLSelectOrOtherField extends HTMLTextField {
657 static $jsAdded = false;
658
659 function __construct( $params ) {
660 if( !in_array( 'other', $params['options'] ) ) {
661 $params['options'][wfMsg( 'htmlform-selectorother-other' )] = 'other';
662 }
663
664 parent::__construct( $params );
665 }
666
667 function getInputHTML( $value ) {
668 $valInSelect = false;
669
670 if( $value !== false )
671 $valInSelect = in_array( $value,
672 HTMLFormField::flattenOptions( $this->mParams['options'] ) );
673
674 $selected = $valInSelect ? $value : 'other';
675
676 $select = new XmlSelect( $this->mName, $this->mID, $selected );
677 $select->addOptions( array_map( 'strval', $this->mParams['options'] ) );
678
679 $select->setAttribute( 'class', 'mw-htmlform-select-or-other' );
680
681 $tbAttribs = array( 'id' => $this->mID . '-other' );
682 if( !empty( $this->mParams['disabled'] ) ) {
683 $select->setAttribute( 'disabled', 'disabled' );
684 $tbAttribs['disabled'] = 'disabled';
685 }
686
687 $select = $select->getHTML();
688
689 if ( isset( $this->mParams['maxlength'] ) ) {
690 $tbAttribs['maxlength'] = $this->mParams['maxlength'];
691 }
692
693 $textbox = Xml::input( $this->mName . '-other',
694 $this->getSize(),
695 $valInSelect ? '' : $value,
696 $tbAttribs );
697
698 return "$select<br/>\n$textbox";
699 }
700
701 function loadDataFromRequest( $request ) {
702 if( $request->getCheck( $this->mName ) ) {
703 $val = $request->getText( $this->mName );
704
705 if( $val == 'other' ) {
706 $val = $request->getText( $this->mName . '-other' );
707 }
708
709 return $val;
710 } else {
711 return $this->getDefault();
712 }
713 }
714 }
715
716 class HTMLMultiSelectField extends HTMLFormField {
717 function validate( $value, $alldata ) {
718 $p = parent::validate( $value, $alldata );
719 if( $p !== true ) return $p;
720
721 if( !is_array( $value ) ) return false;
722
723 // If all options are valid, array_intersect of the valid options and the provided
724 // options will return the provided options.
725 $validOptions = HTMLFormField::flattenOptions( $this->mParams['options'] );
726
727 $validValues = array_intersect( $value, $validOptions );
728 if ( count( $validValues ) == count( $value ) )
729 return true;
730 else
731 return wfMsgExt( 'htmlform-select-badoption', 'parseinline' );
732 }
733
734 function getInputHTML( $value ) {
735 $html = $this->formatOptions( $this->mParams['options'], $value );
736
737 return $html;
738 }
739
740 function formatOptions( $options, $value ) {
741 $html = '';
742
743 $attribs = array();
744 if ( !empty( $this->mParams['disabled'] ) ) {
745 $attribs['disabled'] = 'disabled';
746 }
747
748 foreach( $options as $label => $info ) {
749 if( is_array( $info ) ) {
750 $html .= Xml::tags( 'h1', null, $label ) . "\n";
751 $html .= $this->formatOptions( $info, $value );
752 } else {
753 $thisAttribs = array( 'id' => $this->mID . "-$info", 'value' => $info );
754
755 $checkbox = Xml::check( $this->mName . '[]', in_array( $info, $value ),
756 $attribs + $thisAttribs );
757 $checkbox .= '&nbsp;' . Xml::tags( 'label', array( 'for' => $this->mID . "-$info" ), $label );
758
759 $html .= $checkbox . '<br />';
760 }
761 }
762
763 return $html;
764 }
765
766 function loadDataFromRequest( $request ) {
767 // won't work with getCheck
768 if( $request->getCheck( 'wpEditToken' ) ) {
769 $arr = $request->getArray( $this->mName );
770
771 if( !$arr )
772 $arr = array();
773
774 return $arr;
775 } else {
776 return $this->getDefault();
777 }
778 }
779
780 function getDefault() {
781 if ( isset( $this->mDefault ) ) {
782 return $this->mDefault;
783 } else {
784 return array();
785 }
786 }
787 }
788
789 class HTMLRadioField extends HTMLFormField {
790 function validate( $value, $alldata ) {
791 $p = parent::validate( $value, $alldata );
792 if( $p !== true ) return $p;
793
794 if( !is_string( $value ) && !is_int( $value ) )
795 return false;
796
797 $validOptions = HTMLFormField::flattenOptions( $this->mParams['options'] );
798
799 if ( in_array( $value, $validOptions ) )
800 return true;
801 else
802 return wfMsgExt( 'htmlform-select-badoption', 'parseinline' );
803 }
804
805 function getInputHTML( $value ) {
806 $html = $this->formatOptions( $this->mParams['options'], $value );
807
808 return $html;
809 }
810
811 function formatOptions( $options, $value ) {
812 $html = '';
813
814 $attribs = array();
815 if ( !empty( $this->mParams['disabled'] ) ) {
816 $attribs['disabled'] = 'disabled';
817 }
818
819 foreach( $options as $label => $info ) {
820 if( is_array( $info ) ) {
821 $html .= Xml::tags( 'h1', null, $label ) . "\n";
822 $html .= $this->formatOptions( $info, $value );
823 } else {
824 $id = Sanitizer::escapeId( $this->mID . "-$info" );
825 $html .= Xml::radio( $this->mName, $info, $info == $value,
826 $attribs + array( 'id' => $id ) );
827 $html .= '&nbsp;' .
828 Xml::tags( 'label', array( 'for' => $id ), $label );
829
830 $html .= "<br/>\n";
831 }
832 }
833
834 return $html;
835 }
836 }
837
838 class HTMLInfoField extends HTMLFormField {
839 function __construct( $info ) {
840 $info['nodata'] = true;
841
842 parent::__construct( $info );
843 }
844
845 function getInputHTML( $value ) {
846 return !empty( $this->mParams['raw'] ) ? $value : htmlspecialchars( $value );
847 }
848
849 function getTableRow( $value ) {
850 if ( !empty( $this->mParams['rawrow'] ) ) {
851 return $value;
852 }
853
854 return parent::getTableRow( $value );
855 }
856 }