Exemple #1
0
 public static function template_create(&$templateName, array &$params, XenForo_Template_Abstract $template)
 {
     if (defined('WIDGET_FRAMEWORK_LOADED')) {
         WidgetFramework_Core::getInstance()->prepareWidgetsFor($templateName, $params, $template);
         WidgetFramework_Core::getInstance()->prepareWidgetsForHooksIn($templateName, $params, $template);
         if ($templateName === 'PAGE_CONTAINER') {
             $template->preloadTemplate('wf_hook_moderator_bar');
             $template->preloadTemplate('wf_revealer');
             if (WidgetFramework_Option::get('indexNodeId')) {
                 // preload our links template for performance
                 $template->preloadTemplate('wf_home_navtab_links');
             }
             WidgetFramework_Template_Extended::WidgetFramework_setPageContainer($template);
             if (isset($params['contentTemplate']) and $params['contentTemplate'] === 'wf_widget_page_index' and empty($params['selectedTabId'])) {
                 // make sure a navtab is selected if user is viewing our (as index) widget page
                 if (!XenForo_Template_Helper_Core::styleProperty('wf_homeNavTab')) {
                     // oh, our "Home" navtab has been disable...
                     // try something from $params['tabs'] OR $params['extraTabs']
                     if (isset($params['tabs']) and isset($params['extraTabs'])) {
                         WidgetFramework_Helper_Index::setNavtabSelected($params['tabs'], $params['extraTabs']);
                     }
                 }
             }
         }
     }
 }
Exemple #2
0
 public function actionIndex()
 {
     $response = WidgetFramework_Helper_Index::getControllerResponse($this);
     if (!empty($response)) {
         return $response;
     }
     return parent::actionIndex();
 }
 public function rebuildPermissionCache($maxExecution = 0, $startCombinationId = 0)
 {
     // we hook ourselves here because XenForo_DataWriter_Node::_postSave trigger this
     // when parent_node_id is changed
     if ($startCombinationId === 0) {
         WidgetFramework_Helper_Index::rebuildChildNodesCache();
     }
     return parent::rebuildPermissionCache($maxExecution, $startCombinationId);
 }
 public function buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, array &$extraParams)
 {
     $action = XenForo_Link::getPageNumberAsAction($action, $extraParams);
     if (!empty($data['node_id']) and $data['node_id'] == WidgetFramework_Option::get('indexNodeId')) {
         if (XenForo_Application::$versionId > 1020000 and !empty($action) and preg_match('#^page-(\\d+)$#i', $action)) {
             // support http://domain.com/xenforo/page-2/ uris
             // XenForo 1.2.0 and up only
             return WidgetFramework_Helper_Index::buildBasicLink($action, '', $extension);
         } elseif (empty($action)) {
             return new XenForo_Link(XenForo_Link::buildPublicLink('widget-page-index', null, $extraParams));
         }
     }
     return XenForo_Link::buildBasicLinkWithStringParam($outputPrefix, $action, $extension, $data, 'node_name');
 }
Exemple #5
0
 public function actionIndex()
 {
     $nodeId = $this->_input->filterSingle('node_id', XenForo_Input::UINT);
     $nodeName = $this->_input->filterSingle('node_name', XenForo_Input::STRING);
     $widgetPage = $this->_getWidgetPageOrError($nodeId ? $nodeId : $nodeName);
     $page = max(1, $this->_input->filterSingle('page', XenForo_Input::UINT));
     $this->canonicalizeRequestUrl(XenForo_Link::buildPublicLink('widget-pages', $widgetPage, array('page' => $page)));
     $widgets = $this->_getWidgetModel()->getWidgetPageWidgets($widgetPage['node_id']);
     $nodeBreadCrumbs = $this->_getNodeModel()->getNodeBreadCrumbs($widgetPage, false);
     $viewParams = array('widgetPage' => $widgetPage, 'widgets' => $widgets, 'nodeBreadCrumbs' => $nodeBreadCrumbs, 'page' => $page);
     if (class_exists('bdCache_ControllerHelper_Cache')) {
         $this->getHelper('bdCache_ControllerHelper_Cache')->markViewParamsAsCacheable($viewParams);
     }
     $indexNodeId = WidgetFramework_Option::get('indexNodeId');
     // TODO: should we change section for other node type too?
     $indexChildNodes = WidgetFramework_Helper_Index::getChildNodes();
     if ($widgetPage['node_id'] == $indexNodeId or isset($indexChildNodes[$widgetPage['node_id']])) {
         $this->_routeMatch->setSections(WidgetFramework_Option::get('indexTabId'));
     }
     return $this->responseView('WidgetFramework_ViewPublic_WidgetPage_Index', 'wf_widget_page_index', $viewParams);
 }
 public function buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, array &$extraParams)
 {
     return WidgetFramework_Helper_Index::buildBasicLink($outputPrefix, $action, $extension);
 }
    protected static function _setupForXenForo1_1_x()
    {
        self::$_setup11x = true;
        if (XenForo_Application::$versionId < 1020000) {
            // dirty trick to get the public routes
            $className = 'a' . md5(uniqid());
            eval(sprintf('class %s extends XenForo_Link{
				public static function getHandlerInfoForGroup($group){
				if (empty(XenForo_Link::$_handlerCache[$group]))return false;
				return XenForo_Link::$_handlerCache[$group];}}', $className));
            $routesPublic = call_user_func(array($className, 'getHandlerInfoForGroup'), 'public');
        } else {
            $routesPublic = XenForo_Link::getHandlerInfoForGroup('public');
        }
        if (!empty($routesPublic)) {
            foreach ($routesPublic as $routePrefix => &$handlerInfo) {
                if ($routePrefix === 'index') {
                    $handlerInfo['build_link'] = 'all';
                }
            }
            XenForo_Link::setHandlerInfoForGroup('public', $routesPublic);
        }
    }