本文整理汇总了PHP中XenForo_Application::setDefaultsFromOptions方法的典型用法代码示例。如果您正苦于以下问题:PHP XenForo_Application::setDefaultsFromOptions方法的具体用法?PHP XenForo_Application::setDefaultsFromOptions怎么用?PHP XenForo_Application::setDefaultsFromOptions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XenForo_Application
的用法示例。
在下文中一共展示了XenForo_Application::setDefaultsFromOptions方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preLoadData
/**
* Pre-loads globally required data for the system.
*/
public function preLoadData()
{
$required = array_merge(array('options', 'languages', 'contentTypes', 'codeEventListeners', 'cron', 'simpleCache'), $this->_dataPreLoadFromRegistry);
$data = XenForo_Model::create('XenForo_Model_DataRegistry')->getMulti($required);
if (XenForo_Application::get('config')->enableListeners) {
if (!is_array($data['codeEventListeners'])) {
$data['codeEventListeners'] = XenForo_Model::create('XenForo_Model_CodeEvent')->rebuildEventListenerCache();
}
XenForo_CodeEvent::setListeners($data['codeEventListeners']);
}
if (!is_array($data['options'])) {
$data['options'] = XenForo_Model::create('XenForo_Model_Option')->rebuildOptionCache();
}
$options = new XenForo_Options($data['options']);
XenForo_Application::setDefaultsFromOptions($options);
XenForo_Application::set('options', $options);
if (!is_array($data['languages'])) {
$data['languages'] = XenForo_Model::create('XenForo_Model_Language')->rebuildLanguageCache();
}
XenForo_Application::set('languages', $data['languages']);
if (!is_array($data['contentTypes'])) {
$data['contentTypes'] = XenForo_Model::create('XenForo_Model_ContentType')->rebuildContentTypeCache();
}
XenForo_Application::set('contentTypes', $data['contentTypes']);
if (!is_int($data['cron'])) {
$data['cron'] = XenForo_Model::create('XenForo_Model_Cron')->updateMinimumNextRunTime();
}
XenForo_Application::set('cron', $data['cron']);
if (!is_array($data['simpleCache'])) {
$data['simpleCache'] = array();
XenForo_Model::create('XenForo_Model_DataRegistry')->set('simpleCache', $data['simpleCache']);
}
XenForo_Application::set('simpleCache', $data['simpleCache']);
$this->_handleCustomPreloadedData($data);
XenForo_CodeEvent::fire('init_dependencies', array($this, $data));
}
示例2: preLoadData
/**
* Pre-loads globally required data for the system.
*/
public function preLoadData()
{
$required = array_merge(array('options', 'languages', 'contentTypes', 'codeEventListeners', 'deferredRun', 'simpleCache', 'addOns', 'defaultStyleProperties', 'routeFiltersIn', 'routeFiltersOut'), $this->_dataPreLoadFromRegistry);
$dr = new XenForo_Model_DataRegistry();
// this is a slight hack to prevent the class from being cached
$data = $dr->getMulti($required);
if (XenForo_Application::get('config')->enableListeners) {
if (!is_array($data['codeEventListeners'])) {
$data['codeEventListeners'] = XenForo_Model::create('XenForo_Model_CodeEvent')->rebuildEventListenerCache();
}
XenForo_CodeEvent::setListeners($data['codeEventListeners']);
}
if (!is_array($data['options'])) {
$data['options'] = XenForo_Model::create('XenForo_Model_Option')->rebuildOptionCache();
}
$options = new XenForo_Options($data['options']);
XenForo_Application::setDefaultsFromOptions($options);
XenForo_Application::set('options', $options);
if (!is_array($data['languages'])) {
$data['languages'] = XenForo_Model::create('XenForo_Model_Language')->rebuildLanguageCache();
}
XenForo_Application::set('languages', $data['languages']);
if (!is_array($data['defaultStyleProperties'])) {
$data['defaultStyleProperties'] = XenForo_Model::create('XenForo_Model_StyleProperty')->rebuildPropertyCacheInStyleAndChildren(0, true);
}
XenForo_Application::set('defaultStyleProperties', $data['defaultStyleProperties']);
if (!is_array($data['contentTypes'])) {
$data['contentTypes'] = XenForo_Model::create('XenForo_Model_ContentType')->rebuildContentTypeCache();
}
XenForo_Application::set('contentTypes', $data['contentTypes']);
if (!is_int($data['deferredRun'])) {
$data['deferredRun'] = XenForo_Model::create('XenForo_Model_Deferred')->updateNextDeferredTime();
}
XenForo_Application::set('deferredRun', $data['deferredRun']);
if (!is_array($data['addOns'])) {
$data['addOns'] = XenForo_Model::create('XenForo_Model_AddOn')->rebuildActiveAddOnCache();
}
XenForo_Application::set('addOns', $data['addOns']);
if (!is_array($data['simpleCache'])) {
$data['simpleCache'] = array();
XenForo_Model::create('XenForo_Model_DataRegistry')->set('simpleCache', $data['simpleCache']);
}
XenForo_Application::set('simpleCache', $data['simpleCache']);
if (!is_array($data['routeFiltersIn']) || !is_array($data['routeFiltersOut'])) {
$filterCache = XenForo_Model::create('XenForo_Model_RouteFilter')->rebuildRouteFilterCache();
$data['routeFiltersIn'] = $filterCache['in'];
$data['routeFiltersOut'] = $filterCache['out'];
}
XenForo_Application::set('routeFiltersIn', $data['routeFiltersIn']);
XenForo_Application::set('routeFiltersOut', $data['routeFiltersOut']);
XenForo_Link::setRouteFiltersOut($data['routeFiltersOut']);
$this->_handleCustomPreloadedData($data);
XenForo_CodeEvent::fire('init_dependencies', array($this, $data));
}
示例3: _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);
}