summaryrefslogtreecommitdiff
path: root/includes/media/FormatMetadata.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/media/FormatMetadata.php')
-rw-r--r--includes/media/FormatMetadata.php101
1 files changed, 51 insertions, 50 deletions
diff --git a/includes/media/FormatMetadata.php b/includes/media/FormatMetadata.php
index 1a7d7723..1c5136f5 100644
--- a/includes/media/FormatMetadata.php
+++ b/includes/media/FormatMetadata.php
@@ -79,7 +79,7 @@ class FormatMetadata {
}
//This is done differently as the tag is an array.
- if ( $tag == 'GPSTimeStamp' && count( $vals ) === 3) {
+ if ( $tag == 'GPSTimeStamp' && count( $vals ) === 3 ) {
//hour min sec array
$h = explode( '/', $vals[0] );
@@ -127,9 +127,9 @@ class FormatMetadata {
foreach ( $vals as &$val ) {
- switch( $tag ) {
+ switch ( $tag ) {
case 'Compression':
- switch( $val ) {
+ switch ( $val ) {
case 1: case 2: case 3: case 4:
case 5: case 6: case 7: case 8:
case 32773: case 32946: case 34712:
@@ -142,7 +142,7 @@ class FormatMetadata {
break;
case 'PhotometricInterpretation':
- switch( $val ) {
+ switch ( $val ) {
case 2: case 6:
$val = self::msg( $tag, $val );
break;
@@ -153,7 +153,7 @@ class FormatMetadata {
break;
case 'Orientation':
- switch( $val ) {
+ switch ( $val ) {
case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8:
$val = self::msg( $tag, $val );
break;
@@ -164,7 +164,7 @@ class FormatMetadata {
break;
case 'PlanarConfiguration':
- switch( $val ) {
+ switch ( $val ) {
case 1: case 2:
$val = self::msg( $tag, $val );
break;
@@ -189,7 +189,7 @@ class FormatMetadata {
case 'XResolution':
case 'YResolution':
- switch( $resolutionunit ) {
+ switch ( $resolutionunit ) {
case 2:
$val = self::msg( 'XYResolution', 'i', self::formatNum( $val ) );
break;
@@ -208,7 +208,7 @@ class FormatMetadata {
break;
case 'ColorSpace':
- switch( $val ) {
+ switch ( $val ) {
case 1: case 65535:
$val = self::msg( $tag, $val );
break;
@@ -219,7 +219,7 @@ class FormatMetadata {
break;
case 'ComponentsConfiguration':
- switch( $val ) {
+ switch ( $val ) {
case 0: case 1: case 2: case 3: case 4: case 5: case 6:
$val = self::msg( $tag, $val );
break;
@@ -267,7 +267,7 @@ class FormatMetadata {
break;
case 'ExposureProgram':
- switch( $val ) {
+ switch ( $val ) {
case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8:
$val = self::msg( $tag, $val );
break;
@@ -282,7 +282,7 @@ class FormatMetadata {
break;
case 'MeteringMode':
- switch( $val ) {
+ switch ( $val ) {
case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 255:
$val = self::msg( $tag, $val );
break;
@@ -293,7 +293,7 @@ class FormatMetadata {
break;
case 'LightSource':
- switch( $val ) {
+ switch ( $val ) {
case 0: case 1: case 2: case 3: case 4: case 9: case 10: case 11:
case 12: case 13: case 14: case 15: case 17: case 18: case 19: case 20:
case 21: case 22: case 23: case 24: case 255:
@@ -307,11 +307,11 @@ class FormatMetadata {
case 'Flash':
$flashDecode = array(
- 'fired' => $val & bindec( '00000001' ),
- 'return' => ( $val & bindec( '00000110' ) ) >> 1,
- 'mode' => ( $val & bindec( '00011000' ) ) >> 3,
+ 'fired' => $val & bindec( '00000001' ),
+ 'return' => ( $val & bindec( '00000110' ) ) >> 1,
+ 'mode' => ( $val & bindec( '00011000' ) ) >> 3,
'function' => ( $val & bindec( '00100000' ) ) >> 5,
- 'redeye' => ( $val & bindec( '01000000' ) ) >> 6,
+ 'redeye' => ( $val & bindec( '01000000' ) ) >> 6,
// 'reserved' => ($val & bindec( '10000000' )) >> 7,
);
$flashMsgs = array();
@@ -328,7 +328,7 @@ class FormatMetadata {
break;
case 'FocalPlaneResolutionUnit':
- switch( $val ) {
+ switch ( $val ) {
case 2:
$val = self::msg( $tag, $val );
break;
@@ -339,7 +339,7 @@ class FormatMetadata {
break;
case 'SensingMethod':
- switch( $val ) {
+ switch ( $val ) {
case 1: case 2: case 3: case 4: case 5: case 7: case 8:
$val = self::msg( $tag, $val );
break;
@@ -350,7 +350,7 @@ class FormatMetadata {
break;
case 'FileSource':
- switch( $val ) {
+ switch ( $val ) {
case 3:
$val = self::msg( $tag, $val );
break;
@@ -361,7 +361,7 @@ class FormatMetadata {
break;
case 'SceneType':
- switch( $val ) {
+ switch ( $val ) {
case 1:
$val = self::msg( $tag, $val );
break;
@@ -372,7 +372,7 @@ class FormatMetadata {
break;
case 'CustomRendered':
- switch( $val ) {
+ switch ( $val ) {
case 0: case 1:
$val = self::msg( $tag, $val );
break;
@@ -383,7 +383,7 @@ class FormatMetadata {
break;
case 'ExposureMode':
- switch( $val ) {
+ switch ( $val ) {
case 0: case 1: case 2:
$val = self::msg( $tag, $val );
break;
@@ -394,7 +394,7 @@ class FormatMetadata {
break;
case 'WhiteBalance':
- switch( $val ) {
+ switch ( $val ) {
case 0: case 1:
$val = self::msg( $tag, $val );
break;
@@ -405,7 +405,7 @@ class FormatMetadata {
break;
case 'SceneCaptureType':
- switch( $val ) {
+ switch ( $val ) {
case 0: case 1: case 2: case 3:
$val = self::msg( $tag, $val );
break;
@@ -416,7 +416,7 @@ class FormatMetadata {
break;
case 'GainControl':
- switch( $val ) {
+ switch ( $val ) {
case 0: case 1: case 2: case 3: case 4:
$val = self::msg( $tag, $val );
break;
@@ -427,7 +427,7 @@ class FormatMetadata {
break;
case 'Contrast':
- switch( $val ) {
+ switch ( $val ) {
case 0: case 1: case 2:
$val = self::msg( $tag, $val );
break;
@@ -438,7 +438,7 @@ class FormatMetadata {
break;
case 'Saturation':
- switch( $val ) {
+ switch ( $val ) {
case 0: case 1: case 2:
$val = self::msg( $tag, $val );
break;
@@ -449,7 +449,7 @@ class FormatMetadata {
break;
case 'Sharpness':
- switch( $val ) {
+ switch ( $val ) {
case 0: case 1: case 2:
$val = self::msg( $tag, $val );
break;
@@ -460,7 +460,7 @@ class FormatMetadata {
break;
case 'SubjectDistanceRange':
- switch( $val ) {
+ switch ( $val ) {
case 0: case 1: case 2: case 3:
$val = self::msg( $tag, $val );
break;
@@ -473,7 +473,7 @@ class FormatMetadata {
//The GPS...Ref values are kept for compatibility, probably won't be reached.
case 'GPSLatitudeRef':
case 'GPSDestLatitudeRef':
- switch( $val ) {
+ switch ( $val ) {
case 'N': case 'S':
$val = self::msg( 'GPSLatitude', $val );
break;
@@ -485,7 +485,7 @@ class FormatMetadata {
case 'GPSLongitudeRef':
case 'GPSDestLongitudeRef':
- switch( $val ) {
+ switch ( $val ) {
case 'E': case 'W':
$val = self::msg( 'GPSLongitude', $val );
break;
@@ -504,7 +504,7 @@ class FormatMetadata {
break;
case 'GPSStatus':
- switch( $val ) {
+ switch ( $val ) {
case 'A': case 'V':
$val = self::msg( $tag, $val );
break;
@@ -515,7 +515,7 @@ class FormatMetadata {
break;
case 'GPSMeasureMode':
- switch( $val ) {
+ switch ( $val ) {
case 2: case 3:
$val = self::msg( $tag, $val );
break;
@@ -528,7 +528,7 @@ class FormatMetadata {
case 'GPSTrackRef':
case 'GPSImgDirectionRef':
case 'GPSDestBearingRef':
- switch( $val ) {
+ switch ( $val ) {
case 'T': case 'M':
$val = self::msg( 'GPSDirection', $val );
break;
@@ -548,7 +548,7 @@ class FormatMetadata {
break;
case 'GPSSpeedRef':
- switch( $val ) {
+ switch ( $val ) {
case 'K': case 'M': case 'N':
$val = self::msg( 'GPSSpeed', $val );
break;
@@ -559,7 +559,7 @@ class FormatMetadata {
break;
case 'GPSDestDistanceRef':
- switch( $val ) {
+ switch ( $val ) {
case 'K': case 'M': case 'N':
$val = self::msg( 'GPSDestDistance', $val );
break;
@@ -646,7 +646,7 @@ class FormatMetadata {
break;
case 'iimCategory':
- switch( strtolower( $val ) ) {
+ switch ( strtolower( $val ) ) {
// See pg 29 of IPTC photo
// metadata standard.
case 'ace': case 'clj':
@@ -682,7 +682,7 @@ class FormatMetadata {
$urgency = 'high';
} elseif ( $val == 5 ) {
$urgency = 'normal';
- } elseif ( $val <= 8 && $val > 5) {
+ } elseif ( $val <= 8 && $val > 5 ) {
$urgency = 'low';
}
@@ -791,7 +791,7 @@ class FormatMetadata {
}
break;
case 'Copyrighted':
- switch( $val ) {
+ switch ( $val ) {
case 'True': case 'False':
$val = self::msg( $tag, $val );
break;
@@ -854,7 +854,7 @@ class FormatMetadata {
return $vals[0];
}
elseif ( count( $vals ) === 0 ) {
- wfDebug( __METHOD__ . ' metadata array with 0 elements!' );
+ wfDebug( __METHOD__ . " metadata array with 0 elements!\n" );
return ""; // paranoia. This should never happen
}
/* @todo FIXME: This should hide some of the list entries if there are
@@ -863,7 +863,7 @@ class FormatMetadata {
*/
else {
global $wgContLang;
- switch( $type ) {
+ switch ( $type ) {
case 'lang':
// Display default, followed by ContLang,
// followed by the rest in no particular
@@ -948,7 +948,7 @@ class FormatMetadata {
* this is treated as wikitext not html).
*/
private static function langItem( $value, $lang, $default = false, $noHtml = false ) {
- if ( $lang === false && $default === false) {
+ if ( $lang === false && $default === false ) {
throw new MWException( '$lang and $default cannot both '
. 'be false.' );
}
@@ -1015,8 +1015,9 @@ class FormatMetadata {
static function msg( $tag, $val, $arg = null, $arg2 = null ) {
global $wgContLang;
- if ( $val === '' )
+ if ( $val === '' ) {
$val = 'value';
+ }
return wfMessage( $wgContLang->lc( "exif-$tag-$val" ), $arg, $arg2 )->text();
}
@@ -1031,9 +1032,9 @@ class FormatMetadata {
static function formatNum( $num, $round = false ) {
global $wgLang;
$m = array();
- if( is_array( $num ) ) {
+ if ( is_array( $num ) ) {
$out = array();
- foreach( $num as $number ) {
+ foreach ( $num as $number ) {
$out[] = self::formatNum( $number );
}
return $wgLang->commaList( $out );
@@ -1071,7 +1072,7 @@ class FormatMetadata {
$numerator = intval( $m[1] );
$denominator = intval( $m[2] );
$gcd = self::gcd( abs( $numerator ), $denominator );
- if( $gcd != 0 ) {
+ if ( $gcd != 0 ) {
// 0 shouldn't happen! ;)
return self::formatNum( $numerator / $gcd ) . '/' . self::formatNum( $denominator / $gcd );
}
@@ -1096,7 +1097,7 @@ class FormatMetadata {
else
return gcd( $b, $a % $b );
*/
- while( $b != 0 ) {
+ while ( $b != 0 ) {
$remainder = $a % $b;
// tail recursion...
@@ -1124,7 +1125,7 @@ class FormatMetadata {
return $val;
}
$cat = '';
- switch( substr( $val, 0, 2 ) ) {
+ switch ( substr( $val, 0, 2 ) ) {
case '01':
$cat = 'ace';
break;
@@ -1236,7 +1237,7 @@ class FormatMetadata {
* @return String of html-ish looking wikitext
*/
public static function collapseContactInfo( $vals ) {
- if( !( isset( $vals['CiAdrExtadr'] )
+ if ( !( isset( $vals['CiAdrExtadr'] )
|| isset( $vals['CiAdrCity'] )
|| isset( $vals['CiAdrCtry'] )
|| isset( $vals['CiEmailWork'] )
@@ -1254,7 +1255,7 @@ class FormatMetadata {
// because people often insert >, etc into
// the metadata which should not be interpreted
// but we still want to auto-link urls.
- foreach( $vals as &$val ) {
+ foreach ( $vals as &$val ) {
$val = htmlspecialchars( $val );
}
return self::flattenArray( $vals );