MediaWiki REL1_35
UnknownContent.php
Go to the documentation of this file.
1<?php
39
41 private $data;
42
47 public function __construct( $data, $model_id ) {
48 parent::__construct( $model_id );
49
50 $this->data = $data;
51 }
52
56 public function copy() {
57 // UnknownContent is immutable, so no need to copy.
58 return $this;
59 }
60
68 public function getTextForSummary( $maxlength = 250 ) {
69 return '';
70 }
71
77 public function getSize() {
78 return strlen( $this->data );
79 }
80
89 public function isCountable( $hasLinks = null ) {
90 return false;
91 }
92
96 public function getNativeData() {
97 return $this->getData();
98 }
99
103 public function getData() {
104 return $this->data;
105 }
106
112 public function getTextForSearchIndex() {
113 return '';
114 }
115
119 public function getWikitextForTransclusion() {
120 return false;
121 }
122
131 protected function fillParserOutput( Title $title, $revId,
132 ParserOptions $options, $generateHtml, ParserOutput &$output
133 ) {
134 $msg = wfMessage( 'unsupported-content-model', [ $this->getModel() ] );
135 $html = Html::rawElement( 'div', [ 'class' => 'error' ], $msg->inContentLanguage()->parse() );
136 $output->setText( $html );
137 }
138
144 public function convert( $toModel, $lossy = '' ) {
145 return false;
146 }
147
148 protected function equalsInternal( Content $that ) {
149 if ( !$that instanceof UnknownContent ) {
150 return false;
151 }
152
153 return $this->getData() == $that->getData();
154 }
155
156}
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
Base implementation for content objects.
string $model_id
Name of the content model this Content object represents.
Set options of the Parser.
Represents a title within MediaWiki.
Definition Title.php:42
Content object implementation representing unknown content.
getSize()
Returns the data size in bytes.
getTextForSummary( $maxlength=250)
Returns an empty string.
convert( $toModel, $lossy='')
fillParserOutput(Title $title, $revId, ParserOptions $options, $generateHtml, ParserOutput &$output)
Fills the ParserOutput with an error message.
getTextForSearchIndex()
Returns an empty string.
__construct( $data, $model_id)
isCountable( $hasLinks=null)
Returns false.
equalsInternal(Content $that)
Checks whether $that is logically equal to this Content object.
Base interface for content objects.
Definition Content.php:35