MediaWiki  master
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 
282  public function getParserOutput( Title $title, $revId = null,
283  ParserOptions $options = null, $generateHtml = true );
284 
285  // TODO: make RenderOutput and RenderOptions base classes
286 
314  public function getSecondaryDataUpdates( Title $title, Content $old = null,
315  $recursive = true, ParserOutput $parserOutput = null );
316 
327  public function getRedirectChain();
328 
339  public function getRedirectTarget();
340 
356  public function getUltimateRedirectTarget();
357 
368  public function isRedirect();
369 
381  public function updateRedirect( Title $target );
382 
395  public function getSection( $sectionId );
396 
411  public function replaceSection( $sectionId, Content $with, $sectionTitle = '' );
412 
425  public function preSaveTransform( Title $title, User $user, ParserOptions $parserOptions );
426 
438  public function addSectionHeader( $header );
439 
452  public function preloadTransform( Title $title, ParserOptions $parserOptions, $params = [] );
453 
480  public function prepareSave( WikiPage $page, $flags, $parentRevId, User $user );
481 
499  public function getDeletionUpdates( WikiPage $page,
500  ParserOutput $parserOutput = null );
501 
511  public function matchMagicWord( MagicWord $word );
512 
525  public function convert( $toModel, $lossy = '' );
526  // @todo ImagePage and CategoryPage interfere with per-content action handlers
527  // @todo nice&sane integration of GeSHi syntax highlighting
528  // [11:59] <vvv> Hooks are ugly; make CodeHighlighter interface and a
529  // config to set the class which handles syntax highlighting
530  // [12:00] <vvv> And default it to a DummyHighlighter
531 
532 }
isRedirect()
Returns whether this Content represents a redirect.
isValid()
Returns whether the content is valid.
getContentHandler()
Convenience method that returns the ContentHandler singleton for handling the content model that this...
convert( $toModel, $lossy='')
Converts this content object into another content object with the given content model, if that is possible.
getDeletionUpdates(WikiPage $page, ParserOutput $parserOutput=null)
Returns a list of updates to perform when this content is deleted.
getTextForSearchIndex()
getSection( $sectionId)
Returns the section with the given ID.
The User object encapsulates all of the user-specific settings (user_id, name, rights, email address, options, last login time).
Definition: User.php:51
getSize()
Returns the content&#39;s nominal size in "bogo-bytes".
getUltimateRedirectTarget()
Construct the redirect destination from this content and return the Title, or null if this content do...
getSupportedFormats()
Convenience method that returns the list of serialization formats supported for the content model tha...
getWikitextForTransclusion()
replaceSection( $sectionId, Content $with, $sectionTitle='')
Replaces a section of the content and returns a Content object with the section replaced.
isEmpty()
Returns true if this Content object represents empty content.
$params
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped & $options
Definition: hooks.txt:1978
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that When $user is not null
Definition: hooks.txt:773
updateRedirect(Title $target)
If this Content object is a redirect, this method updates the redirect target.
namespace and then decline to actually register it file or subcat img or subcat $title
Definition: hooks.txt:918
addSectionHeader( $header)
Returns a new WikitextContent object with the given section heading prepended, if supported...
$header
matchMagicWord(MagicWord $word)
Returns true if this Content object matches the given magic word.
equals(Content $that=null)
Returns true if this Content objects is conceptually equivalent to the given Content object...
getNativeData()
Returns native representation of the data.
getRedirectChain()
Construct the redirect destination from this content and return an array of Titles, or null if this content doesn&#39;t represent a redirect.
isSupportedFormat( $format)
Returns true if $format is a supported serialization format for this Content object, false if it isn&#39;t.
prepareSave(WikiPage $page, $flags, $parentRevId, User $user)
Prepare Content for saving.
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition: injection.txt:35
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...
preSaveTransform(Title $title, User $user, ParserOptions $parserOptions)
Returns a Content object with pre-save transformations applied (or this object if no transformations ...
isCountable( $hasLinks=null)
Returns true if this content is countable as a "real" wiki page, provided that it&#39;s also in a countab...
getTextForSummary( $maxLength=250)
Returns a textual representation of the content suitable for use in edit summaries and log messages...
copy()
Return a copy of this Content object.
getParserOutput(Title $title, $revId=null, ParserOptions $options=null, $generateHtml=true)
Parse the Content object and generate a ParserOutput from the result.
preloadTransform(Title $title, ParserOptions $parserOptions, $params=[])
Returns a Content object with preload transformations applied (or this object if no transformations a...
getModel()
Returns the ID of the content model used by this Content object.
getRedirectTarget()
Construct the redirect destination from this content and return a Title, or null if this content does...
getDefaultFormat()
Convenience method that returns the default serialization format for the content model that this Cont...
return true to allow those checks to and false if checking is done & $user
Definition: hooks.txt:1460
This class encapsulates "magic words" such as "#redirect", NOTOC, etc.
Definition: MagicWord.php:57
serialize( $format=null)
Convenience method for serializing this Content object.