2020-06-16 18:40:13 -05:00
|
|
|
<?php
|
|
|
|
|
|
|
|
require_once "events.php";
|
|
|
|
|
|
|
|
class Download extends Extension
|
|
|
|
{
|
|
|
|
public function get_priority(): int
|
|
|
|
{
|
|
|
|
// Set near the end to give everything else a chance to process
|
|
|
|
return 99;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function onImageDownloading(ImageDownloadingEvent $event)
|
|
|
|
{
|
|
|
|
global $page;
|
|
|
|
|
2020-06-24 17:32:06 +01:00
|
|
|
$page->set_type($event->mime);
|
2020-06-16 18:40:13 -05:00
|
|
|
|
|
|
|
$page->set_mode(PageMode::FILE);
|
|
|
|
|
|
|
|
$page->set_file($event->path, $event->file_modified);
|
|
|
|
|
|
|
|
$event->stop_processing = true;
|
|
|
|
}
|
|
|
|
}
|