Index: trunk/phase3/includes/media/FormatMetadata.php |
— | — | @@ -919,6 +919,7 @@ |
920 | 920 | } |
921 | 921 | } |
922 | 922 | } |
| 923 | + |
923 | 924 | /** Helper function for creating lists of translations. |
924 | 925 | * |
925 | 926 | * @param $value String value (this is not escaped) |
— | — | @@ -982,6 +983,7 @@ |
983 | 984 | $item .= "</li>\n"; |
984 | 985 | return $item; |
985 | 986 | } |
| 987 | + |
986 | 988 | /** |
987 | 989 | * Convenience function for getFormattedData() |
988 | 990 | * |
— | — | @@ -1165,6 +1167,7 @@ |
1166 | 1168 | } |
1167 | 1169 | return $val; |
1168 | 1170 | } |
| 1171 | + |
1169 | 1172 | /** |
1170 | 1173 | * Format a coordinate value, convert numbers from floating point |
1171 | 1174 | * into degree minute second representation. |
— | — | @@ -1204,6 +1207,7 @@ |
1205 | 1208 | |
1206 | 1209 | return wfMsg( 'exif-coordinate-format', $deg, $min, $sec, $ref, $coord ); |
1207 | 1210 | } |
| 1211 | + |
1208 | 1212 | /** |
1209 | 1213 | * Format the contact info field into a single value. |
1210 | 1214 | * |
Index: trunk/phase3/includes/media/Exif.php |
— | — | @@ -805,6 +805,5 @@ |
806 | 806 | wfDebugLog( $this->log, "$class::$fname: end processing: '{$this->basename}'\n" ); |
807 | 807 | } |
808 | 808 | } |
809 | | - |
810 | 809 | } |
811 | 810 | |
Index: trunk/phase3/includes/media/IPTC.php |
— | — | @@ -102,7 +102,7 @@ |
103 | 103 | break; |
104 | 104 | case '2#115': /* source */ |
105 | 105 | /* "Identifies the original owner of the intellectual content of the |
106 | | - *objectdata. This could be an agency, a member of an agency or |
| 106 | + *objectdata. This could be an agency, a member of an agency or |
107 | 107 | *an individual." */ |
108 | 108 | $data['Source'] = self::convIPTC( $val, $c ); |
109 | 109 | break; |
— | — | @@ -329,9 +329,10 @@ |
330 | 330 | /** |
331 | 331 | * Convert an iptc date and time tags into the exif format |
332 | 332 | * |
333 | | - * @todo Potentially this should also capture the timezone offset. |
| 333 | + * @todo Potentially this should also capture the timezone offset. |
334 | 334 | * @param Array $date The date tag |
335 | 335 | * @param Array $time The time tag |
| 336 | + * @param $c |
336 | 337 | * @return String Date in exif format. |
337 | 338 | */ |
338 | 339 | private static function timeHelper( $date, $time, $c ) { |
— | — | @@ -351,7 +352,7 @@ |
352 | 353 | $dateOnly = true; |
353 | 354 | } |
354 | 355 | |
355 | | - if ( ! ( preg_match('/\d\d\d\d\d\d[-+]\d\d\d\d/', $time) |
| 356 | + if ( ! ( preg_match('/\d\d\d\d\d\d[-+]\d\d\d\d/', $time) |
356 | 357 | && preg_match('/\d\d\d\d\d\d\d\d/', $date) |
357 | 358 | && substr($date, 0, 4) !== '0000' |
358 | 359 | && substr($date, 4, 2) !== '00' |
— | — | @@ -390,13 +391,14 @@ |
391 | 392 | } else { |
392 | 393 | return $finalTimestamp; |
393 | 394 | } |
394 | | - |
395 | 395 | } |
396 | 396 | |
397 | 397 | /** |
398 | 398 | * Helper function to convert charset for iptc values. |
399 | 399 | * @param $data Mixed String or Array: The iptc string |
400 | 400 | * @param $charset String: The charset |
| 401 | + * |
| 402 | + * @return string |
401 | 403 | */ |
402 | 404 | private static function convIPTC ( $data, $charset ) { |
403 | 405 | if ( is_array( $data ) ) { |
— | — | @@ -404,7 +406,7 @@ |
405 | 407 | $val = self::convIPTCHelper( $val, $charset ); |
406 | 408 | } |
407 | 409 | } else { |
408 | | - $data = self::convIPTCHelper ( $data, $charset ); |
| 410 | + $data = self::convIPTCHelper( $data, $charset ); |
409 | 411 | } |
410 | 412 | |
411 | 413 | return $data; |
— | — | @@ -413,6 +415,8 @@ |
414 | 416 | * Helper function of a helper function to convert charset for iptc values. |
415 | 417 | * @param $data Mixed String or Array: The iptc string |
416 | 418 | * @param $charset String: The charset |
| 419 | + * |
| 420 | + * @return string |
417 | 421 | */ |
418 | 422 | private static function convIPTCHelper ( $data, $charset ) { |
419 | 423 | if ( $charset ) { |
— | — | @@ -431,7 +435,7 @@ |
432 | 436 | if ($data === $oldData) { |
433 | 437 | return $data; //if validation didn't change $data |
434 | 438 | } else { |
435 | | - return self::convIPTCHelper ( $oldData, 'Windows-1252' ); |
| 439 | + return self::convIPTCHelper( $oldData, 'Windows-1252' ); |
436 | 440 | } |
437 | 441 | } |
438 | 442 | return trim( $data ); |
— | — | @@ -439,8 +443,8 @@ |
440 | 444 | |
441 | 445 | /** |
442 | 446 | * take the value of 1:90 tag and returns a charset |
443 | | - * @param String $tag 1:90 tag. |
444 | | - * @return charset name or "?" |
| 447 | + * @param String $tag 1:90 tag. |
| 448 | + * @return string charset name or "?" |
445 | 449 | * Warning, this function does not (and is not intended to) detect |
446 | 450 | * all iso 2022 escape codes. In practise, the code for utf-8 is the |
447 | 451 | * only code that seems to have wide use. It does detect that code. |
— | — | @@ -510,7 +514,7 @@ |
511 | 515 | $c = "NS_4551-1"; |
512 | 516 | break; |
513 | 517 | case "\x1b(f": //iso646-FR |
514 | | - $c = "NF_Z_62-010"; |
| 518 | + $c = "NF_Z_62-010"; |
515 | 519 | break; |
516 | 520 | case "\x1b(g": |
517 | 521 | $c = "PT2"; //iso646-PT2 |
— | — | @@ -563,7 +567,7 @@ |
564 | 568 | $c = 'CSN_369103'; |
565 | 569 | break; |
566 | 570 | default: |
567 | | - wfDebugLog('iptc', __METHOD__ . 'Unknown charset in iptc 1:90: ' . bin2hex( $tag ) ); |
| 571 | + wfDebugLog('iptc', __METHOD__ . 'Unknown charset in iptc 1:90: ' . bin2hex( $tag ) ); |
568 | 572 | //at this point just give up and refuse to parse iptc? |
569 | 573 | $c = false; |
570 | 574 | } |
Index: trunk/phase3/includes/media/GIFMetadataExtractor.php |
— | — | @@ -28,6 +28,11 @@ |
29 | 29 | // blocks, where it's usually between 32-127 bytes each. |
30 | 30 | const MAX_SUBBLOCKS = 262144; // 5mb divided by 20. |
31 | 31 | |
| 32 | + /** |
| 33 | + * @throws Exception |
| 34 | + * @param $filename string |
| 35 | + * @return array |
| 36 | + */ |
32 | 37 | static function getMetadata( $filename ) { |
33 | 38 | self::$gif_frame_sep = pack( "C", ord("," ) ); |
34 | 39 | self::$gif_extension_sep = pack( "C", ord("!" ) ); |
— | — | @@ -219,6 +224,11 @@ |
220 | 225 | ); |
221 | 226 | } |
222 | 227 | |
| 228 | + /** |
| 229 | + * @param $fh |
| 230 | + * @param $bpp |
| 231 | + * @return void |
| 232 | + */ |
223 | 233 | static function readGCT( $fh, $bpp ) { |
224 | 234 | if ( $bpp > 0 ) { |
225 | 235 | for( $i=1; $i<=pow( 2, $bpp ); ++$i ) { |
— | — | @@ -227,6 +237,10 @@ |
228 | 238 | } |
229 | 239 | } |
230 | 240 | |
| 241 | + /** |
| 242 | + * @param $data |
| 243 | + * @return int |
| 244 | + */ |
231 | 245 | static function decodeBPP( $data ) { |
232 | 246 | $buf = unpack( 'C', $data ); |
233 | 247 | $buf = $buf[1]; |
— | — | @@ -238,6 +252,10 @@ |
239 | 253 | return $have_map ? $bpp : 0; |
240 | 254 | } |
241 | 255 | |
| 256 | + /** |
| 257 | + * @param $fh |
| 258 | + * @return |
| 259 | + */ |
242 | 260 | static function skipBlock( $fh ) { |
243 | 261 | while ( !feof( $fh ) ) { |
244 | 262 | $buf = fread( $fh, 1 ); |
Index: trunk/phase3/includes/media/XMP.php |
— | — | @@ -106,8 +106,6 @@ |
107 | 107 | array( $this, 'endElement' ) ); |
108 | 108 | |
109 | 109 | xml_set_character_data_handler( $this->xmlParser, array( $this, 'char' ) ); |
110 | | - |
111 | | - |
112 | 110 | } |
113 | 111 | |
114 | 112 | /** Destroy the xml parser |
— | — | @@ -386,6 +384,7 @@ |
387 | 385 | } |
388 | 386 | |
389 | 387 | } |
| 388 | + |
390 | 389 | /** When we hit a closing element in MODE_IGNORE |
391 | 390 | * Check to see if this is the element we started to ignore, |
392 | 391 | * in which case we get out of MODE_IGNORE |
— | — | @@ -401,6 +400,7 @@ |
402 | 401 | return; |
403 | 402 | |
404 | 403 | } |
| 404 | + |
405 | 405 | /** |
406 | 406 | * Hit a closing element when in MODE_SIMPLE. |
407 | 407 | * This generally means that we finished processing a |
— | — | @@ -433,6 +433,7 @@ |
434 | 434 | array_shift( $this->mode ); |
435 | 435 | |
436 | 436 | } |
| 437 | + |
437 | 438 | /** |
438 | 439 | * Hit a closing element in MODE_STRUCT, MODE_SEQ, MODE_BAG |
439 | 440 | * generally means we've finished processing a nested structure. |
— | — | @@ -540,6 +541,7 @@ |
541 | 542 | throw new MWException( __METHOD__ . " expected </rdf:seq> or </rdf:bag> but instead got $elm." ); |
542 | 543 | } |
543 | 544 | } |
| 545 | + |
544 | 546 | /** |
545 | 547 | * End element while in MODE_QDESC |
546 | 548 | * mostly when ending an element when we have a simple value |
— | — | @@ -563,6 +565,7 @@ |
564 | 566 | |
565 | 567 | |
566 | 568 | } |
| 569 | + |
567 | 570 | /** |
568 | 571 | * Handler for hitting a closing element. |
569 | 572 | * |
— | — | @@ -1063,6 +1066,7 @@ |
1064 | 1067 | break; |
1065 | 1068 | } |
1066 | 1069 | } |
| 1070 | + |
1067 | 1071 | /** |
1068 | 1072 | * Process attributes. |
1069 | 1073 | * Simple values can be stored as either a tag or attribute |
— | — | @@ -1115,6 +1119,7 @@ |
1116 | 1120 | } |
1117 | 1121 | } |
1118 | 1122 | } |
| 1123 | + |
1119 | 1124 | /** |
1120 | 1125 | * Given an extracted value, save it to results array |
1121 | 1126 | * |
Index: trunk/phase3/includes/media/Bitmap.php |
— | — | @@ -808,6 +808,7 @@ |
809 | 809 | } |
810 | 810 | return 0; |
811 | 811 | } |
| 812 | + |
812 | 813 | /** |
813 | 814 | * Returns whether the current scaler supports rotation (im and gd do) |
814 | 815 | * |
Index: trunk/phase3/includes/media/JpegMetadataExtractor.php |
— | — | @@ -119,8 +119,8 @@ |
120 | 120 | } |
121 | 121 | // shouldn't get here. |
122 | 122 | throw new MWException( "Reached end of jpeg file unexpectedly" ); |
123 | | - |
124 | 123 | } |
| 124 | + |
125 | 125 | /** |
126 | 126 | * Helper function for jpegSegmentSplitter |
127 | 127 | * @param &$fh FileHandle for jpeg file |
— | — | @@ -223,7 +223,5 @@ |
224 | 224 | } else { /*$realHash !== $recordedHash */ |
225 | 225 | return 'iptc-bad-hash'; |
226 | 226 | } |
227 | | - |
228 | 227 | } |
229 | | - |
230 | 228 | } |
Index: trunk/phase3/includes/media/PNG.php |
— | — | @@ -14,7 +14,6 @@ |
15 | 15 | class PNGHandler extends BitmapHandler { |
16 | 16 | |
17 | 17 | const BROKEN_FILE = '0'; |
18 | | - |
19 | 18 | |
20 | 19 | /** |
21 | 20 | * @param File $image |