upload_is_user_over_quota() - WordPress 函数参考中文文档

返回介绍

upload_is_user_over_quota()

发布于 2017-09-11 字数2082 浏览 874 评论 0

upload_is_user_over_quota( bool $echo = true )

Check whether a site has used its allotted upload space.


描述


参数

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

更新日志

Version 描述
MU Introduced.

相关函数

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

目前还没有任何评论,快来抢沙发吧!