Clean up makeFlatExifTags; a simple foreach loop is a little easier on the
authorBrion Vibber <brion@users.mediawiki.org>
Sun, 8 May 2005 23:48:40 +0000 (23:48 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Sun, 8 May 2005 23:48:40 +0000 (23:48 +0000)
eyes than the array_walk bit, and seems to explode and die less on PHP 5.

includes/Exif.php

index e475771..3e57697 100644 (file)
@@ -279,19 +279,22 @@ class Exif {
         */
        function makeFlatExifTags() {
                $exif = $this->getExif();
-               array_walk($exif, array(&$this, 'callback')); // note the reference
+               $this->extractTags( $exif );
        }
        
        /**
-        * A callback function used by makeFlatExifTags()
+        * A recursing extractor function used by makeFlatExifTags()
         */
-       function callback($val, $key) {
-               if (gettype($val) === 'array')
-                       array_walk($val, array(&$this, 'callback'));
-               else
-                       $this->mFlatExif[$key] = $val;
+       function extractTags( $tagset ) {
+               foreach( $tagset as $key => $val ) {
+                       if( is_array( $val ) ) {
+                               $this->extractTags( $val );
+                       } else {
+                               $this->mFlatExif[$key] = $val;
+                       }
+               }
        }
-
+       
        /**
         * Produce a list of all Exif tags appropriate for user output
         *