Un motore di ricerca WordPress per sviluppatori e autori di temi



upload_is_user_over_quota ›

Da3.0.0
Deprecaton/a
upload_is_user_over_quota ( $echo = true )
Parametri:
  • (bool) $echo Optional. If $echo is set and the quota is exceeded, a warning message is echoed. Default is true.
    Richiesto: No
    Default: true
Ritorna:
  • (bool) True if user is over upload space quota, otherwise false.
Definito a:
Codex:
ChangeLog:
  • MU

Check whether a site has used its allotted upload space.



Sorgenti

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 ) {
			_e( 'Sorry, you have used your space allocation. Please delete some files to upload more files.' );
		}
		return true;
	} else {
		return false;
	}
}