Skip to content

Commit

Permalink
fix deprecated JSON class
Browse files Browse the repository at this point in the history
  • Loading branch information
ssahara committed Oct 31, 2020
1 parent ee4cd93 commit 22a33cc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
5 changes: 2 additions & 3 deletions _test/renderer_plugin_edittable_json.test.php
Expand Up @@ -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));
}


Expand Down
10 changes: 5 additions & 5 deletions action/editor.php
Expand Up @@ -122,14 +122,14 @@ public function editform(Doku_Event $event)
*
* @author Andreas Gohr <gohr@cosmocode,de>
*/
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);
}
Expand Down
6 changes: 2 additions & 4 deletions renderer/json.php
Expand Up @@ -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);
}

/**
Expand All @@ -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
Expand Down

0 comments on commit 22a33cc

Please sign in to comment.