From 08aa4418c30cfc18ccc69a0f0f9cb9e17be6c196 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Mon, 12 Aug 2013 09:28:15 +0200 Subject: Update to MediaWiki 1.21.1 --- includes/content/WikitextContentHandler.php | 98 +++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 includes/content/WikitextContentHandler.php (limited to 'includes/content/WikitextContentHandler.php') diff --git a/includes/content/WikitextContentHandler.php b/includes/content/WikitextContentHandler.php new file mode 100644 index 00000000..e1dcc668 --- /dev/null +++ b/includes/content/WikitextContentHandler.php @@ -0,0 +1,98 @@ +checkFormat( $format ); + + return new WikitextContent( $text ); + } + + /** + * @see ContentHandler::makeEmptyContent + * + * @return Content + */ + public function makeEmptyContent() { + return new WikitextContent( '' ); + } + + /** + * Returns a WikitextContent object representing a redirect to the given destination page. + * + * @see ContentHandler::makeRedirectContent + * + * @param Title $destination the page to redirect to. + * + * @return Content + */ + public function makeRedirectContent( Title $destination ) { + $mwRedir = MagicWord::get( 'redirect' ); + $redirectText = $mwRedir->getSynonym( 0 ) . ' [[' . $destination->getPrefixedText() . ']]'; + + return new WikitextContent( $redirectText ); + } + + /** + * Returns true because wikitext supports redirects. + * + * @see ContentHandler::supportsRedirects + * + * @return boolean whether redirects are supported. + */ + public function supportsRedirects() { + return true; + } + + /** + * Returns true because wikitext supports sections. + * + * @return boolean whether sections are supported. + */ + public function supportsSections() { + return true; + } + + /** + * Returns true, because wikitext supports caching using the + * ParserCache mechanism. + * + * @since 1.21 + * @return bool + */ + public function isParserCacheSupported() { + return true; + } +} -- cgit v1.2.3-54-g00ecf