simple vue-based column editor
This commit is contained in:
@@ -67,3 +67,27 @@ function vali($arr) {
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* like old(), but decodes stringified json
|
||||
*
|
||||
* @param string $name
|
||||
* @param object|array $default
|
||||
* @return object|array
|
||||
*/
|
||||
function old_json($name, $default) {
|
||||
$old = old($name, null);
|
||||
if (is_string($old)) return json_decode($old);
|
||||
return $default;
|
||||
}
|
||||
|
||||
// Safe JSON funcs
|
||||
function toJSON($object) {
|
||||
return \GuzzleHttp\json_encode($object, JSON_UNESCAPED_SLASHES + JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
function fromJSON($object, $assoc=false) {
|
||||
return \GuzzleHttp\json_decode($object, $assoc);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user