Skip to content

Commit

Permalink
Bring back spell.roundcube.net as integrated spelling service but dis…
Browse files Browse the repository at this point in the history
…able by default (#8182)

This partially reverts commit 92757f5.
  • Loading branch information
thomascube committed Oct 4, 2021
1 parent 6ed101f commit 2a055b7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
11 changes: 7 additions & 4 deletions config/defaults.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -909,25 +909,28 @@
// if in your system 0 quota means no limit set this option to true
$config['quota_zero_as_unlimited'] = false;

// Make use of the built-in spell checker. It is based on GoogieSpell.
// Make use of the built-in spell checker.
$config['enable_spellcheck'] = false;

// Enables spellchecker exceptions dictionary.
// Setting it to 'shared' will make the dictionary shared by all users.
$config['spellcheck_dictionary'] = false;

// Set the spell checking engine. Possible values:
// - 'googie' - requires 'spellcheck_uri' option to be set (also used for connecting to Nox Spell Server)
// - 'googie' - the default (also used for connecting to Nox Spell Server, see 'spellcheck_uri' setting)
// - 'pspell' - requires the PHP Pspell module and aspell installed
// - 'enchant' - requires the PHP Enchant module
// - 'atd' - install your own After the Deadline server or check with the people at http://www.afterthedeadline.com before using their API
// Since Google shut down their public spell checking service, the default settings
// connect to http://spell.roundcube.net which is a hosted service provided by Roundcube.
// You can connect to any other googie-compliant service by setting 'spellcheck_uri' accordingly.
$config['spellcheck_engine'] = 'googie';

// For locally installed Nox Spell Server or After the Deadline services,
// please specify the URI to call it.
// Get Nox Spell Server from https://github.com/handwritingio/nox_spell_server or
// the After the Deadline package from http://www.afterthedeadline.com
// Get Nox Spell Server from http://orangoo.com/labs/?page_id=72 or
// the After the Deadline package from http://www.afterthedeadline.com.
// Leave empty to use the public API of service.afterthedeadline.com
$config['spellcheck_uri'] = '';

// These languages can be selected for spell checking.
Expand Down
14 changes: 6 additions & 8 deletions program/lib/Roundcube/spellchecker/googie.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
*/
class rcube_spellchecker_googie extends rcube_spellchecker_engine
{
const GOOGIE_HOST = 'https://spell.roundcube.net';

private $matches = [];
private $content;

Expand Down Expand Up @@ -67,15 +69,11 @@ function check($text)
// spell check uri is configured
$url = $rcube->config->get('spellcheck_uri');

if (empty($url)) {
$this->error = "Missing 'spellcheck_uri' config option";
return $matches;
}
if (strpos($url, '%s') !== false) {
$url = sprintf($url, $this->lang);
} else {
$url .= $this->lang;
if (!$url) {
$url = self::GOOGIE_HOST . '/tbproxy/spell?lang=';
}
$url .= $this->lang;
$url .= sprintf('&key=%06d', !empty($_SESSION['user_id']) ? $_SESSION['user_id'] : 0);

$gtext = '<?xml version="1.0" encoding="utf-8" ?>'
.'<spellrequest textalreadyclipped="0" ignoredups="0" ignoredigits="1" ignoreallcaps="1">'
Expand Down

0 comments on commit 2a055b7

Please sign in to comment.