本文整理匯總了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);
}