コード例 #1
0
ファイル: config.php プロジェクト: drognisep/Portfolio-Site
 /**
  * @NoAdminRequired
  *
  * Returns an app configuration array
  *
  * @param bool $extraMediaTypes
  *
  * @return array <string,null|array>
  */
 private function getConfig($extraMediaTypes = false)
 {
     $features = $this->configService->getFeaturesList();
     //$this->logger->debug("Features: {features}", ['features' => $features]);
     $nativeSvgSupport = $this->isNativeSvgActivated($features);
     $mediaTypes = $this->configService->getSupportedMediaTypes($extraMediaTypes, $nativeSvgSupport);
     return ['features' => $features, 'mediatypes' => $mediaTypes];
 }
コード例 #2
0
ファイル: config.php プロジェクト: sualko/gallery
 /**
  * @NoAdminRequired
  *
  * Returns an app configuration array
  *
  * @param bool $extraMediaTypes
  *
  * @return array <string,null|array>
  */
 private function getConfig($extraMediaTypes = false)
 {
     $features = $this->configService->getFeaturesList();
     //$this->logger->debug("Features: {features}", ['features' => $features]);
     $nativeSvgSupport = $this->isNativeSvgActivated($features);
     $mediaTypes = $this->configService->getSupportedMediaTypes($extraMediaTypes, $nativeSvgSupport);
     $enablePreviews = \OC::$server->getConfig()->getSystemValue('enable_previews', true);
     return ['features' => $features, 'mediatypes' => $mediaTypes, 'enablePreviews' => $enablePreviews];
 }
コード例 #3
0
 /**
  * @dataProvider providesValidateMimeTypeWithForbiddenMimeData
  *
  * @param $mimeType
  *
  * @expectedException \OCA\Gallery\Service\ForbiddenServiceException
  */
 public function testValidateMimeTypeWithForbiddenMime($mimeType)
 {
     $supportedMimeTypes = ['image/png', 'image/jpeg', 'image/gif', 'image/x-xbitmap', 'image/bmp', 'application/postscript', 'application/x-font'];
     $this->assertSame($supportedMimeTypes, self::invokePrivate($this->service, 'baseMimeTypes', [$supportedMimeTypes]));
     $this->mockIsMimeSupported($nativeSvgSupport = true);
     $this->service->validateMimeType($mimeType);
 }
コード例 #4
0
ファイル: files.php プロジェクト: enoch85/owncloud-testserver
 /**
  * Generates the download data
  *
  * @param int $fileId the ID of the file of which we need a large preview of
  * @param string|null $filename
  *
  * @return array|false
  */
 private function getDownload($fileId, $filename)
 {
     /** @type File $file */
     $file = $this->downloadService->getResourceFromId($fileId);
     $this->configService->validateMimeType($file->getMimeType());
     $download = $this->downloadService->downloadFile($file);
     if (is_null($filename)) {
         $filename = $file->getName();
     }
     $download['name'] = $filename;
     return $download;
 }
コード例 #5
0
 /**
  * Returns the file of which a preview will be generated
  *
  * @param int $fileId
  *
  * @return array<File|int|null>
  */
 private function getFile($fileId)
 {
     $status = Http::STATUS_OK;
     try {
         /** @type File $file */
         $file = $this->previewService->getResourceFromId($fileId);
         $this->configService->validateMimeType($file->getMimeType());
     } catch (ServiceException $exception) {
         $file = null;
         $status = $this->getHttpStatusCode($exception);
     }
     return [$file, $status];
 }
コード例 #6
0
 /**
  * Mocks PreviewService->getSupportedMediaTypes
  *
  * @param $slideshow
  * @param $nativeSvgSupport
  * @param $mimeTypes
  */
 private function mockSupportedMediaTypes($slideshow, $nativeSvgSupport, $mimeTypes)
 {
     $this->configService->expects($this->any())->method('getSupportedMediaTypes')->with($this->equalTo($slideshow), $this->equalTo($nativeSvgSupport))->willReturn($mimeTypes);
 }
コード例 #7
0
 private function mockGetAlbumInfo($folderNode, $folderPathFromRoot, $features, $answer)
 {
     $this->configService->expects($this->once())->method('getAlbumInfo')->with($folderNode, $folderPathFromRoot, $features)->willReturn($answer);
 }