*/ class syntax_plugin_newsfeed_feed extends SyntaxPlugin { private helper_plugin_newsfeed $helper; public function __construct() { $this->helper = $this->loadHelper('newsfeed'); } public function getType(): string { return 'substition'; } public function getPType(): string { return 'block'; } public function getAllowedTypes(): array { return []; } public function getSort(): int { return 24; } public function connectTo($mode): void { $this->Lexer->addSpecialPattern('{{news-feed>.+?}}', $mode, 'plugin_newsfeed_feed'); } public function handle($match, $state, $pos, Doku_Handler $handler): array { preg_match_all('/([a-z-_]+)="([^".]*)"/', substr($match, 12, -2), $matches); $parameters = []; foreach ($matches[1] as $index => $match) { $parameters[$match] = $matches[2][$index]; } return [$state, $parameters]; } public function render($format, Doku_Renderer $renderer, $data): bool { if ($format !== 'xhtml') { return true; } [$state, $param] = $data; switch ($state) { case DOKU_LEXER_SPECIAL: $renderer->nocache(); $news = $this->helper->serviceNews->getById($param['id']); if (is_null($news) || ($param['id'] == 0)) { $renderer->doc .= '