1
0
mirror of https://github.com/e107inc/e107.git synced 2025-03-14 17:39:46 +01:00

Fix for inline editing.

This commit is contained in:
Lóna Lore 2017-02-12 21:55:46 +01:00
parent 096b35e737
commit 768176c5c3
2 changed files with 14 additions and 2 deletions

View File

@ -2171,9 +2171,15 @@ class e_parse extends e_parser
* We use HTML-safe strings, with several characters escaped.
*
* @param mixed $var
* PHP variable.
* @param bool $force_object
* True: Outputs an object rather than an array when a non-associative
* array is used. Especially useful when the recipient of the output
* is expecting an object and the array is empty.
*
* @return string
*/
public function toJSON($var)
public function toJSON($var, $force_object = false)
{
// The PHP version cannot change within a request.
static $php530;
@ -2185,6 +2191,12 @@ class e_parse extends e_parser
if($php530)
{
if($force_object === true)
{
// Encode <, >, ', &, and " using the json_encode() options parameter.
return json_encode($var, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT | JSON_FORCE_OBJECT);
}
// Encode <, >, ', &, and " using the json_encode() options parameter.
return json_encode($var, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT);
}

View File

@ -3919,7 +3919,7 @@ class e_form
}
}
$source = e107::getParser()->toJSON($jsonArray);
$source = e107::getParser()->toJSON($jsonArray, true);
$mode = preg_replace('/[^\w]/', '', vartrue($_GET['mode'], ''));