MediaWiki  master
UnknownContentHandler.php
Go to the documentation of this file.
1 <?php
35 
48  public function __construct( $modelId, $formats = null ) {
49  parent::__construct(
50  $modelId,
51  $formats ?? [
52  'application/octet-stream',
53  'application/unknown',
54  'application/x-binary',
55  'text/unknown',
56  'unknown/unknown',
57  ]
58  );
59  }
60 
69  public function serializeContent( Content $content, $format = null ) {
71  '@phan-var UnknownContent $content';
72  return $content->getData();
73  }
74 
85  public function unserializeContent( $blob, $format = null ) {
86  return new UnknownContent( $blob, $this->getModelID() );
87  }
88 
96  public function makeEmptyContent() {
97  return $this->unserializeContent( '' );
98  }
99 
103  public function supportsDirectEditing() {
104  return false;
105  }
106 
112  protected function getSlotDiffRendererInternal( IContextSource $context ) {
113  return new UnsupportedSlotDiffRenderer( $context );
114  }
115 }
ContentHandler
A content handler knows how do deal with a specific type of content on a wiki page.
Definition: ContentHandler.php:59
UnsupportedSlotDiffRenderer
Produces a warning message about not being able to render a slot diff.
Definition: UnsupportedSlotDiffRenderer.php:31
UnknownContent
Content object implementation representing unknown content.
Definition: UnknownContent.php:38
$blob
$blob
Definition: testCompression.php:70
$content
$content
Definition: router.php:76
UnknownContentHandler\makeEmptyContent
makeEmptyContent()
Creates an empty UnknownContent object.
Definition: UnknownContentHandler.php:96
IContextSource
Interface for objects which can provide a MediaWiki context on request.
Definition: IContextSource.php:55
Content
Base interface for content objects.
Definition: Content.php:35
UnknownContentHandler\__construct
__construct( $modelId, $formats=null)
Constructs an UnknownContentHandler.
Definition: UnknownContentHandler.php:48
ContentHandler\getModelID
getModelID()
Returns the model id that identifies the content model this ContentHandler can handle.
Definition: ContentHandler.php:465
UnknownContentHandler\unserializeContent
unserializeContent( $blob, $format=null)
Constructs an UnknownContent instance wrapping the given data.
Definition: UnknownContentHandler.php:85
UnknownContentHandler\getSlotDiffRendererInternal
getSlotDiffRendererInternal(IContextSource $context)
Definition: UnknownContentHandler.php:112
UnknownContentHandler\supportsDirectEditing
supportsDirectEditing()
Definition: UnknownContentHandler.php:103
UnknownContentHandler\serializeContent
serializeContent(Content $content, $format=null)
Returns the content's data as-is.
Definition: UnknownContentHandler.php:69
UnknownContentHandler
Content handler implementation for unknown content.
Definition: UnknownContentHandler.php:34