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


PHP SiteStats::numberInGroup方法代码示例

本文整理汇总了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);
 }
开发者ID:spicy-tmw,项目名称:wiki-raw,代码行数:33,代码来源:ApiQuerySiteinfo.php

示例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);
 }
开发者ID:laiello,项目名称:media-wiki-law,代码行数:29,代码来源:ApiQuerySiteinfo.php

示例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);
 }
开发者ID:rocLv,项目名称:conference,代码行数:15,代码来源:ApiQuerySiteinfo.php


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