From 84ce78ab1fa5ce65b8e41df6718c172fb54b1365 Mon Sep 17 00:00:00 2001 From: ryan Date: Mon, 2 Aug 2010 17:56:05 +0000 Subject: [PATCH] Move dashboard_quota in dashboard.php. Don't perform current_user_can check before init. git-svn-id: http://svn.automattic.com/wordpress/trunk@15487 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/dashboard.php | 39 ++++++++++++++++++++++++++++++++ wp-admin/includes/ms.php | 40 --------------------------------- 2 files changed, 39 insertions(+), 40 deletions(-) diff --git a/wp-admin/includes/dashboard.php b/wp-admin/includes/dashboard.php index 8486581bec..c35be0a165 100644 --- a/wp-admin/includes/dashboard.php +++ b/wp-admin/includes/dashboard.php @@ -1034,6 +1034,45 @@ function wp_dashboard_rss_control( $widget_id, $form_inputs = array() ) { wp_widget_rss_form( $widget_options[$widget_id], $form_inputs ); } +// Display File upload quota on dashboard +function wp_dashboard_quota() { + if ( !is_multisite() || !current_user_can('edit_posts') || get_site_option( 'upload_space_check_disabled' ) ) + return true; + + $quota = get_space_allowed(); + $used = get_dirsize( BLOGUPLOADDIR ) / 1024 / 1024; + + if ( $used > $quota ) + $percentused = '100'; + else + $percentused = ( $used / $quota ) * 100; + $used_color = ( $percentused < 70 ) ? ( ( $percentused >= 40 ) ? 'waiting' : 'approved' ) : 'spam'; + $used = round( $used, 2 ); + $percentused = number_format( $percentused ); + + ?> +

+
+ + + + + +
%2$sMB' ), esc_url( admin_url( 'upload.php' ) ), $quota ); ?>
+
+
+ + + + + +
%2$sMB (%3$s%%)' ), esc_url( admin_url( 'upload.php' ) ), $used, $percentused ); ?>
+
+
+ $quota ) - $percentused = '100'; - else - $percentused = ( $used / $quota ) * 100; - $used_color = ( $percentused < 70 ) ? ( ( $percentused >= 40 ) ? 'waiting' : 'approved' ) : 'spam'; - $used = round( $used, 2 ); - $percentused = number_format( $percentused ); - - ?> -

-
- - - - - -
%2$sMB' ), esc_url( admin_url( 'upload.php' ) ), $quota ); ?>
-
-
- - - - - -
%2$sMB (%3$s%%)' ), esc_url( admin_url( 'upload.php' ) ), $used, $percentused ); ?>
-
-
-