From 1f86001203409fd700c8b9f211838a11beabbe6f Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Mon, 18 Apr 2011 13:18:15 +0000 Subject: [PATCH] Few more comment/whitespace issues from r86169 --- includes/media/Bitmap.php | 1 + includes/media/Exif.php | 1 - includes/media/FormatMetadata.php | 4 ++++ includes/media/GIFMetadataExtractor.php | 18 ++++++++++++++++++ includes/media/IPTC.php | 24 ++++++++++++++---------- includes/media/JpegMetadataExtractor.php | 4 +--- includes/media/PNG.php | 1 - includes/media/XMP.php | 9 +++++++-- 8 files changed, 45 insertions(+), 17 deletions(-) diff --git a/includes/media/Bitmap.php b/includes/media/Bitmap.php index 8011a2d7f6..f230d417c1 100644 --- a/includes/media/Bitmap.php +++ b/includes/media/Bitmap.php @@ -808,6 +808,7 @@ class BitmapHandler extends ImageHandler { } return 0; } + /** * Returns whether the current scaler supports rotation (im and gd do) * diff --git a/includes/media/Exif.php b/includes/media/Exif.php index d41b6547a0..fdb5a498bf 100644 --- a/includes/media/Exif.php +++ b/includes/media/Exif.php @@ -805,6 +805,5 @@ class Exif { wfDebugLog( $this->log, "$class::$fname: end processing: '{$this->basename}'\n" ); } } - } diff --git a/includes/media/FormatMetadata.php b/includes/media/FormatMetadata.php index f6abb701bb..38de34dd60 100644 --- a/includes/media/FormatMetadata.php +++ b/includes/media/FormatMetadata.php @@ -919,6 +919,7 @@ class FormatMetadata { } } } + /** Helper function for creating lists of translations. * * @param $value String value (this is not escaped) @@ -982,6 +983,7 @@ class FormatMetadata { $item .= "\n"; return $item; } + /** * Convenience function for getFormattedData() * @@ -1165,6 +1167,7 @@ class FormatMetadata { } return $val; } + /** * Format a coordinate value, convert numbers from floating point * into degree minute second representation. @@ -1204,6 +1207,7 @@ class FormatMetadata { return wfMsg( 'exif-coordinate-format', $deg, $min, $sec, $ref, $coord ); } + /** * Format the contact info field into a single value. * diff --git a/includes/media/GIFMetadataExtractor.php b/includes/media/GIFMetadataExtractor.php index 86d624b768..a3d3ced39a 100644 --- a/includes/media/GIFMetadataExtractor.php +++ b/includes/media/GIFMetadataExtractor.php @@ -28,6 +28,11 @@ class GIFMetadataExtractor { // blocks, where it's usually between 32-127 bytes each. const MAX_SUBBLOCKS = 262144; // 5mb divided by 20. + /** + * @throws Exception + * @param $filename string + * @return array + */ static function getMetadata( $filename ) { self::$gif_frame_sep = pack( "C", ord("," ) ); self::$gif_extension_sep = pack( "C", ord("!" ) ); @@ -219,6 +224,11 @@ class GIFMetadataExtractor { ); } + /** + * @param $fh + * @param $bpp + * @return void + */ static function readGCT( $fh, $bpp ) { if ( $bpp > 0 ) { for( $i=1; $i<=pow( 2, $bpp ); ++$i ) { @@ -227,6 +237,10 @@ class GIFMetadataExtractor { } } + /** + * @param $data + * @return int + */ static function decodeBPP( $data ) { $buf = unpack( 'C', $data ); $buf = $buf[1]; @@ -238,6 +252,10 @@ class GIFMetadataExtractor { return $have_map ? $bpp : 0; } + /** + * @param $fh + * @return + */ static function skipBlock( $fh ) { while ( !feof( $fh ) ) { $buf = fread( $fh, 1 ); diff --git a/includes/media/IPTC.php b/includes/media/IPTC.php index dcc21e74b2..a86833ab32 100644 --- a/includes/media/IPTC.php +++ b/includes/media/IPTC.php @@ -102,7 +102,7 @@ class IPTC { break; case '2#115': /* source */ /* "Identifies the original owner of the intellectual content of the - *objectdata. This could be an agency, a member of an agency or + *objectdata. This could be an agency, a member of an agency or *an individual." */ $data['Source'] = self::convIPTC( $val, $c ); break; @@ -329,9 +329,10 @@ class IPTC { /** * Convert an iptc date and time tags into the exif format * - * @todo Potentially this should also capture the timezone offset. + * @todo Potentially this should also capture the timezone offset. * @param Array $date The date tag * @param Array $time The time tag + * @param $c * @return String Date in exif format. */ private static function timeHelper( $date, $time, $c ) { @@ -351,7 +352,7 @@ class IPTC { $dateOnly = true; } - if ( ! ( preg_match('/\d\d\d\d\d\d[-+]\d\d\d\d/', $time) + if ( ! ( preg_match('/\d\d\d\d\d\d[-+]\d\d\d\d/', $time) && preg_match('/\d\d\d\d\d\d\d\d/', $date) && substr($date, 0, 4) !== '0000' && substr($date, 4, 2) !== '00' @@ -390,13 +391,14 @@ class IPTC { } else { return $finalTimestamp; } - } /** * Helper function to convert charset for iptc values. * @param $data Mixed String or Array: The iptc string * @param $charset String: The charset + * + * @return string */ private static function convIPTC ( $data, $charset ) { if ( is_array( $data ) ) { @@ -404,7 +406,7 @@ class IPTC { $val = self::convIPTCHelper( $val, $charset ); } } else { - $data = self::convIPTCHelper ( $data, $charset ); + $data = self::convIPTCHelper( $data, $charset ); } return $data; @@ -413,6 +415,8 @@ class IPTC { * Helper function of a helper function to convert charset for iptc values. * @param $data Mixed String or Array: The iptc string * @param $charset String: The charset + * + * @return string */ private static function convIPTCHelper ( $data, $charset ) { if ( $charset ) { @@ -431,7 +435,7 @@ class IPTC { if ($data === $oldData) { return $data; //if validation didn't change $data } else { - return self::convIPTCHelper ( $oldData, 'Windows-1252' ); + return self::convIPTCHelper( $oldData, 'Windows-1252' ); } } return trim( $data ); @@ -439,8 +443,8 @@ class IPTC { /** * take the value of 1:90 tag and returns a charset - * @param String $tag 1:90 tag. - * @return charset name or "?" + * @param String $tag 1:90 tag. + * @return string charset name or "?" * Warning, this function does not (and is not intended to) detect * all iso 2022 escape codes. In practise, the code for utf-8 is the * only code that seems to have wide use. It does detect that code. @@ -510,7 +514,7 @@ class IPTC { $c = "NS_4551-1"; break; case "\x1b(f": //iso646-FR - $c = "NF_Z_62-010"; + $c = "NF_Z_62-010"; break; case "\x1b(g": $c = "PT2"; //iso646-PT2 @@ -563,7 +567,7 @@ class IPTC { $c = 'CSN_369103'; break; default: - wfDebugLog('iptc', __METHOD__ . 'Unknown charset in iptc 1:90: ' . bin2hex( $tag ) ); + wfDebugLog('iptc', __METHOD__ . 'Unknown charset in iptc 1:90: ' . bin2hex( $tag ) ); //at this point just give up and refuse to parse iptc? $c = false; } diff --git a/includes/media/JpegMetadataExtractor.php b/includes/media/JpegMetadataExtractor.php index d95dbafd78..984bbe09dd 100644 --- a/includes/media/JpegMetadataExtractor.php +++ b/includes/media/JpegMetadataExtractor.php @@ -119,8 +119,8 @@ class JpegMetadataExtractor { } // shouldn't get here. throw new MWException( "Reached end of jpeg file unexpectedly" ); - } + /** * Helper function for jpegSegmentSplitter * @param &$fh FileHandle for jpeg file @@ -223,7 +223,5 @@ class JpegMetadataExtractor { } else { /*$realHash !== $recordedHash */ return 'iptc-bad-hash'; } - } - } diff --git a/includes/media/PNG.php b/includes/media/PNG.php index f688b4c890..cd7b5d6cae 100644 --- a/includes/media/PNG.php +++ b/includes/media/PNG.php @@ -14,7 +14,6 @@ class PNGHandler extends BitmapHandler { const BROKEN_FILE = '0'; - /** * @param File $image diff --git a/includes/media/XMP.php b/includes/media/XMP.php index fd95f3c17c..b0a811647b 100644 --- a/includes/media/XMP.php +++ b/includes/media/XMP.php @@ -106,8 +106,6 @@ class XMPReader { array( $this, 'endElement' ) ); xml_set_character_data_handler( $this->xmlParser, array( $this, 'char' ) ); - - } /** Destroy the xml parser @@ -386,6 +384,7 @@ class XMPReader { } } + /** When we hit a closing element in MODE_IGNORE * Check to see if this is the element we started to ignore, * in which case we get out of MODE_IGNORE @@ -401,6 +400,7 @@ class XMPReader { return; } + /** * Hit a closing element when in MODE_SIMPLE. * This generally means that we finished processing a @@ -433,6 +433,7 @@ class XMPReader { array_shift( $this->mode ); } + /** * Hit a closing element in MODE_STRUCT, MODE_SEQ, MODE_BAG * generally means we've finished processing a nested structure. @@ -540,6 +541,7 @@ class XMPReader { throw new MWException( __METHOD__ . " expected or but instead got $elm." ); } } + /** * End element while in MODE_QDESC * mostly when ending an element when we have a simple value @@ -563,6 +565,7 @@ class XMPReader { } + /** * Handler for hitting a closing element. * @@ -1063,6 +1066,7 @@ class XMPReader { break; } } + /** * Process attributes. * Simple values can be stored as either a tag or attribute @@ -1115,6 +1119,7 @@ class XMPReader { } } } + /** * Given an extracted value, save it to results array * -- 2.20.1