本文整理汇总了PHP中SiteStats::numberingroup方法的典型用法代码示例。如果您正苦于以下问题:PHP SiteStats::numberingroup方法的具体用法?PHP SiteStats::numberingroup怎么用?PHP SiteStats::numberingroup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SiteStats
的用法示例。
在下文中一共展示了SiteStats::numberingroup方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: printWikiInfo
/**
* Print basic information about this site.
*/
public function printWikiInfo()
{
global $wgSitename, $wgLanguageCode;
$this->prepareSerialization();
$this->delay_flush = 35;
// don't do intermediate flushes with default parameters
// assemble export data:
$expData = new SMWExpData(new SMWExpResource('&wiki;#wiki'));
$expData->addPropertyObjectValue(SMWExporter::getInstance()->getSpecialNsResource('rdf', 'type'), new SMWExpData(SMWExporter::getInstance()->getSpecialNsResource('swivt', 'Wikisite')));
// basic wiki information
$expData->addPropertyObjectValue(SMWExporter::getInstance()->getSpecialNsResource('rdfs', 'label'), new SMWExpLiteral($wgSitename));
$expData->addPropertyObjectValue(SMWExporter::getInstance()->getSpecialNsResource('swivt', 'siteName'), new SMWExpLiteral($wgSitename, 'http://www.w3.org/2001/XMLSchema#string'));
$expData->addPropertyObjectValue(SMWExporter::getInstance()->getSpecialNsResource('swivt', 'pagePrefix'), new SMWExpLiteral(SMWExporter::getInstance()->expandURI('&wikiurl;'), 'http://www.w3.org/2001/XMLSchema#string'));
$expData->addPropertyObjectValue(SMWExporter::getInstance()->getSpecialNsResource('swivt', 'smwVersion'), new SMWExpLiteral(SMW_VERSION, 'http://www.w3.org/2001/XMLSchema#string'));
$expData->addPropertyObjectValue(SMWExporter::getInstance()->getSpecialNsResource('swivt', 'langCode'), new SMWExpLiteral($wgLanguageCode, 'http://www.w3.org/2001/XMLSchema#string'));
$mainpage = Title::newMainPage();
if (!is_null($mainpage)) {
$ed = new SMWExpData(new SMWExpResource($mainpage->getFullURL()));
$expData->addPropertyObjectValue(SMWExporter::getInstance()->getSpecialNsResource('swivt', 'mainPage'), $ed);
}
// statistical information
$expData->addPropertyObjectValue(SMWExporter::getInstance()->getSpecialNsResource('swivt', 'pageCount'), new SMWExpLiteral(SiteStats::pages(), 'http://www.w3.org/2001/XMLSchema#int'));
$expData->addPropertyObjectValue(SMWExporter::getInstance()->getSpecialNsResource('swivt', 'contentPageCount'), new SMWExpLiteral(SiteStats::articles(), 'http://www.w3.org/2001/XMLSchema#int'));
$expData->addPropertyObjectValue(SMWExporter::getInstance()->getSpecialNsResource('swivt', 'mediaCount'), new SMWExpLiteral(SiteStats::images(), 'http://www.w3.org/2001/XMLSchema#int'));
$expData->addPropertyObjectValue(SMWExporter::getInstance()->getSpecialNsResource('swivt', 'editCount'), new SMWExpLiteral(SiteStats::edits(), 'http://www.w3.org/2001/XMLSchema#int'));
// SiteStats::views was deprecated in MediaWiki 1.25
// "Stop calling this function, it will be removed some time in the future"
//$expData->addPropertyObjectValue(
// SMWExporter::getInstance()->getSpecialNsResource( 'swivt', 'viewCount' ),
// new SMWExpLiteral( SiteStats::views(), 'http://www.w3.org/2001/XMLSchema#int' )
//);
$expData->addPropertyObjectValue(SMWExporter::getInstance()->getSpecialNsResource('swivt', 'userCount'), new SMWExpLiteral(SiteStats::users(), 'http://www.w3.org/2001/XMLSchema#int'));
$expData->addPropertyObjectValue(SMWExporter::getInstance()->getSpecialNsResource('swivt', 'adminCount'), new SMWExpLiteral(SiteStats::numberingroup('sysop'), 'http://www.w3.org/2001/XMLSchema#int'));
$this->serializer->startSerialization();
$this->serializer->serializeExpData(SMWExporter::getInstance()->getOntologyExpData(''));
$this->serializer->serializeExpData($expData);
// link to list of existing pages:
if (strpos(SMWExporter::getInstance()->expandURI('&wikiurl;'), '?') === false) {
// check whether we have title as a first parameter or in URL
$nexturl = SMWExporter::getInstance()->expandURI('&export;?offset=0');
} else {
$nexturl = SMWExporter::getInstance()->expandURI('&export;&offset=0');
}
$expData = new SMWExpData(new SMWExpResource($nexturl));
$ed = new SMWExpData(SMWExporter::getInstance()->getSpecialNsResource('owl', 'Thing'));
$expData->addPropertyObjectValue(SMWExporter::getInstance()->getSpecialNsResource('rdf', 'type'), $ed);
$ed = new SMWExpData(new SMWExpResource($nexturl));
$expData->addPropertyObjectValue(SMWExporter::getInstance()->getSpecialNsResource('rdfs', 'isDefinedBy'), $ed);
$this->serializer->serializeExpData($expData);
$this->serializer->finishSerialization();
$this->flush(true);
}
示例2: numberingroup
public static function numberingroup($parser, $name = '', $raw = null)
{
return self::formatRaw(SiteStats::numberingroup(strtolower($name)), $raw);
}
示例3: appendStatistics
protected function appendStatistics($property)
{
global $wgDisableCounters;
$data = array();
$data['pages'] = intval(SiteStats::pages());
$data['articles'] = intval(SiteStats::articles());
if (!$wgDisableCounters) {
$data['views'] = intval(SiteStats::views());
}
$data['edits'] = intval(SiteStats::edits());
$data['images'] = intval(SiteStats::images());
$data['users'] = intval(SiteStats::users());
$data['activeusers'] = intval(SiteStats::activeUsers());
$data['admins'] = intval(SiteStats::numberingroup('sysop'));
$data['jobs'] = intval(SiteStats::jobs());
return $this->getResult()->addValue('query', $property, $data);
}
示例4: appendStatistics
protected function appendStatistics($property)
{
global $wgDisableCounters;
$data = array();
$data['pages'] = intval(SiteStats::pages());
$data['articles'] = intval(SiteStats::articles());
if (!$wgDisableCounters) {
$data['views'] = intval(SiteStats::views());
}
$data['edits'] = intval(SiteStats::edits());
$data['images'] = intval(SiteStats::images());
$data['users'] = intval(SiteStats::users());
$data['activeusers'] = intval(SiteStats::activeUsers());
$data['admins'] = intval(SiteStats::numberingroup('sysop'));
$data['jobs'] = intval(SiteStats::jobs());
// Wikia change begin
// @author macbre
wfRunHooks('APIQuerySiteInfoStatistics', array($this, &$data));
// Wikia change end
return $this->getResult()->addValue('query', $property, $data);
}
示例5: getVariableValue
//.........这里部分代码省略.........
break;
case 'currenttime':
$value = $pageLang->time(wfTimestamp(TS_MW, $ts), false, false);
break;
case 'currenthour':
$value = $pageLang->formatNum(MWTimestamp::getInstance($ts)->format('H'), true);
break;
case 'currentweek':
# @bug 4594 PHP5 has it zero padded, PHP4 does not, cast to
# int to remove the padding
$value = $pageLang->formatNum((int) MWTimestamp::getInstance($ts)->format('W'));
break;
case 'currentdow':
$value = $pageLang->formatNum(MWTimestamp::getInstance($ts)->format('w'));
break;
case 'localdayname':
$value = $pageLang->getWeekdayName((int) MWTimestamp::getLocalInstance($ts)->format('w') + 1);
break;
case 'localyear':
$value = $pageLang->formatNum(MWTimestamp::getLocalInstance($ts)->format('Y'), true);
break;
case 'localtime':
$value = $pageLang->time(MWTimestamp::getLocalInstance($ts)->format('YmdHis'), false, false);
break;
case 'localhour':
$value = $pageLang->formatNum(MWTimestamp::getLocalInstance($ts)->format('H'), true);
break;
case 'localweek':
# @bug 4594 PHP5 has it zero padded, PHP4 does not, cast to
# int to remove the padding
$value = $pageLang->formatNum((int) MWTimestamp::getLocalInstance($ts)->format('W'));
break;
case 'localdow':
$value = $pageLang->formatNum(MWTimestamp::getLocalInstance($ts)->format('w'));
break;
case 'numberofarticles':
$value = $pageLang->formatNum(SiteStats::articles());
break;
case 'numberoffiles':
$value = $pageLang->formatNum(SiteStats::images());
break;
case 'numberofusers':
$value = $pageLang->formatNum(SiteStats::users());
break;
case 'numberofactiveusers':
$value = $pageLang->formatNum(SiteStats::activeUsers());
break;
case 'numberofpages':
$value = $pageLang->formatNum(SiteStats::pages());
break;
case 'numberofadmins':
$value = $pageLang->formatNum(SiteStats::numberingroup('sysop'));
break;
case 'numberofedits':
$value = $pageLang->formatNum(SiteStats::edits());
break;
case 'numberofviews':
global $wgDisableCounters;
$value = !$wgDisableCounters ? $pageLang->formatNum(SiteStats::views()) : '';
break;
case 'currenttimestamp':
$value = wfTimestamp(TS_MW, $ts);
break;
case 'localtimestamp':
$value = MWTimestamp::getLocalInstance($ts)->format('YmdHis');
break;
case 'currentversion':
$value = SpecialVersion::getVersion();
break;
case 'articlepath':
return $wgArticlePath;
case 'sitename':
return $wgSitename;
case 'server':
return $wgServer;
case 'servername':
$serverParts = wfParseUrl($wgServer);
return $serverParts && isset($serverParts['host']) ? $serverParts['host'] : $wgServer;
case 'scriptpath':
return $wgScriptPath;
case 'stylepath':
return $wgStylePath;
case 'directionmark':
return $pageLang->getDirMark();
case 'contentlanguage':
global $wgLanguageCode;
return $wgLanguageCode;
case 'cascadingsources':
$value = CoreParserFunctions::cascadingsources($this);
break;
default:
$ret = null;
wfRunHooks('ParserGetVariableValueSwitch', array(&$this, &$this->mVarCache, &$index, &$ret, &$frame));
return $ret;
}
if ($index) {
$this->mVarCache[$index] = $value;
}
return $value;
}
示例6: getVariableValue
//.........这里部分代码省略.........
$value = $pageLang->formatNum(gmdate('Y', $ts), true);
break;
case 'currenttime':
$value = $pageLang->time(wfTimestamp(TS_MW, $ts), false, false);
break;
case 'currenthour':
$value = $pageLang->formatNum(gmdate('H', $ts), true);
break;
case 'currentweek':
# @bug 4594 PHP5 has it zero padded, PHP4 does not, cast to
# int to remove the padding
$value = $pageLang->formatNum((int) gmdate('W', $ts));
break;
case 'currentdow':
$value = $pageLang->formatNum(gmdate('w', $ts));
break;
case 'localdayname':
$value = $pageLang->getWeekdayName($localDayOfWeek + 1);
break;
case 'localyear':
$value = $pageLang->formatNum($localYear, true);
break;
case 'localtime':
$value = $pageLang->time($localTimestamp, false, false);
break;
case 'localhour':
$value = $pageLang->formatNum($localHour, true);
break;
case 'localweek':
# @bug 4594 PHP5 has it zero padded, PHP4 does not, cast to
# int to remove the padding
$value = $pageLang->formatNum((int) $localWeek);
break;
case 'localdow':
$value = $pageLang->formatNum($localDayOfWeek);
break;
case 'numberofarticles':
$value = $pageLang->formatNum(SiteStats::articles());
break;
case 'numberoffiles':
$value = $pageLang->formatNum(SiteStats::images());
break;
case 'numberofusers':
$value = $pageLang->formatNum(SiteStats::users());
break;
case 'numberofactiveusers':
$value = $pageLang->formatNum(SiteStats::activeUsers());
break;
case 'numberofpages':
$value = $pageLang->formatNum(SiteStats::pages());
break;
case 'numberofadmins':
$value = $pageLang->formatNum(SiteStats::numberingroup('sysop'));
break;
case 'numberofedits':
$value = $pageLang->formatNum(SiteStats::edits());
break;
case 'numberofviews':
$value = $pageLang->formatNum(SiteStats::views());
break;
case 'currenttimestamp':
$value = wfTimestamp(TS_MW, $ts);
break;
case 'localtimestamp':
$value = $localTimestamp;
break;
case 'currentversion':
$value = SpecialVersion::getVersion();
break;
case 'articlepath':
return $wgArticlePath;
case 'sitename':
return $wgSitename;
case 'server':
return $wgServer;
case 'servername':
$serverParts = wfParseUrl($wgServer);
return $serverParts && isset($serverParts['host']) ? $serverParts['host'] : $wgServer;
case 'scriptpath':
return $wgScriptPath;
case 'stylepath':
return $wgStylePath;
case 'directionmark':
return $pageLang->getDirMark();
case 'contentlanguage':
global $wgLanguageCode;
return $wgLanguageCode;
default:
$ret = null;
if (wfRunHooks('ParserGetVariableValueSwitch', array(&$this, &$this->mVarCache, &$index, &$ret, &$frame))) {
return $ret;
} else {
return null;
}
}
if ($index) {
$this->mVarCache[$index] = $value;
}
return $value;
}
示例7: getVariableValue
//.........这里部分代码省略.........
// *after* a revision ID has been assigned. This is for null edits.
$this->mOutput->setFlag('vary-revision');
wfDebug(__METHOD__ . ": {{REVISIONYEAR}} used, setting vary-revision...\n");
return substr($this->getRevisionTimestamp(), 0, 4);
case 'revisiontimestamp':
// Let the edit saving system know we should parse the page
// *after* a revision ID has been assigned. This is for null edits.
$this->mOutput->setFlag('vary-revision');
wfDebug(__METHOD__ . ": {{REVISIONTIMESTAMP}} used, setting vary-revision...\n");
return $this->getRevisionTimestamp();
case 'revisionuser':
// Let the edit saving system know we should parse the page
// *after* a revision ID has been assigned. This is for null edits.
$this->mOutput->setFlag('vary-revision');
wfDebug(__METHOD__ . ": {{REVISIONUSER}} used, setting vary-revision...\n");
return $this->getRevisionUser();
case 'namespace':
return str_replace('_', ' ', $wgContLang->getNsText($this->mTitle->getNamespace()));
case 'namespacee':
return wfUrlencode($wgContLang->getNsText($this->mTitle->getNamespace()));
case 'talkspace':
return $this->mTitle->canTalk() ? str_replace('_', ' ', $this->mTitle->getTalkNsText()) : '';
case 'talkspacee':
return $this->mTitle->canTalk() ? wfUrlencode($this->mTitle->getTalkNsText()) : '';
case 'subjectspace':
return $this->mTitle->getSubjectNsText();
case 'subjectspacee':
return wfUrlencode($this->mTitle->getSubjectNsText());
case 'currentdayname':
return $this->mVarCache[$index] = $wgContLang->getWeekdayName(gmdate('w', $ts) + 1);
case 'currentyear':
return $this->mVarCache[$index] = $wgContLang->formatNum(gmdate('Y', $ts), true);
case 'currenttime':
return $this->mVarCache[$index] = $wgContLang->time(wfTimestamp(TS_MW, $ts), false, false);
case 'currenthour':
return $this->mVarCache[$index] = $wgContLang->formatNum(gmdate('H', $ts), true);
case 'currentweek':
// @bug 4594 PHP5 has it zero padded, PHP4 does not, cast to
// int to remove the padding
return $this->mVarCache[$index] = $wgContLang->formatNum((int) gmdate('W', $ts));
case 'currentdow':
return $this->mVarCache[$index] = $wgContLang->formatNum(gmdate('w', $ts));
case 'localdayname':
return $this->mVarCache[$index] = $wgContLang->getWeekdayName($localDayOfWeek + 1);
case 'localyear':
return $this->mVarCache[$index] = $wgContLang->formatNum($localYear, true);
case 'localtime':
return $this->mVarCache[$index] = $wgContLang->time($localTimestamp, false, false);
case 'localhour':
return $this->mVarCache[$index] = $wgContLang->formatNum($localHour, true);
case 'localweek':
// @bug 4594 PHP5 has it zero padded, PHP4 does not, cast to
// int to remove the padding
return $this->mVarCache[$index] = $wgContLang->formatNum((int) $localWeek);
case 'localdow':
return $this->mVarCache[$index] = $wgContLang->formatNum($localDayOfWeek);
case 'numberofarticles':
return $this->mVarCache[$index] = $wgContLang->formatNum(SiteStats::articles());
case 'numberoffiles':
return $this->mVarCache[$index] = $wgContLang->formatNum(SiteStats::images());
case 'numberofusers':
return $this->mVarCache[$index] = $wgContLang->formatNum(SiteStats::users());
case 'numberofactiveusers':
return $this->mVarCache[$index] = $wgContLang->formatNum(SiteStats::activeUsers());
case 'numberofpages':
return $this->mVarCache[$index] = $wgContLang->formatNum(SiteStats::pages());
case 'numberofadmins':
return $this->mVarCache[$index] = $wgContLang->formatNum(SiteStats::numberingroup('sysop'));
case 'numberofedits':
return $this->mVarCache[$index] = $wgContLang->formatNum(SiteStats::edits());
case 'numberofviews':
return $this->mVarCache[$index] = $wgContLang->formatNum(SiteStats::views());
case 'currenttimestamp':
return $this->mVarCache[$index] = wfTimestamp(TS_MW, $ts);
case 'localtimestamp':
return $this->mVarCache[$index] = $localTimestamp;
case 'currentversion':
return $this->mVarCache[$index] = SpecialVersion::getVersion();
case 'sitename':
return $wgSitename;
case 'server':
return $wgServer;
case 'servername':
return $wgServerName;
case 'scriptpath':
return $wgScriptPath;
case 'directionmark':
return $wgContLang->getDirMark();
case 'contentlanguage':
global $wgContLanguageCode;
return $wgContLanguageCode;
default:
$ret = null;
if (wfRunHooks('ParserGetVariableValueSwitch', array(&$this, &$this->mVarCache, &$index, &$ret))) {
return $ret;
} else {
return null;
}
}
}
示例8: getGroupStats
private function getGroupStats()
{
global $wgGroupPermissions, $wgImplicitGroups;
$text = '';
foreach ($wgGroupPermissions as $group => $permissions) {
# Skip generic * and implicit groups
if (in_array($group, $wgImplicitGroups) || $group == '*') {
continue;
}
$groupname = htmlspecialchars($group);
$msg = $this->msg('group-' . $groupname);
if ($msg->isBlank()) {
$groupnameLocalized = $groupname;
} else {
$groupnameLocalized = $msg->text();
}
$msg = $this->msg('grouppage-' . $groupname)->inContentLanguage();
if ($msg->isBlank()) {
$grouppageLocalized = MWNamespace::getCanonicalName(NS_PROJECT) . ':' . $groupname;
} else {
$grouppageLocalized = $msg->text();
}
$linkTarget = Title::newFromText($grouppageLocalized);
$grouppage = Linker::link($linkTarget, htmlspecialchars($groupnameLocalized));
$grouplink = Linker::linkKnown(SpecialPage::getTitleFor('Listusers'), $this->msg('listgrouprights-members')->escaped(), array(), array('group' => $group));
# Add a class when a usergroup contains no members to allow hiding these rows
$classZero = '';
$countUsers = SiteStats::numberingroup($groupname);
if ($countUsers == 0) {
$classZero = ' statistics-group-zero';
}
$text .= $this->formatRow($grouppage . ' ' . $grouplink, $this->getLanguage()->formatNum($countUsers), array('class' => 'statistics-group-' . Sanitizer::escapeClass($group) . $classZero));
}
return $text;
}
示例9: appendStatistics
protected function appendStatistics($property)
{
$data = array();
$data['pages'] = intval(SiteStats::pages());
$data['articles'] = intval(SiteStats::articles());
if (!$this->getConfig()->get('DisableCounters')) {
$data['views'] = intval(SiteStats::views());
}
$data['edits'] = intval(SiteStats::edits());
$data['images'] = intval(SiteStats::images());
$data['users'] = intval(SiteStats::users());
$data['activeusers'] = intval(SiteStats::activeUsers());
$data['admins'] = intval(SiteStats::numberingroup('sysop'));
$data['jobs'] = intval(SiteStats::jobs());
wfRunHooks('APIQuerySiteInfoStatisticsInfo', array(&$data));
return $this->getResult()->addValue('query', $property, $data);
}
示例10: 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::setArrayType($arr[$type], 'BCarray');
ApiResult::setIndexedTagName($arr[$type], 'group');
}
}
}
ApiResult::setIndexedTagName($arr['rights'], 'permission');
$data[] = $arr;
}
ApiResult::setIndexedTagName($data, 'group');
return $result->addValue('query', $property, $data);
}
示例11: usersInGroup
public function usersInGroup($group = null)
{
$this->checkType('usersInGroup', 1, $group, 'string');
return array((int) SiteStats::numberingroup(strtolower($group)));
}
示例12: getDbParams
/**
* Return three arrays of params for the db queries
* @return array
*/
private function getDbParams()
{
$values = array('ss_total_edits' => $this->mEdits, 'ss_good_articles' => $this->mArticles, 'ss_total_pages' => $this->mPages, 'ss_users' => $this->mUsers, 'ss_admins' => SiteStats::numberingroup('sysop'), 'ss_images' => $this->mFiles);
$conds = array('ss_row_id' => 1);
$views = array('ss_total_views' => $this->mViews);
return array($values, $conds, $views);
}
示例13: prepareVariables
public function prepareVariables()
{
global $wgContLang, $wgSitename, $wgServer, $wgServerName, $wgScriptPath;
global $wgContLanguageCode;
global $wgTitle;
$this->mRevisionId = $this->mTitle->getLatestRevID();
$ts = time();
# Use the time zone
global $wgLocaltimezone;
if (isset($wgLocaltimezone)) {
$oldtz = getenv('TZ');
putenv('TZ=' . $wgLocaltimezone);
}
wfSuppressWarnings();
// E_STRICT system time bitching
$localTimestamp = date('YmdHis', $ts);
$localMonth = date('m', $ts);
$localMonthName = date('n', $ts);
$localDay = date('j', $ts);
$localDay2 = date('d', $ts);
$localDayOfWeek = date('w', $ts);
$localWeek = date('W', $ts);
$localYear = date('Y', $ts);
$localHour = date('H', $ts);
if (isset($wgLocaltimezone)) {
putenv('TZ=' . $oldtz);
}
wfRestoreWarnings();
// some simpler ones...
$w2lVars = array('currentmonth' => $wgContLang->formatNum(gmdate('m', $ts)), 'currentmonthname' => $wgContLang->getMonthName(gmdate('n', $ts)), 'currentmonthnamegen' => $wgContLang->getMonthNameGen(gmdate('n', $ts)), 'currentmonthabbrev' => $wgContLang->getMonthAbbreviation(gmdate('n', $ts)), 'currentday' => $wgContLang->formatNum(gmdate('j', $ts)), 'currentday2' => $wgContLang->formatNum(gmdate('d', $ts)), 'localmonth' => $wgContLang->formatNum($localMonth), 'localmonthname' => $wgContLang->getMonthName($localMonthName), 'localmonthnamegen' => $wgContLang->getMonthNameGen($localMonthName), 'localmonthabbrev' => $wgContLang->getMonthAbbreviation($localMonthName), 'localday' => $wgContLang->formatNum($localDay), 'localday2' => $wgContLang->formatNum($localDay2), 'pagename' => wfEscapeWikiText($this->mTitle->getText()), 'pagenamee' => $this->mTitle->getPartialURL(), 'fullpagename' => wfEscapeWikiText($this->mTitle->getPrefixedText()), 'fullpagenamee' => $this->mTitle->getPrefixedURL(), 'subpagename' => wfEscapeWikiText($this->mTitle->getSubpageText()), 'subpagenamee' => $this->mTitle->getSubpageUrlForm(), 'basepagename' => wfEscapeWikiText($this->mTitle->getBaseText()), 'basepagenamee' => wfUrlEncode(str_replace(' ', '_', $this->mTitle->getBaseText())), 'revisionid' => $this->mRevisionId, 'revisionday' => intval(substr($this->getRevisionTimestamp(), 6, 2)), 'revisionday2' => substr($this->getRevisionTimestamp(), 6, 2), 'revisionmonth' => substr($this->getRevisionTimestamp(), 4, 2), 'revisionmonth1' => intval(substr($this->getRevisionTimestamp(), 4, 2)), 'revisionyear' => substr($this->getRevisionTimestamp(), 0, 4), 'revisiontimestamp' => $this->getRevisionTimestamp(), 'namespace' => str_replace('_', ' ', $wgContLang->getNsText($this->mTitle->getNamespace())), 'namespacee' => wfUrlencode($wgContLang->getNsText($this->mTitle->getNamespace())), 'talkspace' => $this->mTitle->canTalk() ? str_replace('_', ' ', $this->mTitle->getTalkNsText()) : '', 'talkspacee' => $this->mTitle->canTalk() ? wfUrlencode($this->mTitle->getTalkNsText()) : '', 'subjectspace' => $this->mTitle->getSubjectNsText(), 'subjectspacee' => wfUrlencode($this->mTitle->getSubjectNsText()), 'currentdayname' => $wgContLang->getWeekdayName(gmdate('w', $ts) + 1), 'currentyear' => $wgContLang->formatNum(gmdate('Y', $ts), true), 'currenttime' => $wgContLang->time(wfTimestamp(TS_MW, $ts), false, false), 'currenthour' => $wgContLang->formatNum(gmdate('H', $ts), true), 'currentweek' => $wgContLang->formatNum((int) gmdate('W', $ts)), 'currentdow' => $wgContLang->formatNum(gmdate('w', $ts)), 'localdayname' => $wgContLang->getWeekdayName($localDayOfWeek + 1), 'localyear' => $wgContLang->formatNum($localYear, true), 'localtime' => $wgContLang->time($localTimestamp, false, false), 'localhour' => $wgContLang->formatNum($localHour, true), 'localweek' => $wgContLang->formatNum((int) $localWeek), 'localdow' => $wgContLang->formatNum($localDayOfWeek), 'numberofarticles' => $wgContLang->formatNum(SiteStats::articles()), 'numberoffiles' => $wgContLang->formatNum(SiteStats::images()), 'numberofusers' => $wgContLang->formatNum(SiteStats::users()), 'numberofpages' => $wgContLang->formatNum(SiteStats::pages()), 'numberofadmins' => $wgContLang->formatNum(SiteStats::numberingroup('sysop')), 'numberofedits' => $wgContLang->formatNum(SiteStats::edits()), 'currenttimestamp' => wfTimestampNow(), 'localtimestamp' => $localTimestamp, 'currentversion' => SpecialVersion::getVersion(), 'sitename' => $wgSitename, 'server' => $wgServer, 'servername' => $wgServerName, 'scriptpath' => $wgScriptPath, 'directionmark' => $wgContLang->getDirMark(), 'contentlanguage' => $wgContLanguageCode, 'pageid' => $this->mTitle->getArticleID(), 'namespacenumber' => $this->mTitle->getNamespace(), 'numberofactiveusers' => $wgContLang->formatNum(SiteStats::activeUsers()), 'revisionuser' => $this->mRevision->getUserText(), 'stylepath' => $wgStylePath);
// These are a bit more complicated...
//case 'talkpagename':
if ($this->mTitle->canTalk()) {
$talkPage = $this->mTitle->getTalkPage();
$talkpagename = wfEscapeWikiText($talkPage->getPrefixedText());
} else {
$talkpagename = '';
}
$w2lVars['talkpagename'] = $talkpagename;
//case 'talkpagenamee':
if ($this->mTitle->canTalk()) {
$talkPage = $this->mTitle->getTalkPage();
$talkpagenamee = $talkPage->getPrefixedUrl();
} else {
$talkpagenamee = '';
}
$w2lVars['talkpagenamee'] = $talkpagenamee;
//case 'subjectpagename':
$subjPage = $this->mTitle->getSubjectPage();
$w2lVars['subjectpagename'] = wfEscapeWikiText($subjPage->getPrefixedText());
$w2lVars['subjectpagenamee'] = $subjPage->getPrefixedUrl();
wfRunHooks('w2lTemplateVars', array(&$this, &$w2lVars));
$w2lVars = array_change_key_case($w2lVars, CASE_UPPER);
return $w2lVars;
}
示例14: getGroupStats
private function getGroupStats()
{
global $wgGroupPermissions, $wgImplicitGroups, $wgLang, $wgUser;
$sk = $wgUser->getSkin();
$text = '';
foreach ($wgGroupPermissions as $group => $permissions) {
# Skip generic * and implicit groups
if (in_array($group, $wgImplicitGroups) || $group == '*') {
continue;
}
$groupname = htmlspecialchars($group);
$msg = wfMsg('group-' . $groupname);
if (wfEmptyMsg('group-' . $groupname, $msg) || $msg == '') {
$groupnameLocalized = $groupname;
} else {
$groupnameLocalized = $msg;
}
$msg = wfMsgForContent('grouppage-' . $groupname);
if (wfEmptyMsg('grouppage-' . $groupname, $msg) || $msg == '') {
$grouppageLocalized = MWNamespace::getCanonicalName(NS_PROJECT) . ':' . $groupname;
} else {
$grouppageLocalized = $msg;
}
$grouppage = $sk->makeLink($grouppageLocalized, htmlspecialchars($groupnameLocalized));
$grouplink = $sk->link(SpecialPage::getTitleFor('Listusers'), wfMsgHtml('listgrouprights-members'), array(), array('group' => $group), 'known');
# Add a class when a usergroup contains no members to allow hiding these rows
$classZero = '';
$countUsers = SiteStats::numberingroup($groupname);
if ($countUsers == 0) {
$classZero = ' statistics-group-zero';
}
$text .= $this->formatRow($grouppage . ' ' . $grouplink, $wgLang->formatNum($countUsers), array('class' => 'statistics-group-' . Sanitizer::escapeClass($group) . $classZero));
}
return $text;
}