X-Git-Url: https://git.cyclocoop.org/%28%28?a=blobdiff_plain;f=includes%2Ffilerepo%2Ffile%2FFile.php;h=950baea11baf0feecf15bf2bf98ad5f383fa5888;hb=f077c4b1d6fd38de065353eccaa60b6b25c3e302;hp=7d9e79deac743190ec77d33f5b1eeb027869ff3c;hpb=5de26bec5939c28849245e721252243b4c250c57;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/filerepo/file/File.php b/includes/filerepo/file/File.php index 7d9e79deac..950baea11b 100644 --- a/includes/filerepo/file/File.php +++ b/includes/filerepo/file/File.php @@ -97,10 +97,10 @@ abstract class File { /** @var Title|string|bool */ protected $title; - /** @var string Text of last error */ + /** @var string Text of last error */ protected $lastError; - /** @var string Main part of the title, with underscores (Title::getDBkey) */ + /** @var string Main part of the title, with underscores (Title::getDBkey) */ protected $redirected; /** @var Title */ @@ -495,6 +495,42 @@ abstract class File { } } + /** + * Gives a (possibly empty) list of languages to render + * the file in. + * + * If the file doesn't have translations, or if the file + * format does not support that sort of thing, returns + * an empty array. + * + * @return Array + * @since 1.23 + */ + public function getAvailableLanguages() { + $handler = $this->getHandler(); + if ( $handler ) { + return $handler->getAvailableLanguages( $this ); + } else { + return array(); + } + } + + /** + * In files that support multiple language, what is the default language + * to use if none specified. + * + * @return String lang code, or null if filetype doesn't support multiple languages. + * @since 1.23 + */ + public function getDefaultRenderLanguage() { + $handler = $this->getHandler(); + if ( $handler ) { + return $handler->getDefaultRenderLanguage( $this ); + } else { + return null; + } + } + /** * Will the thumbnail be animated if one would expect it to be. * @@ -547,6 +583,10 @@ abstract class File { public function getCommonMetaArray() { $handler = $this->getHandler(); + if ( !$handler ) { + return false; + } + return $handler->getCommonMetaArray( $this ); } @@ -868,7 +908,7 @@ abstract class File { $params['height'] = $height; } $thumb = $this->transform( $params ); - if ( is_null( $thumb ) || $thumb->isError() ) { + if ( !$thumb || $thumb->isError() ) { return ''; } @@ -1289,7 +1329,7 @@ abstract class File { $this->assertRepoDefined(); return $this->repo->getZonePath( 'thumb' ) . '/' . - $this->getArchiveThumbRel( $archiveName, $suffix ); + $this->getArchiveThumbRel( $archiveName, $suffix ); } /**