本文整理汇总了PHP中get_space_used函数的典型用法代码示例。如果您正苦于以下问题:PHP get_space_used函数的具体用法?PHP get_space_used怎么用?PHP get_space_used使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_space_used函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: setup_column
/**
* Output our custom quota column content.
*
* @param string $column_name The registered column name that the list table is currently on.
* @param int $user_id The blog ID associated with the current blog row.
*/
public function setup_column($column_name, $blog_id)
{
if ($this->column_name !== $column_name) {
return;
}
switch_to_blog($blog_id);
// You might recognize this from wp_dashboard_quota().
$quota = get_space_allowed();
$used = get_space_used();
if ($used > $quota) {
$percentused = '100';
} else {
$percentused = $used / $quota * 100;
}
$text = sprintf(__('%1$s MB / %2$s MB (%3$s%%)'), number_format_i18n(round($used, 2), 2), number_format_i18n($quota, 2), number_format($percentused));
printf('<a href="%1$s" title="%2$s" class="musublink">%3$s</a>', esc_url(admin_url('upload.php')), __('Manage Uploads'), $text);
restore_current_blog();
}
开发者ID:hwdsbcommons,项目名称:wp-ms-disk-quota-column,代码行数:24,代码来源:wp-ms-site-quota.php
示例2: wp_dashboard_quota
/**
* Display file upload quota on dashboard.
*
* Runs on the activity_box_end hook in wp_dashboard_right_now().
*
* @since 3.0.0
*
* @return bool|null True if not multisite, user can't upload files, or the space check option is disabled.
*/
function wp_dashboard_quota()
{
if (!is_multisite() || !current_user_can('upload_files') || get_network_option('upload_space_check_disabled')) {
return true;
}
$quota = get_space_allowed();
$used = get_space_used();
if ($used > $quota) {
$percentused = '100';
} else {
$percentused = $used / $quota * 100;
}
$used_class = $percentused >= 70 ? ' warning' : '';
$used = round($used, 2);
$percentused = number_format($percentused);
?>
<h4 class="mu-storage"><?php
_e('Storage Space');
?>
</h4>
<div class="mu-storage">
<ul>
<li class="storage-count">
<?php
$text = sprintf(__('%s MB Space Allowed'), number_format_i18n($quota));
printf('<a href="%1$s" title="%2$s">%3$s</a>', esc_url(admin_url('upload.php')), __('Manage Uploads'), $text);
?>
</li><li class="storage-count <?php
echo $used_class;
?>
">
<?php
$text = sprintf(__('%1$s MB (%2$s%%) Space Used'), number_format_i18n($used, 2), $percentused);
printf('<a href="%1$s" title="%2$s" class="musublink">%3$s</a>', esc_url(admin_url('upload.php')), __('Manage Uploads'), $text);
?>
</li>
</ul>
</div>
<?php
}
开发者ID:riasnelli,项目名称:WordPress,代码行数:49,代码来源:dashboard.php
示例3: get_upload_space_available
/**
* Determines if there is any upload space left in the current blog's quota.
*
* @since 3.0.0
*
* @return int of upload space available in bytes
*/
function get_upload_space_available()
{
$allowed = get_space_allowed();
if ($allowed < 0) {
$allowed = 0;
}
$space_allowed = $allowed * 1024 * 1024;
if (get_site_option('upload_space_check_disabled')) {
return $space_allowed;
}
$space_used = get_space_used() * 1024 * 1024;
if ($space_allowed - $space_used <= 0) {
return 0;
}
return $space_allowed - $space_used;
}
开发者ID:Jitsufreak,项目名称:PJ,代码行数:23,代码来源:ms-functions.php
示例4: test_get_space_used_pre_get_spaced_used_filter
function test_get_space_used_pre_get_spaced_used_filter()
{
add_filter('pre_get_space_used', array($this, '_filter_space_used'));
$this->assertEquals(300, get_space_used());
remove_filter('pre_get_space_used', array($this, '_filter_space_used'));
}
开发者ID:plis197715,项目名称:wordpress-develop,代码行数:6,代码来源:getSpaceUsed.php
示例5: wp_dashboard_quota
/**
* Display file upload quota on dashboard.
*
* Runs on the activity_box_end hook in wp_dashboard_right_now().
*
* @since 3.0.0
*
* @return bool True if not multisite, user can't upload files, or the space check option is disabled.
*/
function wp_dashboard_quota()
{
if (!is_multisite() || !current_user_can('upload_files') || get_site_option('upload_space_check_disabled')) {
return true;
}
$quota = get_space_allowed();
$used = get_space_used();
if ($used > $quota) {
$percentused = '100';
} else {
$percentused = $used / $quota * 100;
}
$used_color = $percentused >= 70 ? ' spam' : '';
$used = round($used, 2);
$percentused = number_format($percentused);
?>
<p class="sub musub"><?php
_e('Storage Space');
?>
</p>
<div class="table table_content musubtable">
<table>
<tr class="first">
<td class="first b b-posts"><?php
printf(__('<a href="%1$s" title="Manage Uploads" class="musublink">%2$sMB</a>'), esc_url(admin_url('upload.php')), number_format_i18n($quota));
?>
</td>
<td class="t posts"><?php
_e('Space Allowed');
?>
</td>
</tr>
</table>
</div>
<div class="table table_discussion musubtable">
<table>
<tr class="first">
<td class="b b-comments"><?php
printf(__('<a href="%1$s" title="Manage Uploads" class="musublink">%2$sMB (%3$s%%)</a>'), esc_url(admin_url('upload.php')), number_format_i18n($used, 2), $percentused);
?>
</td>
<td class="last t comments<?php
echo $used_color;
?>
"><?php
_e('Space Used');
?>
</td>
</tr>
</table>
</div>
<br class="clear" />
<?php
}
开发者ID:jcsilkey,项目名称:CodeReviewSecurityRepo,代码行数:63,代码来源:dashboard.php
示例6: display_space_usage
/**
* Displays the amount of disk space used by the current site. Not used in core.
*
* @since MU
*/
function display_space_usage()
{
$space_allowed = get_space_allowed();
$space_used = get_space_used();
$percent_used = $space_used / $space_allowed * 100;
if ($space_allowed > 1000) {
$space = number_format($space_allowed / KB_IN_BYTES);
/* translators: Gigabytes */
$space .= __('GB');
} else {
$space = number_format($space_allowed);
/* translators: Megabytes */
$space .= __('MB');
}
?>
<strong><?php
printf(__('Used: %1$s%% of %2$s'), number_format($percent_used), $space);
?>
</strong>
<?php
}
开发者ID:atimmer,项目名称:wordpress-develop-mirror,代码行数:26,代码来源:ms.php
示例7: get_upload_space_available
/**
* Determines if there is any upload space left in the current blog's quota.
*
* @since 3.0.0
*
* @return int of upload space available in bytes
*/
function get_upload_space_available() {
$space_allowed = get_space_allowed() * 1024 * 1024;
if ( get_site_option( 'upload_space_check_disabled' ) )
return $space_allowed;
$space_used = get_space_used() * 1024 * 1024;
if ( ( $space_allowed - $space_used ) <= 0 )
return 0;
return $space_allowed - $space_used;
}
开发者ID:nasrulhazim,项目名称:WordPress,代码行数:19,代码来源:ms-functions.php
示例8: add_quota_to_library
public function add_quota_to_library()
{
global $psts;
$quota = get_space_allowed();
$used = get_space_used();
if ($used > $quota) {
$percentused = '100';
} else {
$percentused = $used / $quota * 100;
}
$used_class = $percentused >= 70 ? 'class="warning"' : '';
$used = round($used, 2);
$percentused = number_format($percentused);
$text = sprintf(__('%1$s MB (%2$s%%) of %3$s MB used.', 'psts'), number_format_i18n($used, 2), $percentused, number_format_i18n($quota, 2));
?>
<div id="prosites-media-quota-display" style="display:none;" <?php
echo $used_class;
?>
><div class="size-text"><?php
echo $text;
?>
</div><?php
echo $this->message(false, 'media-upload');
?>
</div><?php
global $psts;
wp_enqueue_style('psts-quota-style', $psts->plugin_url . 'css/quota.css', $psts->version);
wp_enqueue_script('psts-quota', $psts->plugin_url . 'js/quota.js', array('jquery'), $psts->version);
}
开发者ID:vilmark,项目名称:vilmark_main,代码行数:30,代码来源:quota.php
示例9: blog_info_widget_cb
/**
* "This blog" widget callback
*/
public function blog_info_widget_cb()
{
$comments_count = wp_count_comments();
?>
<table cellpadding="5" cellspacing="0" width="100%" class="siw_tbl">
<tr>
<th><?php
_e('Title', 'siw');
?>
</th>
<td><?php
bloginfo('name');
?>
</td>
</tr>
<tr>
<th><?php
_e('Tagline', 'siw');
?>
</th>
<td><?php
bloginfo('description');
?>
</td>
</tr>
<tr>
<th><?php
_e('Theme', 'siw');
?>
</th>
<td><?php
echo get_current_theme();
?>
</td>
</tr>
<tr>
<th><?php
_e('Privacy', 'siw');
?>
</th>
<td><?php
echo get_option('blog_public') == 1 ? __('Blog is visible to everyone, including search engines (like Google, Sphere, Technorati) and archivers.', 'siw') : __('Blog is invisible to search engines, but allow normal visitors.', 'siw');
?>
</td>
</tr>
<tr>
<th><?php
_e('Comments', 'siw');
?>
</th>
<td><?php
printf(__('%s Pending | %s Spam', 'siw'), $comments_count->moderated, $comments_count->spam);
?>
</td>
</tr>
</table>
<?php
// Check if WPMU pro sites plugin activated
if (class_exists('ProSites')) {
global $psts;
$blog_id = get_current_blog_id();
$levels = (array) get_site_option('psts_levels');
$current_level = $psts->get_level($blog_id);
$expire = $psts->get_expire($blog_id);
$trialing = ProSites_Helper_Registration::is_trial($blog_id);
$active_trial = $trialing ? __('(Active trial)', 'siw') : '';
$quota = get_space_allowed();
$used = get_space_used();
if ($used > $quota) {
$percentused = '100';
} else {
$percentused = $used / $quota * 100;
}
$used = round($used, 2);
$percentused = number_format($percentused);
?>
<table cellpadding="5" cellspacing="0" width="100%" class="siw_tbl">
<tr>
<th><?php
_e('Level', 'siw');
?>
</th>
<td>
<?php
echo $current_level . ' - ' . @$levels[$current_level]['name'];
?>
<a class="manage_pro" href="<?php
echo $psts->checkout_url($blog_id);
?>
"><?php
_e('Manage Pro Account', 'siw');
?>
</a>
</td>
</tr>
<tr>
<th><?php
//.........这里部分代码省略.........
开发者ID:bappi-d-great,项目名称:subsite-info-widget,代码行数:101,代码来源:subsite-info-widget.php
示例10: display_space_usage
/**
* Displays the amount of disk space used by the current site. Not used in core.
*
* @since MU
*/
function display_space_usage()
{
$space_allowed = get_space_allowed();
$space_used = get_space_used();
$percent_used = $space_used / $space_allowed * 100;
if ($space_allowed > 1000) {
$space = number_format($space_allowed / KB_IN_BYTES);
/* translators: Gigabytes */
$space .= __('GB');
} else {
$space = number_format($space_allowed);
/* translators: Megabytes */
$space .= __('MB');
}
?>
<strong><?php
/* translators: Storage space that's been used. 1: Percentage of used space, 2: Total space allowed in megabytes or gigabytes */
printf(__('Used: %1$s%% of %2$s'), number_format($percent_used), $space);
?>
</strong>
<?php
}
开发者ID:johnpbloch,项目名称:wordpress,代码行数:27,代码来源:ms.php
注:本文中的get_space_used函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论