* Revert last change to trimStars() which broke multi-level licenses like:
authorÆvar Arnfjörð Bjarmason <avar@users.mediawiki.org>
Wed, 28 Sep 2005 18:36:31 +0000 (18:36 +0000)
committerÆvar Arnfjörð Bjarmason <avar@users.mediawiki.org>
Wed, 28 Sep 2005 18:36:31 +0000 (18:36 +0000)
  * GNU
  ** GFDL
  *** GFDL|GNU Free Documentation License
* Coding style
* including {{}} in title="" e.g. title="{{GFDL}}" instead of title="GFDL"

includes/Licenses.php

index 641405f..e63709b 100644 (file)
@@ -75,21 +75,20 @@ class Licenses {
        
        function trimStars( $str ) {
                $i = $count = 0;
-               $len = strlen( $str );
                
-               while ($len < $i && $str[$i++] == '*')
+               wfSuppressWarnings();
+               while ($str[$i++] == '*')
                        ++$count;
-
+               wfRestoreWarnings();
+       
                return array( $count, ltrim( $str, '* ' ) );
        }
        
        function stackItem( &$list, $path, $item ) {
                $position =& $list;
-               if ( $path ) {
-                       foreach ( $path as $key ) {
+               if ( $path )
+                       foreach( $path as $key )
                                $position =& $position[$key];
-                       }
-               }
                $position[] = $item;
        }
 
@@ -110,7 +109,7 @@ class Licenses {
                                        $this->msg( $val->text ),
                                        array(
                                                'value' => $val->template,
-                                               'title' => $val->template
+                                               'title' => '{{' . $val->template . '}}'
                                        ),
                                        $depth
                                );