function wpcloud_calc_used_space($user_id) { if (!file_exists(get_directory_from_id($user_id))) { return '0';} $used_MB = 0; $dir = ABSPATH . 'cloud/' . $user_id; if ($handle = opendir($dir)) { while (false !== ($entry = readdir($handle))) { if ($entry != "." && $entry != "..") { $file = $dir . '/' . $entry; $used_MB = $used_MB + wpcloud_format_size($file, true); } } closedir($handle); return $used_MB; } }
$temp = explode(".", $entry); $extension = end($temp); if (!in_array($extension, getAllowedExtensions())) { continue; } // ==== $file = $dir . '/' . $entry; $file_url = get_site_url() . '/cloud/' . get_current_user_id() . '/' . $entry; echo '<tr>'; echo '<td><a '; echo 'class="wpcloud-file mime-' . getMimeType($file) . '" '; echo 'href="' . $file_url . '" title="' . $entry . '">' . $entry . '</a></td>'; echo '<td><small>' . wpcloud_format_size($file, false) . '</small></td>'; echo '<td><small>' . date("j M Y", filemtime($file)) . '</small></td>'; echo '<td><a onclick="if (!confirm(\'Are you sure?\')) return false;" href="' . get_site_url() . '/?cloud=delete&file=' . $entry . '&redirect=http://' . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] . '">'; echo '<img src="' . WP_PLUGIN_URL . '/cloud/includes/delete.png' . '" />'; echo '</a></td>'; echo '</tr>'; } } closedir($handle); } } ?> </table>