BxDolModuleConfig.php 2.6 KB

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