From f123809d29d6cc335251cd4fd8984c1b5ef67e2a Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sat, 25 Jan 2020 16:24:14 -0800 Subject: more work on zap export --- include/text.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'include/text.php') diff --git a/include/text.php b/include/text.php index 87ed9f658..1f0af08e3 100644 --- a/include/text.php +++ b/include/text.php @@ -3694,3 +3694,18 @@ function svg2bb($s) { } return EMPTY_STR; } + + + +function serialise($x) { + return ((is_array($x)) ? 'json:' . json_encode($x) : $x); +} + +function unserialise($x) { + if (is_array($x)) { + return $x; + } + $y = ((substr($x,0,5) === 'json:') ? json_decode(substr($x,5),true) : ''); + return ((is_array($y)) ? $y : $x); +} + -- cgit v1.2.3