function getSpellingResults($data, $lang) { // connect and get results global $SPELLCHECKER_PROXY_URL, $SPELLCHECKER_PROXY_PORT, $SPELLCHECKER_PROXY_USER, $SPELLCHECKER_PROXY_PASS; //$resultsXML=stripslashes($_POST['wproSpellcheckerResultsXML']); require_once WPRO_DIR . 'core/libs/wproWebAgent.class.php'; $fs = new wproWebAgent(); $fs->proxyURL = $SPELLCHECKER_PROXY_URL; $fs->proxyPort = $SPELLCHECKER_PROXY_PORT; $fs->proxyUser = $SPELLCHECKER_PROXY_USER; $fs->proxyPass = $SPELLCHECKER_PROXY_PASS; $fs->requestMethod = 'POST'; // create XML $fs->postData = array('XMLRequest' => '<xml version="1.0"><wproSpellcheckerQuery version="1.0"><dictionary>' . htmlspecialchars($lang) . '</dictionary><bodyHTML>' . htmlspecialchars($data) . '</bodyHTML></wproSpellcheckerQuery>'); if ($resultsXML = $fs->fetch(WPRO_CENTRAL_SPELLCHECKER_URL)) { $this->XMLCollection = new DOMIT_Lite_Document(); $this->XMLCollection->resolveErrors(true); if (!@$this->XMLCollection->parseXML($resultsXML, false)) { exit("<strong>WysiwygPro SpellChecker error</strong>: XML Parser Error: " . $this->XMLCollection->getErrorString()); } $textNode =& $this->XMLCollection->documentElement->childNodes[0]->firstChild; if ($textNode != NULL) { exit("<p><strong>WysiwygPro Central SpellChecker error</strong>: " . htmlspecialchars($textNode->toString()) . "</p>"); } } else { exit("<strong>WysiwygPro SpellChecker error</strong>: Connection Error: Failed to connect to remote server"); } // get dictionaries $this->mode = 'showResults'; $availDicts = $this->getAvailableDictionaries(); $lang = $this->getLang($lang); $words_elem = array(); if ($this->mode == 'showResults') { // process the results from the results XML $nodes =& $this->XMLCollection->documentElement->getElementsByTagName('missSpelt'); if ($nodes != null) { $n = $nodes->getLength(); for ($i = 0; $i < $n; $i++) { $node =& $nodes->item($i); $words_elem[$this->htmlentityDecode($node->getAttribute('word'))] = $this->htmlentityDecode($node->getAttribute('suggestions')); } } } return $words_elem; }
function loadValueFromURL($url, $authUser = '', $authPass = '', $proxyURL = '', $proxyPort = 0, $proxyUser = '', $proxyPass = '') { $this->baseURL = $url; require_once WPRO_DIR . 'core/libs/wproWebAgent.class.php'; $fs = new wproWebAgent(); $fs->proxyURL = $proxyURL; $fs->proxyPort = $proxyPort; $fs->proxyUser = $proxyUser; $fs->proxyPass = $proxyPass; $fs->authUser = $authUser; $fs->authPass = $authPass; if ($html = $fs->fetch($url)) { $this->value = $html; } }