projects
/
Pman.Core
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(from parent 1:
90ef5a2
)
add missing jsencode
author
Alan
<alan@roojs.com>
Thu, 29 Feb 2024 05:23:49 +0000
(13:23 +0800)
committer
Alan
<alan@roojs.com>
Thu, 29 Feb 2024 05:23:49 +0000
(13:23 +0800)
JsonOutputTrait.php
patch
|
blob
|
history
diff --git
a/JsonOutputTrait.php
b/JsonOutputTrait.php
index
0c1e7a4
..
92a313f
100644
(file)
--- a/
JsonOutputTrait.php
+++ b/
JsonOutputTrait.php
@@
-278,4
+278,23
@@
trait Pman_Core_JsonOutputTrait {
}
+ function jsencode($v, $header = false)
+ {
+ if ($header) {
+ header("Content-type: text/javascript");
+ }
+ if (function_exists("json_encode")) {
+ $ret= json_encode($v);
+ if ($ret !== false) {
+ return $ret;
+ }
+ }
+ require_once 'Services/JSON.php';
+ $js = new Services_JSON();
+ return $js->encodeUnsafe($v);
+
+
+
+ }
+
}
\ No newline at end of file