Index: trunk/phase3/includes/Exif.php |
— | — | @@ -677,6 +677,10 @@ |
678 | 678 | break; |
679 | 679 | } |
680 | 680 | break; |
| 681 | + |
| 682 | + case 'SubjectDistance': |
| 683 | + $tags[$tag] = $this->msg( $tag, '', $this->formatNum( $val ) ); |
| 684 | + break; |
681 | 685 | |
682 | 686 | case 'MeteringMode': |
683 | 687 | switch( $val ) { |
— | — | @@ -927,14 +931,10 @@ |
928 | 932 | case 'Make': |
929 | 933 | case 'Model': |
930 | 934 | case 'Software': |
931 | | - $tags[$tag] = wfMsg( strtolower( "exif-$tag-value" ), $val ); |
| 935 | + $tags[$tag] = $this->msg( $tag, '', $val ); |
932 | 936 | break; |
933 | 937 | default: |
934 | | - if ( preg_match( '/^(\d+)\/(\d+)$/', $val, $m ) ) { |
935 | | - $tags[$tag] = $m[2] != 0 ? $m[1]/$m[2] : $val; |
936 | | - break; |
937 | | - } |
938 | | - $tags[$tag] = $val; |
| 938 | + $tags[$tag] = $this->formatNum( $val ); |
939 | 939 | break; |
940 | 940 | } |
941 | 941 | } |
— | — | @@ -943,13 +943,27 @@ |
944 | 944 | } |
945 | 945 | |
946 | 946 | /** |
947 | | - * Conviniance function for format() |
| 947 | + * Conviniance function for getFormattedData() |
948 | 948 | * |
949 | 949 | * @param string $tag The tag name to pass on |
950 | 950 | * @param string $val The value of the tag |
| 951 | + * @param string $arg An argument to pass ($1) |
951 | 952 | * @return string A wfMsg of "exif-$tag-$val" in lower case |
952 | 953 | */ |
953 | | - function msg( $tag, $val ) { |
954 | | - return wfMsg( strtolower("exif-$tag-$val") ); |
| 954 | + function msg( $tag, $val, $arg = null ) { |
| 955 | + if ($val == '') |
| 956 | + $val = 'value'; |
| 957 | + return wfMsg( strtolower( "exif-$tag-$val" ), $arg ); |
955 | 958 | } |
| 959 | + |
| 960 | + /** |
| 961 | + * @param mixed $num The value to format |
| 962 | + * @return mixed A floating point number or whatever we were fed |
| 963 | + */ |
| 964 | + function formatNum( $num ) { |
| 965 | + if ( preg_match( '/^(\d+)\/(\d+)$/', $num, $m ) ) |
| 966 | + return $m[2] != 0 ? $m[1] / $m[2] : $num; |
| 967 | + else |
| 968 | + return $num; |
| 969 | + } |
956 | 970 | } |