MediaWiki REL1_37
Content.php
Go to the documentation of this file.
1<?php
35interface Content {
36
47 public function getTextForSearchIndex();
48
61 public function getWikitextForTransclusion();
62
73 public function getTextForSummary( $maxLength = 250 );
74
90 public function getNativeData();
91
97 public function getSize();
98
107 public function getModel();
108
119 public function getContentHandler();
120
131 public function getDefaultFormat();
132
143 public function getSupportedFormats();
144
160 public function isSupportedFormat( $format );
161
173 public function serialize( $format = null );
174
182 public function isEmpty();
183
196 public function isValid();
197
223 public function equals( Content $that = null );
224
243 public function copy();
244
260 public function isCountable( $hasLinks = null );
261
284 public function getParserOutput( Title $title, $revId = null,
285 ParserOptions $options = null, $generateHtml = true );
286
287 // TODO: make RenderOutput and RenderOptions base classes
288
299 public function getRedirectChain();
300
311 public function getRedirectTarget();
312
328 public function getUltimateRedirectTarget();
329
340 public function isRedirect();
341
353 public function updateRedirect( Title $target );
354
367 public function getSection( $sectionId );
368
383 public function replaceSection( $sectionId, Content $with, $sectionTitle = '' );
384
398 public function preSaveTransform( Title $title, User $user, ParserOptions $parserOptions );
399
411 public function addSectionHeader( $header );
412
426 public function preloadTransform( Title $title, ParserOptions $parserOptions, $params = [] );
427
454 public function prepareSave( WikiPage $page, $flags, $parentRevId, User $user );
455
465 public function matchMagicWord( MagicWord $word );
466
479 public function convert( $toModel, $lossy = '' );
480
481 // @todo ImagePage and CategoryPage interfere with per-content action handlers
482 // @todo nice&sane integration of GeSHi syntax highlighting
483 // [11:59] <vvv> Hooks are ugly; make CodeHighlighter interface and a
484 // config to set the class which handles syntax highlighting
485 // [12:00] <vvv> And default it to a DummyHighlighter
486
487}
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:48
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
Definition User.php:69
Class representing a MediaWiki article and history.
Definition WikiPage.php:60
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.
getRedirectChain()
Construct the redirect destination from this content and return an array of Titles,...
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.
getUltimateRedirectTarget()
Construct the redirect destination from this content and return the Title, or null if this content do...
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