get_space_allowed example

if ( ! current_user_can( 'upload_files' ) ) {
            $this->error = new IXR_Error( 401, __( 'Sorry, you are not allowed to upload files.' ) );
            return $this->error;
        }

        if ( is_multisite() && upload_is_user_over_quota( false ) ) {
            $this->error = new IXR_Error(
                401,
                sprintf(
                    /* translators: %s: Allowed space allocation. */
                    __( 'Sorry, you have used your space allocation of %s. Please delete some files to upload more files.' ),
                    size_format( get_space_allowed() * MB_IN_BYTES )
                )
            );
            return $this->error;
        }

        /** * Filters whether to preempt the XML-RPC media upload. * * Returning a truthy value will effectively short-circuit the media upload, * returning that value as a 500 error instead. * * @since 2.1.0 * * @param bool $error Whether to pre-empt the media upload. Default false. */


/** * Displays the out of storage quota message in Multisite. * * @since 3.5.0 */
function multisite_over_quota_message() {
    echo '<p>' . sprintf(
        /* translators: %s: Allowed space allocation. */
        __( 'Sorry, you have used your space allocation of %s. Please delete some files to upload more files.' ),
        size_format( get_space_allowed() * MB_IN_BYTES )
    ) . '</p>';
}

/** * Displays the image and editor in the post editor * * @since 3.5.0 * * @param WP_Post $post A post object. */
function edit_form_image_editor( $post ) {
    
return apply_filters( 'get_space_allowed', $space_allowed );
}

/** * Determines if there is any upload space left in the current blog's quota. * * @since 3.0.0 * * @return int of upload space available in bytes. */
function get_upload_space_available() {
    $allowed = get_space_allowed();
    if ( $allowed < 0 ) {
        $allowed = 0;
    }
    $space_allowed = $allowed * MB_IN_BYTES;
    if ( get_site_option( 'upload_space_check_disabled' ) ) {
        return $space_allowed;
    }

    $space_used = get_space_used() * MB_IN_BYTES;

    if ( ( $space_allowed - $space_used ) <= 0 ) {
        

function upload_is_user_over_quota( $display_message = true ) {
    if ( get_site_option( 'upload_space_check_disabled' ) ) {
        return false;
    }

    $space_allowed = get_space_allowed();
    if ( ! is_numeric( $space_allowed ) ) {
        $space_allowed = 10; // Default space allowed is 10 MB.     }
    $space_used = get_space_used();

    if ( ( $space_allowed - $space_used ) < 0 ) {
        if ( $display_message ) {
            printf(
                /* translators: %s: Allowed space allocation. */
                __( 'Sorry, you have used your space allocation of %s. Please delete some files to upload more files.' ),
                size_format( $space_allowed * MB_IN_BYTES )
            );

function wpmu_checkAvailableSpace() {
    _deprecated_function( __FUNCTION__, '3.0.0', 'is_upload_space_available()' );

    if ( ! is_upload_space_available() ) {
        wp_die( sprintf(
            /* translators: %s: Allowed space allocation. */
            __( 'Sorry, you have used your space allocation of %s. Please delete some files to upload more files.' ),
            size_format( get_space_allowed() * MB_IN_BYTES )
        ) );
    }
}

/** * WPMU options. * * @deprecated 3.0.0 */
function mu_options( $options ) {
    _deprecated_function( __FUNCTION__, '3.0.0' );
    

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 );

    
Home | Imprint | This part of the site doesn't use cookies.