1
0

BxBaseModGeneralConfig.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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 BaseGeneral Base classes for modules
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. class BxBaseModGeneralConfig extends BxDolModuleConfig
  12. {
  13. public $CNF;
  14. protected $_aObjects;
  15. protected $_aPrefixes;
  16. protected $_aJsClasses;
  17. protected $_aJsObjects;
  18. protected $_aGridObjects;
  19. /**
  20. * Delayed Publishing Notification Time (in seconds)
  21. * If video transcoding takes more than specified amount of time
  22. * then author will be notified about publishing (failure).
  23. */
  24. protected $_iDpnTime;
  25. function __construct($aModule)
  26. {
  27. parent::__construct($aModule);
  28. $this->CNF = array();
  29. $this->_aObjects = array();
  30. $this->_aPrefixes = array();
  31. $this->_aJsClasses = array();
  32. $this->_aJsObjects = array();
  33. $this->_aGridObjects = array();
  34. $this->_iDpnTime = 3600;
  35. }
  36. public function getObject($sType = '')
  37. {
  38. if(empty($sType))
  39. return $this->_aObjects;
  40. return isset($this->_aObjects[$sType]) ? $this->_aObjects[$sType] : '';
  41. }
  42. public function getPrefix($sType = '')
  43. {
  44. if(empty($sType))
  45. return $this->_aPrefixes;
  46. return isset($this->_aPrefixes[$sType]) ? $this->_aPrefixes[$sType] : '';
  47. }
  48. public function getJsClass($sType)
  49. {
  50. return isset($this->_aJsClasses[$sType]) ? $this->_aJsClasses[$sType] : '';
  51. }
  52. public function getJsObject($sType)
  53. {
  54. return isset($this->_aJsObjects[$sType]) ? $this->_aJsObjects[$sType] : '';
  55. }
  56. public function getGridObject($sType)
  57. {
  58. return isset($this->_aGridObjects[$sType]) ? $this->_aGridObjects[$sType] : '';
  59. }
  60. /*
  61. * Note. The first Transcoder in the array $aTranscoders has the highest priority.
  62. */
  63. public function getImageUrl($iId, $aTranscoders)
  64. {
  65. $sResult = '';
  66. if(empty($iId) || empty($aTranscoders) || !is_array($aTranscoders))
  67. return $sResult;
  68. foreach($aTranscoders as $sTranscoder) {
  69. if(empty($this->CNF[$sTranscoder]))
  70. continue;
  71. $oTranscoder = BxDolTranscoderImage::getObjectInstance($this->CNF[$sTranscoder]);
  72. if(!$oTranscoder)
  73. continue;
  74. $sResult = $oTranscoder->getFileUrl($iId);
  75. if(!empty($sResult))
  76. break;
  77. }
  78. return $sResult;
  79. }
  80. public function getDpnTime()
  81. {
  82. return $this->_iDpnTime;
  83. }
  84. }
  85. /** @} */