MediaWiki REL1_34
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
126 protected function fillParserOutput( Title $title, $revId,
127 ParserOptions $options, $generateHtml, ParserOutput &$output
128 ) {
129 $msg = wfMessage( 'unsupported-content-model', [ $this->getModel() ] );
130 $html = Html::rawElement( 'div', [ 'class' => 'error' ], $msg->inContentLanguage()->parse() );
131 $output->setText( $html );
132 }
133
137 public function convert( $toModel, $lossy = '' ) {
138 return false;
139 }
140
141 protected function equalsInternal( Content $that ) {
142 if ( !$that instanceof UnknownContent ) {
143 return false;
144 }
145
146 return $this->getData() == $that->getData();
147 }
148
149}
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
Base implementation for content objects.
$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='')
Returns false.
fillParserOutput(Title $title, $revId, ParserOptions $options, $generateHtml, ParserOutput &$output)
Fills the ParserOutput with an error message.
getWikitextForTransclusion()
Returns false.
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:34