* Allow input of the stub from a compressed file instead of stdin
for dumpTextPass.php; easier to get errors back on the shell
* Added an attractive space on the namespace selector on contribs
+* Move PHP 5-friendly XHTML doctype hack to Sanitizer, use for sig checks.
+ Fixes use of named entities in sigs on PHP 5
=== Caveats ===
*/
function wfIsWellFormedXmlFragment( $text ) {
$html =
- '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ' .
- '"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' .
+ Sanitizer::hackDocType() .
'<html>' .
$text .
'</html>';
return $text;
}
+ /**
+ * Hack up a private DOCTYPE with HTML's standard entity declarations.
+ * PHP 4 seemed to know these if you gave it an HTML doctype, but
+ * PHP 5.1 doesn't.
+ *
+ * Use for passing XHTML fragments to PHP's XML parsing functions
+ *
+ * @return string
+ * @static
+ */
+ function hackDocType() {
+ global $wgHtmlEntities;
+ $out = "<!DOCTYPE html [\n";
+ foreach( $wgHtmlEntities as $entity => $codepoint ) {
+ $out .= "<!ENTITY $entity \"&#$codepoint;\">";
+ }
+ $out .= "]>\n";
+ return $out;
+ }
+
}
?>
return $text;
}
- /**
- * Hack up a private DOCTYPE with HTML's standard entity declarations.
- * PHP 4 seemed to know these if you gave it an HTML doctype, but
- * PHP 5.1 doesn't.
- * @return string
- * @access private
- */
- function hackDocType() {
- global $wgHtmlEntities;
- $out = "<!DOCTYPE html [\n";
- foreach( $wgHtmlEntities as $entity => $codepoint ) {
- $out .= "<!ENTITY $entity \"&#$codepoint;\">";
- }
- $out .= "]>\n";
- return $out;
- }
-
function wellFormed( $text ) {
$html =
- $this->hackDocType() .
+ Sanitizer::hackDocType() .
'<html>' .
$text .
'</html>';