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


PHP XenForo_Visitor::hasPermission方法代码示例

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


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

示例1: assertTeamValidAndViewable

 public function assertTeamValidAndViewable($teamIdOrName = null, array $teamFetchOptions = array(), array $categoryFetchOptions = array())
 {
     if (!isset($teamFetchOptions['join'])) {
         $teamFetchOptions['join'] = 0;
     }
     $teamFetchOptions['join'] |= Nobita_Teams_Model_Team::FETCH_PRIVACY | Nobita_Teams_Model_Team::FETCH_PROFILE | Nobita_Teams_Model_Team::FETCH_FEATURED;
     if ($this->_visitor->hasPermission('Teams', 'viewDeleted')) {
         $teamFetchOptions['join'] |= Nobita_Teams_Model_Team::FETCH_DELETION_LOG;
     }
     $visitor = XenForo_Visitor::getInstance();
     $teamFetchOptions['banUserId'] = $visitor['user_id'];
     $teamFetchOptions['memberUserId'] = $visitor['user_id'];
     $team = $this->getTeamOrError($teamIdOrName, $teamFetchOptions);
     $category = $this->assertCategoryValidAndViewable($team['team_category_id'], $categoryFetchOptions);
     $teamModel = $this->_controller->getModelFromCache('Nobita_Teams_Model_Team');
     if (!$teamModel->canViewTeam($team, $category, $errorPhraseKey)) {
         throw $this->_controller->getErrorOrNoPermissionResponseException($errorPhraseKey);
     }
     $team = $teamModel->prepareTeam($team, $category);
     $team = $teamModel->prepareTeamCustomFields($team, $category);
     if (!empty($team['ban_expired_date']) && $team['ban_expired_date'] > XenForo_Application::$time) {
         $banLift = new XenForo_Phrase('ban_will_be_automatically_lifted_on_x', array('date' => XenForo_Locale::date($team['ban_expired_date'])), false);
         throw $this->_controller->responseException($this->_controller->responseError($team['user_reason'] . '. ' . $banLift->render()));
     }
     return array($team, $category);
 }
开发者ID:Sywooch,项目名称:forums,代码行数:26,代码来源:Team.php

示例2: visitor_setup

 public static function visitor_setup(XenForo_Visitor &$visitor)
 {
     $options = $visitor->get('bdsocialshare_options');
     if (!empty($options)) {
         $visitor['_bdSocialShare_options'] = bdSocialShare_Helper_Common::unserializeOrFalse($options);
     } else {
         $visitor['_bdSocialShare_options'] = array();
     }
     $visitor['_bdSocialShare_canStaffShare'] = $visitor->hasPermission('general', 'bdSocialShare_staffShare');
 }
开发者ID:Sywooch,项目名称:forums,代码行数:10,代码来源:Listener.php


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