Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.
   1  <?php
   2  /**

   3   * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $

   4   *

   5   * @package MCManager.includes

   6   * @author Moxiecode

   7   * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.

   8   */
   9  
  10  class SpellChecker {
  11  	 /**

  12  	  * Constructor.

  13  	  *

  14  	  * @param $config Configuration name/value array.

  15  	  */
  16  	public function __construct(&$config) {
  17  	 	 $this->_config = $config;
  18  	 }
  19  
  20      /**

  21       * Old syntax of class constructor. Deprecated in PHP7.

  22       *

  23       * @deprecated since Moodle 3.1

  24       */
  25      public function SpellChecker(&$config) {
  26          debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
  27          self::__construct($config);
  28      }
  29  
  30  	 /**

  31  	  * Simple loopback function everything that gets in will be send back.

  32  	  *

  33  	  * @param $args.. Arguments.

  34  	  * @return {Array} Array of all input arguments. 

  35  	  */
  36  	 function &loopback(/* args.. */) {
  37  	 	 return func_get_args();
  38  	 }
  39  
  40  	 /**

  41  	  * Spellchecks an array of words.

  42  	  *

  43  	  * @param {String} $lang Language code like sv or en.

  44  	  * @param {Array} $words Array of words to spellcheck.

  45  	  * @return {Array} Array of misspelled words.

  46  	  */
  47  	 function &checkWords($lang, $words) {
  48  	 	 return $words;
  49  	 }
  50  
  51  	 /**

  52  	  * Returns suggestions of for a specific word.

  53  	  *

  54  	  * @param {String} $lang Language code like sv or en.

  55  	  * @param {String} $word Specific word to get suggestions for.

  56  	  * @return {Array} Array of suggestions for the specified word.

  57  	  */
  58  	 function &getSuggestions($lang, $word) {
  59  	 	 return array();
  60  	 }
  61  
  62  	 /**

  63  	  * Throws an error message back to the user. This will stop all execution.

  64  	  *

  65  	  * @param {String} $str Message to send back to user.

  66  	  */
  67  	function throwError($str) {
  68  	 	 die('{"result":null,"id":null,"error":{"errstr":"' . addslashes($str) . '","errfile":"","errline":null,"errcontext":"","level":"FATAL"}}');
  69  	 }
  70  }
  71  
  72  ?>