MediaWiki  REL1_24
WikitextContentHandler.php
Go to the documentation of this file.
00001 <?php
00031 class WikitextContentHandler extends TextContentHandler {
00032 
00033     public function __construct( $modelId = CONTENT_MODEL_WIKITEXT ) {
00034         parent::__construct( $modelId, array( CONTENT_FORMAT_WIKITEXT ) );
00035     }
00036 
00037     protected function getContentClass() {
00038         return 'WikitextContent';
00039     }
00040 
00051     public function makeRedirectContent( Title $destination, $text = '' ) {
00052         $optionalColon = '';
00053 
00054         if ( $destination->getNamespace() == NS_CATEGORY ) {
00055             $optionalColon = ':';
00056         } else {
00057             $iw = $destination->getInterwiki();
00058             if ( $iw && Language::fetchLanguageName( $iw, null, 'mw' ) ) {
00059                 $optionalColon = ':';
00060             }
00061         }
00062 
00063         $mwRedir = MagicWord::get( 'redirect' );
00064         $redirectText = $mwRedir->getSynonym( 0 ) .
00065             ' [[' . $optionalColon . $destination->getFullText() . ']]';
00066 
00067         if ( $text != '' ) {
00068             $redirectText .= "\n" . $text;
00069         }
00070 
00071         $class = $this->getContentClass();
00072         return new $class( $redirectText );
00073     }
00074 
00082     public function supportsRedirects() {
00083         return true;
00084     }
00085 
00093     public function supportsSections() {
00094         return true;
00095     }
00096 
00107     public function isParserCacheSupported() {
00108         return true;
00109     }
00110 
00111 }