本文整理汇总了PHP中SiteStats::numberInGroup方法的典型用法代码示例。如果您正苦于以下问题:PHP SiteStats::numberInGroup方法的具体用法?PHP SiteStats::numberInGroup怎么用?PHP SiteStats::numberInGroup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SiteStats
的用法示例。
在下文中一共展示了SiteStats::numberInGroup方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: appendUserGroups
protected function appendUserGroups($property, $numberInGroup)
{
$config = $this->getConfig();
$data = array();
$result = $this->getResult();
$allGroups = User::getAllGroups();
foreach ($config->get('GroupPermissions') as $group => $permissions) {
$arr = array('name' => $group, 'rights' => array_keys($permissions, true));
if ($numberInGroup) {
$autopromote = $config->get('Autopromote');
if ($group == 'user') {
$arr['number'] = SiteStats::users();
// '*' and autopromote groups have no size
} elseif ($group !== '*' && !isset($autopromote[$group])) {
$arr['number'] = SiteStats::numberInGroup($group);
}
}
$groupArr = array('add' => $config->get('AddGroups'), 'remove' => $config->get('RemoveGroups'), 'add-self' => $config->get('GroupsAddToSelf'), 'remove-self' => $config->get('GroupsRemoveFromSelf'));
foreach ($groupArr as $type => $rights) {
if (isset($rights[$group])) {
$groups = array_intersect($rights[$group], $allGroups);
if ($groups) {
$arr[$type] = $groups;
ApiResult::setIndexedTagName($arr[$type], 'group');
}
}
}
ApiResult::setIndexedTagName($arr['rights'], 'permission');
$data[] = $arr;
}
ApiResult::setIndexedTagName($data, 'group');
return $result->addValue('query', $property, $data);
}
示例2: appendUserGroups
protected function appendUserGroups($property, $numberInGroup)
{
global $wgGroupPermissions, $wgAddGroups, $wgRemoveGroups, $wgGroupsAddToSelf, $wgGroupsRemoveFromSelf;
$data = array();
$result = $this->getResult();
foreach ($wgGroupPermissions as $group => $permissions) {
$arr = array('name' => $group, 'rights' => array_keys($permissions, true));
if ($numberInGroup) {
global $wgAutopromote;
if ($group == 'user') {
$arr['number'] = SiteStats::users();
// '*' and autopromote groups have no size
} elseif ($group !== '*' && !isset($wgAutopromote[$group])) {
$arr['number'] = SiteStats::numberInGroup($group);
}
}
$groupArr = array('add' => $wgAddGroups, 'remove' => $wgRemoveGroups, 'add-self' => $wgGroupsAddToSelf, 'remove-self' => $wgGroupsRemoveFromSelf);
foreach ($groupArr as $type => $rights) {
if (isset($rights[$group])) {
$arr[$type] = $rights[$group];
$result->setIndexedTagName($arr[$type], 'group');
}
}
$result->setIndexedTagName($arr['rights'], 'permission');
$data[] = $arr;
}
$result->setIndexedTagName($data, 'group');
return $result->addValue('query', $property, $data);
}
示例3: appendUserGroups
protected function appendUserGroups($property, $numberInGroup)
{
global $wgGroupPermissions;
$data = array();
foreach ($wgGroupPermissions as $group => $permissions) {
$arr = array('name' => $group, 'rights' => array_keys($permissions, true));
if ($numberInGroup) {
$arr['number'] = SiteStats::numberInGroup($group);
}
$this->getResult()->setIndexedTagName($arr['rights'], 'permission');
$data[] = $arr;
}
$this->getResult()->setIndexedTagName($data, 'group');
return $this->getResult()->addValue('query', $property, $data);
}