require_once( "$IP/includes/ObjectCache.php" );
require_once( "$IP/includes/BagOStuff.php" );
require_once( "$IP/languages/LanguageUtf8.php" );
+require_once( "$IP/includes/Hooks.php" );
+require_once( "$IP/maintenance/parserTestsParserHook.php" );
/**
* @package MediaWiki
}
$parser =& new Parser();
+ wfRunHooks( 'ParserTestParser', array( &$parser ) );
$title =& Title::makeTitle( NS_MAIN, $titleText );
if (preg_match('/\\bpst\\b/i', $opts)) {
'wgDefaultUserOptions' => array(),
'wgNoFollowLinks' => true,
'wgThumbnailScriptPath' => false,
+ 'wgUseTeX' => false,
);
$this->savedGlobals = array();
foreach( $settings as $var => $val ) {
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 =
- '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ' .
- '"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' .
+ $this->hackDocType() .
'<html>' .
$text .
'</html>';