display_space_usage

Displays the amount of disk space used by the current site.

Description

display_space_usage(); 

Not used in core.


Usage

  1. if ( !function_exists( 'display_space_usage' ) ) { 
  2. require_once ABSPATH . '/wp-admin/includes/ms.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = display_space_usage(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/wp-admin/includes/ms.php  
  1. function display_space_usage() { 
  2. $space_allowed = get_space_allowed(); 
  3. $space_used = get_space_used(); 
  4.  
  5. $percent_used = ( $space_used / $space_allowed ) * 100; 
  6.  
  7. if ( $space_allowed > 1000 ) { 
  8. $space = number_format( $space_allowed / KB_IN_BYTES ); 
  9. /** translators: Gigabytes */ 
  10. $space .= __( 'GB' ); 
  11. } else { 
  12. $space = number_format( $space_allowed ); 
  13. /** translators: Megabytes */ 
  14. $space .= __( 'MB' ); 
  15. ?> 
  16. <strong><?php 
  17. /** translators: Storage space that's been used. 1: Percentage of used space, 2: Total space allowed in megabytes or gigabytes */ 
  18. printf( __( 'Used: %1$s%% of %2$s' ), number_format( $percent_used ), $space ); 
  19. ?></strong> 
  20. <?php