本文整理汇总了PHP中XenForo_Template_Abstract::setLanguageId方法的典型用法代码示例。如果您正苦于以下问题:PHP XenForo_Template_Abstract::setLanguageId方法的具体用法?PHP XenForo_Template_Abstract::setLanguageId怎么用?PHP XenForo_Template_Abstract::setLanguageId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XenForo_Template_Abstract
的用法示例。
在下文中一共展示了XenForo_Template_Abstract::setLanguageId方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderCss
/**
* 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;
}
示例2: 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;
}
示例3: renderHtml
public function renderHtml()
{
$dep = $this->_renderer->getDependencyHandler();
$oldClass = $dep->templateClass;
$dep->templateClass = 'XenForo_Template_Admin';
XenForo_Template_Abstract::setLanguageId(1);
// this is the language that was created
$this->_params['renderedOptions'] = XenForo_ViewAdmin_Helper_Option::renderPreparedOptionsHtml($this, $this->_params['options'], $this->_params['canEditOptionDefinition']);
$dep->templateClass = $oldClass;
}
示例4: renderCss
/**
* Render the CSS version of the... CSS!
*
* @return string
*/
public function renderCss()
{
XenForo_Template_Abstract::setLanguageId(0);
$templates = array();
foreach ($this->_params['css'] as $cssTemplate) {
if (strpos($cssTemplate, 'public:') === 0) {
$templates[$cssTemplate] = new XenForo_Template_Public(substr($cssTemplate, strlen('public:')));
} else {
$templates[$cssTemplate] = $this->createTemplateObject($cssTemplate);
}
}
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);
return XenForo_CssOutput::renderCssFromObjects($templates, true);
}
示例5: 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');
}
示例6: _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);
}
示例7: 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');
}
示例8: _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);
}
示例9: _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);
}