コード例 #1
0
ファイル: Dependencies.php プロジェクト: billyprice1/bdApi
 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
0
ファイル: Admin.php プロジェクト: darkearl/projectT122015
 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
0
 /**
  * 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
0
ファイル: Listener.php プロジェクト: darkearl/projectT122015
 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
0
ファイル: SourceHandler.php プロジェクト: Sywooch/forums
 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
0
 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
0
ファイル: Extended.php プロジェクト: Sywooch/forums
 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
0
ファイル: Layout.php プロジェクト: Sywooch/forums
 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
0
ファイル: Indexer.php プロジェクト: Sywooch/forums
 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
0
ファイル: Admin.php プロジェクト: Sywooch/forums
 /**
  * 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
0
ファイル: Admin.php プロジェクト: hahuunguyen/DTUI_201105
 /**
  * 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
0
ファイル: CssOutput.php プロジェクト: Sywooch/forums
 /**
  * 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
0
ファイル: Abstract.php プロジェクト: Sywooch/forums
 /**
  * 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
0
ファイル: Public.php プロジェクト: darkearl/projectT122015
 /**
  * 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
0
ファイル: Public.php プロジェクト: hahuunguyen/DTUI_201105
 /**
  * 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;
 }
コード例 #16
0
 /**
  * Renders the view.
  *
  * @param XenForo_ControllerResponse_Abstract Controller response object from last controller
  * @param XenForo_ViewRenderer_Abstract       View renderer for specified response type
  * @param array                            Extra container params (probably "sections" from routing)
  *
  * @return string View output
  */
 public function renderView(XenForo_ControllerResponse_Abstract $controllerResponse, XenForo_ViewRenderer_Abstract $viewRenderer, array $containerParams = array())
 {
     $this->_dependencies->preRenderView($controllerResponse);
     $this->_response->setHeader('Last-Modified', gmdate('D, d M Y H:i:s') . ' GMT', true);
     if ($controllerResponse->responseCode) {
         $this->_response->setHttpResponseCode($controllerResponse->responseCode);
         if (!empty($controllerResponse->containerParams['allowHeader'])) {
             $this->_response->setHeader('Allow', $controllerResponse->containerParams['allowHeader']);
         }
     }
     if ($controllerResponse instanceof XenForo_ControllerResponse_Error) {
         $innerContent = $viewRenderer->renderError($controllerResponse->errorText);
     } else {
         if ($controllerResponse instanceof XenForo_ControllerResponse_Message) {
             $innerContent = $viewRenderer->renderMessage($controllerResponse->message);
         } else {
             if ($controllerResponse instanceof XenForo_ControllerResponse_View) {
                 $viewRenderer->addJsonParams($controllerResponse->jsonParams);
                 $innerContent = $viewRenderer->renderView($controllerResponse->viewName, $controllerResponse->params, $controllerResponse->templateName, $controllerResponse->subView);
             } else {
                 if ($controllerResponse instanceof XenForo_ControllerResponse_Redirect) {
                     $target = XenForo_Link::convertUriToAbsoluteUri($controllerResponse->redirectTarget, true);
                     $innerContent = $viewRenderer->renderRedirect($controllerResponse->redirectType, $target, $controllerResponse->redirectMessage, $controllerResponse->redirectParams);
                 } else {
                     // generally shouldn't happen
                     $innerContent = false;
                 }
             }
         }
     }
     if ($innerContent === false || $innerContent === null) {
         $innerContent = $viewRenderer->renderUnrepresentable();
     }
     if ($viewRenderer->getNeedsContainer()) {
         $specificContainerParams = XenForo_Application::mapMerge($containerParams, $controllerResponse->containerParams);
         $containerParams = $this->_dependencies->getEffectiveContainerParams($specificContainerParams, $this->_request);
         return $viewRenderer->renderContainer($innerContent, $containerParams);
     } else {
         return $innerContent;
     }
 }
コード例 #17
0
ファイル: Install.php プロジェクト: namgiangle90/tokyobaito
 /**
  * Merges in extra container data from the template render.
  *
  * @param array
  */
 protected function _mergeExtraContainerData(array $extraData)
 {
     self::$_extraData = XenForo_Application::mapMerge(self::$_extraData, $extraData);
 }
コード例 #18
0
 public static function setContainerData($widget, array $containerData)
 {
     if (is_array($widget)) {
         if (empty(self::$_containerData[$widget['widget_id']])) {
             self::$_containerData[$widget['widget_id']] = $containerData;
         } else {
             self::$_containerData[$widget['widget_id']] = XenForo_Application::mapMerge(self::$_containerData[$widget['widget_id']], $containerData);
         }
     }
 }
コード例 #19
0
ファイル: Install.php プロジェクト: Sywooch/forums
 /**
  * Helper method to create a template object for rendering.
  *
  * @param string Name of the template to be used
  * @param array  Key-value parameters to pass to the template
  *
  * @return XenForo_Template_Admin
  */
 public function createTemplateObject($templateName, array $params = array())
 {
     if ($params) {
         $params = XenForo_Application::mapMerge($this->_defaultTemplateParams, $params);
     } else {
         $params = $this->_defaultTemplateParams;
     }
     $class = $this->templateClass;
     return new $class($templateName, $params);
 }