From: Ævar Arnfjörð Bjarmason Date: Wed, 28 Sep 2005 18:36:31 +0000 (+0000) Subject: * Revert last change to trimStars() which broke multi-level licenses like: X-Git-Tag: 1.6.0~1567 X-Git-Url: https://git.cyclocoop.org/%27.%24link.%27?a=commitdiff_plain;h=23993eb17ac62d7f97c5d531795ced8d16b998d0;p=lhc%2Fweb%2Fwiklou.git * Revert last change to trimStars() which broke multi-level licenses like: * GNU ** GFDL *** GFDL|GNU Free Documentation License * Coding style * including {{}} in title="" e.g. title="{{GFDL}}" instead of title="GFDL" --- diff --git a/includes/Licenses.php b/includes/Licenses.php index 641405fed9..e63709b3f4 100644 --- a/includes/Licenses.php +++ b/includes/Licenses.php @@ -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 );