From 222b01f5169f1c7e69762e0e8904c24f78f71882 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Wed, 28 Jul 2010 11:52:48 +0200 Subject: update to MediaWiki 1.16.0 --- includes/Exif.php | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'includes/Exif.php') diff --git a/includes/Exif.php b/includes/Exif.php index 9e54bd55..594e633a 100644 --- a/includes/Exif.php +++ b/includes/Exif.php @@ -558,7 +558,7 @@ class Exif { * @param $fname String: * @param $action Mixed: , default NULL. */ - function debug( $in, $fname, $action = NULL ) { + function debug( $in, $fname, $action = null ) { if ( !$this->log ) { return; } @@ -1043,6 +1043,14 @@ class FormatExif { $this->formatNum( $val ) ); break; + // Do not transform fields with pure text. + // For some languages the formatNum() conversion results to wrong output like + // foo,bar@example,com or foo٫bar@example٫com + case 'ImageDescription': + case 'Artist': + case 'Copyright': + $tags[$tag] = htmlspecialchars( $val ); + break; default: $tags[$tag] = $this->formatNum( $val ); break; @@ -1080,11 +1088,13 @@ class FormatExif { * @return mixed A floating point number or whatever we were fed */ function formatNum( $num ) { + global $wgLang; + $m = array(); if ( preg_match( '/^(\d+)\/(\d+)$/', $num, $m ) ) - return $m[2] != 0 ? $m[1] / $m[2] : $num; + return $wgLang->formatNum( $m[2] != 0 ? $m[1] / $m[2] : $num ); else - return $num; + return $wgLang->formatNum( $num ); } /** @@ -1103,7 +1113,7 @@ class FormatExif { $gcd = $this->gcd( $numerator, $denominator ); if( $gcd != 0 ) { // 0 shouldn't happen! ;) - return $numerator / $gcd . '/' . $denominator / $gcd; + return $this->formatNum( $numerator / $gcd ) . '/' . $this->formatNum( $denominator / $gcd ); } } return $this->formatNum( $num ); -- cgit v1.2.2