Esempio n. 1
0
 /**
  * Renders a hidden link for file picker.
  *
  * @return string
  */
 public function render()
 {
     $result = '';
     if ($this->getModuleLoader()->hasPlugin('filePicker')) {
         $result = sprintf('<script type="text/javascript" src="%s"></script>', Path::getRelativePath('JavaScript/Media.Plugin.FilePicker.js'));
     }
     return $result;
 }
Esempio n. 2
0
    /**
     * Renders a hidden link for link creator.
     *
     * @return string
     */
    public function render()
    {
        $result = '';
        if ($this->getModuleLoader()->hasPlugin('linkCreator')) {
            $result = sprintf('<script type="text/javascript" src="%s"></script>
			<a href="%s" id="btn-linkCreator-current" class="btn btn-linkCreator" style="display: none"></a>', Path::getRelativePath('JavaScript/Media.Plugin.LinkCreator.js'), $this->getLinkCreatorUri());
        }
        return $result;
    }
Esempio n. 3
0
 /**
  * Render the URI of the thumbnail.
  *
  * @return string
  */
 public function renderUri()
 {
     $relativePath = sprintf('Icons/MimeType/%s.png', $this->getFile()->getProperty('extension'));
     $fileNameAndPath = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName('EXT:media/Resources/Public/' . $relativePath);
     if (!file_exists($fileNameAndPath)) {
         $relativePath = 'Icons/UnknownMimeType.png';
     }
     $uri = Path::getRelativePath($relativePath);
     return $this->prefixUri($uri);
 }
Esempio n. 4
0
 /**
  * Render a fallback thumbnail if no type was found for the given resource.
  *
  * @return string
  */
 public function create()
 {
     return sprintf('<img src="%s" hspace="2" class="" alt="" />', Path::getRelativePath('Icons/UnknownMimeType.png'));
 }
Esempio n. 5
0
 /**
  * @test
  */
 public function methodNotExistsReturnFalseForFileExistingInExtensionMedia()
 {
     $this->assertFalse(\Fab\Media\Utility\Path::notExists('Icons/MissingMimeTypeIcon.png'));
 }
Esempio n. 6
0
 /**
  * Returns a path to an icon given an extension.
  *
  * @param string $extension File extension
  * @return string
  */
 protected function getIcon($extension)
 {
     $resource = Path::getRelativePath(sprintf('Icons/MimeType/%s.png', $extension));
     // If file is not found, fall back to a default icon
     if (Path::notExists($resource)) {
         $resource = Path::getRelativePath('Icons/MissingMimeTypeIcon.png');
     }
     return $resource;
 }