BxDolInstallView.php 2.3 KB

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