r86310 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r86309‎ | r86310 | r86311 >
Date:13:18, 18 April 2011
Author:reedy
Status:ok
Tags:
Comment:
Few more comment/whitespace issues from r86169
Modified paths:
  • /trunk/phase3/includes/media/Bitmap.php (modified) (history)
  • /trunk/phase3/includes/media/Exif.php (modified) (history)
  • /trunk/phase3/includes/media/FormatMetadata.php (modified) (history)
  • /trunk/phase3/includes/media/GIFMetadataExtractor.php (modified) (history)
  • /trunk/phase3/includes/media/IPTC.php (modified) (history)
  • /trunk/phase3/includes/media/JpegMetadataExtractor.php (modified) (history)
  • /trunk/phase3/includes/media/PNG.php (modified) (history)
  • /trunk/phase3/includes/media/XMP.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/media/FormatMetadata.php
@@ -919,6 +919,7 @@
920920 }
921921 }
922922 }
 923+
923924 /** Helper function for creating lists of translations.
924925 *
925926 * @param $value String value (this is not escaped)
@@ -982,6 +983,7 @@
983984 $item .= "</li>\n";
984985 return $item;
985986 }
 987+
986988 /**
987989 * Convenience function for getFormattedData()
988990 *
@@ -1165,6 +1167,7 @@
11661168 }
11671169 return $val;
11681170 }
 1171+
11691172 /**
11701173 * Format a coordinate value, convert numbers from floating point
11711174 * into degree minute second representation.
@@ -1204,6 +1207,7 @@
12051208
12061209 return wfMsg( 'exif-coordinate-format', $deg, $min, $sec, $ref, $coord );
12071210 }
 1211+
12081212 /**
12091213 * Format the contact info field into a single value.
12101214 *
Index: trunk/phase3/includes/media/Exif.php
@@ -805,6 +805,5 @@
806806 wfDebugLog( $this->log, "$class::$fname: end processing: '{$this->basename}'\n" );
807807 }
808808 }
809 -
810809 }
811810
Index: trunk/phase3/includes/media/IPTC.php
@@ -102,7 +102,7 @@
103103 break;
104104 case '2#115': /* source */
105105 /* "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
107107 *an individual." */
108108 $data['Source'] = self::convIPTC( $val, $c );
109109 break;
@@ -329,9 +329,10 @@
330330 /**
331331 * Convert an iptc date and time tags into the exif format
332332 *
333 - * @todo Potentially this should also capture the timezone offset.
 333+ * @todo Potentially this should also capture the timezone offset.
334334 * @param Array $date The date tag
335335 * @param Array $time The time tag
 336+ * @param $c
336337 * @return String Date in exif format.
337338 */
338339 private static function timeHelper( $date, $time, $c ) {
@@ -351,7 +352,7 @@
352353 $dateOnly = true;
353354 }
354355
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)
356357 && preg_match('/\d\d\d\d\d\d\d\d/', $date)
357358 && substr($date, 0, 4) !== '0000'
358359 && substr($date, 4, 2) !== '00'
@@ -390,13 +391,14 @@
391392 } else {
392393 return $finalTimestamp;
393394 }
394 -
395395 }
396396
397397 /**
398398 * Helper function to convert charset for iptc values.
399399 * @param $data Mixed String or Array: The iptc string
400400 * @param $charset String: The charset
 401+ *
 402+ * @return string
401403 */
402404 private static function convIPTC ( $data, $charset ) {
403405 if ( is_array( $data ) ) {
@@ -404,7 +406,7 @@
405407 $val = self::convIPTCHelper( $val, $charset );
406408 }
407409 } else {
408 - $data = self::convIPTCHelper ( $data, $charset );
 410+ $data = self::convIPTCHelper( $data, $charset );
409411 }
410412
411413 return $data;
@@ -413,6 +415,8 @@
414416 * Helper function of a helper function to convert charset for iptc values.
415417 * @param $data Mixed String or Array: The iptc string
416418 * @param $charset String: The charset
 419+ *
 420+ * @return string
417421 */
418422 private static function convIPTCHelper ( $data, $charset ) {
419423 if ( $charset ) {
@@ -431,7 +435,7 @@
432436 if ($data === $oldData) {
433437 return $data; //if validation didn't change $data
434438 } else {
435 - return self::convIPTCHelper ( $oldData, 'Windows-1252' );
 439+ return self::convIPTCHelper( $oldData, 'Windows-1252' );
436440 }
437441 }
438442 return trim( $data );
@@ -439,8 +443,8 @@
440444
441445 /**
442446 * 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 "?"
445449 * Warning, this function does not (and is not intended to) detect
446450 * all iso 2022 escape codes. In practise, the code for utf-8 is the
447451 * only code that seems to have wide use. It does detect that code.
@@ -510,7 +514,7 @@
511515 $c = "NS_4551-1";
512516 break;
513517 case "\x1b(f": //iso646-FR
514 - $c = "NF_Z_62-010";
 518+ $c = "NF_Z_62-010";
515519 break;
516520 case "\x1b(g":
517521 $c = "PT2"; //iso646-PT2
@@ -563,7 +567,7 @@
564568 $c = 'CSN_369103';
565569 break;
566570 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 ) );
568572 //at this point just give up and refuse to parse iptc?
569573 $c = false;
570574 }
Index: trunk/phase3/includes/media/GIFMetadataExtractor.php
@@ -28,6 +28,11 @@
2929 // blocks, where it's usually between 32-127 bytes each.
3030 const MAX_SUBBLOCKS = 262144; // 5mb divided by 20.
3131
 32+ /**
 33+ * @throws Exception
 34+ * @param $filename string
 35+ * @return array
 36+ */
3237 static function getMetadata( $filename ) {
3338 self::$gif_frame_sep = pack( "C", ord("," ) );
3439 self::$gif_extension_sep = pack( "C", ord("!" ) );
@@ -219,6 +224,11 @@
220225 );
221226 }
222227
 228+ /**
 229+ * @param $fh
 230+ * @param $bpp
 231+ * @return void
 232+ */
223233 static function readGCT( $fh, $bpp ) {
224234 if ( $bpp > 0 ) {
225235 for( $i=1; $i<=pow( 2, $bpp ); ++$i ) {
@@ -227,6 +237,10 @@
228238 }
229239 }
230240
 241+ /**
 242+ * @param $data
 243+ * @return int
 244+ */
231245 static function decodeBPP( $data ) {
232246 $buf = unpack( 'C', $data );
233247 $buf = $buf[1];
@@ -238,6 +252,10 @@
239253 return $have_map ? $bpp : 0;
240254 }
241255
 256+ /**
 257+ * @param $fh
 258+ * @return
 259+ */
242260 static function skipBlock( $fh ) {
243261 while ( !feof( $fh ) ) {
244262 $buf = fread( $fh, 1 );
Index: trunk/phase3/includes/media/XMP.php
@@ -106,8 +106,6 @@
107107 array( $this, 'endElement' ) );
108108
109109 xml_set_character_data_handler( $this->xmlParser, array( $this, 'char' ) );
110 -
111 -
112110 }
113111
114112 /** Destroy the xml parser
@@ -386,6 +384,7 @@
387385 }
388386
389387 }
 388+
390389 /** When we hit a closing element in MODE_IGNORE
391390 * Check to see if this is the element we started to ignore,
392391 * in which case we get out of MODE_IGNORE
@@ -401,6 +400,7 @@
402401 return;
403402
404403 }
 404+
405405 /**
406406 * Hit a closing element when in MODE_SIMPLE.
407407 * This generally means that we finished processing a
@@ -433,6 +433,7 @@
434434 array_shift( $this->mode );
435435
436436 }
 437+
437438 /**
438439 * Hit a closing element in MODE_STRUCT, MODE_SEQ, MODE_BAG
439440 * generally means we've finished processing a nested structure.
@@ -540,6 +541,7 @@
541542 throw new MWException( __METHOD__ . " expected </rdf:seq> or </rdf:bag> but instead got $elm." );
542543 }
543544 }
 545+
544546 /**
545547 * End element while in MODE_QDESC
546548 * mostly when ending an element when we have a simple value
@@ -563,6 +565,7 @@
564566
565567
566568 }
 569+
567570 /**
568571 * Handler for hitting a closing element.
569572 *
@@ -1063,6 +1066,7 @@
10641067 break;
10651068 }
10661069 }
 1070+
10671071 /**
10681072 * Process attributes.
10691073 * Simple values can be stored as either a tag or attribute
@@ -1115,6 +1119,7 @@
11161120 }
11171121 }
11181122 }
 1123+
11191124 /**
11201125 * Given an extracted value, save it to results array
11211126 *
Index: trunk/phase3/includes/media/Bitmap.php
@@ -808,6 +808,7 @@
809809 }
810810 return 0;
811811 }
 812+
812813 /**
813814 * Returns whether the current scaler supports rotation (im and gd do)
814815 *
Index: trunk/phase3/includes/media/JpegMetadataExtractor.php
@@ -119,8 +119,8 @@
120120 }
121121 // shouldn't get here.
122122 throw new MWException( "Reached end of jpeg file unexpectedly" );
123 -
124123 }
 124+
125125 /**
126126 * Helper function for jpegSegmentSplitter
127127 * @param &$fh FileHandle for jpeg file
@@ -223,7 +223,5 @@
224224 } else { /*$realHash !== $recordedHash */
225225 return 'iptc-bad-hash';
226226 }
227 -
228227 }
229 -
230228 }
Index: trunk/phase3/includes/media/PNG.php
@@ -14,7 +14,6 @@
1515 class PNGHandler extends BitmapHandler {
1616
1717 const BROKEN_FILE = '0';
18 -
1918
2019 /**
2120 * @param File $image

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r86169Merge to trunk everything in img_metadata branch....bawolff01:23, 16 April 2011

Status & tagging log