MediaWiki master
Content.php
Go to the documentation of this file.
1<?php
7namespace MediaWiki\Content;
8
11
28interface Content {
29
37 public function getTextForSearchIndex();
38
50 public function getWikitextForTransclusion();
51
61 public function getTextForSummary( $maxLength = 250 );
62
75 public function getNativeData();
76
83 public function getSize();
84
91 public function getModel();
92
101 public function getContentHandler();
102
112 public function getDefaultFormat();
113
123 public function getSupportedFormats();
124
138 public function isSupportedFormat( $format );
139
150 public function serialize( $format = null );
151
158 public function isEmpty();
159
171 public function isValid();
172
203 public function equals( ?Content $that = null );
204
220 public function copy();
221
236 public function isCountable( $hasLinks = null );
237
244 public function getRedirectTarget();
245
255 public function isRedirect();
256
271 public function updateRedirect( Title $target );
272
283 public function getSection( $sectionId );
284
296 public function replaceSection( $sectionId, Content $with, $sectionTitle = '' );
297
309 public function addSectionHeader( $header );
310
320 public function matchMagicWord( MagicWord $word );
321
334 public function convert( $toModel, $lossy = '' );
335
336 // @todo ImagePage and CategoryPage interfere with per-content action handlers
337 // @todo nice integration of GeSHi syntax highlighting
338 // [11:59] <vvv> Hooks are ugly; make CodeHighlighter interface and a
339 // config to set the class which handles syntax highlighting
340 // [12:00] <vvv> And default it to a DummyHighlighter
341
342}
343
345class_alias( Content::class, 'Content' );
This class encapsulates "magic words" such as "#redirect", NOTOC, etc.
Definition MagicWord.php:51
Represents a title within MediaWiki.
Definition Title.php:69
Content objects represent page content, e.g.
Definition Content.php:28
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.