BxDolModuleConfig.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <?php defined('BX_DOL') or die('hack attempt');
  2. /**
  3. * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
  4. * CC-BY License - http://creativecommons.org/licenses/by/3.0/
  5. *
  6. * @defgroup DolphinCore Dolphin Core
  7. * @{
  8. */
  9. /**
  10. * Base class for Config classes in modules engine.
  11. *
  12. * The object of the class contains different basic configuration settings which are necessary for all modules.
  13. *
  14. *
  15. * Example of usage:
  16. * @see any module included in the default Dolphin's package.
  17. *
  18. *
  19. * Memberships/ACL:
  20. * Doesn't depend on user's membership.
  21. *
  22. *
  23. * Alerts:
  24. * no alerts available
  25. *
  26. */
  27. class BxDolModuleConfig extends BxDol {
  28. protected $_iId;
  29. protected $_sName;
  30. protected $_sVendor;
  31. protected $_sClassPrefix;
  32. protected $_sDbPrefix;
  33. protected $_sDirectory;
  34. protected $_sUri;
  35. protected $_sHomePath;
  36. protected $_sClassPath;
  37. protected $_sHomeUrl;
  38. /**
  39. * constructor
  40. */
  41. function __construct($aModule) {
  42. parent::__construct();
  43. $this->_iId = empty($aModule['id']) ? 0 : (int)$aModule['id'];
  44. $this->_sName = isset($aModule['name']) ? $aModule['name'] : '';
  45. $this->_sVendor = $aModule['vendor'];
  46. $this->_sClassPrefix = $aModule['class_prefix'];
  47. $this->_sDbPrefix = $aModule['db_prefix'];
  48. $this->_sDirectory = $aModule['path'];
  49. $this->_sHomePath = BX_DIRECTORY_PATH_MODULES . $this->_sDirectory;
  50. $this->_sClassPath = $this->_sHomePath . 'classes/';
  51. $this->_sUri = $aModule['uri'];
  52. $this->_sHomeUrl = BX_DOL_URL_MODULES . $this->_sDirectory;
  53. }
  54. function getId() {
  55. return $this->_iId;
  56. }
  57. function getName() {
  58. return $this->_sName;
  59. }
  60. function getClassPrefix() {
  61. return $this->_sClassPrefix;
  62. }
  63. function getDbPrefix() {
  64. return $this->_sDbPrefix;
  65. }
  66. function getDirectory() {
  67. return $this->_sDirectory;
  68. }
  69. function getHomePath() {
  70. return $this->_sHomePath;
  71. }
  72. function getClassPath() {
  73. return $this->_sClassPath;
  74. }
  75. /**
  76. * Get unique URI.
  77. *
  78. * @return string with unique URI.
  79. */
  80. function getUri() {
  81. return $this->_sUri;
  82. }
  83. /**
  84. * Get base URI which depends on the Permalinks mechanism.
  85. *
  86. * example /modules/?r=module_uri or /m/module_uri
  87. * @return string with base URI.
  88. */
  89. function getBaseUri() {
  90. bx_import('BxDolPermalinks');
  91. return BxDolPermalinks::getInstance()->permalink('modules/?r=' . $this->_sUri . '/');
  92. }
  93. /**
  94. * Get full URL.
  95. *
  96. * @return string with full URL.
  97. */
  98. function getHomeUrl() {
  99. return $this->_sHomeUrl;
  100. }
  101. }
  102. /** @} */