public function getAverageCount(&$dbr) { $standings = new SpellcheckerStandingsGroup(); return $standings->getStandingByIndex(self::GLOBAL_WIDGET_MEDIAN); }
function execute($par) { global $wgOut, $wgRequest, $wgUser, $wgHooks; $wgHooks['getBreadCrumbs'][] = array('Spellchecker::getBreadCrumbsCallback'); if ($wgUser->isBlocked()) { $wgOut->blockedPage(); return; } if ($wgUser->getID() == 0) { $wgOut->setRobotpolicy('noindex,nofollow'); $wgOut->showErrorPage('nosuchspecialpage', 'nospecialpagetext'); return; } //start temp code for taking down tool /* wfLoadExtensionMessages("Spellchecker"); $wgOut->setHTMLTitle(wfMsg('spellchecker')); $wgOut->setPageTitle(wfMsg('spellchecker')); $wgOut->addWikiText("This tool is temporarily down for maintenance. Please check out the [[Special:CommunityDashboard|Community Dashboard]] for other ways to contribute while we iron out a few issues with this tool. Happy editing!"); return; */ //end temp code /*if ( !($wgUser->isSysop() || in_array( 'newarticlepatrol', $wgUser->getRights()) ) ) { $wgOut->setRobotpolicy( 'noindex,nofollow' ); $wgOut->showErrorPage( 'nosuchspecialpage', 'nospecialpagetext' ); return; }*/ wfLoadExtensionMessages("Spellchecker"); $this->skipTool = new ToolSkip("spellchecker", "spellchecker", "sc_checkout", "sc_checkout_user", "sc_page"); if ($wgRequest->getVal('getNext')) { $wgOut->disable(); if ($wgRequest->getVal('articleName')) { $articleName = $wgRequest->getVal('articleName'); } else { $articleName = ""; } $result = self::getNextArticle($articleName); print_r(json_encode($result)); return; } else { if ($wgRequest->getVal('edit')) { $wgOut->disable(); $id = $wgRequest->getVal('id'); $result = $this->getArticleEdit($id); print_r(json_encode($result)); return; } else { if ($wgRequest->getVal('skip')) { $wgOut->disable(); $id = $wgRequest->getVal('id'); $this->skipTool->skipItem($id); $this->skipTool->unUseItem($id); $result = self::getNextArticle(); print_r(json_encode($result)); return; } else { if ($wgRequest->getVal('cache')) { $this->skipTool->clearSkipCache(); } else { if ($wgRequest->getVal('addWord')) { $wgOut->setArticleBodyOnly(true); $result->success = wikiHowDictionary::addWordToDictionary($wgRequest->getVal('word')); print_r(json_encode($result)); return; } else { if ($wgRequest->getVal('addWords')) { $wgOut->setArticleBodyOnly(true); $result->success = wikiHowDictionary::addWordsToDictionary($wgRequest->getArray('words')); print_r(json_encode($result)); return; } else { if ($wgRequest->wasPosted()) { $wgOut->setArticleBodyOnly(true); if ($wgRequest->getVal('submitEditForm')) { //user has edited the article from within the Spellchecker tool $wgOut->disable(); $this->submitEdit(); $result = self::getNextArticle(); print_r(json_encode($result)); return; } } } } } } } } $wgOut->setHTMLTitle(wfMsg('spellchecker')); $wgOut->setPageTitle(wfMsg('spellchecker')); $wgOut->addHTML(HtmlSnips::makeUrlTags('css', array('spellchecker.css'), 'extensions/wikihow/spellchecker', false)); $wgOut->addScript(HtmlSnips::makeUrlTags('js', array('spellchecker.js'), 'extensions/wikihow/spellchecker', false)); $tmpl = new EasyTemplate(dirname(__FILE__)); $setVars = $wgUser->isSysop() || in_array('newarticlepatrol', $wgUser->getRights()); $tmpl->set_vars(array('addWords' => $setVars)); $wgOut->addHTML($tmpl->execute('Spellchecker.tmpl.php')); // add standings widget $group = new SpellcheckerStandingsGroup(); $indi = new SpellcheckerStandingsIndividual(); $indi->addStatsWidget(); $group->addStandingsWidget(); }