返回介绍

upload_is_user_over_quota()

发布于 2017-09-11 11:09:25 字数 2080 浏览 931 评论 0 收藏 0

upload_is_user_over_quota( bool $echo = true )

Check whether a site has used its allotted upload space.


description


参数

$echo

(bool) (Optional) If $echo is set and the quota is exceeded, a warning message is echoed. Default is true.

Default value: true


返回值

(bool) True if user is over upload space quota, otherwise false.


源代码

File: wp-admin/includes/ms.php

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

更新日志

Versiondescription
MUIntroduced.

相关函数

Uses

  • wp-includes/l10n.php: _e()
  • wp-includes/option.php: get_site_option()
  • wp-includes/ms-functions.php: get_space_allowed()
  • wp-includes/ms-functions.php: get_space_used()

Used By

  • wp-admin/includes/ms.php: fix_import_form_size()
  • wp-admin/includes/ms.php: check_upload_size()
  • wp-admin/includes/class-wp-importer.php: WP_Importer::is_user_over_quota()
  • wp-includes/class-wp-xmlrpc-server.php: wp_xmlrpc_server::mw_newMediaObject()

User Contributed Notes

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文