当前位置: 首页>>代码示例>>PHP>>正文


PHP XenForo_Template_Abstract类代码示例

本文整理汇总了PHP中XenForo_Template_Abstract的典型用法代码示例。如果您正苦于以下问题:PHP XenForo_Template_Abstract类的具体用法?PHP XenForo_Template_Abstract怎么用?PHP XenForo_Template_Abstract使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了XenForo_Template_Abstract类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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;
 }
开发者ID:Sywooch,项目名称:forums,代码行数:25,代码来源:Callback.php

示例2: _render

 protected function _render(array $widget, $positionCode, array $params, XenForo_Template_Abstract $renderTemplateObject)
 {
     $mediaCloudModel = XenForo_Model::create('EWRmedio_Model_Keywords');
     //		$model = XenForo_Model::create('EWRporta_Model_Options');
     //		$option = $model->getOptionById('MediaCloud');
     $options = XenForo_Application::get('options');
     $sidebar['keywords'] = $mediaCloudModel->getKeywordCloud($options->EWRmedio_cloudcount, $options->EWRmedio_mincloud, $options->EWRmedio_maxcloud);
     if ($options->EWRmedio_animatedcloud && $sidebar['keywords']) {
         $sidebar['animated'] = $mediaCloudModel->getAnimatedCloud($sidebar['keywords']);
     }
     /*		$limit = $option['limit'];
     		$mincloud = $option['mincloud'];
     		$maxcloud = $option['maxcloud'];
     		$animated = $option['animated'];
     		
     		$cloud['keywords'] = $mediaCloudModel->getKeywordCloud($limit, $mincloud, $maxcloud);
     
     		if ($animated && $cloud['keywords'])
     		{
     			$cloud['animated'] = $mediaCloudModel->getAnimatedCloud($cloud['keywords']);
     		}*/
     $viewParams = array('MediaCloud' => $sidebar);
     $renderTemplateObject->setParams($viewParams);
     return $renderTemplateObject->render();
 }
开发者ID:Sywooch,项目名称:forums,代码行数:25,代码来源:MediaCloudWidget.php

示例3: _render

 protected function _render(array $widget, $positionCode, array $params, XenForo_Template_Abstract $renderTemplateObject)
 {
     if (!XenForo_Visitor::getInstance()->hasPermission('modm_ajaxchat', 'ajax_chat_view')) {
         return "";
     }
     /* @var $ajaxChatModel MODM_AJAXChat_Model_Chat */
     $ajaxChatModel = XenForo_Model::create("MODM_AJAXChat_Model_Chat");
     // Removes inactive users
     $ajaxChatModel->checkAndRemoveInactive();
     // Get online users for all accessible channels:
     $channels = $ajaxChatModel->getChannels();
     // Add the own private channel if allowed:
     if ($ajaxChatModel->isAllowedToCreatePrivateChannel()) {
         array_push($channels, $ajaxChat->getPrivateChannelID());
     }
     // Add the invitation channels:
     foreach ($ajaxChatModel->getInvitations() as $channelID) {
         if (!in_array($channelID, $channels)) {
             array_push($channels, $channelID);
         }
     }
     $userNames = $ajaxChatModel->getOnlineUsers($channels);
     /* @var $userModel XenForo_Model_User */
     $userModel = XenForo_Model::create("XenForo_Model_User");
     $guestUsers = array();
     $ajaxChat['onlineUsers'] = $userModel->getUsersByNames($userNames, array(), $guestUsers);
     $ajaxChat['members'] = count($ajaxChat['onlineUsers']);
     $ajaxChat['guests'] = XenForo_Application::getOptions()->get('modm_ajaxchat_options_allowguests') != "0" ? count($guestUsers) : null;
     $ajaxChat['total'] = $ajaxChat['members'] + $ajaxChat['guests'];
     $ajaxChat['limit'] = $ajaxChat['members'] < 10 ? $ajaxChat['members'] : 10;
     $ajaxChat['recordsUnseen'] = $ajaxChat['members'] > $ajaxChat['limit'] ? true : false;
     $renderTemplateObject->setParam('AjaxChat', $ajaxChat);
     return $renderTemplateObject->render();
 }
开发者ID:Sywooch,项目名称:forums,代码行数:34,代码来源:AjaxChatOnline.php

示例4: listen

 public static function listen($hookName, &$content, array $hookParams, XenForo_Template_Abstract $template)
 {
     if ($hookName == 'ad_below_content') {
         $params = $template->getParams();
         $content .= $template->create('dark_azucloud', $params);
     }
 }
开发者ID:Sywooch,项目名称:forums,代码行数:7,代码来源:TemplateHook.php

示例5: _render

 protected function _render(array $widget, $positionCode, array $params, XenForo_Template_Abstract $renderTemplateObject)
 {
     if (empty($widget['options']['limit'])) {
         $widget['options']['limit'] = 5;
     }
     if (empty($widget['options']['order'])) {
         $widget['options']['order'] = 'register_date';
     }
     if (empty($widget['options']['direction'])) {
         $widget['options']['direction'] = 'DESC';
     }
     $users = false;
     // try to be smart and get the users data if they happen to be available
     if ($positionCode == 'member_list') {
         if ($widget['options']['limit'] == 12 && $widget['options']['order'] == 'message_count' and !empty($params['activeUsers'])) {
             $users = $params['activeUsers'];
         }
         if ($widget['options']['limit'] == 8 && $widget['options']['order'] == 'register_date' and !empty($params['latestUsers'])) {
             $users = $params['latestUsers'];
         }
     }
     if ($users === false) {
         /** @var XenForo_Model_User $userModel */
         $userModel = WidgetFramework_Core::getInstance()->getModelFromCache('XenForo_Model_User');
         $conditions = array('user_state' => 'valid', 'is_banned' => 0);
         $fetchOptions = array('limit' => $widget['options']['limit'], 'order' => $widget['options']['order'], 'direction' => $widget['options']['direction']);
         $users = $userModel->getUsers($conditions, $fetchOptions);
     }
     $renderTemplateObject->setParam('users', $users);
     return $renderTemplateObject->render();
 }
开发者ID:maitandat1507,项目名称:bdWidgetFramework,代码行数:31,代码来源:Users.php

示例6: templatePostRender

 public static function templatePostRender($templateName, &$content, array &$containerData, XenForo_Template_Abstract $template)
 {
     $param = array();
     switch ($templateName) {
         case 'node_list.css':
             $cacheDataForum = XenForo_Application::isRegistered('brcnsCacheDataForum') ? XenForo_Application::get('brcnsCacheDataForum') : XenForo_Model::create('XenForo_Model_DataRegistry')->get('brcnsCacheDataForum');
             $cacheDataPage = XenForo_Application::isRegistered('brcnsCacheDataPage') ? XenForo_Application::get('brcnsCacheDataPage') : XenForo_Model::create('XenForo_Model_DataRegistry')->get('brcnsCacheDataPage');
             $cacheDataLink = XenForo_Application::isRegistered('brcnsCacheDataLink') ? XenForo_Application::get('brcnsCacheDataLink') : XenForo_Model::create('XenForo_Model_DataRegistry')->get('brcnsCacheDataLink');
             $cacheDataCategory = XenForo_Application::isRegistered('brcnsCacheDataCategory') ? XenForo_Application::get('brcnsCacheDataCategory') : XenForo_Model::create('XenForo_Model_DataRegistry')->get('brcnsCacheDataCategory');
             $cacheDataCategoryRoot = XenForo_Application::isRegistered('brcnsCacheDataCateRoot') ? XenForo_Application::get('brcnsCacheDataCateRoot') : XenForo_Model::create('XenForo_Model_DataRegistry')->get('brcnsCacheDataCateRoot');
             XenForo_Application::set('brcnsCustomNodeStylesForum', $cacheDataForum);
             XenForo_Application::set('brcnsCustomNodeStylesPage', $cacheDataPage);
             XenForo_Application::set('brcnsCustomNodeStylesLink', $cacheDataLink);
             XenForo_Application::set('brcnsCustomNodeStylesCategory', $cacheDataCategory);
             XenForo_Application::set('brcnsCustomNodeStylesCategoryRoot', $cacheDataCategoryRoot);
             $param['CustomNodeStylesForums'] = XenForo_Application::get('brcnsCustomNodeStylesForum');
             $param['CustomNodeStylesPages'] = XenForo_Application::get('brcnsCustomNodeStylesPage');
             $param['CustomNodeStylesLinks'] = XenForo_Application::get('brcnsCustomNodeStylesLink');
             $param['CustomNodeStylescategories'] = XenForo_Application::get('brcnsCustomNodeStylesCategory');
             $param['CustomNodeStylesCategoriesRoot'] = XenForo_Application::get('brcnsCustomNodeStylesCategoryRoot');
             $options = XenForo_Application::get('options');
             $param['size'] = $options->BRCNS_size_icon;
             $newTemplate = $template->create('BRCNS_custom_node_style.css', $template->getParams());
             $newTemplate->setParams($param);
             $content = $content . $newTemplate->render();
             break;
     }
 }
开发者ID:darkearl,项目名称:projectT122015,代码行数:28,代码来源:Listener.php

示例7: listen

 public static function listen($hookName, &$content, array $hookParams, XenForo_Template_Abstract $template)
 {
     if ($hookName == 'editor') {
         $params = $template->getParams();
         $options = XenForo_Application::get('options');
         if ($options->dark_minorin_enabled) {
             $smilies = array();
             $toolbar_bbcode = array();
             $toolbar_bbcode_temp = explode("\n", str_replace("\r", "", trim($options->dark_minorin_bbcode)));
             foreach ($toolbar_bbcode_temp as $bbcode) {
                 $bbcode = explode(":", trim($bbcode));
                 $toolbar_bbcode[$bbcode[0]] = $bbcode[1];
             }
             if (XenForo_Application::isRegistered('smilies')) {
                 $smilies = XenForo_Application::get('smilies');
             } else {
                 $smilies = XenForo_Model::create('XenForo_Model_Smilie')->getAllSmiliesForCache();
                 XenForo_Application::set('smilies', $smilies);
             }
             foreach ($smilies as &$smilie) {
                 $smilie['text'] = $smilie['smilieText'][0];
                 $smilie['sprite_mode'] = array_key_exists('sprite_params', $smilie);
             }
             $params += array('minorin' => array("toolbar_bbcode" => $toolbar_bbcode, "toolbar_smilies" => $smilies, "enabled" => $options->dark_minorin_enabled, "js_modification" => filemtime("js/dark/minorin.js")));
         }
         $content .= $template->create('dark_minorin_toolbar', $params);
     }
 }
开发者ID:Sywooch,项目名称:forums,代码行数:28,代码来源:TemplateHook.php

示例8: _render

 protected function _render(array $widget, $positionCode, array $params, XenForo_Template_Abstract $renderTemplateObject)
 {
     $renderTemplateObject->setParams($params);
     if (!isset($params['url'])) {
         // try to detect the correct url for different templates
         $autoDetectedUrl = false;
         switch ($positionCode) {
             case 'forum_list':
                 $autoDetectedUrl = XenForo_Link::buildPublicLink('canonical:forums');
                 break;
             case 'forum_view':
                 $autoDetectedUrl = XenForo_Link::buildPublicLink('canonical:forums', $params['forum']);
                 break;
             case 'member_view':
                 // this widget on member_view, seriously?
                 $autoDetectedUrl = XenForo_Link::buildPublicLink('canonical:members', $params['user']);
                 break;
             case 'resource_author_view':
                 $autoDetectedUrl = XenForo_Link::buildPublicLink('canonical:resources/authors', $params['user']);
                 break;
             case 'resource_view':
                 $autoDetectedUrl = XenForo_Link::buildPublicLink('canonical:resources', $params['resource']);
                 break;
             case 'thread_view':
                 $autoDetectedUrl = XenForo_Link::buildPublicLink('canonical:threads', $params['thread']);
                 break;
         }
         if ($autoDetectedUrl !== false) {
             $renderTemplateObject->setParam('url', $autoDetectedUrl);
         }
     }
     return $renderTemplateObject->render();
 }
开发者ID:Sywooch,项目名称:forums,代码行数:33,代码来源:ShareThisPage.php

示例9: template_hook

 public static function template_hook($hookName, &$contents, array $hookParams, XenForo_Template_Abstract $template)
 {
     if ($hookName == 'message_content') {
         $ourTemplate = $template->create('MoreThread_main', $template->getParams());
         $ourTemplate->setParam('message', $hookParams['message']);
         $contents .= $ourTemplate->render();
     }
 }
开发者ID:Sywooch,项目名称:forums,代码行数:8,代码来源:Listener.php

示例10: _render

 /**
  * Required method: prepare data or whatever to get the render template ready to
  * be rendered.
  *
  * @param array $widget
  * @param string $positionCode
  * @param array $params
  * @param XenForo_Template_Abstract $renderTemplateObject
  */
 protected function _render(array $widget, $positionCode, array $params, XenForo_Template_Abstract $renderTemplateObject)
 {
     $minecraftServerModel = $this->_getMinecraftServerModel();
     //Get all active minecraft servers from the database
     $minecraftServers = $minecraftServerModel->prepareMinecraftServers($minecraftServerModel->getAllActiveMinecraftServers());
     $renderTemplateObject->setParam('minecraftServers', $minecraftServers);
     return $renderTemplateObject->render();
 }
开发者ID:alexsatellite,项目名称:xenforo-minecraft-server-status,代码行数:17,代码来源:Status.php

示例11: _render

 protected function _render(array $widget, $templateName, array $params, XenForo_Template_Abstract $renderTemplateObject)
 {
     $userModel = WidgetFramework_Core::getInstance()->getModelFromCache('XenForo_Model_User');
     $fetchOptions = array();
     $users = $userModel->getTopUsers($widget['options']);
     $renderTemplateObject->setParam('users', $users);
     return $renderTemplateObject->render();
 }
开发者ID:Sywooch,项目名称:forums,代码行数:8,代码来源:WidgetRenderer.php

示例12: _render

 protected function _render(array $widget, $positionCode, array $params, XenForo_Template_Abstract $renderTemplateObject)
 {
     $params = $renderTemplateObject->getParams();
     $params['taigachat']['alt'] = true;
     $params['taigachat_alt'] = true;
     $renderTemplateObject->setParams($params);
     return $renderTemplateObject->render();
 }
开发者ID:VoDongMy,项目名称:xenforo-laravel5.1,代码行数:8,代码来源:Alt.php

示例13: templateHook

 public static function templateHook($hookName, &$contents, array $hookParams, XenForo_Template_Abstract $template)
 {
     switch ($hookName) {
         case 'page_container_sidebar':
             $contents .= $template->create('cta_countdown_main', $template->getParams());
             break;
     }
 }
开发者ID:Sywooch,项目名称:forums,代码行数:8,代码来源:Listener.php

示例14: templateHook

 public static function templateHook($hookName, &$contents, array $hookParams, XenForo_Template_Abstract $template)
 {
     switch ($hookName) {
         case 'user_criteria_extra':
             $s = new Steam_Helper_Steam();
             $contents .= $template->create('steam_helper_criteria_privs', array_merge($hookParams, $template->getParams(), array_merge($hookParams, $template->getParams(), array("steam_games" => $s->getAvailableGames()))));
             break;
     }
 }
开发者ID:WENKz,项目名称:Steam-Authentication-for-XenForo,代码行数:9,代码来源:Listener.php

示例15: preloader

 public static function preloader($templateName, array &$params, XenForo_Template_Abstract $template)
 {
     if (in_array($templateName, array('conversation_view', 'thread_view'))) {
         $template->preloadTemplate('sedo_agent');
     }
     if ($templateName == 'account_privacy') {
         $template->preloadTemplate('sedo_agent_account');
     }
 }
开发者ID:Sywooch,项目名称:forums,代码行数:9,代码来源:Preloader.php


注:本文中的XenForo_Template_Abstract类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。