Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -292,23 +292,8 @@ public static function format_active_installs_for_display( $count ) {
* @return int The sanitized version for display.
*/
public static function sanitize_active_installs( $active_installs ) {
if ( $active_installs > 10000000 ) {
// 10 million +
return 10000000;
} elseif ( $active_installs > 1000000 ) {
$round = 1000000;
} elseif ( $active_installs > 100000 ) {
$round = 100000;
} elseif ( $active_installs > 10000 ) {
$round = 10000;
} elseif ( $active_installs > 1000 ) {
$round = 1000;
} elseif ( $active_installs > 100 ) {
$round = 100;
} else {
// Rounded to ten, else 0
$round = 10;
}
$length = strlen( (string) $active_installs );
$round = pow( 10, max( 1, $length - 1 ) );

return floor( $active_installs / $round ) * $round;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,21 +155,8 @@ function bulk_update_stats( $request ) {
* @return int The sanitized version for display.
*/
protected function sanitize_active_installs( $active_installs ) {
if ( $active_installs > 1000000 ) {
// 1 million +;
return 1000000;
} elseif ( $active_installs > 100000 ) {
$round = 100000;
} elseif ( $active_installs > 10000 ) {
$round = 10000;
} elseif ( $active_installs > 1000 ) {
$round = 1000;
} elseif ( $active_installs > 100 ) {
$round = 100;
} else {
// Rounded to ten, else 0
$round = 10;
}
$length = strlen( (string) $active_installs );
$round = pow( 10, max( 1, $length - 1 ) );

return floor( $active_installs / $round ) * $round;
}
Expand Down
Loading