MediaWiki REL1_39
Content.php
Go to the documentation of this file.
1<?php
35interface Content {
36
47 public function getTextForSearchIndex();
48
61 public function getWikitextForTransclusion();
62
74 public function getTextForSummary( $maxLength = 250 );
75
91 public function getNativeData();
92
98 public function getSize();
99
108 public function getModel();
109
120 public function getContentHandler();
121
132 public function getDefaultFormat();
133
144 public function getSupportedFormats();
145
161 public function isSupportedFormat( $format );
162
174 public function serialize( $format = null );
175
183 public function isEmpty();
184
197 public function isValid();
198
224 public function equals( Content $that = null );
225
244 public function copy();
245
261 public function isCountable( $hasLinks = null );
262
286 public function getParserOutput( Title $title, $revId = null,
287 ParserOptions $options = null, $generateHtml = true );
288
289 // TODO: make RenderOutput and RenderOptions base classes
290
299 public function getRedirectTarget();
300
311 public function isRedirect();
312
324 public function updateRedirect( Title $target );
325
338 public function getSection( $sectionId );
339
354 public function replaceSection( $sectionId, Content $with, $sectionTitle = '' );
355
369 public function preSaveTransform( Title $title, User $user, ParserOptions $parserOptions );
370
382 public function addSectionHeader( $header );
383
397 public function preloadTransform( Title $title, ParserOptions $parserOptions, $params = [] );
398
426 public function prepareSave( WikiPage $page, $flags, $parentRevId, User $user );
427
437 public function matchMagicWord( MagicWord $word );
438
451 public function convert( $toModel, $lossy = '' );
452
453 // @todo ImagePage and CategoryPage interfere with per-content action handlers
454 // @todo nice integration of GeSHi syntax highlighting
455 // [11:59] <vvv> Hooks are ugly; make CodeHighlighter interface and a
456 // config to set the class which handles syntax highlighting
457 // [12:00] <vvv> And default it to a DummyHighlighter
458
459}
This class encapsulates "magic words" such as "#redirect", NOTOC, etc.
Definition MagicWord.php:60
Set options of the Parser.
Represents a title within MediaWiki.
Definition Title.php:49
internal since 1.36
Definition User.php:70
Base representation for an editable wiki page.
Definition WikiPage.php:62
Base interface for content objects.
Definition Content.php:35
getRedirectTarget()
Construct the redirect destination from this content and return a Title, or null if this content does...
isCountable( $hasLinks=null)
Returns true if this content is countable as a "real" wiki page, provided that it's also in a countab...
convert( $toModel, $lossy='')
Converts this content object into another content object with the given content model,...
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.
getSection( $sectionId)
Returns the section with the given ID.
getNativeData()
Returns native representation of the data.
getModel()
Returns the ID of the content model used by this Content object.
copy()
Return a copy of this Content object.
getTextForSearchIndex()
preSaveTransform(Title $title, User $user, ParserOptions $parserOptions)
Returns a Content object with pre-save transformations applied (or this object if no transformations ...
getSize()
Returns the content's nominal size in "bogo-bytes".
serialize( $format=null)
Convenience method for serializing this Content object.
getDefaultFormat()
Convenience method that returns the default serialization format for the content model that this Cont...
getSupportedFormats()
Convenience method that returns the list of serialization formats supported for the content model tha...
preloadTransform(Title $title, ParserOptions $parserOptions, $params=[])
Returns a Content object with preload transformations applied (or this object if no transformations a...
isSupportedFormat( $format)
Returns true if $format is a supported serialization format for this Content object,...
matchMagicWord(MagicWord $word)
Returns true if this Content object matches the given magic word.
addSectionHeader( $header)
Returns a new WikitextContent object with the given section heading prepended, if supported.
isRedirect()
Returns whether this Content represents a redirect.
isEmpty()
Returns true if this Content object represents empty content.
getParserOutput(Title $title, $revId=null, ParserOptions $options=null, $generateHtml=true)
Parse the Content object and generate a ParserOutput from the result.
replaceSection( $sectionId, Content $with, $sectionTitle='')
Replaces a section of the content and returns a Content object with the section replaced.
equals(Content $that=null)
Returns true if this Content objects is conceptually equivalent to the given Content object.
getWikitextForTransclusion()
isValid()
Returns whether the content is valid.
updateRedirect(Title $target)
If this Content object is a redirect, this method updates the redirect target.
prepareSave(WikiPage $page, $flags, $parentRevId, User $user)
Prepare Content for saving.
$header