本文整理汇总了PHP中XenForo_Template_Helper_Core::setStyleProperties方法的典型用法代码示例。如果您正苦于以下问题:PHP XenForo_Template_Helper_Core::setStyleProperties方法的具体用法?PHP XenForo_Template_Helper_Core::setStyleProperties怎么用?PHP XenForo_Template_Helper_Core::setStyleProperties使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XenForo_Template_Helper_Core
的用法示例。
在下文中一共展示了XenForo_Template_Helper_Core::setStyleProperties方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderCss
/**
* 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;
}
示例2: templateCreate
public static function templateCreate(&$templateName, array &$params, XenForo_Template_Abstract $template)
{
if ($template instanceof XenForo_Template_Admin && !empty(self::$_defaultTemplateParams)) {
$params = XenForo_Application::mapMerge(self::$_defaultTemplateParams, $params);
if (!empty(self::$_setStyleProperties)) {
XenForo_Template_Helper_Core::setStyleProperties(self::$_setStyleProperties);
self::$_setStyleProperties = array();
}
}
}
示例3: preRenderView
public function preRenderView(XenForo_ControllerResponse_Abstract $controllerResponse = null)
{
if (!empty($this->_viewStateChanges['brass_admin_style_id'])) {
$styleId = $this->_viewStateChanges['brass_admin_style_id'];
} else {
$user = XenForo_Visitor::getInstance();
$styleId = !empty($user['brass_admin_style_id']) ? $user['brass_admin_style_id'] : 0;
}
$styleModel = XenForo_Model::create('XenForo_Model_Style');
$styleModel->setAdminStyles(true);
$styles = XenForo_Application::isRegistered('adminStyles') ? XenForo_Application::get('adminStyles') : $styleModel->getAllStyles();
$style = array();
if (!empty($styles)) {
$defaultStyleId = XenForo_Application::get('options')->BRASS_defaultAdminStyleId;
if (!isset($styles[$defaultStyleId])) {
$style = reset($styles);
if (!empty($style['style_id'])) {
XenForo_Model::create('XenForo_Model_Option')->updateOptions(array('BRASS_defaultAdminStyleId' => $style['style_id']));
}
$defaultStyleId = $style['style_id'];
}
if (!empty($styleId) && isset($styles[$styleId]) && ($styles[$styleId]['brass_user_selectable'] || XenForo_Visitor::getInstance()->hasAdminPermission('BRASS_adminStyle'))) {
$style = $styles[$styleId];
} else {
$style = $styles[$defaultStyleId];
}
}
$defaultProperties = XenForo_Application::get('defaultStyleProperties');
if (!empty($style)) {
$properties = unserialize($style['properties']);
$properties = is_array($properties) ? $properties : array();
}
if (empty($properties)) {
$properties = XenForo_Application::get('adminStyleProperties');
}
$setStyleProperties = XenForo_Application::mapMerge($defaultProperties, $properties);
XenForo_Template_Helper_Core::setStyleProperties($setStyleProperties);
if (!empty($style)) {
Brivium_AdminStyleSystem_Template_Admin::setStyleId($style['style_id']);
$this->_defaultTemplateParams['visitorStyle'] = $style;
$this->_defaultTemplateParams['_styleId'] = $style['style_id'];
}
$this->_defaultTemplateParams['_styleModifiedDate'] = XenForo_Application::get('adminStyleModifiedDate');
return array($this->_defaultTemplateParams, $setStyleProperties);
}
示例4: preRenderView
/**
* Performs any pre-view rendering setup, such as getting style information and
* ensuring the correct data is registered.
*
* @param XenForo_ControllerResponse_Abstract|null $controllerResponse
*/
public function preRenderView(XenForo_ControllerResponse_Abstract $controllerResponse = null)
{
parent::preRenderView($controllerResponse);
XenForo_Template_Abstract::setLanguageId(XenForo_Phrase::getLanguageId());
$properties = XenForo_Application::get('adminStyleProperties');
XenForo_Template_Helper_Core::setStyleProperties($properties);
$this->_defaultTemplateParams['_styleModifiedDate'] = XenForo_Application::get('adminStyleModifiedDate');
}
示例5: _prepareForOutput
/**
* Does any preparations necessary for outputting to be done.
*/
protected function _prepareForOutput()
{
$this->_displayStyles = XenForo_Application::get('displayStyles');
$styles = XenForo_Application::get('styles');
$smilieSprites = XenForo_Model::create('XenForo_Model_DataRegistry')->get('smilieSprites');
if (is_array($smilieSprites)) {
$this->_smilieSprites = $smilieSprites;
}
if ($this->_styleId && isset($styles[$this->_styleId])) {
$style = $styles[$this->_styleId];
} else {
$style = reset($styles);
}
if ($style) {
$properties = unserialize($style['properties']);
$this->_styleId = $style['style_id'];
$this->_styleModifiedDate = $style['last_modified_date'];
} else {
$properties = array();
$this->_styleId = 0;
}
$defaultProperties = XenForo_Application::get('defaultStyleProperties');
XenForo_Template_Helper_Core::setStyleProperties(XenForo_Application::mapMerge($defaultProperties, $properties), false);
XenForo_Template_Public::setStyleId($this->_styleId);
XenForo_Template_Abstract::setLanguageId(0);
}
示例6: preRenderView
/**
* Performs any pre-view rendering setup, such as getting style information and
* ensuring the correct data is registered.
*
* @param XenForo_ControllerResponse_Abstract|null $controllerResponse
*/
public function preRenderView(XenForo_ControllerResponse_Abstract $controllerResponse = null)
{
parent::preRenderView($controllerResponse);
if (!empty($this->_viewStateChanges['styleId'])) {
$styleId = $this->_viewStateChanges['styleId'];
$forceStyleId = true;
} else {
$user = XenForo_Visitor::getInstance();
$styleId = !empty($user['style_id']) ? $user['style_id'] : 0;
$forceStyleId = $user['is_admin'] ? true : false;
}
XenForo_Template_Abstract::setLanguageId(XenForo_Phrase::getLanguageId());
$styles = XenForo_Application::isRegistered('styles') ? XenForo_Application::get('styles') : XenForo_Model::create('XenForo_Model_Style')->getAllStyles();
if ($styleId && isset($styles[$styleId]) && ($styles[$styleId]['user_selectable'] || $forceStyleId)) {
$style = $styles[$styleId];
} else {
$defaultStyleId = XenForo_Application::get('options')->defaultStyleId;
$style = isset($styles[$defaultStyleId]) ? $styles[$defaultStyleId] : reset($styles);
}
$defaultProperties = XenForo_Application::get('defaultStyleProperties');
if ($style) {
$properties = XenForo_Helper_Php::safeUnserialize($style['properties']);
XenForo_Template_Helper_Core::setStyleProperties(XenForo_Application::mapMerge($defaultProperties, $properties));
XenForo_Template_Public::setStyleId($style['style_id']);
} else {
XenForo_Template_Helper_Core::setStyleProperties($defaultProperties);
}
// setup the default template params
if ($style) {
$this->_defaultTemplateParams['visitorStyle'] = $style;
}
// expose the user fields info array
$this->_defaultTemplateParams['userFieldsInfo'] = XenForo_Application::get('userFieldsInfo');
}
示例7: _prepareForOutput
/**
* Does any preperations necessary for outputting to be done.
*/
protected function _prepareForOutput()
{
$cacheData = XenForo_Model::create('XenForo_Model_DataRegistry')->getMulti(array('styles', 'displayStyles', 'options'));
if (is_array($cacheData['displayStyles'])) {
$this->_displayStyles = $cacheData['displayStyles'];
}
$styles = $cacheData['styles'];
if (!is_array($styles)) {
$styles = XenForo_Model::create('XenForo_Model_Style')->rebuildStyleCache();
}
if (!is_array($cacheData['options'])) {
$cacheData['options'] = XenForo_Model::create('XenForo_Model_Option')->rebuildOptionCache();
}
$options = new XenForo_Options($cacheData['options']);
XenForo_Application::setDefaultsFromOptions($options);
XenForo_Application::set('options', $options);
if ($this->_styleId && isset($styles[$this->_styleId])) {
$style = $styles[$this->_styleId];
} else {
$style = reset($styles);
}
if ($style) {
$properties = unserialize($style['properties']);
$this->_styleId = $style['style_id'];
$this->_styleModifiedDate = $style['last_modified_date'];
} else {
$properties = array();
$this->_styleId = 0;
}
XenForo_Template_Helper_Core::setStyleProperties($properties, false);
XenForo_Template_Public::setStyleId($this->_styleId);
XenForo_Template_Abstract::setLanguageId(0);
}
示例8: _prepareForOutput
/**
* Does any preperations necessary for outputting to be done.
*/
protected function _prepareForOutput()
{
$styles = XenForo_Application::get('styles');
if ($this->_styleId && isset($styles[$this->_styleId])) {
$style = $styles[$this->_styleId];
} else {
$style = reset($styles);
}
if ($style) {
$properties = unserialize($style['properties']);
$this->_styleId = $style['style_id'];
$this->_styleModifiedDate = $style['last_modified_date'];
} else {
$properties = array();
$this->_styleId = 0;
}
$languages = XenForo_Application::get('languages');
if ($this->_languageId && isset($languages[$this->_languageId])) {
$language = $languages[$this->_languageId];
} else {
$language = reset($languages);
}
if ($language) {
$this->_textDirection = $language['text_direction'];
$this->_languageId = $language['language_id'];
} else {
$this->_textDirection = 'LTR';
$this->_languageId = 0;
}
XenForo_Template_Helper_Core::setStyleProperties($properties, false);
XenForo_Template_Public::setStyleId($this->_styleId);
XenForo_Template_Abstract::setLanguageId($this->_languageId);
}