Update formatting
[lhc/web/wiklou.git] / includes / filerepo / file / File.php
index 7d9e79d..950baea 100644 (file)
@@ -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 );
        }
 
        /**