From: Ævar Arnfjörð Bjarmason Date: Tue, 6 Sep 2005 16:53:58 +0000 (+0000) Subject: * Improved trimStars() X-Git-Tag: 1.6.0~1709 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/password.php?a=commitdiff_plain;h=0359fe2e549b30bb5eac6594bfa6f584e18700dc;p=lhc%2Fweb%2Fwiklou.git * Improved trimStars() * Coding style * Changed the name of the wfNoMsg() function to wfEmptyMsg() --- diff --git a/includes/Licenses.php b/includes/Licenses.php index 2f0b1ae14c..641405fed9 100644 --- a/includes/Licenses.php +++ b/includes/Licenses.php @@ -75,19 +75,18 @@ class Licenses { function trimStars( $str ) { $i = $count = 0; + $len = strlen( $str ); - wfSuppressWarnings(); - while ($str[$i++] == '*') + while ($len < $i && $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]; } } @@ -125,7 +124,7 @@ class Licenses { function msg( $str ) { $out = wfMsg( $str ); - return wfNoMsg( $str, $out ) ? $str : $out; + return wfEmptyMsg( $str, $out ) ? $str : $out; } /**#@-*/