3 * Content handler for wiki text pages.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
27 * Content handler for wiki text pages.
31 class WikitextContentHandler
extends TextContentHandler
{
33 public function __construct( $modelId = CONTENT_MODEL_WIKITEXT
) {
34 parent
::__construct( $modelId, array( CONTENT_FORMAT_WIKITEXT
) );
37 public function unserializeContent( $text, $format = null ) {
38 $this->checkFormat( $format );
40 return new WikitextContent( $text );
44 * @see ContentHandler::makeEmptyContent
48 public function makeEmptyContent() {
49 return new WikitextContent( '' );
54 * Returns a WikitextContent object representing a redirect to the given destination page.
56 * @see ContentHandler::makeRedirectContent
58 * @param Title $destination the page to redirect to.
62 public function makeRedirectContent( Title
$destination ) {
63 $mwRedir = MagicWord
::get( 'redirect' );
64 $redirectText = $mwRedir->getSynonym( 0 ) . ' [[' . $destination->getPrefixedText() . ']]';
66 return new WikitextContent( $redirectText );
70 * Returns true because wikitext supports redirects.
72 * @see ContentHandler::supportsRedirects
74 * @return boolean whether redirects are supported.
76 public function supportsRedirects() {
81 * Returns true because wikitext supports sections.
83 * @return boolean whether sections are supported.
85 public function supportsSections() {
90 * Returns true, because wikitext supports caching using the
91 * ParserCache mechanism.
96 public function isParserCacheSupported() {