/** * main() */ public function execute($par) { global $wgRequest, $wgOut, $wgContLang; wfLoadExtensionMessages('Editcount'); $target = isset($par) ? $par : $wgRequest->getText('username'); list($username, $namespace) = $this->extractParamaters($target); $username = Title::newFromText($username); $username = is_object($username) ? $username->getText() : ''; $uid = User::idFromName($username); if ($this->including()) { if ($namespace === null) { if ($uid != 0) { $out = $wgContLang->formatNum(User::edits($uid)); } else { $out = ""; } } else { $out = $wgContLang->formatNum($this->editsInNs($uid, $namespace)); } $wgOut->addHTML($out); } else { if ($uid != 0) { $total = $this->getTotal($nscount = $this->editsByNs($uid)); } $html = new EditcountHTML(); $html->outputHTML($username, $uid, @$nscount, @$total); } }
/** * main() */ function execute($par = null) { global $wgRequest, $wgContLang, $wgSpecialEditCountExludedUsernames; $target = isset($par) ? $par : $wgRequest->getText('username'); if (isset($par) && $par == "User") { global $wgUser; $target = $wgUser->getName(); } list($username, $namespace) = $this->extractParamaters($target); $username = Title::newFromText($username); $username = is_object($username) ? $username->getText() : ''; //FB#1040: block requests for 'Default' username, using a configurable array, could be useful for further blocks if (in_array(strtolower($username), $wgSpecialEditCountExludedUsernames)) { $uid = 0; } else { $uid = User::idFromName($username); } /* take archived revisions count for current wiki into consideration */ $arcount = 0; if ($uid != 0) { $arcount = $this->editsArchived($uid); } if ($this->including()) { if (!isset($namespace)) { if ($uid != 0) { // ADi: can't do that, we need count per wiki // $out = $wgContLang->formatNum( User::edits( $uid ) ); $out = $wgContLang->formatNum($this->getTotal($this->editsByNs($uid)) + $arcount); } else { $out = ""; } } else { if ($uid != 0) { $out = $wgContLang->formatNum($this->editsInNs($uid, $namespace)); } else { $out = ""; } } $this->getOutput()->addHTML($out); } else { $nscount = $nscountAll = array(); $total = $totalAll = 0; if ($uid != 0) { /* show results for current wiki */ $total = $this->getTotal($nscount = $this->editsByNs($uid)); $total += $arcount; // Let archived revisions have their share in percentage /* show results for all wikis */ $totalAll = $this->getTotal($nscountAll = $this->editsByNsAll($uid)); } $html = new EditcountHTML(); $html->outputHTML($username, $uid, $nscount, $arcount, $total, $nscountAll, $totalAll, $this->refreshTimestamps); } }
/** * main() */ function execute($par = null) { global $wgVersion, $wgRequest, $wgOut, $wgContLang, $wgSpecialEditCountExludedUsernames; if (version_compare($wgVersion, '1.5beta4', '<')) { $wgOut->versionRequired('1.5beta4'); return; } $target = isset($par) ? $par : $wgRequest->getText('username'); if (isset($par) && $par == "User") { global $wgUser; $target = $wgUser->getName(); } list($username, $namespace) = $this->extractParamaters($target); $username = Title::newFromText($username); $username = is_object($username) ? $username->getText() : ''; //FB#1040: block requests for 'Default' username, using a configurable array, could be useful for further blocks if (in_array(strtolower($username), $wgSpecialEditCountExludedUsernames)) { $uid = 0; } else { $uid = User::idFromName($username); } if ($this->including()) { if (!isset($namespace)) { if ($uid != 0) { // ADi: can't do that, we need count per wiki // $out = $wgContLang->formatNum( User::edits( $uid ) ); $out = $wgContLang->formatNum($this->getTotal($this->editsByNs($uid))); } else { $out = ""; } } else { if ($uid != 0) { $out = $wgContLang->formatNum($this->editsInNs($uid, $namespace)); } else { $out = ""; } } $wgOut->addHTML($out); } else { $nscount = $nscountAll = array(); if ($uid != 0) { /* show results for current wiki */ $total = $this->getTotal($nscount = $this->editsByNs($uid)); /* show results for all wikis */ $totalAll = $this->getTotal($nscountAll = $this->editsByNsAll($uid)); } $html = new EditcountHTML(); $html->outputHTML($username, $uid, @$nscount, @$total, @$nscountAll, @$totalAll); } }