本文整理汇总了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);
}
示例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');
}