20 $this->skip_len =
$params[
"skip_length"];
22 $this->pspell = (function_exists(
'pspell_config_create') && (
$params[
"use_pspell"] ==
"Y"));
24 $this->custom_spell =
false;
25 $this->pspell_mode =
$params[
"mode"];
27 $this->dics_path = $this->checkDicPath();
28 $this->user_dics_path = $this->dics_path.
"/custom.pws";
29 $this->custom_dics_path = $this->dics_path.
'/custom_dics/'.$this->
lang.
'_';
31 if($this->custom_spell)
38 $pspell_config = pspell_config_create ($this->
lang,
null,
null,
'utf-8');
39 pspell_config_ignore($pspell_config, $this->skip_len);
40 pspell_config_mode($pspell_config,
$params[
"mode"]);
41 pspell_config_personal($pspell_config, $this->user_dics_path);
42 $this->pspell_link = pspell_new_config($pspell_config);
46 private function checkDicPath()
49 $dics_path =
$_SERVER[
"DOCUMENT_ROOT"].COption::GetOptionString(
'fileman',
"user_dics_path",
"/bitrix/modules/fileman/u_dics");
53 if (COption::GetOptionString(
'fileman',
"use_separeted_dics",
"Y") ==
"Y")
55 $custom_path = $custom_path.
'/'.
$USER->GetID();
59 if(!
$io->DirectoryExists($custom_path))
61 $io->CreateDirectory($custom_path);
69 return (in_array($letter, $this->letters) && $letter !=
'ы' && $letter !=
'ь' && $letter !=
'ъ') ? ord($letter) :
'def';
74 $path = $this->custom_dics_path.$letter.
'.dic';
75 if (is_readable(
$path))
78 foreach ($dic as $dict_word)
80 $this->dic[$letter][mb_strtolower(trim($dict_word))] = $dict_word;
84 $this->dic[$letter] =
array();
92 return pspell_check($this->pspell_link, $word);
99 $this->wrongWords =
array();
105 $this->wrongWords[] =
array(
112 return $this->wrongWords;
117 $suggestions =
array();
121 $suggestions = pspell_suggest($this->pspell_link, $word);
123 return array_unique($suggestions);
131 if (!pspell_add_to_personal($this->pspell_link, $word) || !pspell_save_wordlist($this->pspell_link))
if(!defined('SITE_ID')) $lang