) {
continue;
}
- $tags[$tag] = intval( $h[0] / $h[1] )
+ $tags[$tag] = str_pad( intval( $h[0] / $h[1] ), 2, '0', STR_PAD_LEFT )
. ':' . str_pad( intval( $m[0] / $m[1] ), 2, '0', STR_PAD_LEFT )
. ':' . str_pad( intval( $s[0] / $s[1] ), 2, '0', STR_PAD_LEFT );
case 'dc-date':
case 'DateTimeMetadata':
if ( $val == '0000:00:00 00:00:00' || $val == ' : : : : ' ) {
- $val = wfMsg( 'exif-unknowndate' );
+ $val = wfMessage( 'exif-unknowndate' )->text();
} elseif ( preg_match( '/^(?:\d{4}):(?:\d\d):(?:\d\d) (?:\d\d):(?:\d\d):(?:\d\d)$/D', $val ) ) {
// Full date.
$time = wfTimestamp( TS_MW, $val );
'redeye' => ( $val & bindec( '01000000' ) ) >> 6,
// 'reserved' => ($val & bindec( '10000000' )) >> 7,
);
-
+ $flashMsgs = array();
# We do not need to handle unknown values since all are used.
foreach ( $flashDecode as $subTag => $subValue ) {
# We do not need any message for zeroed values.
case 'Software':
if ( is_array( $val ) ) {
//if its a software, version array.
- $val = wfMsg( 'exif-software-version-value', $val[0], $val[1] );
+ $val = wfMessage( 'exif-software-version-value', $val[0], $val[1] )->text();
} else {
$val = self::msg( $tag, '', $val );
}
case 'ExposureTime':
// Show the pretty fraction as well as decimal version
- $val = wfMsg( 'exif-exposuretime-format',
- self::formatFraction( $val ), self::formatNum( $val ) );
+ $val = wfMessage( 'exif-exposuretime-format',
+ self::formatFraction( $val ), self::formatNum( $val ) )->text();
break;
case 'ISOSpeedRatings':
// If its = 65535 that means its at the
}
break;
case 'FNumber':
- $val = wfMsg( 'exif-fnumber-format',
- self::formatNum( $val ) );
+ $val = wfMessage( 'exif-fnumber-format',
+ self::formatNum( $val ) )->text();
break;
case 'FocalLength': case 'FocalLengthIn35mmFilm':
- $val = wfMsg( 'exif-focallength-format',
- self::formatNum( $val ) );
+ $val = wfMessage( 'exif-focallength-format',
+ self::formatNum( $val ) )->text();
break;
case 'MaxApertureValue':
if ( is_numeric( $val ) ) {
$fNumber = pow( 2, $val / 2 );
if ( $fNumber !== false ) {
- $val = wfMsg( 'exif-maxaperturevalue-value',
+ $val = wfMessage( 'exif-maxaperturevalue-value',
self::formatNum( $val ),
self::formatNum( $fNumber, 2 )
- );
+ )->text();
}
}
break;
case 'PixelYDimension':
case 'ImageWidth':
case 'ImageLength':
- $val = self::formatNum( $val ) . ' ' . wfMsg( 'unit-pixel' );
+ $val = self::formatNum( $val ) . ' ' . wfMessage( 'unit-pixel' )->text();
break;
// Do not transform fields with pure text.
* @param $lang String lang code of item or false
* @param $default Boolean if it is default value.
* @param $noHtml Boolean If to avoid html (for back-compat)
- * @return language item (Note: despite how this looks,
- * this is treated as wikitext not html).
+ * @throws MWException
+ * @return string language item (Note: despite how this looks,
+ * 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 ) {
if ( $noHtml ) {
- return wfMsg( 'metadata-langitem-default',
- $wrappedValue ) . "\n\n";
+ return wfMessage( 'metadata-langitem-default',
+ $wrappedValue )->text() . "\n\n";
} /* else */
return '<li class="mw-metadata-lang-default">'
- . wfMsg( 'metadata-langitem-default',
- $wrappedValue )
+ . wfMessage( 'metadata-langitem-default',
+ $wrappedValue )->text()
. "</li>\n";
}
// else we have a language specified
if ( $noHtml ) {
- return '*' . wfMsg( 'metadata-langitem',
- $wrappedValue, $langName, $lang );
+ return '*' . wfMessage( 'metadata-langitem',
+ $wrappedValue, $langName, $lang )->text();
} /* else: */
$item = '<li class="mw-metadata-lang-code-'
$item .= ' mw-metadata-lang-default';
}
$item .= '" lang="' . $lang . '">';
- $item .= wfMsg( 'metadata-langitem',
- $wrappedValue, $langName, $lang );
+ $item .= wfMessage( 'metadata-langitem',
+ $wrappedValue, $langName, $lang )->text();
$item .= "</li>\n";
return $item;
}
* @param $val String: the value of the tag
* @param $arg String: an argument to pass ($1)
* @param $arg2 String: a 2nd argument to pass ($2)
- * @return string A wfMsg of "exif-$tag-$val" in lower case
+ * @return string A wfMessage of "exif-$tag-$val" in lower case
*/
static function msg( $tag, $val, $arg = null, $arg2 = null ) {
global $wgContLang;
if ($val === '')
$val = 'value';
- return wfMsg( $wgContLang->lc( "exif-$tag-$val" ), $arg, $arg2 );
+ return wfMessage( $wgContLang->lc( "exif-$tag-$val" ), $arg, $arg2 )->text();
}
/**
* Format a number, convert numbers from fractions into floating point
* numbers, joins arrays of numbers with commas.
*
- * @private
- *
* @param $num Mixed: the value to format
- * @param $round float|int digits to round to or false.
+ * @param $round float|int|bool digits to round to or false.
* @return mixed A floating point number or whatever we were fed
*/
static function formatNum( $num, $round = false ) {
* a string, not an int.
*
* @param $val String: The 8 digit news code.
- * @return srting The human readable form
+ * @return string The human readable form
*/
static private function convertNewsCode( $val ) {
if ( !preg_match( '/^\d{8}$/D', $val ) ) {
* Format a coordinate value, convert numbers from floating point
* into degree minute second representation.
*
- * @param $coord Array: degrees, minutes and seconds
+ * @param $coord int degrees, minutes and seconds
* @param $type String: latitude or longitude (for if its a NWS or E)
* @return mixed A floating point number or whatever we were fed
*/
$nCoord = -$coord;
if ( $type === 'latitude' ) {
$ref = 'S';
- }
- elseif ( $type === 'longitude' ) {
+ } elseif ( $type === 'longitude' ) {
$ref = 'W';
}
- }
- else {
+ } else {
$nCoord = $coord;
if ( $type === 'latitude' ) {
$ref = 'N';
- }
- elseif ( $type === 'longitude' ) {
+ } elseif ( $type === 'longitude' ) {
$ref = 'E';
}
}
$min = self::formatNum( $min );
$sec = self::formatNum( $sec );
- return wfMsg( 'exif-coordinate-format', $deg, $min, $sec, $ref, $coord );
+ return wfMessage( 'exif-coordinate-format', $deg, $min, $sec, $ref, $coord )->text();
}
/**
. htmlspecialchars( $vals['CiUrlWork'] )
. '</span>';
}
- return wfMsg( 'exif-contact-value', $email, $url,
+ return wfMessage( 'exif-contact-value', $email, $url,
$street, $city, $region, $postal, $country,
- $tel );
+ $tel )->text();
}
}
}
**/
class FormatExif {
var $meta;
- function FormatExif ( $meta ) {
+
+ /**
+ * @param $meta array
+ */
+ function FormatExif( $meta ) {
wfDeprecated(__METHOD__);
$this->meta = $meta;
}
- function getFormattedData ( ) {
+ /**
+ * @return array
+ */
+ function getFormattedData() {
return FormatMetadata::getFormattedData( $this->meta );
}
}