From: Aaron Schulz Date: Mon, 12 Mar 2007 20:55:08 +0000 (+0000) Subject: *Add case option to base convert X-Git-Tag: 1.31.0-rc.0~53789 X-Git-Url: https://git.cyclocoop.org/%28%28?a=commitdiff_plain;h=2f2700c0890be96b52d87b6291244c0bc8a1b828;p=lhc%2Fweb%2Fwiklou.git *Add case option to base convert --- diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 19eb4be087..c89bac3346 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -1996,7 +1996,8 @@ function wfExplodeMarkup( $separator, $text ) { * @param $pad int 1 or greater * @return string or false on invalid input */ -function wfBaseConvert( $input, $sourceBase, $destBase, $pad=1 ) { +function wfBaseConvert( $input, $sourceBase, $destBase, $pad=1, $lowercase=true ) { + $input = strval( $input ); if( $sourceBase < 2 || $sourceBase > 36 || $destBase < 2 || @@ -2009,8 +2010,7 @@ function wfBaseConvert( $input, $sourceBase, $destBase, $pad=1 ) { $input == '' ) { return false; } - - $digitChars = '0123456789abcdefghijklmnopqrstuvwxyz'; + $digitChars = ( $lowercase ) ? '0123456789abcdefghijklmnopqrstuvwxyz' : '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'; $inDigits = array(); $outChars = '';