本文整理汇总了PHP中MainWP_Utility::human_filesize方法的典型用法代码示例。如果您正苦于以下问题:PHP MainWP_Utility::human_filesize方法的具体用法?PHP MainWP_Utility::human_filesize怎么用?PHP MainWP_Utility::human_filesize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MainWP_Utility
的用法示例。
在下文中一共展示了MainWP_Utility::human_filesize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showBackups
public static function showBackups(&$website, $fullBackups, $dbBackups)
{
$output = '';
echo '<table>';
$mwpDir = MainWP_Utility::getMainWPDir();
$mwpDir = $mwpDir[0];
foreach ($fullBackups as $key => $fullBackup) {
$downloadLink = admin_url('?sig=' . md5(filesize($fullBackup)) . '&mwpdl=' . rawurlencode(str_replace($mwpDir, '', $fullBackup)));
$output .= '<tr><td style="width: 400px;">' . MainWP_Utility::formatTimestamp(MainWP_Utility::getTimestamp(filemtime($fullBackup))) . ' - ' . MainWP_Utility::human_filesize(filesize($fullBackup));
$output .= '</td><td><a title="' . basename($fullBackup) . '" href="' . $downloadLink . '" class="button">Download</a></td>';
$output .= '<td><a href="admin.php?page=SiteRestore&websiteid=' . $website->id . '&f=' . base64_encode($downloadLink) . '&size=' . filesize($fullBackup) . '" class="mainwp-upgrade-button button" target="_blank" title="' . basename($fullBackup) . '">Restore</a></td></tr>';
}
if ($output == '') {
echo '<br />' . __('No full backup has been taken yet', 'mainwp') . '<br />';
} else {
echo '<strong style="font-size: 14px">' . __('Last backups from your files:', 'mainwp') . '</strong>' . $output;
}
echo '</table><br/><table>';
$output = '';
foreach ($dbBackups as $key => $dbBackup) {
$downloadLink = admin_url('?sig=' . md5(filesize($dbBackup)) . '&mwpdl=' . rawurlencode(str_replace($mwpDir, '', $dbBackup)));
$output .= '<tr><td style="width: 400px;">' . MainWP_Utility::formatTimestamp(MainWP_Utility::getTimestamp(filemtime($dbBackup))) . ' - ' . MainWP_Utility::human_filesize(filesize($dbBackup)) . '</td><td><a title="' . basename($dbBackup) . '" href="' . $downloadLink . '" download class="button">Download</a></td></tr>';
}
if ($output == '') {
echo '<br />' . __('No database only backup has been taken yet', 'mainwp') . '<br /><br />';
} else {
echo '<strong style="font-size: 14px">' . __('Last backups from your database:', 'mainwp') . '</strong>' . $output;
}
echo '</table>';
}