MediaWiki  master
FallbackContentHandler.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 FallbackContent $content';
72  return $content->getData();
73  }
74 
85  public function unserializeContent( $blob, $format = null ) {
86  return new FallbackContent( $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 }
116 
117 class_alias( FallbackContentHandler::class, 'UnknownContentHandler' );
ContentHandler
A content handler knows how do deal with a specific type of content on a wiki page.
Definition: ContentHandler.php:60
FallbackContentHandler\serializeContent
serializeContent(Content $content, $format=null)
Returns the content's data as-is.
Definition: FallbackContentHandler.php:69
UnsupportedSlotDiffRenderer
Produces a warning message about not being able to render a slot diff.
Definition: UnsupportedSlotDiffRenderer.php:31
FallbackContentHandler\unserializeContent
unserializeContent( $blob, $format=null)
Constructs an UnknownContent instance wrapping the given data.
Definition: FallbackContentHandler.php:85
FallbackContentHandler\supportsDirectEditing
supportsDirectEditing()
Definition: FallbackContentHandler.php:103
$blob
$blob
Definition: testCompression.php:70
FallbackContent
Content object implementation representing unknown content.
Definition: FallbackContent.php:38
$content
$content
Definition: router.php:76
IContextSource
Interface for objects which can provide a MediaWiki context on request.
Definition: IContextSource.php:58
Content
Base interface for content objects.
Definition: Content.php:35
FallbackContentHandler\getSlotDiffRendererInternal
getSlotDiffRendererInternal(IContextSource $context)
Definition: FallbackContentHandler.php:112
FallbackContentHandler
Content handler implementation for unknown content.
Definition: FallbackContentHandler.php:34
ContentHandler\getModelID
getModelID()
Returns the model id that identifies the content model this ContentHandler can handle.
Definition: ContentHandler.php:473
FallbackContentHandler\makeEmptyContent
makeEmptyContent()
Creates an empty UnknownContent object.
Definition: FallbackContentHandler.php:96
FallbackContentHandler\__construct
__construct( $modelId, $formats=null)
Constructs an UnknownContentHandler.
Definition: FallbackContentHandler.php:48