fix deprecated JSON class

This commit is contained in:
Satoshi Sahara
2020-10-31 11:04:11 +09:00
parent ee4cd93c3a
commit 22a33cc253
3 changed files with 9 additions and 12 deletions

View File

@ -52,10 +52,9 @@ EOF;
);
$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));
}

View File

@ -122,14 +122,14 @@ class action_plugin_edittable_editor extends DokuWiki_Action_Plugin {
*
* @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);
}

View File

@ -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 @@ class renderer_plugin_edittable_json extends renderer_plugin_edittable_inverse {
* @return array
*/
public function getMetaJSON() {
$json = new JSON();
return $json->encode($this->tmeta);
return json_encode($this->tmeta);
}
// renderer functions below