BxDolInstallView.php 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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 DolphinInstall Dolphin Install
  7. * @{
  8. */
  9. class BxDolInstallView
  10. {
  11. protected $_sDirPlugins = BX_INSTALL_DIR_PLUGINS;
  12. protected $_sDirTemplates = BX_INSTALL_DIR_TEMPLATES;
  13. protected $_sUrlCss = '../template/css/';
  14. protected $_sPathCss = '../template/css/';
  15. protected $_sUrlJs = '../';
  16. protected $_aFilesCss = array (
  17. 'common.css',
  18. 'default.less',
  19. 'general.css',
  20. 'icons.css',
  21. 'colors.css',
  22. 'forms.css',
  23. 'media-desktop.css',
  24. 'media-tablet.css',
  25. 'media-phone.css',
  26. 'media-print.css',
  27. );
  28. protected $_aFilesJs = array (
  29. 'plugins/jquery/jquery.js',
  30. 'plugins/jquery/jquery.ui.position.min.js',
  31. 'inc/js/jquery.dolPopup.js',
  32. 'inc/js/jquery.webForms.js',
  33. );
  34. function __construct()
  35. {
  36. }
  37. function out ($sTemplate, $aVars = array())
  38. {
  39. extract($aVars);
  40. include($this->_sDirTemplates . $sTemplate);
  41. }
  42. function pageStart ()
  43. {
  44. ob_start();
  45. }
  46. function pageEnd ($sTitle)
  47. {
  48. $sInlineCSS = $this->_getInlineCSS();
  49. $sFilesCSS = $this->_getFilesCSS();
  50. $sFilesJS = $this->_getFilesJS();
  51. $sCode = ob_get_clean();
  52. include($this->_sDirTemplates . '_page.php');
  53. }
  54. protected function _getFilesCSS()
  55. {
  56. $s = '';
  57. foreach ($this->_aFilesCss as $sFile)
  58. if (substr($sFile, -4) === '.css')
  59. $s .= '<link rel="stylesheet" href="' . $this->_sUrlCss . $sFile . '" />';
  60. return $s;
  61. }
  62. protected function _getFilesJS()
  63. {
  64. $s = '';
  65. foreach ($this->_aFilesJs as $sFile)
  66. $s .= '<script src="' . $this->_sUrlJs . $sFile . '"></script>';
  67. return $s;
  68. }
  69. protected function _getInlineCSS()
  70. {
  71. $s = '';
  72. require_once($this->_sDirPlugins . 'lessphp/lessc.inc.php');
  73. $oLess = new lessc();
  74. $oConfigBase = new BxBaseConfig();
  75. $oLess->setVariables($oConfigBase->aLessConfig);
  76. foreach ($this->_aFilesCss as $sFile) {
  77. if (substr($sFile, -5) !== '.less')
  78. continue;
  79. $s .= $oLess->compileFile($this->_sPathCss . $sFile) . "\n";
  80. }
  81. return $s;
  82. }
  83. }
  84. /** @} */