MediaWiki  master
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 }
getTextForSearchIndex()
Returns an empty string.
setText( $text)
$model_id
Name of the content model this Content object represents.
static rawElement( $element, $attribs=[], $contents='')
Returns an HTML element in a string.
Definition: Html.php:209
getSize()
Returns the data size in bytes.
getTextForSummary( $maxlength=250)
Returns an empty string.
fillParserOutput(Title $title, $revId, ParserOptions $options, $generateHtml, ParserOutput &$output)
Fills the ParserOutput with an error message.
__construct( $data, $model_id)
Base implementation for content objects.
equalsInternal(Content $that)
Content object implementation representing unknown content.
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
convert( $toModel, $lossy='')
isCountable( $hasLinks=null)
Returns false.