isSupportedMimetype() public static method

Checks if mimetype is supported by the app
public static isSupportedMimetype ( string $mimetype ) : boolean
$mimetype string - checked mimetype
return boolean
Example #1
0
 protected function initViews()
 {
     $this->ownerView = new View('/' . $this->owner);
     $this->ownerViewFiles = new View('/' . $this->owner . '/files');
     $this->path = $this->ownerView->getPath($this->fileId);
     $this->pathFiles = $this->ownerViewFiles->getPath($this->fileId);
     if (!$this->path || !$this->pathFiles) {
         throw new \Exception($this->fileId . ' can not be resolved');
     }
     if (!$this->ownerView->file_exists($this->path)) {
         throw new \Exception($this->path . ' doesn\'t exist');
     }
     if (!$this->ownerViewFiles->file_exists($this->pathFiles)) {
         throw new \Exception($this->pathFiles . ' doesn\'t exist');
     }
     if (!$this->ownerView->is_file($this->path)) {
         throw new \Exception('Object ' . $this->path . ' is not a file.');
     }
     //TODO check if it is a valid odt
     $mimetype = $this->ownerView->getMimeType($this->path);
     if (!Filter::isSupportedMimetype($mimetype)) {
         throw new \Exception($this->path . ' is ' . $mimetype . ' and is not supported by RichDocuments app');
     }
 }