From fe957bb77085fa5123aa131d5d16d51490b98806 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 8 Nov 2023 22:02:33 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=A4=96=20Rector=20and=20PHPCS=20fixes=20(?= =?UTF-8?q?#42)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: mprins --- syntax.php | 56 ++++++++++++++++++++++++++++++------------------------ 1 file changed, 31 insertions(+), 25 deletions(-) diff --git a/syntax.php b/syntax.php index e221090..cd0a2c4 100644 --- a/syntax.php +++ b/syntax.php @@ -1,4 +1,7 @@ * @author Mark C. Prins */ - /** * All DokuWiki plugins to extend the parser/rendering mechanism * need to inherit from this class. */ -class syntax_plugin_backlinks extends DokuWiki_Syntax_Plugin { +class syntax_plugin_backlinks extends SyntaxPlugin +{ /** * Syntax Type. * @@ -26,21 +29,24 @@ class syntax_plugin_backlinks extends DokuWiki_Syntax_Plugin { * * @see DokuWiki_Syntax_Plugin::getType() */ - public function getType() { + public function getType() + { return 'substition'; } /** * @see DokuWiki_Syntax_Plugin::getPType() */ - public function getPType() { + public function getPType() + { return 'block'; } /** * @see Doku_Parser_Mode::getSort() */ - public function getSort() { + public function getSort() + { return 304; } @@ -49,7 +55,8 @@ public function getSort() { * * @see Doku_Parser_Mode::connectTo() */ - public function connectTo($mode) { + public function connectTo($mode) + { $this->Lexer->addSpecialPattern('\{\{backlinks>.+?\}\}', $mode, 'plugin_backlinks'); } @@ -58,17 +65,18 @@ public function connectTo($mode) { * * @see DokuWiki_Syntax_Plugin::handle() */ - public function handle($match, $state, $pos, Doku_Handler $handler) { + public function handle($match, $state, $pos, Doku_Handler $handler) + { // strip {{backlinks> from start and }} from end $match = substr($match, 12, -2); $includeNS = ''; - if(strstr($match, "#")) { + if (strstr($match, "#")) { $includeNS = substr(strstr($match, "#", false), 1); $match = strstr($match, "#", true); } - return (array($match, $includeNS)); + return ([$match, $includeNS]); } /** @@ -76,23 +84,24 @@ public function handle($match, $state, $pos, Doku_Handler $handler) { * * @see DokuWiki_Syntax_Plugin::render() */ - public function render($format, Doku_Renderer $renderer, $data) { + public function render($format, Doku_Renderer $renderer, $data) + { global $lang; global $INFO; global $ID; $id = $ID; // If it's a sidebar, get the original id. - if($INFO != null) { + if ($INFO != null) { $id = $INFO['id']; } $match = $data[0]; $match = ($match == '.') ? $id : $match; - if(strstr($match, ".:")) { + if (strstr($match, ".:")) { resolve_pageid(getNS($id), $match, $exists); } - if($format == 'xhtml') { + if ($format == 'xhtml') { $renderer->info['cache'] = false; $backlinks = ft_backlinks($match); @@ -102,34 +111,31 @@ public function render($format, Doku_Renderer $renderer, $data) { $renderer->doc .= '