fix double encoding of tree items

This commit is contained in:
ralf 2024-04-05 10:44:49 +02:00
parent f1317e6b63
commit 76d6f179c6

View File

@ -169,31 +169,11 @@ class Tree extends Etemplate\Widget
Api\Json\Request::isJSONRequest(false);
header('Content-Type: application/json; charset=utf-8');
echo json_encode(self::htmlencode_node($data));
echo json_encode($data);
exit;
}
/**
* HTML encoding of text and tooltip of node including all children
*
* @param array $item
* @return array
*/
public static function htmlencode_node(array $item)
{
$item['text'] = Api\Html::htmlspecialchars($item['text']);
if (isset($item['item']) && is_array($item['item']))
{
foreach($item['item'] as &$child)
{
$child = self::htmlencode_node($child);
}
}
return $item;
}
/**
* Check if given $id is one of given tree
*