PageRenderTime 38ms CodeModel.GetById 13ms RepoModel.GetById 0ms app.codeStats 0ms

/scripts/xinha/plugins/SpellChecker/spell-check-savedicts.php

https://github.com/radicaldesigns/amp
PHP | 38 lines | 35 code | 3 blank | 0 comment | 3 complexity | e8b9b4eb1ef42d39972130d07926c37e MD5 | raw file
Possible License(s): LGPL-2.1, GPL-2.0, BSD-3-Clause, LGPL-2.0, CC-BY-SA-3.0, AGPL-1.0
  1. <?php
  2. require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'aspell_setup.php');
  3. $to_p_dict = $_REQUEST['to_p_dict'] ? $_REQUEST['to_p_dict'] : array();
  4. $to_r_list = $_REQUEST['to_r_list'] ? $_REQUEST['to_r_list'] : array();
  5. print_r($to_r_list);
  6. if($to_p_dict || $to_r_list)
  7. {
  8. if($fh = fopen($temptext, 'w'))
  9. {
  10. foreach($to_p_dict as $personal_word)
  11. {
  12. $cmd = '&' . $personal_word . "\n";
  13. echo $cmd;
  14. fwrite($fh, $cmd, strlen($cmd));
  15. }
  16. foreach($to_r_list as $replace_pair)
  17. {
  18. $cmd = '$$ra ' . $replace_pair[0] . ' , ' . $replace_pair[1] . "\n";
  19. echo $cmd;
  20. fwrite($fh, $cmd, strlen($cmd));
  21. }
  22. $cmd = "#\n";
  23. echo $cmd;
  24. fwrite($fh, $cmd, strlen($cmd));
  25. fclose($fh);
  26. }
  27. else
  28. {
  29. die("Can't Write");
  30. }
  31. echo $aspellcommand."\n";
  32. echo shell_exec($aspellcommand . ' 2>&1');
  33. unlink($temptext);
  34. }
  35. ?>