本文整理汇总了PHP中XenForo_Template_Abstract::getTemplateName方法的典型用法代码示例。如果您正苦于以下问题:PHP XenForo_Template_Abstract::getTemplateName方法的具体用法?PHP XenForo_Template_Abstract::getTemplateName怎么用?PHP XenForo_Template_Abstract::getTemplateName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XenForo_Template_Abstract
的用法示例。
在下文中一共展示了XenForo_Template_Abstract::getTemplateName方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: listenhooks
public static function listenhooks($hookName, &$contents, array $hookParams, XenForo_Template_Abstract $template)
{
switch ($hookName) {
case 'account_privacy_top':
$options = XenForo_Application::get('options');
if (!$options->sedo_at_preventracing) {
break;
}
$mergedParams = array_merge($template->getParams(), $hookParams);
$contents = $template->create('sedo_agent_account', $mergedParams) . $contents;
break;
case 'message_content':
$options = XenForo_Application::get('options');
$src = $template->getTemplateName();
//Check which kind of integration is activated
if ($src == 'conversation_view' && (!$options->sedo_at_auto_conversation || $options->sedo_at_auto_conversation_style != 'graphic') or $src == 'thread_view' && (!$options->sedo_at_auto_thread || $options->sedo_at_auto_thread_style != 'graphic')) {
break;
}
if ($options->sedo_at_auto_thread_style == 'graphic' || $options->sedo_at_auto_thread_style == 'graphic') {
$mergedParams = array_merge($template->getParams(), $hookParams);
$contents .= $template->create('sedo_agent', $mergedParams);
}
break;
}
}
示例2: _render
protected function _render(array $widget, $positionCode, array $params, XenForo_Template_Abstract $renderTemplateObject)
{
if (!empty($widget['options']['controller_name']) and !empty($widget['options']['controller_action'])) {
$controllerResponse = $this->_dispatch($widget, $widget['options']['controller_name'], $widget['options']['controller_action']);
if (!empty($controllerResponse)) {
if ($controllerResponse instanceof XenForo_ControllerResponse_View and !empty($widget['options']['template'])) {
$controllerResponse = $this->_findViewForTemplate($widget, $controllerResponse, $widget['options']['template']);
}
$renderedView = $this->_renderView($widget, $controllerResponse);
return $renderedView;
}
} elseif (!empty($widget['options']['template']) and $widget['options']['template'] == $renderTemplateObject->getTemplateName()) {
return $renderTemplateObject->render();
} else {
return '';
}
}
示例3: getViewObject
public static function getViewObject(array $params, XenForo_Template_Abstract $templateObj)
{
if (isset($params[WidgetFramework_Core::PARAM_VIEW_OBJECT])) {
return $params[WidgetFramework_Core::PARAM_VIEW_OBJECT];
}
$viewObj = $templateObj->getParam(WidgetFramework_Core::PARAM_VIEW_OBJECT);
if (!empty($viewObj)) {
return $viewObj;
}
if (empty(self::$_pseudoViewObj)) {
if (!empty(WidgetFramework_Listener::$fc) and !empty(WidgetFramework_Listener::$viewRenderer)) {
if (WidgetFramework_Listener::$viewRenderer instanceof XenForo_ViewRenderer_HtmlPublic) {
self::$_pseudoViewObj = new XenForo_ViewPublic_Base(WidgetFramework_Listener::$viewRenderer, WidgetFramework_Listener::$fc->getResponse());
}
}
}
if (!empty(self::$_pseudoViewObj)) {
return self::$_pseudoViewObj;
}
if (WidgetFramework_Core::debugMode()) {
// log the exception for admin examination (in our debug mode only)
XenForo_Error::logException(new XenForo_Exception(sprintf('Unable to get view object for %s', $templateObj->getTemplateName())), false, '[bd] Widget Framework');
}
return null;
}
示例4: _renderWidgetsFor
protected function _renderWidgetsFor($positionCode, array $params, XenForo_Template_Abstract $template, $html)
{
static $renderedPositions = array();
$renderArea = false;
$renderSimpleArea = false;
if (WidgetFramework_Option::get('layoutEditorEnabled')) {
if (isset($renderedPositions[$positionCode])) {
// during layout editor, only run through each position once
return $html;
}
$renderedPositions[$positionCode] = true;
$areaSaveParams = array('position' => $positionCode);
if (!empty($params[self::PARAM_IS_HOOK])) {
// hook position, only render for some hooks
if ($positionCode === 'hook:wf_widget_page_contents') {
$areaSaveParams['widget_page_id'] = $params['widgetPage']['node_id'];
$renderArea = true;
} elseif (in_array($positionCode, array('hook:ad_above_content', 'hook:ad_below_content'), true)) {
$renderArea = true;
} elseif ($template->getTemplateName() !== 'PAGE_CONTAINER') {
// render simple area for content template hooks
$renderArea = true;
$renderSimpleArea = true;
}
} else {
// page position, always render for sidebar
$renderArea = true;
if ($positionCode == 'wf_widget_page') {
$areaSaveParams['widget_page_id'] = $params['widgetPage']['node_id'];
}
}
}
if (!isset($this->_positions[$positionCode])) {
if ($renderArea) {
$position = array('widgets' => array(), 'prepared' => true);
} else {
// stop rendering if no widget configured for this position
return $html;
}
} else {
$position =& $this->_positions[$positionCode];
if (WidgetFramework_Option::get('layoutEditorEnabled')) {
$renderArea = true;
}
$renderSimpleArea = false;
}
if (empty($position['prepared'])) {
// stop rendering if not prepared
return $html;
}
if ($renderArea && !$renderSimpleArea && !empty($html)) {
$html = WidgetFramework_Helper_String::createArrayOfStrings(array('<div title="', new XenForo_Phrase('wf_original_contents'), '" class="original-contents Tooltip">', $html, '</div>'));
}
$widgetParams = $this->_prepareWidgetParams($params);
$this->_renderWidgetsFor_renderWidgetsContainer($position, $positionCode, $widgetParams, $template, $html);
if ($renderArea) {
$conditionalParams = WidgetFramework_Template_Helper_Layout::prepareConditionalParams($widgetParams);
if (!empty($areaSaveParams['widget_page_id']) and !empty($conditionalParams['widgetPage'])) {
unset($conditionalParams['widgetPage']);
}
$areaParams = array('positionCode' => $positionCode, 'conditionalParams' => $conditionalParams, 'areaSaveParams' => $areaSaveParams, 'contents' => $html);
$areaTemplate = $renderSimpleArea ? 'wf_layout_editor_area_simple' : 'wf_layout_editor_area';
$html = $template->create($areaTemplate, $areaParams);
}
return $html;
}
示例5: renderWidgetsForHook
public function renderWidgetsForHook($hookName, array $hookParams, XenForo_Template_Abstract $template, &$hookHtml)
{
$hookParams[WidgetFramework_WidgetRenderer::PARAM_PARENT_TEMPLATE] = $template->getTemplateName();
$hookParams[WidgetFramework_WidgetRenderer::PARAM_POSITION_CODE] = 'hook:' . $hookName;
$hookParams[WidgetFramework_WidgetRenderer::PARAM_IS_HOOK] = true;
// sondh@2013-04-02
// merge hook params with template's params
$hookParams = array_merge($template->getParams(), $hookParams);
$hookHtml = $this->_renderWidgetsFor('hook:' . $hookName, $hookParams, $template, $hookHtml);
return true;
}
示例6: template_hook
public static function template_hook($hookName, &$contents, array $hookParams, XenForo_Template_Abstract $template)
{
if (defined('WIDGET_FRAMEWORK_LOADED')) {
$renderWidgets = true;
if ($template->getTemplateName() == 'PAGE_CONTAINER' and $template->getParam('contentTemplate') == 'wf_widget_page') {
if (WidgetFramework_Option::get('layoutEditorEnabled') and $hookName != 'wf_widget_page_contents') {
$renderWidgets = false;
}
}
if ($renderWidgets) {
WidgetFramework_Core::getInstance()->renderWidgetsForHook($hookName, $hookParams, $template, $contents);
}
if ($hookName == 'moderator_bar') {
$ourParams = $template->getParams();
$ourParams['hasAdminPermStyle'] = XenForo_Visitor::getInstance()->hasAdminPermission('style');
$ourTemplate = $template->create('wf_hook_moderator_bar', $ourParams);
$contents .= $ourTemplate->render();
} elseif ($hookName === 'footer') {
$ourTemplate = $template->create('wf_hook_footer', $template->getParams());
$contents .= $ourTemplate->render();
} elseif (in_array($hookName, array('page_container_breadcrumb_top', 'page_container_content_title_bar'))) {
if (!!$template->getParam('widgetPageOptionsBreakContainer')) {
$contents = '';
}
}
}
}