Changeset 14190 for trunk/wp-includes/functions.php
- Timestamp:
- 04/22/2010 09:39:37 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/functions.php
r14184 r14190 132 132 * 133 133 * @param int $number The number to convert based on locale. 134 * @param int $decimals Precision of the number of decimal places. Deprectated.134 * @param int $decimals Precision of the number of decimal places. 135 135 * @return string Converted number in string format. 136 136 */ 137 function number_format_i18n( $number, $decimals = null) {137 function number_format_i18n( $number, $decimals = 0 ) { 138 138 global $wp_locale; 139 139 $number = (int)$number; 140 if ( !is_null( $decimals ) ) _deprecated_argument( __FUNCTION__, '3.0' ); 141 $formatted = number_format( $number, 0, null, $wp_locale->number_format['thousands_sep'] ); 140 $formatted = number_format( $number, absint( $decimals ), $wp_locale->number_format['decimal_point'], $wp_locale->number_format['thousands_sep'] ); 142 141 return apply_filters( 'number_format_i18n', $formatted ); 143 142 } … … 164 163 * @return bool|string False on failure. Number string on success. 165 164 */ 166 function size_format( $bytes, $decimals = null) {165 function size_format( $bytes, $decimals = 0 ) { 167 166 $quant = array( 168 167 // ========================= Origin ==== … … 173 172 'B ' => 1, // pow( 1024, 0) 174 173 ); 175 if ( !is_null( $decimals ) ) _deprecated_argument( __FUNCTION__, '3.0' );176 174 foreach ( $quant as $unit => $mag ) 177 175 if ( doubleval($bytes) >= $mag ) 178 return number_format_i18n( round( $bytes / $mag )) . ' ' . $unit;176 return number_format_i18n( $bytes / $mag, $decimals ) . ' ' . $unit; 179 177 180 178 return false;
Note: See TracChangeset
for help on using the changeset viewer.