BxBaseModFilesUploaderHTML5.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php defined('BX_DOL') or die('hack attempt');
  2. /**
  3. * Copyright (c) UNA, Inc - https://una.io
  4. * MIT License - https://opensource.org/licenses/MIT
  5. *
  6. * @defgroup BaseFile Base classes for modules
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. class BxBaseModFilesUploaderHTML5 extends BxTemplUploaderHTML5
  12. {
  13. protected $MODULE;
  14. protected $_oModule;
  15. public function __construct ($aObject, $sStorageObject, $sUniqId, $oTemplate)
  16. {
  17. parent::__construct($aObject, $sStorageObject, $sUniqId, $oTemplate);
  18. $this->_oModule = BxDolModule::getInstance($this->MODULE);
  19. }
  20. protected function getGhostTemplateVars($aFile, $iProfileId, $iContentId, $oStorage, $oImagesTranscoder)
  21. {
  22. $sTitle = $this->_oModule->_oDb->getFileTitle($aFile['id']);
  23. $a = array(
  24. 'file_title' => $sTitle ? $sTitle : $aFile['file_name']
  25. );
  26. $a['file_title_attr'] = bx_html_attribute($a['file_title']);
  27. return $a;
  28. }
  29. protected function isUseTranscoderForPreview($oImagesTranscoder, $aFile)
  30. {
  31. if (!$oImagesTranscoder)
  32. return false;
  33. if (in_array($aFile['ext'], array('jpg', 'jpeg', 'png', 'gif', /* when ImageMagick is used - 'tif', 'tiff', 'bmp', 'ico', 'psd' */)) && (is_a($oImagesTranscoder, 'BxDolTranscoderImage') || is_a($oImagesTranscoder, 'BxDolTranscoderProxy')))
  34. return true;
  35. return false;
  36. }
  37. protected function isAdmin ($iContentId = 0)
  38. {
  39. return $this->_oModule->_isModerator (false);
  40. }
  41. }
  42. /** @} */