MediaWiki  1.34.4
Content.php
Go to the documentation of this file.
1 <?php
34 interface Content {
35 
46  public function getTextForSearchIndex();
47 
60  public function getWikitextForTransclusion();
61 
72  public function getTextForSummary( $maxLength = 250 );
73 
89  public function getNativeData();
90 
96  public function getSize();
97 
106  public function getModel();
107 
118  public function getContentHandler();
119 
130  public function getDefaultFormat();
131 
142  public function getSupportedFormats();
143 
159  public function isSupportedFormat( $format );
160 
172  public function serialize( $format = null );
173 
181  public function isEmpty();
182 
195  public function isValid();
196 
222  public function equals( Content $that = null );
223 
242  public function copy();
243 
259  public function isCountable( $hasLinks = null );
260 
283  public function getParserOutput( Title $title, $revId = null,
284  ParserOptions $options = null, $generateHtml = true );
285 
286  // TODO: make RenderOutput and RenderOptions base classes
287 
315  public function getSecondaryDataUpdates( Title $title, Content $old = null,
316  $recursive = true, ParserOutput $parserOutput = null );
317 
328  public function getRedirectChain();
329 
340  public function getRedirectTarget();
341 
357  public function getUltimateRedirectTarget();
358 
369  public function isRedirect();
370 
382  public function updateRedirect( Title $target );
383 
396  public function getSection( $sectionId );
397 
412  public function replaceSection( $sectionId, Content $with, $sectionTitle = '' );
413 
426  public function preSaveTransform( Title $title, User $user, ParserOptions $parserOptions );
427 
439  public function addSectionHeader( $header );
440 
453  public function preloadTransform( Title $title, ParserOptions $parserOptions, $params = [] );
454 
481  public function prepareSave( WikiPage $page, $flags, $parentRevId, User $user );
482 
500  public function getDeletionUpdates( WikiPage $page,
501  ParserOutput $parserOutput = null );
502 
512  public function matchMagicWord( MagicWord $word );
513 
526  public function convert( $toModel, $lossy = '' );
527  // @todo ImagePage and CategoryPage interfere with per-content action handlers
528  // @todo nice&sane integration of GeSHi syntax highlighting
529  // [11:59] <vvv> Hooks are ugly; make CodeHighlighter interface and a
530  // config to set the class which handles syntax highlighting
531  // [12:00] <vvv> And default it to a DummyHighlighter
532 
533 }
Content\getContentHandler
getContentHandler()
Convenience method that returns the ContentHandler singleton for handling the content model that this...
ParserOptions
Set options of the Parser.
Definition: ParserOptions.php:42
Content\getDefaultFormat
getDefaultFormat()
Convenience method that returns the default serialization format for the content model that this Cont...
Content\isRedirect
isRedirect()
Returns whether this Content represents a redirect.
Content\serialize
serialize( $format=null)
Convenience method for serializing this Content object.
ParserOutput
Definition: ParserOutput.php:25
Content\isValid
isValid()
Returns whether the content is valid.
Content\convert
convert( $toModel, $lossy='')
Converts this content object into another content object with the given content model,...
WikiPage
Class representing a MediaWiki article and history.
Definition: WikiPage.php:47
Content\getTextForSearchIndex
getTextForSearchIndex()
Content\getDeletionUpdates
getDeletionUpdates(WikiPage $page, ParserOutput $parserOutput=null)
Returns a list of updates to perform when this content is deleted.
Content\getSize
getSize()
Returns the content's nominal size in "bogo-bytes".
Content\getWikitextForTransclusion
getWikitextForTransclusion()
Content\getUltimateRedirectTarget
getUltimateRedirectTarget()
Construct the redirect destination from this content and return the Title, or null if this content do...
Content\getSection
getSection( $sectionId)
Returns the section with the given ID.
Content\getSupportedFormats
getSupportedFormats()
Convenience method that returns the list of serialization formats supported for the content model tha...
$title
$title
Definition: testCompression.php:34
MagicWord
This class encapsulates "magic words" such as "#redirect", NOTOC, etc.
Definition: MagicWord.php:57
Content\isEmpty
isEmpty()
Returns true if this Content object represents empty content.
Content\replaceSection
replaceSection( $sectionId, Content $with, $sectionTitle='')
Replaces a section of the content and returns a Content object with the section replaced.
Content\matchMagicWord
matchMagicWord(MagicWord $word)
Returns true if this Content object matches the given magic word.
Content\prepareSave
prepareSave(WikiPage $page, $flags, $parentRevId, User $user)
Prepare Content for saving.
Content\equals
equals(Content $that=null)
Returns true if this Content objects is conceptually equivalent to the given Content object.
Content\addSectionHeader
addSectionHeader( $header)
Returns a new WikitextContent object with the given section heading prepended, if supported.
Content\getRedirectChain
getRedirectChain()
Construct the redirect destination from this content and return an array of Titles,...
Content\updateRedirect
updateRedirect(Title $target)
If this Content object is a redirect, this method updates the redirect target.
$header
$header
Definition: updateCredits.php:41
Content\getSecondaryDataUpdates
getSecondaryDataUpdates(Title $title, Content $old=null, $recursive=true, ParserOutput $parserOutput=null)
Returns a list of DataUpdate objects for recording information about this Content in some secondary d...
Content\getNativeData
getNativeData()
Returns native representation of the data.
Content\isSupportedFormat
isSupportedFormat( $format)
Returns true if $format is a supported serialization format for this Content object,...
Content\preSaveTransform
preSaveTransform(Title $title, User $user, ParserOptions $parserOptions)
Returns a Content object with pre-save transformations applied (or this object if no transformations ...
Content
Base interface for content objects.
Definition: Content.php:34
Title
Represents a title within MediaWiki.
Definition: Title.php:42
Content\copy
copy()
Return a copy of this Content object.
Content\getTextForSummary
getTextForSummary( $maxLength=250)
Returns a textual representation of the content suitable for use in edit summaries and log messages.
Content\preloadTransform
preloadTransform(Title $title, ParserOptions $parserOptions, $params=[])
Returns a Content object with preload transformations applied (or this object if no transformations a...
Content\getModel
getModel()
Returns the ID of the content model used by this Content object.
Content\getParserOutput
getParserOutput(Title $title, $revId=null, ParserOptions $options=null, $generateHtml=true)
Parse the Content object and generate a ParserOutput from the result.
Content\getRedirectTarget
getRedirectTarget()
Construct the redirect destination from this content and return a Title, or null if this content does...
Content\isCountable
isCountable( $hasLinks=null)
Returns true if this content is countable as a "real" wiki page, provided that it's also in a countab...
User
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
Definition: User.php:51