本文整理汇总了PHP中ACL::loadUserGroups方法的典型用法代码示例。如果您正苦于以下问题:PHP ACL::loadUserGroups方法的具体用法?PHP ACL::loadUserGroups怎么用?PHP ACL::loadUserGroups使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ACL
的用法示例。
在下文中一共展示了ACL::loadUserGroups方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: displayACLForm
/**
* What we should do if the permission action is clicked.
* @param OutputPage $output
* @param Article $article
* @param Title $title
* @param User $user
* @param WebRequest $request
* @Param MediaWiki $wiki
*/
static function displayACLForm($output, $article, $title, $user, $request, $wiki)
{
global $wgParser;
if ($request->getVal('action') != self::$ACTION) {
return true;
}
$text = "";
$owner = MWUtil::pageOwner($title, true);
$text .= "Page owner is '''" . $owner->getName() . "'''.";
ACL::loadUserGroups();
$ownergroups = ACL::getUserGroups($owner);
$ogroups = " Owner belongs to these user groups:";
if ($ownergroups) {
foreach ($ownergroups as $g) {
$ogroups .= $g['name'] . ",";
}
} else {
$ogroups = " Owner does not belong to any user group";
}
$text .= $ogroups . "\n\n";
$permissionpage = ACL_ACL . ":" . $article->getID();
$permissiontitle = Title::newFromText($permissionpage);
$ns = $title->getNSText();
if (!$ns) {
$ns = "Main";
}
$sp = SpecialPage::getPage("FormEdit");
$sp_url = $sp->getTitle()->getLocalURL();
$sp_url .= "?form=" . self::$FORM . "&target={$permissionpage}&ACL Page Permission[PageId]={$article->getID()}&ACL Page Permission[PageName]={$title->getDBkey()}&ACL Page Permission[Namespace]={$ns}";
if ($permissiontitle->exists()) {
$text .= "[[{$permissionpage}|View Page Permission]]\n\n----\n";
$output->addWikiText($text);
$output->addHTML("<a href='{$sp_url}'>Edit permission for this page</a>");
} else {
$text .= "No page specific Permission is set.";
$output->addWikiText($text);
$output->addHTML("<a href='{$sp_url}'>Set permission for this page</a>");
}
return false;
}
示例2: usergroups
/**
*
* Return all groups one user belongs to
*
* @param $parser
*/
function usergroups(&$parser, $username, $includepredfined = false)
{
global $wgUser;
if ($username === 'current') {
$username = $wgUser->getName();
}
ACL::loadUserGroups();
$groups = ACL::getUserGroupsByUsername($username);
$grps = array();
foreach ($groups as $g) {
$grps[] = $g['name'];
}
$prefinedgroups = ACL::getPredefinedGroups();
if (!$includepredfined) {
$grps = array_diff($grps, $prefinedgroups);
}
sort($grps);
return implode(",", $grps);
}