本文整理汇总了PHP中XenForo_Application::mapMerge方法的典型用法代码示例。如果您正苦于以下问题:PHP XenForo_Application::mapMerge方法的具体用法?PHP XenForo_Application::mapMerge怎么用?PHP XenForo_Application::mapMerge使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XenForo_Application
的用法示例。
在下文中一共展示了XenForo_Application::mapMerge方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createTemplateObject
public function createTemplateObject($templateName, array $params = array())
{
if ($params) {
$params = XenForo_Application::mapMerge($this->_defaultTemplateParams, $params);
} else {
$params = $this->_defaultTemplateParams;
}
return new bdApi_Template_Simulation_Template($templateName, $params);
}
示例2: createTemplateObject
public function createTemplateObject($templateName, array $params = array())
{
if ($params) {
$params = XenForo_Application::mapMerge($this->_defaultTemplateParams, $params);
} else {
$params = $this->_defaultTemplateParams;
}
return new Brivium_AdminStyleSystem_Template_Admin($templateName, $params);
}
示例3: 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;
}
示例4: 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();
}
}
}
示例5: insertIntoIndex
public function insertIntoIndex($contentType, $contentId, $title, $message, $itemDate, $userId, $discussionId = 0, array $metadata = array())
{
// looks for our customized meta data and put it in place
if (!empty(self::$_extraMetaData)) {
$metadata = XenForo_Application::mapMerge($metadata, self::$_extraMetaData);
self::$_extraMetaData = false;
// reset immediately
}
return parent::insertIntoIndex($contentType, $contentId, $title, $message, $itemDate, $userId, $discussionId, $metadata);
}
示例6: setWidgetOption
public function setWidgetOption($optionKey, $optionValue = null)
{
$options = $this->getWidgetOptions();
if (is_array($optionKey)) {
$options = XenForo_Application::mapMerge($options, $optionKey);
} elseif ($optionValue !== null) {
$options[$optionKey] = $optionValue;
} elseif (isset($options[$optionKey])) {
unset($options[$optionKey]);
}
$this->set('options', $options);
}
示例7: WidgetFramework_mergeExtraContainerData
public static function WidgetFramework_mergeExtraContainerData(array $extraData)
{
if (empty($extraData)) {
return;
}
if (self::$_WidgetFramework_pageContainerTemplate === null or self::$_WidgetFramework_pageContainerTemplate->getParam('contents') === null) {
XenForo_Template_Public::$_extraData = XenForo_Application::mapMerge(XenForo_Template_Public::$_extraData, $extraData);
} else {
// these extra data came too late
// page container has already started rendering...
self::$_WidgetFramework_lateExtraData = XenForo_Application::mapMerge(self::$_WidgetFramework_lateExtraData, $extraData);
}
}
示例8: buildLayoutTree
public static function buildLayoutTree(XenForo_ViewPublic_Base $view, array &$widgets, array $options = array())
{
$widgetPage =& $options['widgetPage'];
$rows = 0;
$cols = 0;
$cssClasses = array('cols' => array(), 'rows' => array(), 'xOfY' => array());
$widgetIds = array();
foreach ($widgets as $widget) {
if (empty($widget['active'])) {
continue;
}
if (!empty($widget['position'])) {
continue;
}
if (!isset($widget['options']['layout_row'])) {
continue;
}
if (!isset($widget['options']['layout_col'])) {
continue;
}
if (empty($widget['options']['layout_sizeRow'])) {
continue;
}
if (empty($widget['options']['layout_sizeCol'])) {
continue;
}
$rows = max($rows, $widget['options']['layout_row'] + $widget['options']['layout_sizeRow']);
$cols = max($cols, $widget['options']['layout_col'] + $widget['options']['layout_sizeCol']);
$widgetIds[] = $widget['widget_id'];
}
for ($col = 1; $col <= $cols; $col++) {
$cssClasses['cols'][$col] = array('name' => sprintf('WF_Cols_%d_%d', $widgetPage['node_id'], $col));
if (!empty($widgetPage['options']['column_width']) and !empty($widgetPage['options']['column_gap'])) {
$cssClasses['cols'][$col]['width'] = $col * $widgetPage['options']['column_width'] + ($col - 1) * $widgetPage['options']['column_gap'];
}
}
for ($row = 1; $row <= $rows; $row++) {
$cssClasses['rows'][$row] = array('name' => sprintf('WF_Rows_%d_%d', $widgetPage['node_id'], $row));
}
$options = XenForo_Application::mapMerge(array('params' => $view->getParams(), 'templateObj' => $view->createOwnTemplateObject(), 'positionCode' => md5(implode('_', $widgetIds)), 'rows' => $rows, 'cols' => $cols, 'cssClasses' => $cssClasses, 'layoutCount' => 0), $options);
$layout = new _Layout_Vertical($view, $widgets, $options, $widgetIds);
$layout->prepare();
$layout->render();
return $layout;
}
示例9: insertIntoIndex
public function insertIntoIndex($contentType, $contentId, $title, $message, $itemDate, $userId, $discussionId = 0, array $metadata = array())
{
$metadata = XenForo_Application::mapMerge($metadata, $this->_extraMetadata);
return parent::insertIntoIndex($contentType, $contentId, $title, $message, $itemDate, $userId, $discussionId, $metadata);
}
示例10: 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');
$defaultProperties = XenForo_Application::get('defaultStyleProperties');
XenForo_Template_Helper_Core::setStyleProperties(XenForo_Application::mapMerge($defaultProperties, $properties));
$this->_defaultTemplateParams['_styleModifiedDate'] = XenForo_Application::get('adminStyleModifiedDate');
}
示例11: getEffectiveContainerParams
/**
* Gets the effective set of container params. This includes combining
* and specific container params with any global ones. For example, a specific
* container param may refer to the section the page is in, so this function
* could load the other options that are specific to this section.
*
* @param array $params Container params from the controller/view
* @param Zend_Controller_Request_Http $request
*
* @return array
*/
public function getEffectiveContainerParams(array $params, Zend_Controller_Request_Http $request)
{
$visitor = XenForo_Visitor::getInstance();
if (!$visitor['is_admin'] && !isset($params['containerTemplate'])) {
$params['containerTemplate'] = 'LOGIN_PAGE';
}
$options = XenForo_Application::get('options');
$params['homeLink'] = $options->homePageUrl ? $options->homePageUrl : XenForo_Link::buildPublicLink('index');
$params['jQuerySource'] = self::getJquerySource();
$params = XenForo_Application::mapMerge($params, parent::getEffectiveContainerParams($params, $request), $this->_getCronContainerParams(), $this->_getNavigationContainerParams(empty($params['majorSection']) ? '' : $params['majorSection']));
XenForo_CodeEvent::fire('container_admin_params', array(&$params, $this));
return $params;
}
示例12: _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);
}
示例13: setParams
/**
* Add an array of params to the template. Overwrites parameters with the same name.
*
* @param array
*/
public function setParams(array $params)
{
$this->_params = $this->_params ? XenForo_Application::mapMerge($this->_params, $params) : $params;
}
示例14: getEffectiveContainerParams
/**
* Gets the effective set of container params. This includes combining
* and specific container params with any global ones. For example, a specific
* container param may refer to the section the page is in, so this function
* could load the other options that are specific to this section.
*
* @param array $params Container params from the controller/view
* @param Zend_Controller_Request_Http $request
*
* @return array
*/
public function getEffectiveContainerParams(array $params, Zend_Controller_Request_Http $request)
{
$options = XenForo_Application::get('options');
$visitor = XenForo_Visitor::getInstance();
$params['canSearch'] = $visitor->canSearch();
$params['canUploadAvatar'] = $visitor->canUploadAvatar();
$params['canEditSignature'] = $visitor->canEditSignature();
$params['canEditProfile'] = $visitor->canEditProfile();
$params['canUpdateStatus'] = $visitor->canUpdateStatus();
$params['canStartConversation'] = $visitor->canStartConversations();
$params['canViewProfilePosts'] = $visitor->canViewProfilePosts();
$params['isAwaitingEmailConfirmation'] = $visitor['user_id'] && in_array($visitor['user_state'], array('email_confirm', 'email_confirm_edit'));
$params['isEmailBouncing'] = $visitor['user_id'] && $visitor['user_state'] == 'email_bounce';
$params['tosUrl'] = self::getTosUrl();
$params['jQuerySource'] = self::getJquerySource();
$params['jQuerySourceLocal'] = self::getJquerySource(true);
$params['javaScriptSource'] = XenForo_Application::$javaScriptUrl;
$params['showBoardClosedNotice'] = !$options->boardActive && XenForo_Visitor::getInstance()->get('is_admin');
$params['showCookieNotice'] = $options->showFirstCookieNotice && XenForo_Helper_Cookie::getCookie('session') === false && XenForo_Helper_Cookie::getCookie('user') === false;
$requestPaths = XenForo_Application::get('requestPaths');
$params['isIndexPage'] = $requestPaths['fullUri'] == XenForo_Link::buildPublicLink('full:index');
$params = XenForo_Application::mapMerge($params, parent::getEffectiveContainerParams($params, $request), $this->_getCronContainerParams(), $this->_getStyleLanguageChangerParams($request), $this->_getNavigationContainerParams(empty($params['majorSection']) ? '' : $params['majorSection']));
if ($options->enableNotices) {
$this->_preloadNoticeTemplates($params, $request);
}
XenForo_CodeEvent::fire('container_public_params', array(&$params, $this));
return $params;
}
示例15: getEffectiveContainerParams
/**
* Gets the effective set of container params. This includes combining
* and specific container params with any global ones. For example, a specific
* container param may refer to the section the page is in, so this function
* could load the other options that are specific to this section.
*
* @param array $params Container params from the controller/view
* @param Zend_Controller_Request_Http $request
*
* @return array
*/
public function getEffectiveContainerParams(array $params, Zend_Controller_Request_Http $request)
{
$options = XenForo_Application::get('options');
$visitor = XenForo_Visitor::getInstance();
$params['canSearch'] = $visitor->canSearch();
$params['canUploadAvatar'] = $visitor->canUploadAvatar();
$params['canEditSignature'] = $visitor->canEditSignature();
$params['canUpdateStatus'] = $visitor->canUpdateStatus();
$params['isAwaitingEmailConfirmation'] = $visitor['user_id'] && in_array($visitor['user_state'], array('email_confirm', 'email_confirm_edit'));
$params['tosUrl'] = self::getTosUrl();
$params['jQuerySource'] = self::getJquerySource();
$params['jQuerySourceLocal'] = self::getJquerySource(true);
$params['javaScriptSource'] = $options->javaScriptSource;
$params['showBoardClosedNoticed'] = !$options->boardActive && XenForo_Visitor::getInstance()->get('is_admin');
$params = XenForo_Application::mapMerge($params, parent::getEffectiveContainerParams($params, $request), $this->_getCronContainerParams(), $this->_getStyleLanguageChangerParams($request), $this->_getNavigationContainerParams(empty($params['majorSection']) ? '' : $params['majorSection']));
XenForo_CodeEvent::fire('container_public_params', array(&$params, $this));
return $params;
}