<?php\r
/*\r
-* Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.\r
+* Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.\r
* For licensing, see LICENSE.html or http://ckeditor.com/license\r
*/\r
\r
* The version of %CKEditor.\r
* \private\r
*/\r
- var $version = '3.2.2';\r
+ var $version = '3.6.6';\r
/**\r
* A constant string unique for each release of %CKEditor.\r
* \private\r
*/\r
- var $_timestamp = 'A4SD49X';\r
+ var $_timestamp = 'D03G5XL';\r
\r
/**\r
* URL to the %CKEditor installation directory (absolute or relative to document root).\r
* A string indicating the creation date of %CKEditor.\r
* Do not change it unless you want to force browsers to not use previously cached version of %CKEditor.\r
*/\r
- var $timestamp = "A4SD49X";\r
+ var $timestamp = "D03G5XL";\r
/**\r
* An array that holds event listeners.\r
* \private\r
}\r
else {\r
/**\r
- * realpath — Returns canonicalized absolute pathname\r
+ * realpath - Returns canonicalized absolute pathname\r
*/\r
$realPath = realpath( './' ) ;\r
}\r
\r
$documentRoot = substr($realPath, 0, strlen($realPath) - strlen($selfPath));\r
$fileUrl = substr($file, strlen($documentRoot));\r
- $ckeditorUrl = str_replace("ckeditor_php5.php", "", $fileUrl);\r
+ $ckeditorUrl = str_replace("ckeditor_php4.php", "", $fileUrl);\r
\r
return $ckeditorUrl;\r
}\r
\r
/**\r
* This little function provides a basic JSON support.\r
- * http://php.net/manual/en/function.json-encode.php\r
* \private\r
*\r
* @param mixed $val\r
if (is_null($val)) {\r
return 'null';\r
}\r
- if ($val === false) {\r
- return 'false';\r
+ if (is_bool($val)) {\r
+ return $val ? 'true' : 'false';\r
}\r
- if ($val === true) {\r
- return 'true';\r
+ if (is_int($val)) {\r
+ return $val;\r
}\r
- if (is_scalar($val))\r
- {\r
- if (is_float($val))\r
- {\r
- // Always use "." for floats.\r
- $val = str_replace(",", ".", strval($val));\r
- }\r
-\r
- // Use @@ to not use quotes when outputting string value\r
- if (strpos($val, '@@') === 0) {\r
- return substr($val, 2);\r
- }\r
- else {\r
- // All scalars are converted to strings to avoid indeterminism.\r
- // PHP's "1" and 1 are equal for all PHP operators, but\r
- // JS's "1" and 1 are not. So if we pass "1" or 1 from the PHP backend,\r
- // we should get the same result in the JS frontend (string).\r
- // Character replacements for JSON.\r
- static $jsonReplaces = array(array("\\", "/", "\n", "\t", "\r", "\b", "\f", '"'),\r
- array('\\\\', '\\/', '\\n', '\\t', '\\r', '\\b', '\\f', '\"'));\r
-\r
- $val = str_replace($jsonReplaces[0], $jsonReplaces[1], $val);\r
-\r
- return '"' . $val . '"';\r
- }\r
+ if (is_float($val)) {\r
+ return str_replace(',', '.', $val);\r
}\r
- $isList = true;\r
- for ($i = 0, reset($val); $i < count($val); $i++, next($val))\r
- {\r
- if (key($val) !== $i)\r
- {\r
- $isList = false;\r
- break;\r
+ if (is_array($val) || is_object($val)) {\r
+ if (is_array($val) && (array_keys($val) === range(0,count($val)-1))) {\r
+ return '[' . implode(',', array_map(array($this, 'jsEncode'), $val)) . ']';\r
}\r
+ $temp = array();\r
+ foreach ($val as $k => $v){\r
+ $temp[] = $this->jsEncode("{$k}") . ':' . $this->jsEncode($v);\r
+ }\r
+ return '{' . implode(',', $temp) . '}';\r
}\r
- $result = array();\r
- if ($isList)\r
- {\r
- foreach ($val as $v) $result[] = $this->jsEncode($v);\r
- return '[ ' . join(', ', $result) . ' ]';\r
- }\r
- else\r
- {\r
- foreach ($val as $k => $v) $result[] = $this->jsEncode($k).': '.$this->jsEncode($v);\r
- return '{ ' . join(', ', $result) . ' }';\r
- }\r
+ // String otherwise\r
+ if (strpos($val, '@@') === 0)\r
+ return substr($val, 2);\r
+ if (strtoupper(substr($val, 0, 9)) == 'CKEDITOR.')\r
+ return $val;\r
+\r
+ return '"' . str_replace(array("\\", "/", "\n", "\t", "\r", "\x08", "\x0c", '"'), array('\\\\', '\\/', '\\n', '\\t', '\\r', '\\b', '\\f', '\"'), $val) . '"';\r
}\r
}\r