MediaWiki  1.30.0
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 
86  public function getNativeData();
87 
93  public function getSize();
94 
103  public function getModel();
104 
115  public function getContentHandler();
116 
127  public function getDefaultFormat();
128 
139  public function getSupportedFormats();
140 
156  public function isSupportedFormat( $format );
157 
169  public function serialize( $format = null );
170 
178  public function isEmpty();
179 
192  public function isValid();
193 
217  public function equals( Content $that = null );
218 
237  public function copy();
238 
252  public function isCountable( $hasLinks = null );
253 
275  public function getParserOutput( Title $title, $revId = null,
276  ParserOptions $options = null, $generateHtml = true );
277 
278  // TODO: make RenderOutput and RenderOptions base classes
279 
312  public function getSecondaryDataUpdates( Title $title, Content $old = null,
313  $recursive = true, ParserOutput $parserOutput = null );
314 
325  public function getRedirectChain();
326 
337  public function getRedirectTarget();
338 
354  public function getUltimateRedirectTarget();
355 
364  public function isRedirect();
365 
377  public function updateRedirect( Title $target );
378 
391  public function getSection( $sectionId );
392 
407  public function replaceSection( $sectionId, Content $with, $sectionTitle = '' );
408 
421  public function preSaveTransform( Title $title, User $user, ParserOptions $parserOptions );
422 
434  public function addSectionHeader( $header );
435 
448  public function preloadTransform( Title $title, ParserOptions $parserOptions, $params = [] );
449 
476  public function prepareSave( WikiPage $page, $flags, $parentRevId, User $user );
477 
493  public function getDeletionUpdates( WikiPage $page,
494  ParserOutput $parserOutput = null );
495 
505  public function matchMagicWord( MagicWord $word );
506 
519  public function convert( $toModel, $lossy = '' );
520  // @todo ImagePage and CategoryPage interfere with per-content action handlers
521  // @todo nice&sane integration of GeSHi syntax highlighting
522  // [11:59] <vvv> Hooks are ugly; make CodeHighlighter interface and a
523  // config to set the class which handles syntax highlighting
524  // [12:00] <vvv> And default it to a DummyHighlighter
525 
526 }
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:40
Content\getDefaultFormat
getDefaultFormat()
Convenience method that returns the default serialization format for the content model that this Cont...
$user
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a account $user
Definition: hooks.txt:244
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:24
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:37
Content\getTextForSearchIndex
getTextForSearchIndex()
$params
$params
Definition: styleTest.css.php:40
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".
php
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
Content\getWikitextForTransclusion
getWikitextForTransclusion()
Content\getUltimateRedirectTarget
getUltimateRedirectTarget()
Construct the redirect destination from this content and return the Title, or null if this content do...
$title
namespace and then decline to actually register it file or subcat img or subcat $title
Definition: hooks.txt:932
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...
MagicWord
This class encapsulates "magic words" such as "#redirect", NOTOC, etc.
Definition: MagicWord.php:59
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:35
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:39
$options
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:1965
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
$flags
it s the revision text itself In either if gzip is the revision text is gzipped $flags
Definition: hooks.txt:2801