BxBaseConfig.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <?php defined('BX_DOL') or defined('BX_DOL_INSTALL') or die('hack attempt');
  2. /**
  3. * Copyright (c) UNA, Inc - https://una.io
  4. * MIT License - https://opensource.org/licenses/MIT
  5. *
  6. * @defgroup UnaBaseView UNA Base Representation Classes
  7. * @{
  8. */
  9. class BxBaseConfig extends BxDol implements iBxDolSingleton
  10. {
  11. protected $_aConfig = array (
  12. 'bAllowUnicodeInPreg' => false, ///< allow unicode in regular expressions
  13. 'aLessConfig' => array (
  14. 'bx-page-width' => '1000px',
  15. 'bx-margin' => '20px',
  16. 'bx-margin-sec' => '10px',
  17. 'bx-margin-thd' => '5px',
  18. 'bx-padding' => '20px',
  19. 'bx-padding-sec' => '10px',
  20. 'bx-padding-thd' => '5px',
  21. 'bx-font-family' => 'Helvetica, Arial, sans-serif',
  22. 'bx-size-avatar' => '96px',
  23. 'bx-size-thumb' => '48px',
  24. 'bx-size-icon' => '32px',
  25. 'bx-size-gallery-img-width' => '300px',
  26. 'bx-size-gallery-img-height' => '200px',
  27. 'bx-color-page' => '#fff',
  28. 'bx-color-block' => '#fff',
  29. 'bx-color-box' => 'rgba(242, 242, 242, 1.0)',
  30. 'bx-color-box-hover' => 'rgba(242, 242, 242, 0.8)',
  31. 'bx-color-sec' => '#f2f2f2',
  32. 'bx-color-hl' => 'rgba(196, 248, 156, 0.2)',
  33. 'bx-color-active' => 'rgba(196, 248, 156, 0.4)',
  34. 'bx-border-width' => '1px',
  35. 'bx-border-type' => 'solid',
  36. 'bx-border-color' => '#d0d0d0',
  37. 'bx-font-size-default' => '18px',
  38. 'bx-font-size-small' => '14px',
  39. 'bx-font-size-middle' => '16px',
  40. 'bx-font-size-large' => '22px',
  41. 'bx-font-size-h1' => '38px',
  42. 'bx-font-size-h2' => '24px',
  43. 'bx-font-size-h3' => '18px',
  44. 'bx-font-color-default' => '#333',
  45. 'bx-font-color-grayed' => '#999',
  46. 'bx-font-color-contrasted' => '#fff',
  47. 'bx-round-corners-radius' => '3px',
  48. ),
  49. );
  50. function __construct()
  51. {
  52. parent::__construct();
  53. }
  54. public static function getInstance()
  55. {
  56. if(!isset($GLOBALS['bxDolClasses'][__CLASS__]))
  57. $GLOBALS['bxDolClasses'][__CLASS__] = new BxTemplConfig();
  58. return $GLOBALS['bxDolClasses'][__CLASS__];
  59. }
  60. public function __get($sName)
  61. {
  62. if (array_key_exists($sName, $this->_aConfig))
  63. return $this->_aConfig[$sName];
  64. trigger_error('Undefined property "' . $sName . '" in ' . get_class($this), E_USER_ERROR);
  65. return null;
  66. }
  67. public function __isset($sName)
  68. {
  69. return isset($this->_aConfig[$sName]);
  70. }
  71. protected function setPageWidth($sParamName)
  72. {
  73. if(!class_exists('BxDolDb') || !BxDolDb::getInstance() || empty($sParamName))
  74. return;
  75. $mixedWidth = getParam($sParamName);
  76. if(is_numeric($mixedWidth))
  77. $mixedWidth .= 'px';
  78. $this->_aConfig['aLessConfig']['bx-page-width'] = $mixedWidth;
  79. }
  80. }
  81. /** @} */