Merge "Move up devunt's name to Developers"
[lhc/web/wiklou.git] / includes / media / PNGMetadataExtractor.php
index bccd36c..f4f29dd 100644 (file)
@@ -49,7 +49,7 @@ class PNGMetadataExtractor {
                /* based on list at http://owl.phy.queensu.ca/~phil/exiftool/TagNames/PNG.html#TextualData
                 * and http://www.w3.org/TR/PNG/#11keywords
                 */
-               self::$textChunks = array(
+               self::$textChunks = [
                        'xml:com.adobe.xmp' => 'xmp',
                        # Artist is unofficial. Author is the recommended
                        # keyword in the PNG spec. However some people output
@@ -72,11 +72,11 @@ class PNGMetadataExtractor {
                        'label' => 'Label',
                        'creation time' => 'DateTimeDigitized',
                        /* Other potentially useful things - Document */
-               );
+               ];
 
                $frameCount = 0;
                $loopCount = 1;
-               $text = array();
+               $text = [];
                $duration = 0.0;
                $bitDepth = 0;
                $colorType = 'unknown';
@@ -105,8 +105,7 @@ class PNGMetadataExtractor {
                        if ( !$buf || strlen( $buf ) < 4 ) {
                                throw new Exception( __METHOD__ . ": Read error" );
                        }
-                       $chunk_size = unpack( "N", $buf );
-                       $chunk_size = $chunk_size[1];
+                       $chunk_size = unpack( "N", $buf )[1];
 
                        if ( $chunk_size < 0 ) {
                                throw new Exception( __METHOD__ . ": Chunk size too big for unpack" );
@@ -174,7 +173,7 @@ class PNGMetadataExtractor {
                        } elseif ( $chunk_type == "iTXt" ) {
                                // Extracts iTXt chunks, uncompressing if necessary.
                                $buf = self::read( $fh, $chunk_size );
-                               $items = array();
+                               $items = [];
                                if ( preg_match(
                                        '/^([^\x00]{1,79})\x00(\x00|\x01)\x00([^\x00]*)(.)[^\x00]*\x00(.*)$/Ds',
                                        $buf, $items )
@@ -201,9 +200,9 @@ class PNGMetadataExtractor {
                                        // if compressed
                                        if ( $items[2] == "\x01" ) {
                                                if ( function_exists( 'gzuncompress' ) && $items[4] === "\x00" ) {
-                                                       wfSuppressWarnings();
+                                                       MediaWiki\suppressWarnings();
                                                        $items[5] = gzuncompress( $items[5] );
-                                                       wfRestoreWarnings();
+                                                       MediaWiki\restoreWarnings();
 
                                                        if ( $items[5] === false ) {
                                                                // decompression failed
@@ -245,9 +244,9 @@ class PNGMetadataExtractor {
                                        fseek( $fh, self::$crcSize, SEEK_CUR );
                                        continue;
                                }
-                               wfSuppressWarnings();
+                               MediaWiki\suppressWarnings();
                                $content = iconv( 'ISO-8859-1', 'UTF-8', $content );
-                               wfRestoreWarnings();
+                               MediaWiki\restoreWarnings();
 
                                if ( $content === false ) {
                                        throw new Exception( __METHOD__ . ": Read error (error with iconv)" );
@@ -285,9 +284,9 @@ class PNGMetadataExtractor {
                                                continue;
                                        }
 
-                                       wfSuppressWarnings();
+                                       MediaWiki\suppressWarnings();
                                        $content = gzuncompress( $content );
-                                       wfRestoreWarnings();
+                                       MediaWiki\restoreWarnings();
 
                                        if ( $content === false ) {
                                                // decompression failed
@@ -296,9 +295,9 @@ class PNGMetadataExtractor {
                                                continue;
                                        }
 
-                                       wfSuppressWarnings();
+                                       MediaWiki\suppressWarnings();
                                        $content = iconv( 'ISO-8859-1', 'UTF-8', $content );
-                                       wfRestoreWarnings();
+                                       MediaWiki\restoreWarnings();
 
                                        if ( $content === false ) {
                                                throw new Exception( __METHOD__ . ": Read error (error with iconv)" );
@@ -398,14 +397,14 @@ class PNGMetadataExtractor {
                        }
                }
 
-               return array(
+               return [
                        'frameCount' => $frameCount,
                        'loopCount' => $loopCount,
                        'duration' => $duration,
                        'text' => $text,
                        'bitDepth' => $bitDepth,
                        'colorType' => $colorType,
-               );
+               ];
        }
 
        /**