Browse code

tinyMCE '2' is now 2.1.2 - Seems tinyMCE '2' was actually 3.0.9 (my fault for not checking), so '2' is now 2.1.2, and '3' is now 3.4.8... eFiction 3.4.3 used tinyMCE 2.1.0, and 3.5 upgraded that to 3.0.9.

Clarissa Walker authored on 2026/07/28 07:20:33
Showing 1 changed files
... ...
@@ -1,183 +1,88 @@
1
-<?php
2
-/**
3
- * $Id: tiny_mce_gzip.php 315 2007-10-25 14:03:43Z spocke $
4
- *
5
- * @author Moxiecode
6
- * @copyright Copyright � 2005-2006, Moxiecode Systems AB, All rights reserved.
7
- *
8
- * This file compresses the TinyMCE JavaScript using GZip and
9
- * enables the browser to do two requests instead of one for each .js file.
10
- * Notice: This script defaults the button_tile_map option to true for extra performance.
11
- */
12
-
13
-	// Set the error reporting to minimal.
14
-	@error_reporting(E_ERROR | E_WARNING | E_PARSE);
15
-
16
-	// Get input
17
-	$plugins = explode(',', getParam("plugins", ""));
18
-	$languages = explode(',', getParam("languages", ""));
19
-	$themes = explode(',', getParam("themes", ""));
20
-	$diskCache = getParam("diskcache", "") == "true";
21
-	$isJS = getParam("js", "") == "true";
22
-	$compress = getParam("compress", "true") == "true";
23
-	$core = getParam("core", "true") == "true";
24
-	$suffix = getParam("suffix", "_src") == "_src" ? "_src" : "";
25
-	$cachePath = realpath("."); // Cache path, this is where the .gz files will be stored
26
-	$expiresOffset = 3600 * 24 * 10; // Cache for 10 days in browser cache
27
-	$content = "";
28
-	$encodings = array();
29
-	$supportsGzip = false;
30
-	$enc = "";
31
-	$cacheKey = "";
32
-
33
-	// Custom extra javascripts to pack
34
-	$custom = array(/*
35
-		"some custom .js file",
36
-		"some custom .js file"
37
-	*/);
38
-
39
-	// Headers
40
-	header("Content-type: text/javascript");
41
-	header("Vary: Accept-Encoding");  // Handle proxies
42
-	header("Expires: " . gmdate("D, d M Y H:i:s", time() + $expiresOffset) . " GMT");
43
-
44
-	// Is called directly then auto init with default settings
45
-	if (!$isJS) {
46
-		echo getFileContents("tiny_mce_gzip.js");
47
-		echo "tinyMCE_GZ.init({});";
48
-		die();
49
-	}
50
-
51
-	// Setup cache info
52
-	if ($diskCache) {
53
-		if (!$cachePath)
54
-			die("alert('Real path failed.');");
55
-
56
-		$cacheKey = getParam("plugins", "") . getParam("languages", "") . getParam("themes", "") . $suffix;
57
-
58
-		foreach ($custom as $file)
59
-			$cacheKey .= $file;
60
-
61
-		$cacheKey = md5($cacheKey);
62
-
63
-		if ($compress)
64
-			$cacheFile = $cachePath . "/tiny_mce_" . $cacheKey . ".gz";
65
-		else
66
-			$cacheFile = $cachePath . "/tiny_mce_" . $cacheKey . ".js";
67
-	}
68
-
69
-	// Check if it supports gzip
70
-	if (isset($_SERVER['HTTP_ACCEPT_ENCODING']))
71
-		$encodings = explode(',', strtolower(preg_replace("/\s+/", "", $_SERVER['HTTP_ACCEPT_ENCODING'])));
72
-
73
-	if ((in_array('gzip', $encodings) || in_array('x-gzip', $encodings) || isset($_SERVER['---------------'])) && function_exists('ob_gzhandler') && !ini_get('zlib.output_compression')) {
74
-		$enc = in_array('x-gzip', $encodings) ? "x-gzip" : "gzip";
75
-		$supportsGzip = true;
76
-	}
77
-
78
-	// Use cached file disk cache
79
-	if ($diskCache && $supportsGzip && file_exists($cacheFile)) {
80
-		if ($compress)
81
-			header("Content-Encoding: " . $enc);
82
-
83
-		echo getFileContents($cacheFile);
84
-		die();
85
-	}
86
-
87
-	// Add core
88
-	if ($core == "true") {
89
-		$content .= getFileContents("tiny_mce" . $suffix . ".js");
90
-
91
-		// Patch loading functions
92
-		$content .= "tinyMCE_GZ.start();";
93
-	}
94
-
95
-	// Add core languages
96
-	foreach ($languages as $lang)
97
-		$content .= getFileContents("langs/" . $lang . ".js");
98
-
99
-	// Add themes
100
-	foreach ($themes as $theme) {
101
-		$content .= getFileContents( "themes/" . $theme . "/editor_template" . $suffix . ".js");
102
-
103
-		foreach ($languages as $lang)
104
-			$content .= getFileContents("themes/" . $theme . "/langs/" . $lang . ".js");
105
-	}
106
-
107
-	// Add plugins
108
-	foreach ($plugins as $plugin) {
109
-		$content .= getFileContents("plugins/" . $plugin . "/editor_plugin" . $suffix . ".js");
110
-
111
-		foreach ($languages as $lang)
112
-			$content .= getFileContents("plugins/" . $plugin . "/langs/" . $lang . ".js");
113
-	}
114
-
115
-	// Add custom files
116
-	foreach ($custom as $file)
117
-		$content .= getFileContents($file);
118
-
119
-	// Restore loading functions
120
-	if ($core == "true")
121
-		$content .= "tinyMCE_GZ.end();";
122
-
123
-	// Generate GZIP'd content
124
-	if ($supportsGzip) {
125
-		if ($compress) {
126
-			header("Content-Encoding: " . $enc);
127
-			$cacheData = gzencode($content, 9, FORCE_GZIP);
128
-		} else
129
-			$cacheData = $content;
130
-
131
-		// Write gz file
132
-		if ($diskCache && $cacheKey != "")
133
-			putFileContents($cacheFile, $cacheData);
134
-
135
-		// Stream to client
136
-		echo $cacheData;
137
-	} else {
138
-		// Stream uncompressed content
139
-		echo $content;
140
-	}
141
-
142
-	/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
143
-
144
-	function getParam($name, $def = false) {
145
-		if (!isset($_GET[$name]))
146
-			return $def;
147
-
148
-		return preg_replace("/[^0-9a-z\-_,]+/i", "", $_GET[$name]); // Remove anything but 0-9,a-z,-_
149
-	}
150
-
151
-	function getFileContents($path) {
152
-		$path = realpath($path);
153
-
154
-		if (!$path || !@is_file($path))
155
-			return "";
156
-
157
-		if (function_exists("file_get_contents"))
158
-			return @file_get_contents($path);
159
-
160
-		$content = "";
161
-		$fp = @fopen($path, "r");
162
-		if (!$fp)
163
-			return "";
164
-
165
-		while (!feof($fp))
166
-			$content .= fgets($fp);
167
-
168
-		fclose($fp);
169
-
170
-		return $content;
171
-	}
172
-
173
-	function putFileContents($path, $content) {
174
-		if (function_exists("file_put_contents"))
175
-			return @file_put_contents($path, $content);
176
-
177
-		$fp = @fopen($path, "wb");
178
-		if ($fp) {
179
-			fwrite($fp, $content);
180
-			fclose($fp);
181
-		}
182
-	}
183
-?>
184 1
\ No newline at end of file
2
+<?php
3
+	/**
4
+	 * $RCSfile: tiny_mce_gzip.php,v $
5
+	 * $Revision: 1.1 $
6
+	 * $Date: 2005/06/14 18:55:34 $
7
+	 *
8
+	 * @author Moxiecode
9
+	 * @copyright Copyright � 2004, Moxiecode Systems AB, All rights reserved.
10
+	 *
11
+	 * This file compresses the TinyMCE JavaScript using GZip and
12
+	 * enables the browser to do two requests instead of one for each .js file.
13
+	 * Notice: This script defaults the button_tile_map option to true for extra performance.
14
+	 *
15
+	 * Todo:
16
+	 *  - Add local file cache for the GZip:ed version.
17
+	 */
18
+
19
+	// General options
20
+	$suffix = "";							// Set to "_src" to use source version
21
+	$expiresOffset = 3600 * 24 * 10;		// 10 days util client cache expires
22
+
23
+	// Get data to load
24
+	$theme = isset($_REQUEST['theme']) ? $_REQUEST['theme'] : "";
25
+	$language = isset($_REQUEST['language']) ? $_REQUEST['language'] : "";
26
+	$plugins = isset($_REQUEST['plugins']) ? $_REQUEST['plugins'] : "";
27
+
28
+	// GZip compress and cache it for 10 days
29
+	ob_start ("ob_gzhandler");
30
+	header("Content-type: text/javascript; charset: UTF-8");
31
+	header("Cache-Control: must-revalidate");
32
+	header("Expires: " . gmdate("D, d M Y H:i:s", time() + $expiresOffset) . " GMT");
33
+
34
+	if ($theme) {
35
+		// Write main script and patch some things
36
+		echo file_get_contents(realpath("tiny_mce" . $suffix . ".js"));
37
+		echo 'TinyMCE.prototype.loadScript = function() {};';
38
+		echo "tinyMCE.init(TinyMCECompressed_settings);";
39
+
40
+		// Load theme, language pack and theme language packs
41
+		echo file_get_contents(realpath("themes/" . $theme . "/editor_template" . $suffix . ".js"));
42
+		echo file_get_contents(realpath("themes/" . $theme . "/langs/" . $language . ".js"));
43
+		echo file_get_contents(realpath("langs/" . $language . ".js"));
44
+
45
+		// Load all plugins and their language packs
46
+		$plugins = explode(",", $plugins);
47
+		foreach ($plugins as $plugin) {
48
+			$pluginFile = realpath("plugins/" . $plugin . "/editor_plugin" . $suffix . ".js");
49
+			$languageFile = realpath("plugins/" . $plugin . "/langs/" . $language . ".js");
50
+
51
+			if ($pluginFile)
52
+				echo file_get_contents($pluginFile);
53
+
54
+			if ($languageFile)
55
+				echo file_get_contents($languageFile);
56
+		}
57
+
58
+		die;
59
+	}
60
+?>
61
+
62
+var TinyMCECompressed_settings = null;
63
+
64
+function TinyMCECompressed() {
65
+}
66
+
67
+TinyMCECompressed.prototype.init = function(settings) {
68
+	var elements = document.getElementsByTagName('script');
69
+	var scriptURL = "";
70
+
71
+	for (var i=0; i<elements.length; i++) {
72
+		if (elements[i].src && elements[i].src.indexOf("tiny_mce_gzip.php") != -1) {
73
+			scriptURL = elements[i].src;
74
+			break;
75
+		}
76
+	}
77
+
78
+	settings["theme"] = typeof(settings["theme"]) != "undefined" ? settings["theme"] : "default";
79
+	settings["plugins"] = typeof(settings["plugins"]) != "undefined" ? settings["plugins"] : "";
80
+	settings["language"] = typeof(settings["language"]) != "undefined" ? settings["language"] : "en";
81
+	settings["button_tile_map"] = typeof(settings["button_tile_map"]) != "undefined" ? settings["button_tile_map"] : true;
82
+
83
+	scriptURL += "?theme=" + escape(settings["theme"]) + "&language=" + escape(settings["language"]) + "&plugins=" + escape(settings["plugins"]);
84
+	document.write('<sc'+'ript language="javascript" type="text/javascript" src="' + scriptURL + '"></script>');
85
+
86
+	TinyMCECompressed_settings = settings;
87
+}
88
+
89
+var tinyMCE = new TinyMCECompressed();
Browse code

TinyMCE version directories relocated to /tinymce/ directory, each with its own version numbers: 2, 3, 4 - Slight naming tweak to TinyMCE dropdown in site settings

Clarissa Walker authored on 2026/07/27 13:46:03
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,183 @@
1
+<?php
2
+/**
3
+ * $Id: tiny_mce_gzip.php 315 2007-10-25 14:03:43Z spocke $
4
+ *
5
+ * @author Moxiecode
6
+ * @copyright Copyright � 2005-2006, Moxiecode Systems AB, All rights reserved.
7
+ *
8
+ * This file compresses the TinyMCE JavaScript using GZip and
9
+ * enables the browser to do two requests instead of one for each .js file.
10
+ * Notice: This script defaults the button_tile_map option to true for extra performance.
11
+ */
12
+
13
+	// Set the error reporting to minimal.
14
+	@error_reporting(E_ERROR | E_WARNING | E_PARSE);
15
+
16
+	// Get input
17
+	$plugins = explode(',', getParam("plugins", ""));
18
+	$languages = explode(',', getParam("languages", ""));
19
+	$themes = explode(',', getParam("themes", ""));
20
+	$diskCache = getParam("diskcache", "") == "true";
21
+	$isJS = getParam("js", "") == "true";
22
+	$compress = getParam("compress", "true") == "true";
23
+	$core = getParam("core", "true") == "true";
24
+	$suffix = getParam("suffix", "_src") == "_src" ? "_src" : "";
25
+	$cachePath = realpath("."); // Cache path, this is where the .gz files will be stored
26
+	$expiresOffset = 3600 * 24 * 10; // Cache for 10 days in browser cache
27
+	$content = "";
28
+	$encodings = array();
29
+	$supportsGzip = false;
30
+	$enc = "";
31
+	$cacheKey = "";
32
+
33
+	// Custom extra javascripts to pack
34
+	$custom = array(/*
35
+		"some custom .js file",
36
+		"some custom .js file"
37
+	*/);
38
+
39
+	// Headers
40
+	header("Content-type: text/javascript");
41
+	header("Vary: Accept-Encoding");  // Handle proxies
42
+	header("Expires: " . gmdate("D, d M Y H:i:s", time() + $expiresOffset) . " GMT");
43
+
44
+	// Is called directly then auto init with default settings
45
+	if (!$isJS) {
46
+		echo getFileContents("tiny_mce_gzip.js");
47
+		echo "tinyMCE_GZ.init({});";
48
+		die();
49
+	}
50
+
51
+	// Setup cache info
52
+	if ($diskCache) {
53
+		if (!$cachePath)
54
+			die("alert('Real path failed.');");
55
+
56
+		$cacheKey = getParam("plugins", "") . getParam("languages", "") . getParam("themes", "") . $suffix;
57
+
58
+		foreach ($custom as $file)
59
+			$cacheKey .= $file;
60
+
61
+		$cacheKey = md5($cacheKey);
62
+
63
+		if ($compress)
64
+			$cacheFile = $cachePath . "/tiny_mce_" . $cacheKey . ".gz";
65
+		else
66
+			$cacheFile = $cachePath . "/tiny_mce_" . $cacheKey . ".js";
67
+	}
68
+
69
+	// Check if it supports gzip
70
+	if (isset($_SERVER['HTTP_ACCEPT_ENCODING']))
71
+		$encodings = explode(',', strtolower(preg_replace("/\s+/", "", $_SERVER['HTTP_ACCEPT_ENCODING'])));
72
+
73
+	if ((in_array('gzip', $encodings) || in_array('x-gzip', $encodings) || isset($_SERVER['---------------'])) && function_exists('ob_gzhandler') && !ini_get('zlib.output_compression')) {
74
+		$enc = in_array('x-gzip', $encodings) ? "x-gzip" : "gzip";
75
+		$supportsGzip = true;
76
+	}
77
+
78
+	// Use cached file disk cache
79
+	if ($diskCache && $supportsGzip && file_exists($cacheFile)) {
80
+		if ($compress)
81
+			header("Content-Encoding: " . $enc);
82
+
83
+		echo getFileContents($cacheFile);
84
+		die();
85
+	}
86
+
87
+	// Add core
88
+	if ($core == "true") {
89
+		$content .= getFileContents("tiny_mce" . $suffix . ".js");
90
+
91
+		// Patch loading functions
92
+		$content .= "tinyMCE_GZ.start();";
93
+	}
94
+
95
+	// Add core languages
96
+	foreach ($languages as $lang)
97
+		$content .= getFileContents("langs/" . $lang . ".js");
98
+
99
+	// Add themes
100
+	foreach ($themes as $theme) {
101
+		$content .= getFileContents( "themes/" . $theme . "/editor_template" . $suffix . ".js");
102
+
103
+		foreach ($languages as $lang)
104
+			$content .= getFileContents("themes/" . $theme . "/langs/" . $lang . ".js");
105
+	}
106
+
107
+	// Add plugins
108
+	foreach ($plugins as $plugin) {
109
+		$content .= getFileContents("plugins/" . $plugin . "/editor_plugin" . $suffix . ".js");
110
+
111
+		foreach ($languages as $lang)
112
+			$content .= getFileContents("plugins/" . $plugin . "/langs/" . $lang . ".js");
113
+	}
114
+
115
+	// Add custom files
116
+	foreach ($custom as $file)
117
+		$content .= getFileContents($file);
118
+
119
+	// Restore loading functions
120
+	if ($core == "true")
121
+		$content .= "tinyMCE_GZ.end();";
122
+
123
+	// Generate GZIP'd content
124
+	if ($supportsGzip) {
125
+		if ($compress) {
126
+			header("Content-Encoding: " . $enc);
127
+			$cacheData = gzencode($content, 9, FORCE_GZIP);
128
+		} else
129
+			$cacheData = $content;
130
+
131
+		// Write gz file
132
+		if ($diskCache && $cacheKey != "")
133
+			putFileContents($cacheFile, $cacheData);
134
+
135
+		// Stream to client
136
+		echo $cacheData;
137
+	} else {
138
+		// Stream uncompressed content
139
+		echo $content;
140
+	}
141
+
142
+	/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
143
+
144
+	function getParam($name, $def = false) {
145
+		if (!isset($_GET[$name]))
146
+			return $def;
147
+
148
+		return preg_replace("/[^0-9a-z\-_,]+/i", "", $_GET[$name]); // Remove anything but 0-9,a-z,-_
149
+	}
150
+
151
+	function getFileContents($path) {
152
+		$path = realpath($path);
153
+
154
+		if (!$path || !@is_file($path))
155
+			return "";
156
+
157
+		if (function_exists("file_get_contents"))
158
+			return @file_get_contents($path);
159
+
160
+		$content = "";
161
+		$fp = @fopen($path, "r");
162
+		if (!$fp)
163
+			return "";
164
+
165
+		while (!feof($fp))
166
+			$content .= fgets($fp);
167
+
168
+		fclose($fp);
169
+
170
+		return $content;
171
+	}
172
+
173
+	function putFileContents($path, $content) {
174
+		if (function_exists("file_put_contents"))
175
+			return @file_put_contents($path, $content);
176
+
177
+		$fp = @fopen($path, "wb");
178
+		if ($fp) {
179
+			fwrite($fp, $content);
180
+			fclose($fp);
181
+		}
182
+	}
183
+?>
0 184
\ No newline at end of file