122 if ( $this->path ===
false ) {
147 abstract public function toHtml( $options = [] );
171 return ( !$this->
isError() && ( $this->path || $this->path ===
null ) );
181 return ( !$this->
isError() && $this->path ===
null );
193 } elseif ( $this->path ===
null ) {
194 return $this->file->getLocalRefPath();
196 $be = $this->file->getRepo()->getBackend();
198 $fsFile = $be->getLocalReference( [
'src' => $this->path ] );
200 return $fsFile ? $fsFile->getPath() :
false;
214 if ( !$this->path ) {
217 $be = $this->file->getRepo()->getBackend();
219 $be->streamFile( [
'src' => $this->path,
'headers' => $headers ] ) );
245 protected function linkWrap( $linkAttribs, $contents ) {
246 if ( isset( $linkAttribs[
'href'] ) ) {
247 return Xml::tags(
'a', $linkAttribs, $contents );
249 $parserEnableLegacyMediaDOM = MediaWikiServices::getInstance()
250 ->getMainConfig()->get( MainConfigNames::ParserEnableLegacyMediaDOM );
251 if ( $parserEnableLegacyMediaDOM ) {
254 return Xml::tags(
'span', $linkAttribs ?:
null, $contents );
265 if ( is_array( $params ) ) {
270 if ( $this->page && $this->page !== 1 ) {
277 if ( is_string( $params ) && $params !==
'' ) {
282 'href' => $this->file->getTitle()->getLocalURL( $query ),
285 $parserEnableLegacyMediaDOM = MediaWikiServices::getInstance()
286 ->getMainConfig()->get( MainConfigNames::ParserEnableLegacyMediaDOM );
287 if ( $parserEnableLegacyMediaDOM ) {
288 $attribs[
'class'] =
'image';
290 $attribs[
'class'] =
'mw-file-description';
294 $attribs[
'title'] =
$title;
wfArrayToCgi( $array1, $array2=null, $prefix='')
This function takes one or two arrays as input, and returns a CGI-style string, e....
static isStoragePath( $path)
Check if a given path is a "mwstore://" path.
static extensionFromPath( $path, $case='lowercase')
Get the final extension from a storage or FS path.
A class containing constants representing the names of configuration variables.
static newFatal( $message,... $parameters)
Factory function for fatal errors.
static newGood( $value=null)
Factory function for good results.
static wrap( $sv)
Succinct helper method to wrap a StatusValue.
static stream( $fname, $headers=[], $sendErrors=true, $optHeaders=[], $flags=0)
Stream a file to the browser, adding all the headings and fun stuff.
static tags( $element, $attribs, $contents)
Same as Xml::element(), but does not escape contents.