MediaWiki master
Content.php
Go to the documentation of this file.
1<?php
21namespace MediaWiki\Content;
22
25
39interface Content {
40
51 public function getTextForSearchIndex();
52
65 public function getWikitextForTransclusion();
66
78 public function getTextForSummary( $maxLength = 250 );
79
95 public function getNativeData();
96
102 public function getSize();
103
112 public function getModel();
113
124 public function getContentHandler();
125
136 public function getDefaultFormat();
137
148 public function getSupportedFormats();
149
165 public function isSupportedFormat( $format );
166
178 public function serialize( $format = null );
179
187 public function isEmpty();
188
201 public function isValid();
202
228 public function equals( Content $that = null );
229
248 public function copy();
249
265 public function isCountable( $hasLinks = null );
266
275 public function getRedirectTarget();
276
287 public function isRedirect();
288
300 public function updateRedirect( Title $target );
301
314 public function getSection( $sectionId );
315
330 public function replaceSection( $sectionId, Content $with, $sectionTitle = '' );
331
343 public function addSectionHeader( $header );
344
354 public function matchMagicWord( MagicWord $word );
355
368 public function convert( $toModel, $lossy = '' );
369
370 // @todo ImagePage and CategoryPage interfere with per-content action handlers
371 // @todo nice integration of GeSHi syntax highlighting
372 // [11:59] <vvv> Hooks are ugly; make CodeHighlighter interface and a
373 // config to set the class which handles syntax highlighting
374 // [12:00] <vvv> And default it to a DummyHighlighter
375
376}
377
379class_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
Base interface for representing page content.
Definition Content.php:39
getRedirectTarget()
Construct the redirect destination from this content and return a Title, or null if this content does...
serialize( $format=null)
Convenience method for serializing this Content object.
addSectionHeader( $header)
Returns a new WikitextContent object with the given section heading prepended, if supported.
isEmpty()
Returns true if this Content object represents empty content.
getDefaultFormat()
Convenience method that returns the default serialization format for the content model that this Cont...
matchMagicWord(MagicWord $word)
Returns true if this Content object matches the given magic word.
isCountable( $hasLinks=null)
Returns true if this content is countable as a "real" wiki page, provided that it's also in a countab...
copy()
Return a copy of this Content object.
getSupportedFormats()
Convenience method that returns the list of serialization formats supported for the content model tha...
convert( $toModel, $lossy='')
Converts this content object into another content object with the given content model,...
isValid()
Returns whether the content is valid.
equals(Content $that=null)
Returns true if this Content objects is conceptually equivalent to the given Content object.
updateRedirect(Title $target)
If this Content object is a redirect, this method updates the redirect target.
getContentHandler()
Convenience method that returns the ContentHandler singleton for handling the content model that this...
getTextForSummary( $maxLength=250)
Returns a textual representation of the content suitable for use in edit summaries and log messages.
getSize()
Returns the content's nominal size in "bogo-bytes".
isRedirect()
Returns whether this Content represents a redirect.
isSupportedFormat( $format)
Returns true if $format is a supported serialization format for this Content object,...
getModel()
Returns the ID of the content model used by this Content object.
getSection( $sectionId)
Returns the section with the given ID.
replaceSection( $sectionId, Content $with, $sectionTitle='')
Replaces a section of the content and returns a Content object with the section replaced.
getNativeData()
Returns native representation of the data.
$header