api.ubconfig.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <?php
  2. /*
  3. * Class to speed up loading of base configs
  4. */
  5. class UbillingConfig {
  6. //stores system configs
  7. protected $alterCfg = array();
  8. protected $billingCfg = array();
  9. protected $photoCfg = array();
  10. protected $ymapsCfg = array();
  11. public function __construct() {
  12. $this->loadAlter();
  13. $this->loadBilling();
  14. }
  15. /**
  16. * loads system wide alter.ini to private alterCfg prop
  17. *
  18. * @return void
  19. */
  20. protected function loadAlter() {
  21. $this->alterCfg = rcms_parse_ini_file(CONFIG_PATH . 'alter.ini');
  22. }
  23. /**
  24. * getter of private alterCfg prop
  25. *
  26. * @return array
  27. */
  28. public function getAlter() {
  29. return ($this->alterCfg);
  30. }
  31. /**
  32. * getter some parameter from alterCfg
  33. *
  34. * @return parametr from alter.ini or FALSE if parameter not defined
  35. */
  36. public function getAlterParam($param = false) {
  37. return ($param and isset($this->alterCfg[$param])) ? $this->alterCfg[$param] : false;
  38. }
  39. /**
  40. * loads system wide billing.ini to private alterCfg prop
  41. *
  42. * @return void
  43. */
  44. protected function loadBilling() {
  45. $this->billingCfg = rcms_parse_ini_file(CONFIG_PATH . 'billing.ini');
  46. }
  47. /**
  48. * getter of private billingCfg prop
  49. *
  50. * @return array
  51. */
  52. public function getBilling() {
  53. return ($this->billingCfg);
  54. }
  55. /**
  56. * loads system ymaps.ini to private ymapsCfg prop
  57. *
  58. * @return void
  59. */
  60. protected function loadYmaps() {
  61. $this->ymapsCfg = rcms_parse_ini_file(CONFIG_PATH . "ymaps.ini");
  62. }
  63. /**
  64. * getter of private ymapsCfg prop
  65. *
  66. * @return array
  67. */
  68. public function getYmaps() {
  69. if (empty($this->ymapsCfg)) {
  70. $this->loadYmaps();
  71. }
  72. return ($this->ymapsCfg);
  73. }
  74. /**
  75. * loads system photostorage.ini to private photoCfg prop
  76. *
  77. * @return void
  78. */
  79. protected function loadPhoto() {
  80. $this->photoCfg = rcms_parse_ini_file(CONFIG_PATH . "photostorage.ini");
  81. }
  82. /**
  83. * getter of private photoCfg prop
  84. *
  85. * @return array
  86. */
  87. public function getPhoto() {
  88. if (empty($this->photoCfg)) {
  89. $this->loadPhoto();
  90. }
  91. return ($this->photoCfg);
  92. }
  93. }
  94. $ubillingConfig = new UbillingConfig();
  95. ?>