function _downloadCallback($msg, $params = null)
{
switch ($msg) {
case 'saveas':
$this->log(1, "downloading {$params} ...");
break;
case 'done':
$this->log(1, '...done: ' . number_format($params, 0, '', ',') . ' bytes');
break;
case 'bytesread':
static $bytes;
if (empty($bytes)) {
$bytes = 0;
}
if (!($bytes % 10240)) {
$this->log(1, '.', false);
}
$bytes += $params;
break;
case 'start':
if ($params[1] == -1) {
$length = "Unknown size";
} else {
$length = number_format($params[1], 0, '', ',') . " bytes";
}
$this->log(1, "Starting to download {$params[0]} ({$length})");
break;
}
if (method_exists($this->ui, '_downloadCallback')) {
$this->ui->_downloadCallback($msg, $params);
}
}