diff --git a/src/wp-includes/media-template.php b/src/wp-includes/media-template.php
index 5418a0a..baa8847 100644
|
a
|
b
|
function wp_print_media_templates() { |
| 156 | 156 | <# } #> |
| 157 | 157 | <?php if ( ! _device_can_upload() ) : ?> |
| 158 | 158 | <h3 class="upload-instructions"><?php printf( __('The web browser on your device cannot be used to upload files. You may be able to use the <a href="%s">native app for your device</a> instead.'), 'https://wordpress.org/mobile/' ); ?></h3> |
| 159 | | <?php elseif ( is_multisite() && ! is_upload_space_available() ) : ?> |
| | 159 | <?php elseif ( ! is_upload_space_available() ) : ?> |
| 160 | 160 | <h3 class="upload-instructions"><?php _e( 'Upload Limit Exceeded' ); ?></h3> |
| 161 | 161 | <?php |
| 162 | 162 | /** This action is documented in wp-admin/includes/media.php */ |
diff --git a/src/wp-includes/media.php b/src/wp-includes/media.php
index 135ee95..b814a6e 100644
|
a
|
b
|
function wp_plupload_default_settings() { |
| 2492 | 2492 | 'mobile' => wp_is_mobile(), |
| 2493 | 2493 | 'supported' => _device_can_upload(), |
| 2494 | 2494 | ), |
| 2495 | | 'limitExceeded' => is_multisite() && ! is_upload_space_available() |
| | 2495 | 'limitExceeded' => ! is_upload_space_available() |
| 2496 | 2496 | ); |
| 2497 | 2497 | |
| 2498 | 2498 | $script = 'var _wpPluploadSettings = ' . json_encode( $settings ) . ';'; |
| … |
… |
function wp_maybe_generate_attachment_metadata( $attachment ) { |
| 3137 | 3137 | } |
| 3138 | 3138 | } |
| 3139 | 3139 | } |
| | 3140 | |
| | 3141 | /** |
| | 3142 | * Determines if there is any upload space left in the blog's quota. |
| | 3143 | * |
| | 3144 | * @since 3.0.0 |
| | 3145 | * |
| | 3146 | * @return int of upload space available in bytes |
| | 3147 | */ |
| | 3148 | function get_upload_space_available() { |
| | 3149 | // The default for single-site: astronomically high. |
| | 3150 | $space_available = 1024 * 1024 * 1024; |
| | 3151 | if ( is_multisite() ) { |
| | 3152 | $space_allowed = get_space_allowed() * 1024 * 1024; |
| | 3153 | if ( get_site_option( 'upload_space_check_disabled' ) ) |
| | 3154 | return $space_allowed; |
| | 3155 | |
| | 3156 | $space_used = get_space_used() * 1024 * 1024; |
| | 3157 | |
| | 3158 | if ( ( $space_allowed - $space_used ) <= 0 ) |
| | 3159 | return 0; |
| | 3160 | |
| | 3161 | $space_available = $space_allowed - $space_used; |
| | 3162 | } |
| | 3163 | return apply_filters( 'upload_space_available', $space_available ); |
| | 3164 | } |
| | 3165 | |
| | 3166 | /** |
| | 3167 | * Determines if there is any upload space left in the current blog's quota. |
| | 3168 | * |
| | 3169 | * @since 3.0.0 |
| | 3170 | * @return bool True if space is available, false otherwise. |
| | 3171 | */ |
| | 3172 | function is_upload_space_available() { |
| | 3173 | if ( get_site_option( 'upload_space_check_disabled' ) ) |
| | 3174 | return true; |
| | 3175 | |
| | 3176 | return (bool) get_upload_space_available(); |
| | 3177 | } |
| | 3178 | No newline at end of file |
diff --git a/src/wp-includes/ms-functions.php b/src/wp-includes/ms-functions.php
index 431ba07..129f983 100644
|
a
|
b
|
function get_space_allowed() { |
| 2323 | 2323 | } |
| 2324 | 2324 | |
| 2325 | 2325 | /** |
| 2326 | | * Determines if there is any upload space left in the current blog's quota. |
| 2327 | | * |
| 2328 | | * @since 3.0.0 |
| 2329 | | * |
| 2330 | | * @return int of upload space available in bytes |
| 2331 | | */ |
| 2332 | | function get_upload_space_available() { |
| 2333 | | $space_allowed = get_space_allowed() * 1024 * 1024; |
| 2334 | | if ( get_site_option( 'upload_space_check_disabled' ) ) |
| 2335 | | return $space_allowed; |
| 2336 | | |
| 2337 | | $space_used = get_space_used() * 1024 * 1024; |
| 2338 | | |
| 2339 | | if ( ( $space_allowed - $space_used ) <= 0 ) |
| 2340 | | return 0; |
| 2341 | | |
| 2342 | | return $space_allowed - $space_used; |
| 2343 | | } |
| 2344 | | |
| 2345 | | /** |
| 2346 | | * Determines if there is any upload space left in the current blog's quota. |
| 2347 | | * |
| 2348 | | * @since 3.0.0 |
| 2349 | | * @return bool True if space is available, false otherwise. |
| 2350 | | */ |
| 2351 | | function is_upload_space_available() { |
| 2352 | | if ( get_site_option( 'upload_space_check_disabled' ) ) |
| 2353 | | return true; |
| 2354 | | |
| 2355 | | return (bool) get_upload_space_available(); |
| 2356 | | } |
| 2357 | | |
| 2358 | | /** |
| 2359 | 2326 | * @since 3.0.0 |
| 2360 | 2327 | * |
| 2361 | 2328 | * @return int of upload size limit in bytes |