*/ class syntax_plugin_networkgraph_renderer extends SyntaxPlugin { /** @inheritDoc */ public function getType() { return 'substition'; } /** @inheritDoc */ public function getPType() { return 'normal'; } /** @inheritDoc */ public function getSort() { return 361; } /** @inheritDoc */ public function connectTo($mode) { $this->Lexer->addSpecialPattern('~~NETWORKGRAPH~~', $mode, 'plugin_networkgraph_renderer'); } /** @inheritDoc */ public function handle($match, $state, $pos, Doku_Handler $handler) { // } /** @inheritDoc */ public function render($mode, Doku_Renderer $renderer, $data) { if ($mode !== 'xhtml') { return false; } $radomNumber = rand(0, getrandmax()); $graphId = "networkgraph_". $radomNumber; $file = metaFN('networkgraph_data', '.json'); $json = file_exists($file) ? file_get_contents($file) : json_encode(['nodes' => [], 'links' => []]); $jsonData = json_decode($json); $jsGraph = json_encode($jsonData); $renderer->info['cache'] = FALSE; $renderer->doc .= "
"; $renderer->doc .= ""; return true; } }