コード例 #1
0
 /**
  * Possible upload errors
  */
 public function setup_upload_errors($component)
 {
     $allowed_size = mpp_get_allowed_space($component);
     $this->upload_errors = array(UPLOAD_ERR_OK => _x('Great! the file uploaded successfully!', 'upload error message', 'mediapress'), UPLOAD_ERR_INI_SIZE => sprintf(_x('Your file size was bigger than the maximum allowed file size of: %s', 'upload error message', 'mediapress'), $allowed_size), UPLOAD_ERR_FORM_SIZE => sprintf(_x('Your file was bigger than the maximum allowed file size of: %s', 'upload error message', 'mediapress'), $allowed_size), UPLOAD_ERR_PARTIAL => _x('The uploaded file was only partially uploaded', 'upload error message', 'mediapress'), UPLOAD_ERR_NO_FILE => _x('No file was uploaded', 'upload error message', 'mediapress'), UPLOAD_ERR_NO_TMP_DIR => _x('Missing a temporary folder.', 'upload error message', 'mediapress'));
 }
コード例 #2
0
ファイル: space-stats.php プロジェクト: baden03/mediapress
function mpp_display_space_usage($component = null, $component_id = null)
{
    if (!mpp_get_option('show_upload_quota')) {
        return;
    }
    if (!$component) {
        $component = mpp_get_current_component();
    }
    if (!$component_id) {
        $component_id = mpp_get_current_component_id();
    }
    $total_space = mpp_get_allowed_space($component, $component_id);
    $used = mpp_get_used_space($component, $component_id);
    if ($used > $total_space) {
        $percentused = '100';
    } else {
        $percentused = $used / $total_space * 100;
    }
    if ($total_space > 1000) {
        $total_space = number_format($total_space / 1024);
        $total_space .= __('GB');
    } else {
        $total_space .= __('MB');
    }
    ?>
	<strong><?php 
    printf(__('You have <span> %1s%%</span> of your %2s space left', 'mediapress'), number_format(100 - $percentused), $total_space);
    ?>
</strong>
	<?php 
}