MediaWiki master
Content.php
Go to the documentation of this file.
1<?php
21namespace MediaWiki\Content;
22
25
42interface Content {
43
51 public function getTextForSearchIndex();
52
64 public function getWikitextForTransclusion();
65
75 public function getTextForSummary( $maxLength = 250 );
76
89 public function getNativeData();
90
97 public function getSize();
98
105 public function getModel();
106
117 public function getContentHandler();
118
128 public function getDefaultFormat();
129
139 public function getSupportedFormats();
140
154 public function isSupportedFormat( $format );
155
166 public function serialize( $format = null );
167
174 public function isEmpty();
175
187 public function isValid();
188
219 public function equals( ?Content $that = null );
220
236 public function copy();
237
252 public function isCountable( $hasLinks = null );
253
260 public function getRedirectTarget();
261
271 public function isRedirect();
272
287 public function updateRedirect( Title $target );
288
299 public function getSection( $sectionId );
300
312 public function replaceSection( $sectionId, Content $with, $sectionTitle = '' );
313
325 public function addSectionHeader( $header );
326
336 public function matchMagicWord( MagicWord $word );
337
350 public function convert( $toModel, $lossy = '' );
351
352 // @todo ImagePage and CategoryPage interfere with per-content action handlers
353 // @todo nice integration of GeSHi syntax highlighting
354 // [11:59] <vvv> Hooks are ugly; make CodeHighlighter interface and a
355 // config to set the class which handles syntax highlighting
356 // [12:00] <vvv> And default it to a DummyHighlighter
357
358}
359
361class_alias( Content::class, 'Content' );
This class encapsulates "magic words" such as "#redirect", NOTOC, etc.
Definition MagicWord.php:65
Represents a title within MediaWiki.
Definition Title.php:78
Content objects represent page content, e.g.
Definition Content.php:42
getRedirectTarget()
Get the redirect destination or null if this content doesn't represent a redirect.
serialize( $format=null)
Serialize this Content object.
addSectionHeader( $header)
Create a derived WikitextContent with a prepended section heading, or return $this.
isEmpty()
Whether this Content object is considered empty.
getDefaultFormat()
Get the default serialization format.
equals(?Content $that=null)
Whether this Content object is conceptually equivalent to another one.
matchMagicWord(MagicWord $word)
Returns true if this Content object matches the given magic word.
isCountable( $hasLinks=null)
Whether this content may count towards a "real" wiki page.
copy()
Create a copy of this Content object.
getSupportedFormats()
Get the list of supported serialization formats.
convert( $toModel, $lossy='')
Converts this content object into another content object with the given content model,...
isValid()
Whether the content is valid.
updateRedirect(Title $target)
Create a derived Content with a replaced redirect destination.
getContentHandler()
Convenience method that returns the ContentHandler singleton for handling the content model that this...
getTextForSummary( $maxLength=250)
Get a textual representation of the content, suitable for use in edit summaries and log messages.
getSize()
Get the content's nominal size in "bogo-bytes".
isRedirect()
Whether this Content represents a redirect.
isSupportedFormat( $format)
Whether a given format is a supported serialization format for this Content.
getModel()
Get the content model ID.
getSection( $sectionId)
Create a derived Content for the portion of text in the specified section.
replaceSection( $sectionId, Content $with, $sectionTitle='')
Create a derived Content with the specified section added or replaced.
getNativeData()
Get native representation of the data.
$header