r36724 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r36723‎ | r36724 | r36725 >
Date:11:01, 27 June 2008
Author:ialex
Status:old
Tags:
Comment:
Don't allow contentless tags for <textarea>
Modified paths:
  • /trunk/phase3/includes/Xml.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Xml.php
@@ -14,9 +14,10 @@
1515 * @param $element String: element name
1616 * @param $attribs Array: Name=>value pairs. Values will be escaped.
1717 * @param $contents String: NULL to make an open tag only; '' for a contentless closed tag (default)
 18+ * @param $allowShortTag Bool: whether '' in $contents will result in a contentless closed tag
1819 * @return string
1920 */
20 - public static function element( $element, $attribs = null, $contents = '') {
 21+ public static function element( $element, $attribs = null, $contents = '', $allowShortTag = true ) {
2122 $out = '<' . $element;
2223 if( !is_null( $attribs ) ) {
2324 $out .= self::expandAttributes( $attribs );
@@ -24,7 +25,7 @@
2526 if( is_null( $contents ) ) {
2627 $out .= '>';
2728 } else {
28 - if( $contents === '' ) {
 29+ if( $allowShortTag && $contents === '' ) {
2930 $out .= ' />';
3031 } else {
3132 $out .= '>' . htmlspecialchars( $contents ) . "</$element>";
@@ -489,7 +490,7 @@
490491 'cols' => $cols,
491492 'rows' => $rows
492493 ) + $attribs,
493 - $content."\n" );
 494+ $content, false );
494495 }
495496
496497 /**

Status & tagging log