some useless calls / unitialized $matches arrays
authorAntoine Musso <hashar@users.mediawiki.org>
Sun, 4 Dec 2005 21:15:04 +0000 (21:15 +0000)
committerAntoine Musso <hashar@users.mediawiki.org>
Sun, 4 Dec 2005 21:15:04 +0000 (21:15 +0000)
includes/HttpFunctions.php
includes/Licenses.php
includes/MagicWord.php

index 87e2a86..f4d00e5 100644 (file)
@@ -53,6 +53,7 @@ function wfIsLocalURL( $url ) {
        }
 
        // Extract host part
+       $matches = array();
        if ( preg_match( '!^http://([\w.-]+)[/:].*$!', $url, $matches ) ) {
                $host = $matches[1];
                // Split up dotwise
index 4294e2f..36b5a7e 100644 (file)
@@ -54,24 +54,26 @@ class Licenses {
                $lines = explode( "\n", $this->msg );
                
                foreach ( $lines as $line ) {
-                       if ( strpos( $line, '*' ) !== 0 )
+                       if ( strpos( $line, '*' ) !== 0 ) {
                                continue;
-                       else {
+                       else {
                                list( $level, $line ) = $this->trimStars( $line );
                                
                                if ( strpos( $line, '|' ) !== false ) {
                                        $obj = new License( $line );
                                        $this->stackItem( $this->licenses, $levels, $obj );
                                } else {
-                                       if ( $level < count( $levels ) )
+                                       if ( $level < count( $levels ) ) {
                                                $levels = array_slice( $levels, 0, $level );
-                                       if ( $level == count( $levels ) )
+                                       }
+                                       if ( $level == count( $levels ) ) {
                                                $levels[$level - 1] = $line;
-                                       else if ( $level > count( $levels ) )
+                                       } elseif ( $level > count( $levels ) ) {
                                                $levels[] = $line;
+                                       }
                                }
                        }
-               }
+               } // end foreach
        }
        
        function trimStars( $str ) {
index d5e3ca0..7d38b0e 100644 (file)
@@ -234,6 +234,7 @@ class MagicWord {
         * is one.
         */
        function matchVariableStartToEnd( $text ) {
+               $matches = array();
                $matchcount = preg_match( $this->getVariableStartToEndRegex(), $text, $matches );
                if ( $matchcount == 0 ) {
                        return NULL;
@@ -282,7 +283,6 @@ class MagicWord {
         * Input word must contain $1
         */
        function substituteCallback( $text, $callback ) {
-               $regex = $this->getVariableRegex();
                $res = preg_replace_callback( $this->getVariableRegex(), $callback, $text );
                $this->mModified = !($res === $text);
                return $res;