本文整理汇总了PHP中XenForo_Template_Abstract::getParam方法的典型用法代码示例。如果您正苦于以下问题:PHP XenForo_Template_Abstract::getParam方法的具体用法?PHP XenForo_Template_Abstract::getParam怎么用?PHP XenForo_Template_Abstract::getParam使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XenForo_Template_Abstract
的用法示例。
在下文中一共展示了XenForo_Template_Abstract::getParam方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
}
示例2: getImage
public static function getImage($content, $params, XenForo_Template_Abstract $template)
{
$posts = $template->getParam('posts');
if (!count($posts)) {
return $content;
}
$visitor = XenForo_Visitor::getInstance();
$matches = array();
foreach ($posts as $post) {
if (XenForo_Permission::hasPermission($visitor['permissions'], 'forum', 'viewAttachment')) {
preg_match('#\\[attach(=[^\\]]*)?\\](?P<id>\\d+)(\\D.*)?\\[/attach\\]#iU', $post['message'], $matches);
if (!empty($matches[2])) {
$link = XenForo_Link::buildPublicLink('full:attachments', array('attachment_id' => $matches[2]));
if (!empty($link)) {
return $link;
}
}
}
preg_match('/\\[(img|IMG)\\]\\s*(https?:\\/\\/([^*\\r\\n]+|[a-z0-9\\/\\\\._\\- !]+))\\[\\/(img|IMG)\\]/', $post['message'], $matches);
if (!empty($matches[2])) {
return $matches[2];
}
}
return $content;
}
示例3: _renderOptions
protected function _renderOptions(XenForo_Template_Abstract $template)
{
$text = null;
$widget = $template->getParam('widget');
if (!empty($widget['widget_id'])) {
$widgetOptions = $template->getParam('options');
if (!empty($widgetOptions['html'])) {
// backward compatibility for Html renderers
// html should be saved as template after the next save
$text = $widgetOptions['html'];
} elseif (!empty($widgetOptions['_text'])) {
$model = $this->_getWidgetRendererTemplateModel();
$widgetTemplateTitle = $model->getWidgetTemplateTitle($widget['widget_id']);
$text = $model->getTemplateText($widgetTemplateTitle);
}
}
$template->setParam('text', $text);
return parent::_renderOptions($template);
}
示例4: adminUserEditPanes
/**
* Template hook for Admin User Edit page (panes).
*/
public static function adminUserEditPanes($hookName, &$contents, array $hookParams, XenForo_Template_Abstract $template)
{
$user = $template->getParam("user");
$renderHTML = "";
/* @var $presetModel ThreePointStudio_CustomMarkupForUser_Model_Preset */
$presetModel = XenForo_Model::create("ThreePointStudio_CustomMarkupForUser_Model_Preset");
if ($user["user_id"] == 0) {
return;
}
// New user, don't show this
$fullUserOptions = ThreePointStudio_CustomMarkupForUser_Helpers::prepareOptionsForView($user["3ps_cmfu_options"]);
if (!array_key_exists("presets", $fullUserOptions["username"])) {
$fullUserOptions["username"]["presets"] = array();
} elseif (is_int($fullUserOptions["username"]["presets"])) {
$fullUserOptions["username"]["presets"] = array($fullUserOptions["username"]["presets"]);
}
if (!array_key_exists("presets", $fullUserOptions["usertitle"])) {
$fullUserOptions["usertitle"]["presets"] = array();
} elseif (is_int($fullUserOptions["usertitle"]["presets"])) {
$fullUserOptions["usertitle"]["presets"] = array($fullUserOptions["usertitle"]["presets"]);
}
$settingsTemplate = $template->create("3ps_cmfu_cmcontrol", $template->getParams());
$presets = array();
foreach ($presetModel->getPresetsByGroup("username") as $presetId => $preset) {
$presets[$presetId] = array("label" => $preset["title"], "value" => $presetId, "selected" => in_array($presetId, $fullUserOptions["username"]["presets"]));
}
$presetsTemplate = $template->create("3ps_cmfu_options_presets_list", $template->getParams());
$presetsTemplate->setParams(array("title" => new XenForo_Phrase("user_name"), "titleCode" => "username", "presets" => $presets));
$presetHTML = $presetsTemplate->render();
$settingsTemplate->setParams(array_merge(array("title" => new XenForo_Phrase("user_name"), "titleCode" => "username", "userOptions" => $fullUserOptions["username"], "currentMarkupRender" => XenForo_Template_Helper_Core::callHelper("usernamehtml", array($user, "", true)), "presetsHTML" => $presetHTML), ThreePointStudio_CustomMarkupForUser_Helpers::getBaseViewParams()));
$renderHTML .= $settingsTemplate->render();
// Render user title
if (empty($user["custom_title"])) {
// No user title
$user["custom_title"] = "(No Custom Title Set)";
}
$settingsTemplate = $template->create("3ps_cmfu_cmcontrol", $template->getParams());
$presets = array();
foreach ($presetModel->getPresetsByGroup("usertitle") as $presetId => $preset) {
$presets[$presetId] = array("label" => $preset["title"], "value" => $presetId, "selected" => in_array($presetId, $fullUserOptions["usertitle"]["presets"]));
}
$presetsTemplate = $template->create("3ps_cmfu_options_presets_list", $template->getParams());
$presetsTemplate->setParams(array("title" => new XenForo_Phrase("3ps_cmfu_user_title"), "titleCode" => "usertitle", "presets" => $presets));
$presetHTML = $presetsTemplate->render();
$settingsTemplate->setParams(array_merge(array("title" => new XenForo_Phrase("3ps_cmfu_user_title"), "titleCode" => "usertitle", "userOptions" => $fullUserOptions["usertitle"], "currentMarkupRender" => XenForo_Template_Helper_Core::callHelper("usertitle", array($user, true)), "presetsHTML" => $presetHTML), ThreePointStudio_CustomMarkupForUser_Helpers::getBaseViewParams()));
$renderHTML .= $settingsTemplate->render();
/* Things - AdminCP */
$contents .= "<li>" . $renderHTML . "</li>";
}
示例5: _renderOptions
protected function _renderOptions(XenForo_Template_Abstract $template)
{
$existingCategoryIds = array();
$existingOptions = $template->getParam('options');
if (!empty($existingOptions['categoryIds'])) {
$existingCategoryIds = $existingOptions['categoryIds'];
}
/** @var XenGallery_Model_Category $categoryModel */
$categoryModel = WidgetFramework_Core::getInstance()->getModelFromCache('XenGallery_Model_Category');
$rows = $categoryModel->getCategoryStructure();
$categories = array();
foreach ($rows as $category) {
$categories[] = array('value' => $category['category_id'], 'label' => $category['category_title'], 'depth' => $category['depth'], 'selected' => in_array($category['category_id'], $existingCategoryIds));
}
$template->setParam('categories', $categories);
return parent::_renderOptions($template);
}
示例6: addButtons
public static function addButtons($hookName, &$contents, array $hookParams, XenForo_Template_Abstract $template)
{
$xenoptions = XenForo_Application::get('options');
$optionHookTop = $xenoptions->rrssb_turnOn_top;
$optionHookBottom = $xenoptions->rrssb_turnOn_bottomHook['hookname'];
$thread = $template->getParam('thread');
$excludedForums = $xenoptions->rrssb_excludeForums;
if (!in_array($thread['node_id'], $excludedForums)) {
if (!empty($optionHookTop)) {
if ($hookName == 'thread_view_pagenav_before') {
$contents .= $template->create('SV_rrssbShares', array_merge($hookParams, $template->getParams()));
}
}
if (!empty($optionHookBottom)) {
switch ($hookName) {
case $optionHookBottom:
$contents .= $template->create('SV_rrssbShares', array_merge($hookParams, $template->getParams()));
break;
}
}
}
}
示例7: 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;
}
示例8: _prepareThreads
protected function _prepareThreads(array $widget, $positionCode, array $params, XenForo_Template_Abstract $renderTemplateObject, array &$threads)
{
$core = WidgetFramework_Core::getInstance();
$layoutNeedPost = $renderTemplateObject->getParam('layoutNeedPost');
/** @var WidgetFramework_XenForo_Model_Thread $threadModel */
$threadModel = $core->getModelFromCache('XenForo_Model_Thread');
/** @var XenForo_Model_Node $nodeModel */
$nodeModel = $core->getModelFromCache('XenForo_Model_Node');
/** @var XenForo_Model_Forum $forumModel */
$forumModel = $core->getModelFromCache('XenForo_Model_Forum');
/** @var XenForo_Model_User $userModel */
$userModel = $core->getModelFromCache('XenForo_Model_User');
/** @var XenForo_Model_Post $postModel */
$postModel = $core->getModelFromCache('XenForo_Model_Post');
$nodePermissions = $nodeModel->getNodePermissionsForPermissionCombination(empty($widget['options']['as_guest']) ? null : 1);
$viewObj = self::getViewObject($params, $renderTemplateObject);
if ($layoutNeedPost and !empty($viewObj)) {
$bbCodeFormatter = XenForo_BbCode_Formatter_Base::create('Base', array('view' => $viewObj));
if (XenForo_Application::$versionId < 1020000) {
// XenForo 1.1.x
$bbCodeParser = new XenForo_BbCode_Parser($bbCodeFormatter);
} else {
// XenForo 1.2.x
$bbCodeParser = XenForo_BbCode_Parser::create($bbCodeFormatter);
}
$bbCodeOptions = array('states' => array(), 'contentType' => 'post', 'contentIdKey' => 'post_id');
$postsWithAttachment = array();
foreach (array_keys($threads) as $threadId) {
$threadRef =& $threads[$threadId];
if (empty($threadRef['attach_count'])) {
continue;
}
if (!empty($threadRef['fetched_last_post'])) {
$postsWithAttachment[$threadRef['last_post_id']] = array('post_id' => $threadRef['last_post_id'], 'thread_id' => $threadId, 'attach_count' => $threadRef['attach_count']);
} else {
$postsWithAttachment[$threadRef['first_post_id']] = array('post_id' => $threadRef['first_post_id'], 'thread_id' => $threadId, 'attach_count' => $threadRef['attach_count']);
}
}
if (!empty($postsWithAttachment)) {
$postsWithAttachment = $postModel->getAndMergeAttachmentsIntoPosts($postsWithAttachment);
foreach ($postsWithAttachment as $postWithAttachment) {
if (empty($postWithAttachment['attachments'])) {
continue;
}
if (empty($threads[$postWithAttachment['thread_id']])) {
continue;
}
$threadRef =& $threads[$postWithAttachment['thread_id']];
$threadRef['attachments'] = $postWithAttachment['attachments'];
}
}
}
$threadForumIds = array();
foreach ($threads as $thread) {
$threadForumIds[] = $thread['node_id'];
}
$threadForums = $forumModel->getForumsByIds($threadForumIds);
$viewingUser = empty($widget['options']['as_guest']) ? null : $userModel->getVisitingGuestUser();
foreach (array_keys($threads) as $threadId) {
$threadRef =& $threads[$threadId];
if (empty($nodePermissions[$threadRef['node_id']])) {
unset($threads[$threadId]);
continue;
}
$threadPermissionsRef =& $nodePermissions[$threadRef['node_id']];
if (empty($threadForums[$threadRef['node_id']])) {
unset($threads[$threadId]);
continue;
}
$threadForumRef =& $threadForums[$threadRef['node_id']];
if ($threadModel->isRedirect($threadRef)) {
unset($threads[$threadId]);
continue;
}
if (!$threadModel->canViewThread($threadRef, $threadForumRef, $null, $threadPermissionsRef, $viewingUser)) {
unset($threads[$threadId]);
continue;
}
if (!empty($bbCodeParser) and !empty($bbCodeOptions)) {
$threadBbCodeOptions = $bbCodeOptions;
$threadBbCodeOptions['states']['viewAttachments'] = $threadModel->canViewAttachmentsInThread($threadRef, $threadForumRef, $null, $threadPermissionsRef, $viewingUser);
$threadRef['messageHtml'] = XenForo_ViewPublic_Helper_Message::getBbCodeWrapper($threadRef, $bbCodeParser, $threadBbCodeOptions);
}
$threadRef = $threadModel->WidgetFramework_prepareThreadForRendererThreads($threadRef, $threadForumRef, $threadPermissionsRef, $viewingUser);
}
}
示例9: _getNoticesContainerParams
/**
* Fetches all notices applicable to the visiting user
*
* @param XenForo_Template_Abstract $template
* @param array $containerData
*
* @return array
*/
protected function _getNoticesContainerParams(XenForo_Template_Abstract $template, array $containerData)
{
$notices = array();
foreach ($this->_dependencies->notices as $param => $noticeKey) {
if ($template->getParam($param)) {
$notices['block'][$noticeKey] = array('title' => new XenForo_Phrase($noticeKey), 'message' => $template->create($noticeKey, $template->getParams()), 'wrap' => true, 'dismissible' => false);
}
}
if (XenForo_Application::get('options')->enableNotices) {
if (XenForo_Application::isRegistered('notices')) {
$user = XenForo_Visitor::getInstance()->toArray();
if (XenForo_Application::isRegistered('session')) {
$dismissedNotices = XenForo_Application::getSession()->get('dismissedNotices');
}
if (!isset($dismissedNotices) || !is_array($dismissedNotices)) {
$dismissedNotices = array();
}
// handle style overrides
$visitorStyle = $template->getParam('visitorStyle');
if (!empty($visitorStyle)) {
$user['style_id'] = $visitorStyle['style_id'];
}
$noticeList = XenForo_Application::get('notices');
foreach (XenForo_Application::get('notices') as $noticeId => $notice) {
if (!empty($notice['dismissible']) && in_array($noticeId, $dismissedNotices) || !XenForo_Helper_Criteria::userMatchesCriteria($notice['user_criteria'], true, $user) || !XenForo_Helper_Criteria::pageMatchesCriteria($notice['page_criteria'], true, $template->getParams(), $containerData)) {
unset($noticeList[$noticeId]);
}
}
$noticeTokens = array('{name}' => $user['username'] !== '' ? htmlspecialchars($user['username']) : new XenForo_Phrase('guest'), '{user_id}' => $user['user_id']);
XenForo_CodeEvent::fire('notices_prepare', array(&$noticeList, &$noticeTokens, $template, $containerData));
foreach ($noticeList as $noticeId => $notice) {
$noticeTokens['{title}'] = $notice['title'];
$imageUrl = '';
if ($notice['display_image'] == 'avatar') {
$imageUrl = XenForo_Template_Helper_Core::callHelper('avatar', array($user, 's'));
} else {
if ($notice['display_image'] == 'image') {
$imageUrl = $notice['image_url'];
}
}
$notices[$notice['notice_type']][$noticeId] = array('title' => $notice['title'], 'message' => str_replace(array_keys($noticeTokens), $noticeTokens, $notice['message']), 'wrap' => $notice['wrap'], 'dismissible' => $notice['dismissible'], 'delay_duration' => $notice['delay_duration'], 'display_duration' => $notice['display_duration'], 'auto_dismiss' => $notice['auto_dismiss'], 'display_image' => $notice['display_image'], 'display_style' => $notice['display_style'], 'css_class' => $notice['css_class'], 'visibility' => $notice['visibility'], 'imageUrl' => $imageUrl);
}
}
}
return $notices;
}
示例10: _getNoticesContainerParams
/**
* Fetches all notices applicable to the visiting user
*
* @param XenForo_Template_Abstract $template
* @param array $containerData
*
* @return array
*/
protected function _getNoticesContainerParams(XenForo_Template_Abstract $template, array $containerData)
{
$notices = array();
foreach ($this->_dependencies->notices as $param => $noticeKey) {
if ($template->getParam($param)) {
$notices[$noticeKey] = array('title' => new XenForo_Phrase($noticeKey), 'message' => $template->create($noticeKey, $template->getParams()), 'wrap' => true, 'dismissible' => false);
}
}
if (XenForo_Application::get('options')->enableNotices) {
if (XenForo_Application::isRegistered('notices')) {
$user = XenForo_Visitor::getInstance()->toArray();
if (XenForo_Application::isRegistered('session')) {
$dismissedNotices = XenForo_Application::getSession()->get('dismissedNotices');
}
if (!isset($dismissedNotices) || !is_array($dismissedNotices)) {
$dismissedNotices = array();
}
// handle style overrides
$visitorStyle = $template->getParam('visitorStyle');
if (!empty($visitorStyle)) {
$user['style_id'] = $visitorStyle['style_id'];
}
$noticeList = XenForo_Application::get('notices');
foreach (XenForo_Application::get('notices') as $noticeId => $notice) {
if (!empty($notice['dismissible']) && in_array($noticeId, $dismissedNotices) || !XenForo_Helper_Criteria::userMatchesCriteria($notice['user_criteria'], true, $user) || !XenForo_Helper_Criteria::pageMatchesCriteria($notice['page_criteria'], true, $template->getParams(), $containerData)) {
unset($noticeList[$noticeId]);
}
}
$noticeTokens = array('{name}' => $user['username'] !== '' ? $user['username'] : new XenForo_Phrase('guest'), '{user_id}' => $user['user_id']);
XenForo_CodeEvent::fire('notices_prepare', array(&$noticeList, &$noticeTokens, $template, $containerData));
foreach ($noticeList as $noticeId => $notice) {
$notices[$noticeId] = array('title' => $notice['title'], 'message' => str_replace(array_keys($noticeTokens), $noticeTokens, $notice['message']), 'wrap' => $notice['wrap'], 'dismissible' => $notice['dismissible'] && XenForo_Visitor::getUserId());
}
}
}
return $notices;
}
示例11: template_hook
public static function template_hook($hookName, &$contents, array $hookParams, XenForo_Template_Abstract $template)
{
//Yey! its our template hook!
if ($hookName == 'message_user_info_custom_fields') {
$contents = '';
} else {
if ($hookName == 'message_content') {
$f = $template->getParam('forum');
$isQualified = true;
if ($f && isset($hookParams['message']['customFields']['qualifications'])) {
switch ($f['node_id']) {
case 65:
//hair;
$isQualified = self::isQualified(1, $hookParams['message']['customFields']['qualifications']);
break;
case 7:
//nails
$isQualified = self::isQualified(2, $hookParams['message']['customFields']['qualifications']);
break;
case 61:
//skin
$isQualified = self::isQualified(3, $hookParams['message']['customFields']['qualifications']);
break;
case 89:
//tanning
$isQualified = self::isQualified(4, $hookParams['message']['customFields']['qualifications']);
break;
case 88:
//waxing
$isQualified = self::isQualified(5, $hookParams['message']['customFields']['qualifications']);
break;
}
}
$thing = 1;
}
}
/*
if ($hookName == 'page_container_content_title_bar' && $template->getParam('contentTemplate') == 'category_view')
{
$tag = $template->getParam('quickNavSelected');
$id = null;
switch ( $tag ) {
case 'node-85':
$id = 85; break;
case 'node-83':
$id = 83; break;
case 'node-87':
$id = 87; break;
case 'node-4':
$id = 4; break;
}
//Our tab! We will do somethin better, hang on.
if ( $id ) {
$template->setParam('title', 'Heey ' . $template->getParam('title'));
$contents .= '<li><a href="{$requestPaths.requestUri}#ourTab">Our Tab</a></li>';
}
}*/
}
示例12: 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 = '';
}
}
}
}