Hacked By AnonymousFox

Current Path : /home/missmand/public_html/js/lightbox/
Upload File :
Current File : /home/missmand/public_html/js/lightbox/spellchecker.tar

changelog.txt000064400000000163151775523340007250 0ustar00Version 4.0 (2014-04-16)
	Initial version of the spellchecker for TinyMCE 4.0 supports Enchant and PSpell engines.
dicts/readme.md000064400000000105151775523340007441 0ustar00Add your dictionary files here for example en_GB.dic and en_GB.aff.
plugin.min.js000064400000022265151775523340007205 0ustar00!function(a,b){"use strict";function c(a,b){for(var c,d=[],f=0;f<a.length;++f){if(c=g[a[f]]||e(a[f]),!c)throw"module definition dependecy not found: "+a[f];d.push(c)}b.apply(null,d)}function d(a,d,e){if("string"!=typeof a)throw"invalid module definition, module id must be defined and be a string";if(d===b)throw"invalid module definition, dependencies must be specified";if(e===b)throw"invalid module definition, definition function must be specified";c(d,function(){g[a]=e.apply(null,arguments)})}function e(b){for(var c=a,d=b.split(/[.\/]/),e=0;e<d.length;++e){if(!c[d[e]])return;c=c[d[e]]}return c}function f(c){for(var d=0;d<c.length;d++){for(var e=a,f=c[d],h=f.split(/[.\/]/),i=0;i<h.length-1;++i)e[h[i]]===b&&(e[h[i]]={}),e=e[h[i]];e[h[h.length-1]]=g[f]}}var g={};d("tinymce/spellcheckerplugin/DomTextMatcher",[],function(){return function(a,b){function c(a,b){if(!a[0])throw"findAndReplaceDOMText cannot handle zero-length matches";return{start:a.index,end:a.index+a[0].length,text:a[0],data:b}}function d(a){var b;if(3===a.nodeType)return a.data;if(x[a.nodeName]&&!w[a.nodeName])return"";if(b="",(w[a.nodeName]||y[a.nodeName])&&(b+="\n"),a=a.firstChild)do b+=d(a);while(a=a.nextSibling);return b}function e(a,b,c){var d,e,f,g,h,i=[],j=0,k=a,l=0;b=b.slice(0),b.sort(function(a,b){return a.start-b.start}),h=b.shift();a:for(;;){if((w[k.nodeName]||y[k.nodeName])&&j++,3===k.nodeType&&(!e&&k.length+j>=h.end?(e=k,g=h.end-j):d&&i.push(k),!d&&k.length+j>h.start&&(d=k,f=h.start-j),j+=k.length),d&&e){if(k=c({startNode:d,startNodeIndex:f,endNode:e,endNodeIndex:g,innerNodes:i,match:h.text,matchIndex:l}),j-=e.length-g,d=null,e=null,i=[],h=b.shift(),l++,!h)break}else{if((!x[k.nodeName]||w[k.nodeName])&&k.firstChild){k=k.firstChild;continue}if(k.nextSibling){k=k.nextSibling;continue}}for(;;){if(k.nextSibling){k=k.nextSibling;break}if(k.parentNode===a)break a;k=k.parentNode}}}function f(a){function b(b,c){var d=z[c];d.stencil||(d.stencil=a(d));var e=d.stencil.cloneNode(!1);return e.setAttribute("data-mce-index",c),b&&e.appendChild(A.doc.createTextNode(b)),e}return function(a){var c,d,e,f=a.startNode,g=a.endNode,h=a.matchIndex,i=A.doc;if(f===g){var j=f;e=j.parentNode,a.startNodeIndex>0&&(c=i.createTextNode(j.data.substring(0,a.startNodeIndex)),e.insertBefore(c,j));var k=b(a.match,h);return e.insertBefore(k,j),a.endNodeIndex<j.length&&(d=i.createTextNode(j.data.substring(a.endNodeIndex)),e.insertBefore(d,j)),j.parentNode.removeChild(j),k}c=i.createTextNode(f.data.substring(0,a.startNodeIndex)),d=i.createTextNode(g.data.substring(a.endNodeIndex));for(var l=b(f.data.substring(a.startNodeIndex),h),m=[],n=0,o=a.innerNodes.length;o>n;++n){var p=a.innerNodes[n],q=b(p.data,h);p.parentNode.replaceChild(q,p),m.push(q)}var r=b(g.data.substring(0,a.endNodeIndex),h);return e=f.parentNode,e.insertBefore(c,f),e.insertBefore(l,f),e.removeChild(f),e=g.parentNode,e.insertBefore(r,g),e.insertBefore(d,g),e.removeChild(g),r}}function g(a){var b=a.parentNode;b.insertBefore(a.firstChild,a),a.parentNode.removeChild(a)}function h(b){var c=a.getElementsByTagName("*"),d=[];b="number"==typeof b?""+b:null;for(var e=0;e<c.length;e++){var f=c[e],g=f.getAttribute("data-mce-index");null!==g&&g.length&&(g===b||null===b)&&d.push(f)}return d}function i(a){for(var b=z.length;b--;)if(z[b]===a)return b;return-1}function j(a){var b=[];return k(function(c,d){a(c,d)&&b.push(c)}),z=b,this}function k(a){for(var b=0,c=z.length;c>b&&a(z[b],b)!==!1;b++);return this}function l(b){return z.length&&e(a,z,f(b)),this}function m(a,b){if(v&&a.global)for(;u=a.exec(v);)z.push(c(u,b));return this}function n(a){var b,c=h(a?i(a):null);for(b=c.length;b--;)g(c[b]);return this}function o(a){return z[a.getAttribute("data-mce-index")]}function p(a){return h(i(a))[0]}function q(a,b,c){return z.push({start:a,end:a+b,text:v.substr(a,b),data:c}),this}function r(a){var c=h(i(a)),d=b.dom.createRng();return d.setStartBefore(c[0]),d.setEndAfter(c[c.length-1]),d}function s(a,c){var d=r(a);return d.deleteContents(),c.length>0&&d.insertNode(b.dom.doc.createTextNode(c)),d}function t(){return z.splice(0,z.length),n(),this}var u,v,w,x,y,z=[],A=b.dom;return w=b.schema.getBlockElements(),x=b.schema.getWhiteSpaceElements(),y=b.schema.getShortEndedElements(),v=d(a),{text:v,matches:z,each:k,filter:j,reset:t,matchFromElement:o,elementFromMatch:p,find:m,add:q,wrap:l,unwrap:n,replace:s,rangeFromMatch:r,indexOf:i}}}),d("tinymce/spellcheckerplugin/Plugin",["tinymce/spellcheckerplugin/DomTextMatcher","tinymce/PluginManager","tinymce/util/Tools","tinymce/ui/Menu","tinymce/dom/DOMUtils","tinymce/util/XHR","tinymce/util/URI","tinymce/util/JSON"],function(a,b,c,d,e,f,g,h){b.add("spellchecker",function(b,i){function j(){return E.textMatcher||(E.textMatcher=new a(b.getBody(),b)),E.textMatcher}function k(a,b){var d=[];return c.each(b,function(a){d.push({selectable:!0,text:a.name,data:a.value})}),d}function l(a){for(var b in a)return!1;return!0}function m(a,f){var g=[],h=A[a];c.each(h,function(a){g.push({text:a,onclick:function(){b.insertContent(b.dom.encode(a)),b.dom.remove(f),r()}})}),g.push({text:"-"}),D&&g.push({text:"Add to Dictionary",onclick:function(){s(a,f)}}),g.push.apply(g,[{text:"Ignore",onclick:function(){t(a,f)}},{text:"Ignore all",onclick:function(){t(a,f,!0)}}]),C=new d({items:g,context:"contextmenu",onautohide:function(a){-1!=a.target.className.indexOf("spellchecker")&&a.preventDefault()},onhide:function(){C.remove(),C=null}}),C.renderTo(document.body);var i=e.DOM.getPos(b.getContentAreaContainer()),j=b.dom.getPos(f[0]),k=b.dom.getRoot();"BODY"==k.nodeName?(j.x-=k.ownerDocument.documentElement.scrollLeft||k.scrollLeft,j.y-=k.ownerDocument.documentElement.scrollTop||k.scrollTop):(j.x-=k.scrollLeft,j.y-=k.scrollTop),i.x+=j.x,i.y+=j.y,C.moveTo(i.x,i.y+f[0].offsetHeight)}function n(){return b.getParam("spellchecker_wordchar_pattern")||new RegExp('[^\\s!"#$%&()*+,-./:;<=>?@[\\]^_{|}`\xa7\xa9\xab\xae\xb1\xb6\xb7\xb8\xbb\xbc\xbd\xbe\xbf\xd7\xf7\xa4\u201d\u201c\u201e\xa0\u2002\u2003\u2009]+',"g")}function o(a,b,d,e){var j={method:a},k="";"spellcheck"==a&&(j.text=b,j.lang=F.spellchecker_language),"addToDictionary"==a&&(j.word=b),c.each(j,function(a,b){k&&(k+="&"),k+=b+"="+encodeURIComponent(a)}),f.send({url:new g(i).toAbsolute(F.spellchecker_rpc_url),type:"post",content_type:"application/x-www-form-urlencoded",data:k,success:function(a){a=h.parse(a),a?a.error?e(a.error):d(a):e("Sever response wasn't proper JSON.")},error:function(a,b){e("Spellchecker request error: "+b.status)}})}function p(a,b,c,d){var e=F.spellchecker_callback||o;e.call(E,a,b,c,d)}function q(){function a(a){b.windowManager.alert(a),b.setProgressState(!1),u()}return B?void u():(u(),b.setProgressState(!0),p("spellcheck",j().text,y,a),void b.focus())}function r(){b.dom.select("span.mce-spellchecker-word").length||u()}function s(a,c){b.setProgressState(!0),p("addToDictionary",a,function(){b.setProgressState(!1),b.dom.remove(c,!0),r()},function(a){b.windowManager.alert(a),b.setProgressState(!1)})}function t(a,d,e){b.selection.collapse(),e?c.each(b.dom.select("span.mce-spellchecker-word"),function(c){c.getAttribute("data-mce-word")==a&&b.dom.remove(c,!0)}):b.dom.remove(d,!0),r()}function u(){j().reset(),E.textMatcher=null,B&&(B=!1,b.fire("SpellcheckEnd"))}function v(a){var b=a.getAttribute("data-mce-index");return"number"==typeof b?""+b:b}function w(a){var d,e=[];if(d=c.toArray(b.getBody().getElementsByTagName("span")),d.length)for(var f=0;f<d.length;f++){var g=v(d[f]);null!==g&&g.length&&g===a.toString()&&e.push(d[f])}return e}function x(a){var b=F.spellchecker_language;a.control.items().each(function(a){a.active(a.settings.data===b)})}function y(a){var c;return a.words?(D=!!a.dictionary,c=a.words):c=a,b.setProgressState(!1),l(c)?(b.windowManager.alert("No misspellings found"),void(B=!1)):(A=c,j().find(n()).filter(function(a){return!!c[a.text]}).wrap(function(a){return b.dom.create("span",{"class":"mce-spellchecker-word","data-mce-bogus":1,"data-mce-word":a.text})}),B=!0,void b.fire("SpellcheckStart"))}var z,A,B,C,D,E=this,F=b.settings,G=F.spellchecker_languages||"English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr_FR,German=de,Italian=it,Polish=pl,Portuguese=pt_BR,Spanish=es,Swedish=sv";z=k("Language",c.map(G.split(","),function(a){return a=a.split("="),{name:a[0],value:a[1]}})),b.on("click",function(a){var c=a.target;if("mce-spellchecker-word"==c.className){a.preventDefault();var d=w(v(c));if(d.length>0){var e=b.dom.createRng();e.setStartBefore(d[0]),e.setEndAfter(d[d.length-1]),b.selection.setRng(e),m(c.getAttribute("data-mce-word"),d)}}}),b.addMenuItem("spellchecker",{text:"Spellcheck",context:"tools",onclick:q,selectable:!0,onPostRender:function(){var a=this;a.active(B),b.on("SpellcheckStart SpellcheckEnd",function(){a.active(B)})}});var H={tooltip:"Spellcheck",onclick:q,onPostRender:function(){var a=this;b.on("SpellcheckStart SpellcheckEnd",function(){a.active(B)})}};z.length>1&&(H.type="splitbutton",H.menu=z,H.onshow=x,H.onselect=function(a){F.spellchecker_language=a.control.settings.data}),b.addButton("spellchecker",H),b.addCommand("mceSpellCheck",q),b.on("remove",function(){C&&(C.remove(),C=null)}),b.on("change",r),this.getTextMatcher=j,this.getWordCharPattern=n,this.markErrors=y,this.getLanguage=function(){return F.spellchecker_language},F.spellchecker_language=F.spellchecker_language||F.language||"en"})}),f(["tinymce/spellcheckerplugin/DomTextMatcher"])}(this);spellchecker.php000064400000001216151775523340007735 0ustar00<?php
/**
 * spellcheck.php
 *
 * Copyright, Moxiecode Systems AB
 * Released under LGPL License.
 *
 * License: http://www.tinymce.com/license
 * Contributing: http://www.tinymce.com/contributing
 */

require('./includes/Engine.php');
require('./includes/EnchantEngine.php');
require('./includes/PSpellEngine.php');

$tinymceSpellCheckerConfig = array(
	"engine" => "enchant", // enchant, pspell

	// Enchant options
	"enchant_dicts_path" => "./dicts",

	// PSpell options
	"pspell.mode" => "fast",
	"pspell.spelling" => "",
	"pspell.jargon" => "",
	"pspell.encoding" => ""
);

TinyMCE_Spellchecker_Engine::processRequest($tinymceSpellCheckerConfig);
?>includes/EnchantEngine.php000064400000004476151775523340011620 0ustar00<?php
/**
 * EnchantEngine.php
 *
 * Copyright, Moxiecode Systems AB
 * Released under LGPL License.
 *
 * License: http://www.tinymce.com/license
 * Contributing: http://www.tinymce.com/contributing
 */

class TinyMCE_SpellChecker_EnchantEngine extends TinyMCE_SpellChecker_Engine {
	/**
	 * Spellchecks an array of words.
	 *
	 * @param String $lang Selected language code (like en_US or de_DE). Shortcodes like "en" and "de" work with enchant >= 1.4.1
	 * @param Array $words Array of words to check.
	 * @return Name/value object with arrays of suggestions.
	 */
	public function getSuggestions($lang, $words) {
		$suggestions = array();
		$enchant = enchant_broker_init();
		$config = $this->getConfig();

		if (isset($config["enchant_dicts_path"])) {
			enchant_broker_set_dict_path($enchant, ENCHANT_MYSPELL, $config["enchant_dicts_path"]);
			enchant_broker_set_dict_path($enchant, ENCHANT_ISPELL, $config["enchant_dicts_path"]);
		}

		if (!enchant_broker_describe($enchant)) {
			throw new Exception("Enchant spellchecker not find any backends.");
		}

		$lang = $this->normalizeLangCode($enchant, $lang);

		if (enchant_broker_dict_exists($enchant, $lang)) {
			$dict = enchant_broker_request_dict($enchant, $lang);

			foreach ($words as $word) {
				if (!enchant_dict_check($dict, $word)) {
					$suggs = enchant_dict_suggest($dict, $word);

					if (!is_array($suggs)) {
						$suggs = array();
					}

					$suggestions[$word] = $suggs;
				}
			}

			enchant_broker_free_dict($dict);
			enchant_broker_free($enchant);
		} else {
			enchant_broker_free($enchant);
			throw new Exception("Enchant spellchecker could not find dictionary for language: " . $lang);
		}

		return $suggestions;
	}

	/**
	 * Return true/false if the engine is supported by the server.
	 *
	 * @return boolean True/false if the engine is supported.
	 */
	public function isSupported() {
		return function_exists("enchant_broker_init");
	}

	private function normalizeLangCode($enchant, $lang) {
		$variants = array(
			"en" => array("en_US", "en_GB")
		);

		if (isset($variants[$lang])) {
			array_unshift($variants, $lang);

			foreach ($variants[$lang] as $variant) {
				if (enchant_broker_dict_exists($enchant, $variant)) {
					return $variant;
				}
			}
		}

		return $lang;
	}
}

TinyMCE_Spellchecker_Engine::add("enchant", "TinyMCE_SpellChecker_EnchantEngine");
?>
includes/Engine.php000064400000007735151775523340010320 0ustar00<?php
/**
 * Engine.php
 *
 * Copyright, Moxiecode Systems AB
 * Released under LGPL License.
 *
 * License: http://www.tinymce.com/license
 * Contributing: http://www.tinymce.com/contributing
 *
 * Base class for all spellcheckers this takes in the words to check
 * spelling on and returns the suggestions.
 */

class TinyMCE_SpellChecker_Engine {
	private static $engines = array();
	private $config;

	public function __constructor($config) {
		$this->config = $config;
	}

	/**
	 * Spellchecks an array of words.
	 *
	 * @param String $lang Selected language code (like en_US or de_DE). Shortcodes like "en" and "de" work with enchant >= 1.4.1
	 * @param Array $words Array of words to check.
	 * @return Name/value object with arrays of suggestions.
	 */
	public function getSuggestions($lang, $words) {
		return array();
	}

	/**
	 * Return true/false if the engine is supported by the server.
	 *
	 * @return boolean True/false if the engine is supported.
	 */
	public function isSupported() {
		return true;
	}

	/**
	 * Sets the config array used to create the instance.
	 *
	 * @param Array $config Name/value array with config options.
	 */
	public function setConfig($config) {
		$this->config = $config;
	}

	/**
	 * Returns the config array used to create the instance.
	 *
	 * @return Array Name/value array with config options.
	 */
	public function getConfig() {
		return $this->config;
	}

	// Static methods

	public static function processRequest($tinymceSpellcheckerConfig) {
		$engine = self::get($tinymceSpellcheckerConfig["engine"]);
		$engine = new $engine();
		$engine->setConfig($tinymceSpellcheckerConfig);

		header('Content-Type: application/json');
		header('Content-Encoding: UTF-8');
		header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
		header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
		header("Cache-Control: no-store, no-cache, must-revalidate");
		header("Cache-Control: post-check=0, pre-check=0", false);
		header("Pragma: no-cache");

		$method = self::getParam("method", "spellcheck");
		$lang = self::getParam("lang", "en_US");
		$text = self::getParam("text");

		if ($method == "spellcheck") {
			try {
				if (!$text) {
					throw new Exception("Missing input parameter 'text'.");
				}

				if (!$engine->isSupported()) {
					throw new Exception("Current spellchecker isn't supported.");
				}

				$words = self::getWords($text);

				echo json_encode((object) array(
					"words" => (object) $engine->getSuggestions($lang, $words)
				));
			} catch (Exception $e) {
				echo json_encode((object) array(
					"error" => $e->getMessage()
				));
			}
		} else {
			echo json_encode((object) array(
				"error" => "Invalid JSON input"
			));
		}
	}

	/**
	 * Returns an request value by name without magic quoting.
	 *
	 * @param String $name Name of parameter to get.
	 * @param String $default_value Default value to return if value not found.
	 * @return String request value by name without magic quoting or default value.
	 */
	public static function getParam($name, $default_value = false) {
		if (isset($_POST[$name])) {
			$req = $_POST;
		} else if (isset($_GET[$name])) {
			$req = $_GET;
		} else {
			return $default_value;
		}

		// Handle magic quotes
		if (ini_get("magic_quotes_gpc")) {
			if (is_array($req[$name])) {
				$out = array();

				foreach ($req[$name] as $name => $value) {
					$out[stripslashes($name)] = stripslashes($value);
				}

				return $out;
			}

			return stripslashes($req[$name]);
		}

		return $req[$name];
	}

	public static function add($name, $className) {
		self::$engines[$name] = $className;
	}

	public static function get($name) {
		if (!isset(self::$engines[$name])) {
			return null;
		}

		return self::$engines[$name];
	}

	public static function getWords($text) {
		preg_match_all('(\w{3,})u', $text, $matches);
		$words = $matches[0];

		for ($i = count($words) - 1;  $i >= 0; $i--) {
			// Exclude words with numbers in them
			if (preg_match('/[0-9]+/', $words[$i])) {
				array_splice($words, $i, 1);
			}
		}

		return $words;
	}
}

?>includes/PSpellEngine.php000064400000003007151775523340011424 0ustar00<?php
/**
 * PSpellEngine.php
 *
 * Copyright, Moxiecode Systems AB
 * Released under LGPL License.
 *
 * License: http://www.tinymce.com/license
 * Contributing: http://www.tinymce.com/contributing
 */

class TinyMCE_SpellChecker_PSpellEngine extends TinyMCE_SpellChecker_Engine {
	/**
	 * Spellchecks an array of words.
	 *
	 * @param String $lang Selected language code (like en_US or de_DE). Shortcodes like "en" and "de" work with enchant >= 1.4.1
	 * @param Array $words Array of words to check.
	 * @return Name/value object with arrays of suggestions.
	 */
	public function getSuggestions($lang, $words) {
		$config = $this->getConfig();

		switch ($config['PSpell.mode']) {
			case "fast":
				$mode = PSPELL_FAST;
				break;

			case "slow":
				$mode = PSPELL_SLOW;
				break;

			default:
				$mode = PSPELL_NORMAL;
		}

		// Setup PSpell link
		$plink = pspell_new(
			$lang,
			$config['pspell.spelling'],
			$config['pspell.jargon'],
			$config['pspell.encoding'],
			$mode
		);

		if (!$plink) {
			throw new Exception("No PSpell link found opened.");
		}

		$outWords = array();
		foreach ($words as $word) {
			if (!pspell_check($plink, trim($word))) {
				$outWords[] = utf8_encode($word);
			}
		}

		return $outWords;
	}

	/**
	 * Return true/false if the engine is supported by the server.
	 *
	 * @return boolean True/false if the engine is supported.
	 */
	public function isSupported() {
		return function_exists("pspell_new");
	}
}

TinyMCE_Spellchecker_Engine::add("pspell", "TinyMCE_SpellChecker_PSpellEngine");
?>
includes/error_log000064400000003762151775523340010313 0ustar00[05-May-2026 19:03:41 Europe/Paris] PHP Fatal error:  Uncaught Error: Class 'TinyMCE_SpellChecker_Engine' not found in /home/missmand/public_html/js/tinymce/plugins/spellchecker/includes/EnchantEngine.php:12
Stack trace:
#0 {main}
  thrown in /home/missmand/public_html/js/tinymce/plugins/spellchecker/includes/EnchantEngine.php on line 12
[05-May-2026 20:15:48 Europe/Paris] PHP Fatal error:  Uncaught Error: Class 'TinyMCE_SpellChecker_Engine' not found in /home/missmand/public_html/js/tinymce/plugins/spellchecker/includes/PSpellEngine.php:12
Stack trace:
#0 {main}
  thrown in /home/missmand/public_html/js/tinymce/plugins/spellchecker/includes/PSpellEngine.php on line 12
[07-May-2026 12:36:11 Europe/Paris] PHP Fatal error:  Uncaught Error: Class 'TinyMCE_SpellChecker_Engine' not found in /home/missmand/public_html/js/tinymce/plugins/spellchecker/includes/EnchantEngine.php:12
Stack trace:
#0 {main}
  thrown in /home/missmand/public_html/js/tinymce/plugins/spellchecker/includes/EnchantEngine.php on line 12
[07-May-2026 15:05:05 Europe/Paris] PHP Fatal error:  Uncaught Error: Class 'TinyMCE_SpellChecker_Engine' not found in /home/missmand/public_html/js/tinymce/plugins/spellchecker/includes/PSpellEngine.php:12
Stack trace:
#0 {main}
  thrown in /home/missmand/public_html/js/tinymce/plugins/spellchecker/includes/PSpellEngine.php on line 12
[09-May-2026 11:38:51 Europe/Paris] PHP Fatal error:  Uncaught Error: Class 'TinyMCE_SpellChecker_Engine' not found in /home/missmand/public_html/js/tinymce/plugins/spellchecker/includes/EnchantEngine.php:12
Stack trace:
#0 {main}
  thrown in /home/missmand/public_html/js/tinymce/plugins/spellchecker/includes/EnchantEngine.php on line 12
[09-May-2026 11:38:51 Europe/Paris] PHP Fatal error:  Uncaught Error: Class 'TinyMCE_SpellChecker_Engine' not found in /home/missmand/public_html/js/tinymce/plugins/spellchecker/includes/PSpellEngine.php:12
Stack trace:
#0 {main}
  thrown in /home/missmand/public_html/js/tinymce/plugins/spellchecker/includes/PSpellEngine.php on line 12

Hacked By AnonymousFox1.0, Coded By AnonymousFox