Changeset 247 for trunk/lib/Utilities.inc.php
- Timestamp:
- Apr 5, 2007 1:48:45 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Utilities.inc.php
r241 r247 50 50 if (is_array($var)) { 51 51 foreach ($var as $k=>$v) { 52 $k = ucfirst( strtolower(str_replace(array('_', ' '), ' ', $k)));52 $k = ucfirst(mb_strtolower(str_replace(array('_', ' '), ' ', $k))); 53 53 if (is_array($v)) { 54 54 $output .= sprintf("\n%s%s: %s\n", $indent, $k, fancyDump($v, $indent . $indent)); … … 152 152 $hash = md5($text); 153 153 $rgb = array( 154 substr($hash, 0, 1),155 substr($hash, 1, 1),156 substr($hash, 2, 1),157 substr($hash, 3, 1),158 substr($hash, 4, 1),159 substr($hash, 5, 1),154 mb_substr($hash, 0, 1), 155 mb_substr($hash, 1, 1), 156 mb_substr($hash, 2, 1), 157 mb_substr($hash, 3, 1), 158 mb_substr($hash, 4, 1), 159 mb_substr($hash, 5, 1), 160 160 ); 161 161 … … 189 189 { 190 190 $ouput = ''; 191 $num = strlen($text);191 $num = mb_strlen($text); 192 192 for ($i=0; $i<$num; $i++) { 193 193 $output .= sprintf('&#%03s', ord($text{$i})); … … 225 225 function truncate($str, $len, $where='middle') 226 226 { 227 if ($len <= 3 || strlen($str) <= 3) {227 if ($len <= 3 || mb_strlen($str) <= 3) { 228 228 return ''; 229 229 } … … 458 458 { 459 459 do { 460 if (! ereg($pattern, $string, $temp)) {460 if (!mb_ereg($pattern, $string, $temp)) { 461 461 continue; 462 462 } 463 463 $string = str_replace($temp[0], '', $string); 464 464 $results[] = $temp; 465 } while ( ereg($pattern, $string, $temp));465 } while (mb_ereg($pattern, $string, $temp)); 466 466 return $results; 467 467 } … … 554 554 { 555 555 // Translate the human string date into SQL-safe date format. 556 if (empty($date) || strpos($date, '0000-00-00') !== false || strtotime($date) === -1 || strtotime($date) === false) {556 if (empty($date) || mb_strpos($date, '0000-00-00') !== false || strtotime($date) === -1 || strtotime($date) === false) { 557 557 // Return a string of zero time, formatted the same as $format. 558 558 return strtr($format, array( … … 673 673 } 674 674 675 return $val . '-' . substr(md5($salt . md5($val . $salt)), 0, 18);675 return $val . '-' . mb_substr(md5($salt . md5($val . $salt)), 0, 18); 676 676 } 677 677 … … 685 685 function removeSignature($signed_val) 686 686 { 687 return substr($signed_val, 0,strrpos($signed_val, '-'));687 return mb_substr($signed_val, 0, mb_strrpos($signed_val, '-')); 688 688 } 689 689 … … 822 822 if (preg_match('![\d\.]{7,15}/\d{1,2}!', $network)) { 823 823 // IP is in CIDR notation. 824 list($cidr_ip, $cidr_bitmask) = split('/', $network);824 list($cidr_ip, $cidr_bitmask) = explode('/', $network); 825 825 $cidr_ip_binary = sprintf('%032b', ip2long($cidr_ip)); 826 if ( substr($ip_binary, 0, $cidr_bitmask) ===substr($cidr_ip_binary, 0, $cidr_bitmask)) {826 if (mb_substr($ip_binary, 0, $cidr_bitmask) === mb_substr($cidr_ip_binary, 0, $cidr_bitmask)) { 827 827 // IP address is within the specified IP range. 828 828 return $network;
Note: See TracChangeset
for help on using the changeset viewer.