Uma área de pesquisa sobre o WordPress para devs e autores do tema



upload_is_user_over_quota ›

Desde3.0.0
Obsoleton/a
upload_is_user_over_quota ( $echo = true )
Parâmetros:
  • (bool) $echo Optional. If $echo is set and the quota is exceeded, a warning message is echoed. Default is true.
    Required: No
    Padrão: true
Retorna:
  • (bool) True if user is over upload space quota, otherwise false.
Definido em:
Codex:
Log de mudanças:
  • MU

Check whether a site has used its allotted upload space.



Fonte

function upload_is_user_over_quota( $echo = 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 ( $echo ) {
			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 )
			);
		}
		return true;
	} else {
		return false;
	}
}