本文整理汇总了PHP中SiteStats::admins方法的典型用法代码示例。如果您正苦于以下问题:PHP SiteStats::admins方法的具体用法?PHP SiteStats::admins怎么用?PHP SiteStats::admins使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SiteStats
的用法示例。
在下文中一共展示了SiteStats::admins方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: admins
static function admins()
{
if (!isset(self::$admins)) {
$dbr =& wfGetDB(DB_SLAVE);
self::$admins = $dbr->selectField('user_groups', 'COUNT(*)', array('ug_group' => 'sysop'), __METHOD__);
}
return self::$admins;
}
示例2: wfSpecialStatistics
/**
* Show the special page
*
* @param mixed $par (not used)
*/
function wfSpecialStatistics($par = '')
{
global $wgOut, $wgLang, $wgRequest;
$dbr = wfGetDB(DB_SLAVE);
$views = SiteStats::views();
$edits = SiteStats::edits();
$good = SiteStats::articles();
$images = SiteStats::images();
$total = SiteStats::pages();
$users = SiteStats::users();
$admins = SiteStats::admins();
$numJobs = SiteStats::jobs();
if ($wgRequest->getVal('action') == 'raw') {
$wgOut->disable();
header('Pragma: nocache');
echo "total={$total};good={$good};views={$views};edits={$edits};users={$users};admins={$admins};images={$images};jobs={$numJobs}\n";
return;
} else {
$text = "__NOTOC__\n";
$text .= '==' . wfMsg('sitestats') . "==\n";
$text .= wfMsgExt('sitestatstext', array('parsemag'), $wgLang->formatNum($total), $wgLang->formatNum($good), $wgLang->formatNum($views), $wgLang->formatNum($edits), $wgLang->formatNum(sprintf('%.2f', $total ? $edits / $total : 0)), $wgLang->formatNum(sprintf('%.2f', $edits ? $views / $edits : 0)), $wgLang->formatNum($numJobs), $wgLang->formatNum($images)) . "\n";
$text .= "==" . wfMsg('userstats') . "==\n";
$text .= wfMsgExt('userstatstext', array('parsemag'), $wgLang->formatNum($users), $wgLang->formatNum($admins), '[[' . wfMsgForContent('grouppage-sysop') . ']]', $wgLang->formatNum(sprintf('%.2f', $admins / $users * 100)), User::makeGroupLinkWiki('sysop')) . "\n";
global $wgDisableCounters, $wgMiserMode, $wgUser, $wgLang, $wgContLang;
if (!$wgDisableCounters && !$wgMiserMode) {
$res = $dbr->select('page', array('page_namespace', 'page_title', 'page_counter'), array('page_is_redirect' => 0, 'page_counter > 0'), __METHOD__, array('ORDER BY' => 'page_counter DESC', 'LIMIT' => 10));
if ($res->numRows() > 0) {
$text .= "==" . wfMsg('statistics-mostpopular') . "==\n";
while ($row = $res->fetchObject()) {
$title = Title::makeTitleSafe($row->page_namespace, $row->page_title);
if ($title instanceof Title) {
$text .= '* [[:' . $title->getPrefixedText() . ']] (' . $wgLang->formatNum($row->page_counter) . ")\n";
}
}
$res->free();
}
}
$footer = wfMsg('statistics-footer');
if (!wfEmptyMsg('statistics-footer', $footer) && $footer != '') {
$text .= "\n" . $footer;
}
$wgOut->addWikiText($text);
}
}
示例3: appendStatistics
protected function appendStatistics($property)
{
$data = array();
$data['pages'] = intval(SiteStats::pages());
$data['articles'] = intval(SiteStats::articles());
$data['views'] = intval(SiteStats::views());
$data['edits'] = intval(SiteStats::edits());
$data['images'] = intval(SiteStats::images());
$data['users'] = intval(SiteStats::users());
$data['admins'] = intval(SiteStats::admins());
$data['jobs'] = intval(SiteStats::jobs());
$this->getResult()->addValue('query', $property, $data);
}
示例4: getVariableValue
//.........这里部分代码省略.........
wfDebug(__METHOD__ . ": {{REVISIONDAY2}} used, setting vary-revision...\n");
return substr($this->getRevisionTimestamp(), 6, 2);
case 'revisionmonth':
// 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__ . ": {{REVISIONMONTH}} used, setting vary-revision...\n");
return intval(substr($this->getRevisionTimestamp(), 4, 2));
case 'revisionyear':
// 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__ . ": {{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 '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 'numberofpages':
return $this->mVarCache[$index] = $wgContLang->formatNum(SiteStats::pages());
case 'numberofadmins':
return $this->mVarCache[$index] = $wgContLang->formatNum(SiteStats::admins());
case 'numberofedits':
return $this->mVarCache[$index] = $wgContLang->formatNum(SiteStats::edits());
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;
}
}
}
示例5: getVariableValue
//.........这里部分代码省略.........
return $talkPage->getPrefixedUrl();
} else {
return '';
}
case 'subjectpagename':
$subjPage = $this->mTitle->getSubjectPage();
return $subjPage->getPrefixedText();
case 'subjectpagenamee':
$subjPage = $this->mTitle->getSubjectPage();
return $subjPage->getPrefixedUrl();
case 'revisionid':
return $this->mRevisionId;
case 'revisionday':
return intval(substr($this->getRevisionTimestamp(), 6, 2));
case 'revisionday2':
return substr($this->getRevisionTimestamp(), 6, 2);
case 'revisionmonth':
return intval(substr($this->getRevisionTimestamp(), 4, 2));
case 'revisionyear':
return substr($this->getRevisionTimestamp(), 0, 4);
case 'revisiontimestamp':
return $this->getRevisionTimestamp();
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 $varCache[$index] = $wgContLang->getWeekdayName(date('w', $ts) + 1);
case 'currentyear':
return $varCache[$index] = $wgContLang->formatNum(date('Y', $ts), true);
case 'currenttime':
return $varCache[$index] = $wgContLang->time(wfTimestamp(TS_MW, $ts), false, false);
case 'currenthour':
return $varCache[$index] = $wgContLang->formatNum(date('H', $ts), true);
case 'currentweek':
// @bug 4594 PHP5 has it zero padded, PHP4 does not, cast to
// int to remove the padding
return $varCache[$index] = $wgContLang->formatNum((int) date('W', $ts));
case 'currentdow':
return $varCache[$index] = $wgContLang->formatNum(date('w', $ts));
case 'localdayname':
return $varCache[$index] = $wgContLang->getWeekdayName($localDayOfWeek + 1);
case 'localyear':
return $varCache[$index] = $wgContLang->formatNum($localYear, true);
case 'localtime':
return $varCache[$index] = $wgContLang->time($localTimestamp, false, false);
case 'localhour':
return $varCache[$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 $varCache[$index] = $wgContLang->formatNum((int) $localWeek);
case 'localdow':
return $varCache[$index] = $wgContLang->formatNum($localDayOfWeek);
case 'numberofarticles':
return $varCache[$index] = $wgContLang->formatNum(SiteStats::articles());
case 'numberoffiles':
return $varCache[$index] = $wgContLang->formatNum(SiteStats::images());
case 'numberofusers':
return $varCache[$index] = $wgContLang->formatNum(SiteStats::users());
case 'numberofpages':
return $varCache[$index] = $wgContLang->formatNum(SiteStats::pages());
case 'numberofadmins':
return $varCache[$index] = $wgContLang->formatNum(SiteStats::admins());
case 'currenttimestamp':
return $varCache[$index] = wfTimestampNow();
case 'localtimestamp':
return $varCache[$index] = $localTimestamp;
case 'currentversion':
return $varCache[$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, &$varCache, &$index, &$ret))) {
return $ret;
} else {
return null;
}
}
}