function transform($text) { $text = preg_replace("/@pageRead/i", $this->page->get("pageRead"), $text); $text = preg_replace("/@pageEdit/i", $this->page->get("pageEdit"), $text); $text = preg_replace("/@pageError/i", $this->page->get("pageError"), $text); $text = preg_replace("/@pageFile/i", $this->page->get("pageFile"), $text); return parent::transform($text); }
function __construct($yellow, $page) { $this->yellow = $yellow; $this->page = $page; $this->idAttributes = array(); $this->no_markup = $page->parserSafeMode; $this->url_filter_func = function ($url) use($yellow, $page) { return $yellow->lookup->normaliseLocation($url, $page->base, $page->location, $yellow->config->get("serverBase") . $yellow->config->get("imageLocation"), $page->parserSafeMode && $page->statusCode == 200); }; parent::__construct(); }
return true; } public static function noOp() { return false; } } // End class MarkdownExtraParser // Running MediaWiki? if (defined('MEDIAWIKI')) { // Define our parser to use our override @define('MARKDOWN_PARSER_CLASS', 'MarkdownExtraOverride'); // Require the Markdown library require_once __DIR__ . DIRECTORY_SEPARATOR . 'markdown.php'; // Instanciate $markdownExtraParser = new MarkdownExtraParser(); // If we have set options, let's pass them in if (isset($MarkdownExtraParserOptions)) { $markdownExtraParser->setConfig($MarkdownExtraParserOptions); } // Register our MediaWiki parser hooks $wgHooks['ParserBeforeStrip'][] = array($markdownExtraParser, 'parseAsMarkdown'); if ($markdownExtraParser->getConfig('use_raw_html')) { $wgHooks['InternalParseBeforeSanitize'][] = array($markdownExtraParser, 'saveContent'); $wgHooks['InternalParseBeforeLinks'][] = array($markdownExtraParser, 'retrieveContent'); } } // End MediaWiki env /** * MarkdownExtraOverride *
/** * Disable mailto unless auto_mailto */ protected function doAutoLinks($text) { if(!$this->features['auto_mailto']) { return preg_replace_callback('{<((https?|ftp|dict):[^\'">\s]+)>}i', array(&$this, '_doAutoLinks_url_callback'), $text); } return parent::doAutoLinks($text); }