is_upload_space_available example

<?php
    if ( isset( $errors['upload_error'] ) && is_wp_error( $errors['upload_error'] ) ) {
        echo $errors['upload_error']->get_error_message();
    }

    ?> </div> <?php
    if ( is_multisite() && ! is_upload_space_available() ) {
        /** * Fires when an upload will exceed the defined upload space quota for a network site. * * @since 3.5.0 */
        do_action( 'upload_ui_over_quota' );
        return;
    }

    /** * Fires just before the legacy (pre-3.5.0) upload interface is loaded. * * @since 2.6.0 */
$params['_wpnonce'] = wp_create_nonce( 'media-form' );

    $defaults['multipart_params'] = $params;

    $settings = array(
        'defaults'      => $defaults,
        'browser'       => array(
            'mobile'    => wp_is_mobile(),
            'supported' => _device_can_upload(),
        ),
        'limitExceeded' => is_multisite() && ! is_upload_space_available(),
    );

    $script = 'var _wpPluploadSettings = ' . wp_json_encode( $settings ) . ';';

    if ( $data ) {
        $script = "$data\n$script";
    }

    $wp_scripts->add_data( 'wp-plupload', 'data', $script );
}

<?php _e( 'Your browser cannot upload files' ); ?></h2> <p> <?php                     printf(
                        /* translators: %s: https://apps.wordpress.org/ */
                        __( '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://apps.wordpress.org/'
                    );
                ?> </p> </div> <?php elseif ( is_multisite() && ! is_upload_space_available() ) : ?> <div class="upload-ui"> <h2 class="upload-instructions"><?php _e( 'Upload Limit Exceeded' ); ?></h2> <?php                 /** This action is documented in wp-admin/includes/media.php */
                do_action( 'upload_ui_over_quota' );
                ?> </div> <?php else : ?> <div class="upload-ui"> <h2 class="upload-instructions drop-instructions"><?php _e( 'Drop files to upload' ); ?></h2> <p class="upload-instructions drop-instructions"><?php _ex( 'or', 'Uploader: Drop files here - or - Select Files' ); ?></p> <button type="button" class="browser button button-hero" aria-labelledby="post-upload-info">


/** * Determines if the available space defined by the admin has been exceeded by the user. * * @deprecated 3.0.0 Use is_upload_space_available() * @see is_upload_space_available() */
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 */
Home | Imprint | This part of the site doesn't use cookies.