Merge "fix some spacing"
[lhc/web/wiklou.git] / includes / media / IPTC.php
index 3ae59ad..3b99fba 100644 (file)
 class IPTC {
 
        /**
-       * This takes the results of iptcparse() and puts it into a
-       * form that can be handled by mediawiki. Generally called from
-       * BitmapMetadataHandler::doApp13.
-       *
-       * @see http://www.iptc.org/std/IIM/4.1/specification/IIMV4.1.pdf
-       *
-       * @param $rawData String app13 block from jpeg containing iptc/iim data
-       * @return Array iptc metadata array
-       */
+        * This takes the results of iptcparse() and puts it into a
+        * form that can be handled by mediawiki. Generally called from
+        * BitmapMetadataHandler::doApp13.
+        *
+        * @see http://www.iptc.org/std/IIM/4.1/specification/IIMV4.1.pdf
+        *
+        * @param $rawData String app13 block from jpeg containing iptc/iim data
+        * @return Array iptc metadata array
+        */
        static function parse( $rawData ) {
                $parsed = iptcparse( $rawData );
                $data = Array();
@@ -198,7 +198,7 @@ class IPTC {
                                        /* original transmission ref.
                                         * "A code representing the location of original transmission ac-
                                         * cording to practises of the provider."
-                                       */
+                                        */
                                        $data['OriginalTransmissionRef'] = self::convIPTC( $val, $c );
                                        break;
                                case '2#118': /*contact*/
@@ -350,14 +350,14 @@ class IPTC {
        }
 
        /**
-       * Convert an iptc date and time tags into the exif format
-       *
-       * @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.
-       */
+        * Convert an iptc date and time tags into the exif format
+        *
+        * @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 ) {
                if ( count( $date ) === 1 ) {
                        //the standard says this should always be 1
@@ -375,8 +375,8 @@ class IPTC {
                        $dateOnly = true;
                }
 
-               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)
+               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'
                        && substr( $date, 6, 2 ) !== '00'
@@ -386,7 +386,7 @@ class IPTC {
                        // for example: the date 00000400 means the photo was taken in
                        // April, but the year and day is unknown. We don't process these
                        // types of incomplete dates atm.
-                       wfDebugLog( 'iptc', "IPTC: invalid time ( $time ) or date ( $date )");
+                       wfDebugLog( 'iptc', "IPTC: invalid time ( $time ) or date ( $date )" );
                        return null;
                }
 
@@ -417,12 +417,12 @@ class IPTC {
        }
 
        /**
-       * Helper function to convert charset for iptc values.
-       * @param $data string|array The iptc string
-       * @param $charset String: The charset
+        * Helper function to convert charset for iptc values.
+        * @param $data string|array The iptc string
+        * @param $charset String: The charset
         *
         * @return string|array
-       */
+        */
        private static function convIPTC ( $data, $charset ) {
                if ( is_array( $data ) ) {
                        foreach ( $data as &$val ) {
@@ -435,12 +435,12 @@ class IPTC {
                return $data;
        }
        /**
-       * 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
-       */
+        * 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 ) {
                        wfSuppressWarnings();
@@ -465,13 +465,13 @@ class IPTC {
        }
 
        /**
-       * take the value of 1:90 tag and returns a charset
-       * @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.
-       */
+        * take the value of 1:90 tag and returns a charset
+        * @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.
+        */
        static function getCharset( $tag ) {
 
                //According to iim standard, charset is defined by the tag 1:90.
@@ -530,7 +530,7 @@ class IPTC {
                        case "\x1b(K":
                                $c = "ISO646-DE";
                                break;
-                       case "\x1b(N":  //crylic
+                       case "\x1b(N": //crylic
                                $c = "ISO_5427";
                                break;
                        case "\x1b(`": //iso646-NO