Index: trunk/phase3/includes/Xml.php |
— | — | @@ -14,9 +14,10 @@ |
15 | 15 | * @param $element String: element name |
16 | 16 | * @param $attribs Array: Name=>value pairs. Values will be escaped. |
17 | 17 | * @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 |
18 | 19 | * @return string |
19 | 20 | */ |
20 | | - public static function element( $element, $attribs = null, $contents = '') { |
| 21 | + public static function element( $element, $attribs = null, $contents = '', $allowShortTag = true ) { |
21 | 22 | $out = '<' . $element; |
22 | 23 | if( !is_null( $attribs ) ) { |
23 | 24 | $out .= self::expandAttributes( $attribs ); |
— | — | @@ -24,7 +25,7 @@ |
25 | 26 | if( is_null( $contents ) ) { |
26 | 27 | $out .= '>'; |
27 | 28 | } else { |
28 | | - if( $contents === '' ) { |
| 29 | + if( $allowShortTag && $contents === '' ) { |
29 | 30 | $out .= ' />'; |
30 | 31 | } else { |
31 | 32 | $out .= '>' . htmlspecialchars( $contents ) . "</$element>"; |
— | — | @@ -489,7 +490,7 @@ |
490 | 491 | 'cols' => $cols, |
491 | 492 | 'rows' => $rows |
492 | 493 | ) + $attribs, |
493 | | - $content."\n" ); |
| 494 | + $content, false ); |
494 | 495 | } |
495 | 496 | |
496 | 497 | /** |