wpseek.com
A WordPress-centric search engine for devs and theme authors
wp_dashboard_quota › WordPress Function
Since3.0.0
Deprecatedn/a
› wp_dashboard_quota ( No parameters )
Returns: |
|
Defined at: |
|
Codex: |
Displays file upload quota on dashboard.
Runs on the {@see 'activity_box_end'} hook in wp_dashboard_right_now().Related Functions: wp_dashboard, wp_dashboard_setup, wp_dashboard_empty, wp_dashboard_secondary, wp_dashboard_primary
Source
function wp_dashboard_quota() { if ( ! is_multisite() || ! current_user_can( 'upload_files' ) || get_site_option( 'upload_space_check_disabled' ) ) { return true; } $quota = get_space_allowed(); $used = get_space_used(); if ( $used > $quota ) { $percentused = '100'; } else { $percentused = ( $used / $quota ) * 100; } $used_class = ( $percentused >= 70 ) ? ' warning' : ''; $used = round( $used, 2 ); $percentused = number_format( $percentused ); ?> <h3 class="mu-storage"><?php _e( 'Storage Space' ); ?></h3> <div class="mu-storage"> <ul> <li class="storage-count"> <?php $text = sprintf( /* translators: %s: Number of megabytes. */ __( '%s MB Space Allowed' ), number_format_i18n( $quota ) ); printf( '<a href="%1$s">%2$s<span class="screen-reader-text"> (%3$s)</span></a>', esc_url( admin_url( 'upload.php' ) ), $text, /* translators: Hidden accessibility text. */ __( 'Manage Uploads' ) ); ?> </li><li class="storage-count <?php echo $used_class; ?>"> <?php $text = sprintf( /* translators: 1: Number of megabytes, 2: Percentage. */ __( '%1$s MB (%2$s%%) Space Used' ), number_format_i18n( $used, 2 ), $percentused ); printf( '<a href="%1$s" class="musublink">%2$s<span class="screen-reader-text"> (%3$s)</span></a>', esc_url( admin_url( 'upload.php' ) ), $text, /* translators: Hidden accessibility text. */ __( 'Manage Uploads' ) ); ?> </li> </ul> </div> <?php }