2020-05-16 17:14:17 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace OCA\BigBlueButton\BigBlueButton;
|
|
|
|
|
2022-04-15 19:45:27 +02:00
|
|
|
use OCP\Files\Storage\IStorage;
|
|
|
|
|
2020-06-19 09:28:58 +02:00
|
|
|
class Presentation {
|
2020-05-16 17:14:17 +02:00
|
|
|
private $url;
|
|
|
|
|
|
|
|
private $filename;
|
|
|
|
|
2022-04-15 19:45:27 +02:00
|
|
|
private $path;
|
|
|
|
|
|
|
|
/** @var IStorage */
|
|
|
|
private $storage;
|
|
|
|
|
|
|
|
public function __construct(string $path, IStorage $storage) {
|
|
|
|
$this->storage = $storage;
|
|
|
|
$this->path = preg_replace('/^\//', '', $path);
|
|
|
|
$this->filename = preg_replace('/[^\x20-\x7E]+/','#', $path);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function generateUrl(): string {
|
|
|
|
return $this->storage->getDirectDownload($this->path);
|
2020-05-16 17:14:17 +02:00
|
|
|
}
|
|
|
|
|
2021-02-24 15:23:26 +01:00
|
|
|
public function getUrl(): string {
|
2020-05-16 17:14:17 +02:00
|
|
|
return $this->url;
|
|
|
|
}
|
|
|
|
|
2021-02-24 15:23:26 +01:00
|
|
|
public function getFilename(): string {
|
2020-05-16 17:14:17 +02:00
|
|
|
return $this->filename;
|
|
|
|
}
|
|
|
|
|
2021-02-24 15:23:26 +01:00
|
|
|
public function isValid(): bool {
|
2022-04-15 19:45:27 +02:00
|
|
|
return !empty($this->filename);
|
2020-05-16 17:14:17 +02:00
|
|
|
}
|
|
|
|
}
|