MediaWiki  1.23.15
WikitextContentHandler.php
Go to the documentation of this file.
1 <?php
32 
33  public function __construct( $modelId = CONTENT_MODEL_WIKITEXT ) {
34  parent::__construct( $modelId, array( CONTENT_FORMAT_WIKITEXT ) );
35  }
36 
37  public function unserializeContent( $text, $format = null ) {
38  $this->checkFormat( $format );
39 
40  return new WikitextContent( $text );
41  }
42 
48  public function makeEmptyContent() {
49  return new WikitextContent( '' );
50  }
51 
62  public function makeRedirectContent( Title $destination, $text = '' ) {
63  $optionalColon = '';
64 
65  if ( $destination->getNamespace() == NS_CATEGORY ) {
66  $optionalColon = ':';
67  } else {
68  $iw = $destination->getInterwiki();
69  if ( $iw && Language::fetchLanguageName( $iw, null, 'mw' ) ) {
70  $optionalColon = ':';
71  }
72  }
73 
74  $mwRedir = MagicWord::get( 'redirect' );
75  $redirectText = $mwRedir->getSynonym( 0 ) .
76  ' [[' . $optionalColon . $destination->getFullText() . ']]';
77 
78  if ( $text != '' ) {
79  $redirectText .= "\n" . $text;
80  }
81 
82  return new WikitextContent( $redirectText );
83  }
84 
92  public function supportsRedirects() {
93  return true;
94  }
95 
103  public function supportsSections() {
104  return true;
105  }
106 
117  public function isParserCacheSupported() {
118  return true;
119  }
120 
121 }
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
WikitextContentHandler\unserializeContent
unserializeContent( $text, $format=null)
Unserializes a Content object of the type supported by this ContentHandler.
Definition: WikitextContentHandler.php:37
MagicWord\get
static & get( $id)
Factory: creates an object representing an ID.
Definition: MagicWord.php:238
CONTENT_MODEL_WIKITEXT
const CONTENT_MODEL_WIKITEXT
Definition: Defines.php:283
WikitextContentHandler\makeEmptyContent
makeEmptyContent()
Definition: WikitextContentHandler.php:48
Title\getNamespace
getNamespace()
Get the namespace index, i.e.
Definition: Title.php:880
Title\getInterwiki
getInterwiki()
Get the interwiki prefix.
Definition: Title.php:778
Title\getFullText
getFullText()
Get the prefixed title with spaces, plus any fragment (part beginning with '#')
Definition: Title.php:1393
array
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
NS_CATEGORY
const NS_CATEGORY
Definition: Defines.php:93
WikitextContent
Content object for wiki text pages.
Definition: WikitextContent.php:33
CONTENT_FORMAT_WIKITEXT
const CONTENT_FORMAT_WIKITEXT
Definition: Defines.php:297
WikitextContentHandler
Content handler for wiki text pages.
Definition: WikitextContentHandler.php:31
WikitextContentHandler\isParserCacheSupported
isParserCacheSupported()
Returns true, because wikitext supports caching using the ParserCache mechanism.
Definition: WikitextContentHandler.php:117
WikitextContentHandler\__construct
__construct( $modelId=CONTENT_MODEL_WIKITEXT)
Definition: WikitextContentHandler.php:33
TextContentHandler
Base content handler implementation for flat text contents.
Definition: TextContentHandler.php:31
Language\fetchLanguageName
static fetchLanguageName( $code, $inLanguage=null, $include='all')
Definition: Language.php:941
Title
Represents a title within MediaWiki.
Definition: Title.php:35
ContentHandler\checkFormat
checkFormat( $format)
Convenient for checking whether a format provided as a parameter is actually supported.
Definition: ContentHandler.php:558
WikitextContentHandler\supportsRedirects
supportsRedirects()
Returns true because wikitext supports redirects.
Definition: WikitextContentHandler.php:92
WikitextContentHandler\supportsSections
supportsSections()
Returns true because wikitext supports sections.
Definition: WikitextContentHandler.php:103
WikitextContentHandler\makeRedirectContent
makeRedirectContent(Title $destination, $text='')
Returns a WikitextContent object representing a redirect to the given destination page.
Definition: WikitextContentHandler.php:62