From 0359fe2e549b30bb5eac6594bfa6f584e18700dc Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Tue, 6 Sep 2005 16:53:58 +0000 Subject: [PATCH] * Improved trimStars() * Coding style * Changed the name of the wfNoMsg() function to wfEmptyMsg() --- includes/Licenses.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) 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; } /**#@-*/ -- 2.20.1