/** * Render the CSS version of the... CSS! * * @return string */ public function renderCss() { XenForo_Template_Abstract::setLanguageId(0); $bbCodeCache = $this->_params['bbCodeCache']; $templateParams = array('displayStyles' => array(), 'smilieSprites' => $this->_params['smilieSprites'], 'xenOptions' => XenForo_Application::get('options')->getOptions(), 'customBbCodes' => !empty($bbCodeCache['bbCodes']) ? $bbCodeCache['bbCodes'] : array(), 'dir' => $this->_params['dir'], 'pageIsRtl' => $this->_params['dir'] == 'RTL'); $templates = array(); foreach ($this->_params['css'] as $cssTemplate) { if (strpos($cssTemplate, 'public:') === 0) { $templates[$cssTemplate] = new XenForo_Template_Public(substr($cssTemplate, strlen('public:')), $templateParams); } else { $templates[$cssTemplate] = $this->createTemplateObject($cssTemplate, $templateParams); } } if (XenForo_Application::isRegistered('adminStyleModifiedDate')) { $modifyDate = XenForo_Application::get('adminStyleModifiedDate'); } else { $modifyDate = XenForo_Application::$time; } $this->_response->setHeader('Expires', 'Wed, 01 Jan 2020 00:00:00 GMT', true); $this->_response->setHeader('Last-Modified', gmdate('D, d M Y H:i:s', $modifyDate) . ' GMT', true); $this->_response->setHeader('Cache-Control', 'private', true); $css = XenForo_CssOutput::renderCssFromObjects($templates, true); $css = XenForo_CssOutput::prepareCssForOutput($css, $this->_params['dir'], false); return $css; }
/** * Render the CSS version of the... CSS! * * @return string */ public function renderCss() { $params = $this->_params; $styleModel = XenForo_Model::create('XenForo_Model_Style'); $styleModel->setAdminStyles(true); $styles = XenForo_Application::isRegistered('adminStyles') ? XenForo_Application::get('adminStyles') : $styleModel->getAllStyles(); $styleId = $params['styleId']; if (!empty($styleId) && isset($styles[$styleId])) { $style = $styles[$styleId]; } else { $style = reset($styles); } $adminStyleProperties = XenForo_Application::get('adminStyleProperties'); $properties = unserialize($style['properties']); $properties = is_array($properties) ? $properties : array(); if (empty($properties)) { $properties = $adminStyleProperties; } else { $tmpAdminStyleProperties = array(); if (!isset($properties['contentWidth']) && isset($tmpAdminStyleProperties['contentWidth'])) { $properties['contentWidth'] = $tmpAdminStyleProperties['contentWidth']; } if (!isset($properties['formWidth']) && isset($tmpAdminStyleProperties['formWidth'])) { $properties['formWidth'] = $tmpAdminStyleProperties['formWidth']; } if (!isset($properties['nonResponsiveMinWidth']) && isset($tmpAdminStyleProperties['nonResponsiveMinWidth'])) { $properties['nonResponsiveMinWidth'] = $tmpAdminStyleProperties['nonResponsiveMinWidth']; } } $styleId = $style['style_id']; $styleModifiedDate = $style['last_modified_date']; $defaultProperties = XenForo_Application::get('defaultStyleProperties'); XenForo_Template_Helper_Core::setStyleProperties(XenForo_Application::mapMerge($defaultProperties, $properties)); Brivium_AdminStyleSystem_Template_Admin::setStyleId($style['style_id']); XenForo_Template_Abstract::setLanguageId(0); $bbCodeCache = !empty($params['bbCodeCache']) ? $params['bbCodeCache'] : array(); $templateParams = array('displayStyles' => array(), 'smilieSprites' => !empty($params['smilieSprites']) ? $params['smilieSprites'] : array(), 'xenOptions' => XenForo_Application::get('options')->getOptions(), 'customBbCodes' => !empty($bbCodeCache['bbCodes']) ? $bbCodeCache['bbCodes'] : array(), 'dir' => $this->_params['dir'], 'pageIsRtl' => $this->_params['dir'] == 'RTL'); $templates = array(); foreach ($this->_params['css'] as $cssTemplate) { if (strpos($cssTemplate, 'public:') === 0) { $templates[$cssTemplate] = new XenForo_Template_Public(substr($cssTemplate, strlen('public:')), $templateParams); } else { $templates[$cssTemplate] = new Brivium_AdminStyleSystem_Template_Admin($cssTemplate, $templateParams); } } if (XenForo_Application::isRegistered('adminStyleModifiedDate')) { $modifyDate = XenForo_Application::get('adminStyleModifiedDate'); } else { $modifyDate = XenForo_Application::$time; } $this->_response->setHeader('Expires', 'Wed, 01 Jan 2020 00:00:00 GMT', true); $this->_response->setHeader('Last-Modified', gmdate('D, d M Y H:i:s', $modifyDate) . ' GMT', true); $this->_response->setHeader('Cache-Control', 'private', true); $css = XenForo_CssOutput::renderCssFromObjects($templates, true); $css = XenForo_CssOutput::prepareCssForOutput($css, $this->_params['dir'], false); return $css; }