public function __construct() { $this->_errors = POCErrorsHolder::Instance(); $this->_pocInstance = PieceOfCode::Instance(); $this->_storeCodes = POCStoredCodes::Instance(); $this->clear(); }
/** * @todo doc * @param $fontcode Is the list of parameter gotten from URL. */ protected function statPagesByCode(array &$fontcode) { global $wgOut; global $wgPieceOfCodeConfig; if ($wgPieceOfCodeConfig['stats']) { $out = ""; $code = POCStoredCodes::Instance()->getByCode($fontcode['code']); if ($this->_errors->ok()) { $this->appendTOC($out); $out .= "== " . wfMsg('poc-sinfo-information') . " ==\n"; $out .= "*'''" . wfMsg('poc-sinfo-connection') . "''': {$code['connection']}\n"; $out .= "*'''" . wfMsg('poc-sinfo-path') . "''': {$code['path']}\n"; $out .= "*'''" . wfMsg('poc-sinfo-revision') . "''': {$code['revision']}\n"; $out .= "*'''" . wfMsg('poc-sinfo-lang') . "''': {$code['lang']}\n"; $auxUrl = Title::makeTitle(NS_USER, $code['user'])->getFullURL(); $out .= "*'''" . wfMsg('poc-sinfo-user') . "''': [[User:{$code['user']}|{$code['user']}]]\n"; $auxUrl = Title::makeTitle(NS_SPECIAL, 'PieceOfCode')->escapeFullURL("action=show&connection={$code['connection']}&path={$code['path']}&revision={$code['revision']}"); $out .= "*[{$auxUrl} " . wfMsg('poc-view-source') . "]\n"; $out .= "== " . wfMsg('poc-sinfo-usage') . " ==\n"; $out .= "{|class=\"wikitable sortable\"\n"; $out .= "|-\n"; $out .= "!" . wfMsg('poc-sinfo-page') . "\n"; $out .= "!" . wfMsg('poc-sinfo-stored-codes-count') . "\n"; $out .= "!" . wfMsg('poc-sinfo-stored-codes-user') . "\n"; foreach (POCStats::Instance()->getCodePages($fontcode['code']) as $c) { $out .= "|-\n"; $auxPage = Title::newFromID($c['page_id']); $title = $c['title']; /* * Checking if it isn't the default namesapace. */ if ($auxPage->getNamespace() != NS_MAIN) { $title = $auxPage->getNsText() . $title; } $out .= "|[[{$title}]]\n"; $out .= "|{$c['times']}\n"; $out .= "|[[User:{$c['last_user']}|{$c['last_user']}]]\n"; } $out .= "|}\n"; $out .= "== " . wfMsg('poc-sinfo-history') . " ==\n"; $out .= "{|class=\"wikitable\"\n"; $out .= "|-\n"; $out .= "!" . wfMsg('poc-sinfo-stored-codes-action') . "\n"; $out .= "!" . wfMsg('poc-sinfo-stored-codes-user') . "\n"; $out .= "!" . wfMsg('poc-sinfo-stored-codes-description') . "\n"; $out .= "!" . wfMsg('poc-sinfo-stored-codes-timestamp') . "\n"; foreach ($this->_history->getHistory($fontcode['code']) as $h) { $out .= "|-\n"; $out .= "|" . wfMsg('poc-sinfo-history-' . $h['action']) . "\n"; $out .= "|[[User:{$h['user']}|{$h['user']}]]\n"; $out .= "|{$h['description']}\n"; $out .= "|{$h['timestamp']}\n"; } $out .= "|}\n"; $out .= "== " . wfMsg('poc-sinfo-links') . " ==\n"; $out .= "*[[Special:PieceOfCode|Back]]\n"; } else { $out .= $this->_errors->getLastError(); } $wgOut->addWikiText($out); } else { $wgOut->addHTML($this->_errors->setLastError(wfMsg('poc-errmsg-stats-disabled'))); } }