Merge "libs/Message: Improve documentation"
[lhc/web/wiklou.git] / includes / media / FormatMetadata.php
index f647a9d..3993795 100644 (file)
@@ -98,6 +98,7 @@ class FormatMetadata extends ContextSource {
         *   Exif::getFilteredData() or BitmapMetadataHandler )
         * @return array
         * @since 1.23
+        * @suppress PhanTypeArraySuspiciousNullable
         */
        public function makeFormattedData( $tags ) {
                $resolutionunit = !isset( $tags['ResolutionUnit'] ) || $tags['ResolutionUnit'] == 2 ? 2 : 3;
@@ -490,8 +491,16 @@ class FormatMetadata extends ContextSource {
 
                                        case 'CustomRendered':
                                                switch ( $val ) {
-                                                       case 0:
-                                                       case 1:
+                                                       case 0: /* normal */
+                                                       case 1: /* custom */
+                                                               /* The following are unofficial Apple additions */
+                                                       case 2: /* HDR (no original saved) */
+                                                       case 3: /* HDR (original saved) */
+                                                       case 4: /* Original (for HDR) */
+                                                               /* Yes 5 is not present ;) */
+                                                       case 6: /* Panorama */
+                                                       case 7: /* Portrait HDR */
+                                                       case 8: /* Portrait */
                                                                $val = $this->exifMsg( $tag, $val );
                                                                break;
                                                        default:
@@ -1003,13 +1012,12 @@ class FormatMetadata extends ContextSource {
        public static function flattenArrayContentLang( $vals, $type = 'ul',
                $noHtml = false, $context = false
        ) {
-               global $wgContLang;
                $obj = new FormatMetadata;
                if ( $context ) {
                        $obj->setContext( $context );
                }
                $context = new DerivativeContext( $obj->getContext() );
-               $context->setLanguage( $wgContLang );
+               $context->setLanguage( MediaWikiServices::getInstance()->getContentLanguage() );
                $obj->setContext( $context );
 
                return $obj->flattenArrayReal( $vals, $type, $noHtml );
@@ -1056,7 +1064,7 @@ class FormatMetadata extends ContextSource {
                         */
                        switch ( $type ) {
                                case 'lang':
-                                       // Display default, followed by ContLang,
+                                       // Display default, followed by ContentLanguage,
                                        // followed by the rest in no particular
                                        // order.
 
@@ -1182,7 +1190,7 @@ class FormatMetadata extends ContextSource {
                $langName = Language::fetchLanguageName( $lowLang );
                if ( $langName === '' ) {
                        // try just the base language name. (aka en-US -> en ).
-                       list( $langPrefix ) = explode( '-', $lowLang, 2 );
+                       $langPrefix = explode( '-', $lowLang, 2 )[0];
                        $langName = Language::fetchLanguageName( $langPrefix );
                        if ( $langName === '' ) {
                                // give up.
@@ -1218,13 +1226,15 @@ class FormatMetadata extends ContextSource {
         * @return string The text content of "exif-$tag-$val" message in lower case
         */
        private function exifMsg( $tag, $val, $arg = null, $arg2 = null ) {
-               global $wgContLang;
-
                if ( $val === '' ) {
                        $val = 'value';
                }
 
-               return $this->msg( $wgContLang->lc( "exif-$tag-$val" ), $arg, $arg2 )->text();
+               return $this->msg(
+                       MediaWikiServices::getInstance()->getContentLanguage()->lc( "exif-$tag-$val" ),
+                       $arg,
+                       $arg2
+               )->text();
        }
 
        /**