function execute() { $this->out->setPageTitle($this->app->runFunction('wfMsg', 'spellchecker-info')); // get information about enchant $dict = new SpellCheckerDictionary(); // show list of all supported lanuages $languages = $dict->getLanguages(); $rows = array(); foreach ($languages as $lang) { $rows[] = array($lang); } $this->out->addHtml(Xml::buildTable($rows, array('class' => 'wikitable'), array($this->app->runFunction('wfMsg', 'spellchecker-info-languages', count($languages))))); // list providers $providers = $dict->getProviders(); $rows = array(); foreach ($providers as $provider => $dictionaries) { sort($dictionaries); $count = count($dictionaries); $rows[] = array($provider, implode(', ', $dictionaries) . " ({$count})"); } $this->out->addHtml(Xml::buildTable($rows, array('class' => 'wikitable'), array($this->app->runFunction('wfMsg', 'spellchecker-info-provider'), $this->app->runFunction('wfMsg', 'spellchecker-info-dictionaries')))); // spell checking demo $this->out->addHtml(Xml::element('hr')); $this->spellCheckingForm($languages); }
/** * Add JavaScript variable with path to be used by AJAX requests sent by RTE plugin */ public function onRTEAddGlobalVariablesScript(array &$vars) { wfProfileIn(__METHOD__); // check user preferences (enabled by default) if ($this->user->getOption('disablespellchecker')) { wfDebug(__METHOD__ . ": spell checker disabled in user preferences\n"); return true; } // check whether current content lang is supported by spellchecker $dict = new SpellCheckerDictionary(); if ($dict->isLanguageSupported($this->contentLanguage)) { $vars['wgSpellCheckerLangIsSupported'] = true; $vars['wgSpellCheckerUrl'] = "{$this->script}?action=ajax&rs=SpellCheckerAjax"; } wfProfileOut(__METHOD__); return true; }