Remove function calls from for loop test part in media classes
authorSiebrand Mazeland <s.mazeland@xs4all.nl>
Thu, 5 Dec 2013 11:36:30 +0000 (12:36 +0100)
committerSiebrand Mazeland <s.mazeland@xs4all.nl>
Thu, 5 Dec 2013 11:36:30 +0000 (12:36 +0100)
Change-Id: Ic9a677e9c678da873d936bad62dddbce7891dd07

includes/media/Exif.php
includes/media/IPTC.php

index a0d5e95..bc55000 100644 (file)
@@ -427,7 +427,9 @@ class Exif {
                if ( isset( $this->mFilteredExifData['ComponentsConfiguration'] ) ) {
                        $val = $this->mFilteredExifData['ComponentsConfiguration'];
                        $ccVals = array();
-                       for ( $i = 0; $i < strlen( $val ); $i++ ) {
+
+                       $strLen = strlen( $val );
+                       for ( $i = 0; $i < $strLen; $i++ ) {
                                $ccVals[$i] = ord( substr( $val, $i, 1 ) );
                        }
                        $ccVals['_type'] = 'ol'; //this is for formatting later.
@@ -444,7 +446,9 @@ class Exif {
                if ( isset( $this->mFilteredExifData['GPSVersion'] ) ) {
                        $val = $this->mFilteredExifData['GPSVersion'];
                        $newVal = '';
-                       for ( $i = 0; $i < strlen( $val ); $i++ ) {
+
+                       $strLen = strlen( $val );
+                       for ( $i = 0; $i < $strLen; $i++ ) {
                                if ( $i !== 0 ) {
                                        $newVal .= '.';
                                }
index 4b228b4..ee0233e 100644 (file)
@@ -84,7 +84,8 @@ class IPTC {
                                                $titles = array();
                                        }
 
-                                       for ( $i = 0; $i < count( $titles ); $i++ ) {
+                                       $titleCount = count( $titles );
+                                       for ( $i = 0; $i < $titleCount; $i++ ) {
                                                if ( isset( $bylines[$i] ) ) {
                                                        // theoretically this should always be set
                                                        // but doesn't hurt to be careful.