예제 #1
0
 public function showStatsList($regex_id)
 {
     global $wgOut, $wgLang;
     wfProfileIn(__METHOD__);
     $regexData = new TextRegexCore($this->subList, $regex_id);
     $regexInfo = $regexData->getOneRegex();
     $numStatResults = $regexData->fetchNbrStatResults();
     #---
     if (!empty($regexInfo)) {
         $regexStats = array();
         if ($numStatResults > 0) {
             $regexStats = $regexData->getRegexStats();
         }
         $filter = 'action=stats&id=' . urlencode($regex_id);
         $pager = $wgLang->viewPrevNext(SpecialPage::getTitleFor('TextRegex/' . $this->subList), $this->offset, $this->limit, wfCgiToArray($filter), $numStatResults - $this->offset <= $this->limit);
         $action = htmlspecialchars($this->oTitle->getLocalURL($this->getListBits()));
         $wgOut->setSubTitle(wfMsgExt('textregex-return-mainpage', 'parse', $action));
         $oTmpl = new EasyTemplate(dirname(__FILE__) . "/templates/");
         $oTmpl->set_vars(array("pager" => $pager, "stats_list" => $regexStats, "lang" => $wgLang, "skin" => RequestContext::getMain()->getSkin(), "oTitle" => $this->oTitle, "regexInfo" => $regexInfo, "action" => $action, "numStatResults" => $numStatResults));
         $wgOut->addHTML($oTmpl->render("textregex-stats"));
     } else {
         $wgOut->addHTML(wfMsg('textregex-invalid-regexid'));
     }
     wfProfileOut(__METHOD__);
     return 1;
 }