Skip to content
Snippets Groups Projects
Commit d50dca8a authored by Peter Rotich's avatar Peter Rotich
Browse files

Add JSON encoder utility to Format class

parent 237cc1ba
No related branches found
No related tags found
No related merge requests found
......@@ -38,9 +38,7 @@ class AjaxController extends ApiController {
* Convert a PHP array into a JSON-encoded string
*/
function json_encode($what) {
require_once (INCLUDE_DIR.'class.json.php');
$encoder = new JsonDataEncoder();
return $encoder->encode($what);
return Format::json_encode($what);
}
function encode($what) {
......
......@@ -99,6 +99,15 @@ class Format {
return $filename;
}
/**
* Json Encoder
*
*/
function json_encode($what) {
require_once (INCLUDE_DIR.'class.json.php');
return JsonDataEncoder::encode($what);
}
function phone($phone) {
$stripped= preg_replace("/[^0-9]/", "", $phone);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment