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


PHP XenForo_Template_Helper_Core类代码示例

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


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

示例1: renderXml

 public function renderXml()
 {
     $system =& $this->_params['system'];
     $widgets =& $this->_params['widgets'];
     $document = new DOMDocument('1.0', 'utf-8');
     $document->formatOutput = true;
     $rootNode = $document->createElement('widget_framework');
     $rootNode->setAttribute('version', $system['version_string']);
     $document->appendChild($rootNode);
     foreach ($widgets as $widget) {
         $widgetNode = $document->createElement('widget');
         $widgetNode->setAttribute('title', $widget['title']);
         $widgetNode->setAttribute('class', $widget['class']);
         $optionsNode = $document->createElement('options');
         $optionsString = $widget['options'];
         if (!is_string($optionsString)) {
             $optionsString = serialize($optionsString);
         }
         $optionsData = XenForo_Helper_DevelopmentXml::createDomCdataSection($document, $optionsString);
         $optionsNode->appendChild($optionsData);
         $widgetNode->appendChild($optionsNode);
         $widgetNode->setAttribute('position', $widget['position']);
         $widgetNode->setAttribute('display_order', $widget['display_order']);
         $widgetNode->setAttribute('active', $widget['active']);
         $rootNode->appendChild($widgetNode);
     }
     $this->setDownloadFileName('widget_framework-widgets-' . XenForo_Template_Helper_Core::date(XenForo_Application::$time, 'YmdHi') . '.xml');
     return $document->saveXml();
 }
开发者ID:maitandat1507,项目名称:bdWidgetFramework,代码行数:29,代码来源:Export.php

示例2: actionGetOnline

 public function actionGetOnline()
 {
     $session_model = $this->_getSessionModel();
     $bypass_privacy = $this->_getUserModel()->canBypassUserPrivacy();
     $visitor = XenForo_Visitor::getInstance();
     $online = $session_model->getSessionActivityRecords(array('cutOff' => array('>', $session_model->getOnlineStatusTimeout()), 'getInvisible' => $bypass_privacy, 'getUnconfirmed' => $bypass_privacy, 'forceInclude' => true), array('join' => XenForo_Model_Session::FETCH_USER, 'order' => 'view_date'));
     $online = $session_model->addSessionActivityDetailsToList($online);
     $totals = $session_model->getSessionActivityQuickList($visitor->toArray(), array('cutOff' => array('>', $session_model->getOnlineStatusTimeout())), $visitor['user_id'] ? $visitor->toArray() : null);
     $online_users = array();
     foreach ($online as $rec) {
         if (!$rec['user_id']) {
             continue;
         }
         $activity = '';
         if ($rec['activityDescription'] instanceof XenForo_Phrase) {
             $activity = $rec['activityDescription']->render();
         }
         $out = array('userid' => $rec['user_id'], 'username' => prepare_utf8_string(strip_tags($rec['username'])));
         if ($activity != '') {
             $out['activity'] = prepare_utf8_string($activity);
         }
         if ($visitor->getUserId() == $rec['user_id']) {
             $out['me'] = true;
         }
         $avatarurl = process_avatarurl(XenForo_Template_Helper_Core::getAvatarUrl($rec, 'm'));
         if (strpos($avatarurl, '/xenforo/avatars/avatar_') !== false) {
             $avatarurl = '';
         }
         if ($avatarurl != '') {
             $out['avatarurl'] = $avatarurl;
         }
         $online_users[] = $out;
     }
     return array('users' => $online_users, 'num_guests' => $totals['guests']);
 }
开发者ID:Sywooch,项目名称:forums,代码行数:35,代码来源:Online.php

示例3: helperSnippet

 public static function helperSnippet($string, $maxLength = 0, array $options = array())
 {
     // TODO: smart stripping of tags with options
     $string = self::stripTag('ismemberofusergroup', $string);
     $string = self::stripTag('isnotmemberofusergroup', $string);
     $string = self::stripTag('isuserid', $string);
     $string = self::stripTag('isusername', $string);
     $string = self::stripTag('isnotuserid', $string);
     $string = self::stripTag('isnotusername', $string);
     $visitor = XenForo_Visitor::getInstance();
     /* @var $userModel XenForo_Model_User */
     $userModel = XenForo_Model::create('XenForo_Model_User');
     if (!$userModel->isMemberOfUserGroup($visitor->toArray(), 1)) {
         $string = self::stripTag('guest', $string);
     } else {
         $string = self::stripTag('notguest', $string);
     }
     if (!$userModel->isMemberOfUserGroup($visitor->toArray(), 2)) {
         $string = self::stripTag('registered', $string);
     } else {
         $string = self::stripTag('notregistered', $string);
     }
     if (!$userModel->isMemberOfUserGroup($visitor->toArray(), 3)) {
         $string = self::stripTag('admin', $string);
     } else {
         $string = self::stripTag('notadmin', $string);
     }
     if (!$userModel->isMemberOfUserGroup($visitor->toArray(), 4)) {
         $string = self::stripTag('mod', $string);
     } else {
         $string = self::stripTag('notmod', $string);
     }
     return XenForo_Template_Helper_Core::callHelper('th_usergroupbbcodes_snippet', array($string, $maxLength, $options));
 }
开发者ID:ThemeHouse-XF,项目名称:GroupBbCodes,代码行数:34,代码来源:Core.php

示例4: template_create

 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']);
                     }
                 }
             }
         }
     }
 }
开发者ID:Sywooch,项目名称:forums,代码行数:26,代码来源:Listener.php

示例5: renderRaw

 public function renderRaw()
 {
     $url = $this->_params['url'];
     $width = $this->_params['width'];
     $height = $this->_params['height'];
     $crop = $this->_params['crop'];
     $extension = XenForo_Helper_File::getFileExtension($url);
     $imageInfo = @getimagesize($url);
     if (!$imageInfo || !in_array($imageInfo[2], array_values(sonnb_XenGallery_Model_PhotoData::$typeMap)) || !in_array(strtolower($extension), array_keys(sonnb_XenGallery_Model_PhotoData::$imageMimes))) {
         $url = XenForo_Template_Helper_Core::getAvatarUrl(array(), 'l');
         $extension = XenForo_Helper_File::getFileExtension($url);
         $imageInfo = @getimagesize($url);
     }
     $this->_response->setHeader('Content-type', sonnb_XenGallery_Model_PhotoData::$imageMimes[$extension], true);
     $this->_response->setHeader('ETag', XenForo_Application::$time, true);
     $this->_response->setHeader('X-Content-Type-Options', 'nosniff');
     $this->setDownloadFileName($url, true);
     $image = XenForo_Image_Abstract::createFromFile($url, sonnb_XenGallery_Model_PhotoData::$typeMap[$extension]);
     if ($image) {
         if (XenForo_Image_Abstract::canResize($width, $height)) {
             if ($crop) {
                 $image->thumbnail($width * 2, $height * 2);
                 $image->crop(0, 0, $width, $height);
             } else {
                 $image->thumbnail($width, $height);
             }
         } else {
             $image->output(sonnb_XenGallery_Model_PhotoData::$typeMap[$extension]);
         }
     }
 }
开发者ID:Sywooch,项目名称:forums,代码行数:31,代码来源:Thumbnail.php

示例6: renderHtml

 public function renderHtml()
 {
     XenForo_Template_Helper_Core::setThreadPrefixes($this->_params['prefixes']);
     // don't pass a view to this, because the templates don't exist in the admin
     $bbCodeParser = XenForo_BbCode_Parser::create(XenForo_BbCode_Formatter_Base::create('Base'));
     $this->_params['entry']['messageHtml'] = new XenForo_BbCode_TextWrapper($this->_params['entry']['message'], $bbCodeParser);
 }
开发者ID:namgiangle90,项目名称:tokyobaito,代码行数:7,代码来源:Preview.php

示例7: actionWithdraw

 public function actionWithdraw()
 {
     $visitor = XenForo_Visitor::getInstance();
     $xenOptions = XenForo_Application::getOptions();
     if (!$visitor->hasPermission('thAffiliatePermissions', 'earnAffiliatePoints') || !$xenOptions->th_affiliate_enableAffiliatePoints) {
         return $this->responseNoPermission();
     }
     if ($this->isConfirmedPost()) {
         $amount = $this->_input->filterSingle('amount', XenForo_Input::FLOAT);
         if ($amount < $xenOptions->th_affiliate_minWithdraw) {
             return $this->responseError(new XenForo_Phrase('th_you_must_withdraw_at_least_x_affiliate', array('amount' => XenForo_Template_Helper_Core::numberFormat($xenOptions->th_affiliate_minWithdraw, 2))));
         }
         if ($amount > $visitor['affiliate_points']) {
             return $this->responseError(new XenForo_Phrase('th_you_do_not_have_enough_points_affiliate', array('amount' => XenForo_Template_Helper_Core::numberFormat($xenOptions->th_affiliate_minWithdraw, 2))));
         }
         $newPoints = $visitor['affiliate_points'] - $amount;
         $userWriter = XenForo_DataWriter::create('XenForo_DataWriter_User');
         $userWriter->setExistingData(XenForo_Visitor::getUserId());
         $userWriter->set('affiliate_points', $newPoints);
         $userWriter->save();
         $withdrawalWriter = XenForo_DataWriter::create('ThemeHouse_Affiliate_DataWriter_Withdraw');
         $withdrawalWriter->set('user_id', XenForo_Visitor::getUserId());
         $withdrawalWriter->set('amount', $amount);
         $withdrawalWriter->save();
         return $this->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS, XenForo_Link::buildPublicLink('affiliate'), new XenForo_Phrase('th_your_withdrawal_request_has_been_submitted_affiliate'));
     } else {
         $viewParams = array();
         return $this->responseView('ThemeHouse_Affiliate_ViewPublic_Affiliate_Withdraw', 'th_withdraw_affiliate', $viewParams);
     }
 }
开发者ID:ThemeHouse-XF,项目名称:Affiliate,代码行数:30,代码来源:Affiliate.php

示例8: actionGames

 /**
  * Section that lists all games and individual game stats
  */
 public function actionGames()
 {
     $sHelper = new Steam_Helper_Steam();
     $gameId = $this->_input->filterSingle('game_id', XenForo_Input::UINT);
     if ($gameId) {
         $userModel = XenForo_Model::create('XenForo_Model_User');
         $sHelper = new Steam_Helper_Steam();
         $users = $sHelper->getGameOwners($gameId);
         $owners = array();
         $hours = 0;
         foreach ($users as $user) {
             $u = $userModel->getUserById($user['user_id']);
             $user['avatar_url'] = XenForo_Template_Helper_Core::callHelper('avatar', array($u, 's', null, true));
             $owners[] = $user;
             $hours += $user['hours'];
         }
         if (count($owners) == 0) {
             $hoursAvgMath = 0;
         } else {
             $hoursAvgMath = round($hours / count($owners));
         }
         $viewParams = array('count' => count($owners), 'game' => $sHelper->getGameInfo($gameId), 'users' => $owners, 'hours' => $hours, 'hoursAvg' => $hoursAvgMath);
         $template = 'steam_stats_game_view';
     } else {
         $steamModel = new Steam_Model_Steam();
         $gamesPerPage = 25;
         $page = $this->_input->filterSingle('page', XenForo_Input::UINT);
         $viewParams = array('page' => $page, 'totalGames' => $sHelper->getAvailableGamesCount(), 'gamesPerPage' => $gamesPerPage, 'games' => $steamModel->getAvailableGames(array('perPage' => $gamesPerPage, 'page' => $page)));
         $template = 'steam_stats_games';
     }
     return $this->responseView('XenForo_ViewAdmin_Steam_Games', $template, $viewParams);
 }
开发者ID:WENKz,项目名称:Steam-Authentication-for-XenForo,代码行数:35,代码来源:Steam.php

示例9: actionEdit

 public function actionEdit()
 {
     $id = $this->_input->filterSingle('tag_id', XenForo_Input::UINT);
     $tag = $this->_getTagOrError($id);
     if ($this->isConfirmedPost()) {
         $dwInput = $this->_input->filter(array('tag_text' => XenForo_Input::STRING, 'tag_title' => XenForo_Input::STRING, 'tag_description' => XenForo_Input::STRING, 'is_staff' => XenForo_Input::UINT));
         $dw = $this->_getTagDataWriter();
         $dw->setExistingData($id);
         $dw->bulkSet($dwInput);
         // process link target_type
         // since 1.8
         $link = $this->_input->filterSingle('link', XenForo_Input::STRING);
         if (!empty($link)) {
             $existingLink = $this->_getTagModel()->getTagLink($tag);
             if ($link != $existingLink) {
                 $dw->bulkSet(array('target_type' => 'link', 'target_id' => 0, 'target_data' => array('link' => $link)));
             }
         } else {
             $dw->bulkSet(array('target_type' => '', 'target_id' => 0, 'target_data' => array()));
         }
         $dw->save();
         return $this->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS, XenForo_Link::buildAdminLink('xentag-tags') . '#' . XenForo_Template_Helper_Core::callHelper('listitemid', array($tag['tag_id'])));
     } else {
         $viewParams = array('tag' => $tag, 'tagLink' => $this->_getTagModel()->getTagLink($tag));
         return $this->responseView('Tinhte_XenTag_ViewAdmin_Tag_Edit', 'tinhte_xentag_tag_edit', $viewParams);
     }
 }
开发者ID:Sywooch,项目名称:forums,代码行数:27,代码来源:Tag.php

示例10: _addMoodDisplay

 /**
  * Helper function to add mood display into hook.
  *
  * @param XenForo_Template_Abstract
  * @param string Needle to hook on to (empty for pure pre/append)
  * @param string Contents of the hook block
  * @param array User of the mood to be displayed
  * @param string Style property to check (null to disable check)
  * @param boolean Set to true to prepend, false to append
  * @param string Override mood display template
  *
  * @return void
  */
 protected static function _addMoodDisplay(XenForo_Template_Abstract $template, $needle, &$contents, $user, $styleProperty = NULL, $prepend = TRUE, $templateName = NULL)
 {
     // check style property
     if (isset($styleProperty) and XenForo_Template_Helper_Core::styleProperty($styleProperty) == FALSE) {
         return;
     }
     // generate the mood template
     $moodDisplay = self::_getMoodTemplate($template, $user, $templateName);
     // pure prepend/append
     if (empty($needle)) {
         // do a bit of flip-flopping
         if ($prepend) {
             $contents = $moodDisplay . $contents;
         } else {
             $contents = $contents . $moodDisplay;
         }
         return;
     }
     // do more flip-flopping!
     if ($prepend) {
         $replace = $moodDisplay . $needle;
     } else {
         $replace = $needle . $moodDisplay;
     }
     // add it to the master template
     $contents = str_replace($needle, $replace, $contents);
 }
开发者ID:Sywooch,项目名称:forums,代码行数:40,代码来源:TemplateHook.php

示例11: helperAvatarHtml

 /**
  *
  * @see XenForo_Template_Helper_Core::helperAvatarHtml()
  */
 public static function helperAvatarHtml(array $user, $img, array $attributes = array(), $content = '')
 {
     $returnLink = XenForo_Template_Helper_Core::callHelper('th_unlinkbanned_avatarhtml', array($user, $img, $attributes, $content));
     if ($user['is_banned']) {
         return preg_replace('#(<a )href="[^"]*"([^>]*>.*<\\/a>)#Us', '$1$2', $returnLink);
     }
     return $returnLink;
 }
开发者ID:ThemeHouse-XF,项目名称:UnlinkBannedb,代码行数:12,代码来源:Core.php

示例12: renderJson

 public function renderJson()
 {
     $results = array();
     foreach ($this->_params['users'] as $user) {
         $results[$user['username']] = array('avatar' => XenForo_Template_Helper_Core::callHelper('avatar', array($user, 's')), 'username' => htmlspecialchars($user['username']));
     }
     return array('results' => $results);
 }
开发者ID:Sywooch,项目名称:forums,代码行数:8,代码来源:SearchName.php

示例13: renderJson

 public function renderJson()
 {
     $output = $this->_renderer->getDefaultOutputArray(get_class($this), $this->_params, $this->_templateName);
     if ($this->_params['isStatus']) {
         $output['statusHtml'] = XenForo_Template_Helper_Core::callHelper('bodytext', array($this->_params['profilePost']['message'])) . ' ' . XenForo_Template_Helper_Core::callHelper('datetimehtml', array($this->_params['profilePost']['post_date']));
     }
     return XenForo_ViewRenderer_Json::jsonEncodeForOutput($output);
 }
开发者ID:VoDongMy,项目名称:xenforo-laravel5.1,代码行数:8,代码来源:Post.php

示例14: renderCss

 /**
  * Render the CSS version of the... CSS!
  *
  * @return string
  */
 public function renderCss()
 {
     $params = $this->_params;
     $styleModel = XenForo_Model::create('XenForo_Model_Style');
     $styleModel->setAdminStyles(true);
     $styles = XenForo_Application::isRegistered('adminStyles') ? XenForo_Application::get('adminStyles') : $styleModel->getAllStyles();
     $styleId = $params['styleId'];
     if (!empty($styleId) && isset($styles[$styleId])) {
         $style = $styles[$styleId];
     } else {
         $style = reset($styles);
     }
     $adminStyleProperties = XenForo_Application::get('adminStyleProperties');
     $properties = unserialize($style['properties']);
     $properties = is_array($properties) ? $properties : array();
     if (empty($properties)) {
         $properties = $adminStyleProperties;
     } else {
         $tmpAdminStyleProperties = array();
         if (!isset($properties['contentWidth']) && isset($tmpAdminStyleProperties['contentWidth'])) {
             $properties['contentWidth'] = $tmpAdminStyleProperties['contentWidth'];
         }
         if (!isset($properties['formWidth']) && isset($tmpAdminStyleProperties['formWidth'])) {
             $properties['formWidth'] = $tmpAdminStyleProperties['formWidth'];
         }
         if (!isset($properties['nonResponsiveMinWidth']) && isset($tmpAdminStyleProperties['nonResponsiveMinWidth'])) {
             $properties['nonResponsiveMinWidth'] = $tmpAdminStyleProperties['nonResponsiveMinWidth'];
         }
     }
     $styleId = $style['style_id'];
     $styleModifiedDate = $style['last_modified_date'];
     $defaultProperties = XenForo_Application::get('defaultStyleProperties');
     XenForo_Template_Helper_Core::setStyleProperties(XenForo_Application::mapMerge($defaultProperties, $properties));
     Brivium_AdminStyleSystem_Template_Admin::setStyleId($style['style_id']);
     XenForo_Template_Abstract::setLanguageId(0);
     $bbCodeCache = !empty($params['bbCodeCache']) ? $params['bbCodeCache'] : array();
     $templateParams = array('displayStyles' => array(), 'smilieSprites' => !empty($params['smilieSprites']) ? $params['smilieSprites'] : array(), 'xenOptions' => XenForo_Application::get('options')->getOptions(), 'customBbCodes' => !empty($bbCodeCache['bbCodes']) ? $bbCodeCache['bbCodes'] : array(), 'dir' => $this->_params['dir'], 'pageIsRtl' => $this->_params['dir'] == 'RTL');
     $templates = array();
     foreach ($this->_params['css'] as $cssTemplate) {
         if (strpos($cssTemplate, 'public:') === 0) {
             $templates[$cssTemplate] = new XenForo_Template_Public(substr($cssTemplate, strlen('public:')), $templateParams);
         } else {
             $templates[$cssTemplate] = new Brivium_AdminStyleSystem_Template_Admin($cssTemplate, $templateParams);
         }
     }
     if (XenForo_Application::isRegistered('adminStyleModifiedDate')) {
         $modifyDate = XenForo_Application::get('adminStyleModifiedDate');
     } else {
         $modifyDate = XenForo_Application::$time;
     }
     $this->_response->setHeader('Expires', 'Wed, 01 Jan 2020 00:00:00 GMT', true);
     $this->_response->setHeader('Last-Modified', gmdate('D, d M Y H:i:s', $modifyDate) . ' GMT', true);
     $this->_response->setHeader('Cache-Control', 'private', true);
     $css = XenForo_CssOutput::renderCssFromObjects($templates, true);
     $css = XenForo_CssOutput::prepareCssForOutput($css, $this->_params['dir'], false);
     return $css;
 }
开发者ID:darkearl,项目名称:projectT122015,代码行数:62,代码来源:CssInternal.php

示例15: getImage

 public function getImage(XenForo_Model $model)
 {
     $resource = $this->_resourceDw->getMergedData();
     if (isset(XenForo_Template_Helper_Core::$helperCallbacks['resourceiconurl'])) {
         $iconUrl = XenForo_Template_Helper_Core::callHelper('resourceiconurl', array($resource));
         return XenForo_Link::convertUriToAbsoluteUri($iconUrl, true);
     }
     return parent::getImage($model);
 }
开发者ID:Sywooch,项目名称:forums,代码行数:9,代码来源:Resource.php


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