diff --git a/_test/renderer_plugin_edittable_json.test.php b/_test/renderer_plugin_edittable_json.test.php index 8038629..3d0b5e0 100644 --- a/_test/renderer_plugin_edittable_json.test.php +++ b/_test/renderer_plugin_edittable_json.test.php @@ -52,10 +52,9 @@ function test_table() { ); $renderer = $this->render($input); - $json = new JSON(JSON_LOOSE_TYPE); - $this->assertEquals($data, $json->decode($renderer->getDataJSON())); - $this->assertEquals($meta, $json->decode($renderer->getMetaJSON())); + $this->assertEquals($data, json_decode($renderer->getDataJSON(), true)); + $this->assertEquals($meta, json_decode($renderer->getMetaJSON(), true)); } diff --git a/action/editor.php b/action/editor.php index 0b2e867..304ba15 100644 --- a/action/editor.php +++ b/action/editor.php @@ -122,14 +122,14 @@ public function editform(Doku_Event $event) * * @author Andreas Gohr */ - public function handle_table_post($event) { + public function handle_table_post(Doku_Event $event) + { global $TEXT; global $INPUT; - if(!$INPUT->post->has('edittable_data')) return; + if (!$INPUT->post->has('edittable_data')) return; - $json = new JSON(JSON_LOOSE_TYPE); - $data = $json->decode($INPUT->post->str('edittable_data')); - $meta = $json->decode($INPUT->post->str('edittable_meta')); + $data = json_decode($INPUT->post->str('edittable_data'), true); + $meta = json_decode($INPUT->post->str('edittable_meta'), true); $TEXT = $this->build_table($data, $meta); } diff --git a/renderer/json.php b/renderer/json.php index 6c5bab7..19de5e4 100644 --- a/renderer/json.php +++ b/renderer/json.php @@ -35,8 +35,7 @@ class renderer_plugin_edittable_json extends renderer_plugin_edittable_inverse { * @return array */ public function getDataJSON() { - $json = new JSON(); - return $json->encode($this->tdata); + return json_encode($this->tdata); } /** @@ -45,8 +44,7 @@ public function getDataJSON() { * @return array */ public function getMetaJSON() { - $json = new JSON(); - return $json->encode($this->tmeta); + return json_encode($this->tmeta); } // renderer functions below