Пример #1
0
 public function renderWidgetsFor($templateName, array $params, XenForo_Template_Abstract $template, array &$containerData)
 {
     if (WidgetFramework_WidgetRenderer::isIgnoredTemplate($templateName, $params)) {
         return false;
     }
     $originalHtml = isset($containerData['sidebar']) ? $containerData['sidebar'] : '';
     $html = $this->_renderWidgetsFor($templateName, array_merge($params, array(WidgetFramework_WidgetRenderer::PARAM_POSITION_CODE => $templateName)), $template, $originalHtml);
     if (defined(WidgetFramework_WidgetRenderer_Empty::NO_VISITOR_PANEL_FLAG)) {
         // the flag is used to avoid string searching as much as possible
         // the string search is also required to confirm the noVisitorPanel request
         $count = 0;
         $html = str_replace(WidgetFramework_WidgetRenderer_Empty::NO_VISITOR_PANEL_MARKUP, '', $html, $count);
         if ($count > 0) {
             $containerData['noVisitorPanel'] = true;
         }
     }
     if ($html != $originalHtml) {
         $containerData['sidebar'] = utf8_trim($html);
         if (!empty($containerData['sidebar']) and self::debugMode()) {
             $containerData['sidebar'] .= sprintf('<div>Widget Framework is in debug mode<br/>Renderers: %d<br/>Widgets: %d<br/></div>', count($this->_renderers), $this->_widgetCount);
         }
     }
     return true;
 }