/**
  * Display form for testing spell checking feature
  */
 function spellCheckingForm($languages)
 {
     $fields = array('text' => array('class' => 'HTMLTextField', 'label-message' => 'spellchecker-info-spellcheck-text'), 'lang' => array('class' => 'HTMLSelectField', 'label-message' => 'spellchecker-info-spellcheck-languages', 'options' => array_combine($languages, $languages)));
     $form = new HTMLForm($fields);
     $form->setTitle($this->title);
     $form->setSubmitText($this->app->runFunction('wfMsg', 'spellchecker-info-spellcheck-submit'));
     $form->loadData();
     $form->displayForm('');
     // page was POSTed, perform spell cheking
     if ($this->request->wasPosted()) {
         $text = $this->request->getText('wptext');
         $langCode = $this->request->getText('wplang');
         // create spell checking service
         $service = new SpellCheckerService($langCode);
         $info = $service->getInfo();
         // check the spelling (returns true or array of spelling suggestions)
         $data = $service->checkWord($text);
         // print out results
         if ($data === true) {
             $result = $this->app->runFunction('wfMsg', 'spellchecker-info-spellcheck-is-correct', $text);
         } else {
             $result = $this->app->runFunction('wfMsg', 'spellchecker-info-spellcheck-suggestions', $text, implode(', ', $data));
         }
         $this->out->addHtml("<p>{$result}</p>");
         $this->out->addHtml("<p><small>{$info['desc']} / {$info['lang']}</small></p>");
     }
 }