Skip to content

Commit 00b8d76

Browse files
🤖 Automatic code style fixes
1 parent c13b196 commit 00b8d76

14 files changed

+509
-434
lines changed

GenericResolver.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
<?php
2+
23
namespace dokuwiki\plugin\include;
4+
35
use dokuwiki\File\Resolver;
46

57
/**
68
* Resolves ids without cleaning them.
79
*
810
* @package dokuwiki\plugin\include
911
*/
10-
class GenericResolver extends Resolver {
12+
class GenericResolver extends Resolver
13+
{
1114
}

action.php

Lines changed: 95 additions & 86 deletions
Large diffs are not rendered by default.

conf/default.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
<?php
2+
23
/**
34
* Options for the Include Plugin
45
*/
6+
57
$conf['noheader'] = 0; // Don't display the header of the inserted section
68
$conf['firstseconly'] = 0; // limit entries on main blog page to first section
79
$conf['showtaglogos'] = 0; // display image for first tag

conf/metadata.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
<?php
2+
23
/**
34
* Metadata for configuration manager plugin
45
* Additions for the Include Plugin
56
*
67
* @author Esther Brunner <wikidesign@gmail.com>
78
*/
9+
810
$meta['noheader'] = array('onoff');
911
$meta['firstseconly'] = array('onoff');
1012
$meta['showtaglogos'] = array('onoff');

helper.php

Lines changed: 212 additions & 219 deletions
Large diffs are not rendered by default.

syntax/closelastsecedit.php

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,39 @@
11
<?php
2+
3+
use dokuwiki\Extension\SyntaxPlugin;
4+
25
/**
36
* Include plugin (close last section edit)
47
*
58
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
69
* @author Michael Hamann <michael@content-space.de>
710
*/
811

9-
class syntax_plugin_include_closelastsecedit extends DokuWiki_Syntax_Plugin {
10-
11-
function getType() {
12+
class syntax_plugin_include_closelastsecedit extends SyntaxPlugin
13+
{
14+
public function getType()
15+
{
1216
return 'formatting';
1317
}
1418

15-
function getSort() {
19+
public function getSort()
20+
{
1621
return 50;
1722
}
1823

19-
function handle($match, $state, $pos, Doku_Handler $handler) {
24+
public function handle($match, $state, $pos, Doku_Handler $handler)
25+
{
2026
// this is a syntax plugin that doesn't offer any syntax, so there's nothing to handle by the parser
2127
}
2228

2329
/**
2430
* Finishes the last open section edit
2531
*/
26-
function render($mode, Doku_Renderer $renderer, $data) {
32+
public function render($mode, Doku_Renderer $renderer, $data)
33+
{
2734
if ($mode == 'xhtml') {
2835
/** @var Doku_Renderer_xhtml $renderer */
29-
list($endpos) = $data;
36+
[$endpos] = $data;
3037
$renderer->finishSectionEdit($endpos);
3138
return true;
3239
}

syntax/editbtn.php

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,28 @@
11
<?php
2+
3+
use dokuwiki\Extension\SyntaxPlugin;
4+
25
/**
36
* Include plugin (editbtn header component)
47
*
58
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
69
* @author Michael Klier <chi@chimeric.de>
710
*/
811

9-
class syntax_plugin_include_editbtn extends DokuWiki_Syntax_Plugin {
10-
11-
function getType() {
12+
class syntax_plugin_include_editbtn extends SyntaxPlugin
13+
{
14+
public function getType()
15+
{
1216
return 'formatting';
1317
}
14-
15-
function getSort() {
18+
19+
public function getSort()
20+
{
1621
return 50;
1722
}
1823

19-
function handle($match, $state, $pos, Doku_Handler $handler) {
24+
public function handle($match, $state, $pos, Doku_Handler $handler)
25+
{
2026
// this is a syntax plugin that doesn't offer any syntax, so there's nothing to handle by the parser
2127
}
2228

@@ -25,11 +31,12 @@ function handle($match, $state, $pos, Doku_Handler $handler) {
2531
*
2632
* @author Michael Klier <chi@chimeric.de>
2733
*/
28-
function render($mode, Doku_Renderer $renderer, $data) {
29-
list($title, $hid) = $data;
34+
public function render($mode, Doku_Renderer $renderer, $data)
35+
{
36+
[$title, $hid] = $data;
3037
if ($mode == 'xhtml') {
3138
if (defined('SEC_EDIT_PATTERN')) { // for DokuWiki Greebo and more recent versions
32-
$renderer->startSectionEdit(0, array('target' => 'plugin_include_editbtn', 'name' => $title, 'hid' => $hid));
39+
$renderer->startSectionEdit(0, ['target' => 'plugin_include_editbtn', 'name' => $title, 'hid' => $hid]);
3340
} else {
3441
$renderer->startSectionEdit(0, 'plugin_include_editbtn', $title);
3542
}

syntax/footer.php

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,28 @@
11
<?php
2+
3+
use dokuwiki\Extension\SyntaxPlugin;
4+
25
/**
36
* Include plugin (footer component)
47
*
58
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
69
* @author Michael Klier <chi@chimeric.de>
710
*/
811

9-
class syntax_plugin_include_footer extends DokuWiki_Syntax_Plugin {
10-
11-
function getType() {
12+
class syntax_plugin_include_footer extends SyntaxPlugin
13+
{
14+
public function getType()
15+
{
1216
return 'formatting';
1317
}
1418

15-
function getSort() {
19+
public function getSort()
20+
{
1621
return 300;
1722
}
1823

19-
function handle($match, $state, $pos, Doku_Handler $handler) {
24+
public function handle($match, $state, $pos, Doku_Handler $handler)
25+
{
2026
// this is a syntax plugin that doesn't offer any syntax, so there's nothing to handle by the parser
2127
}
2228

@@ -26,13 +32,14 @@ function handle($match, $state, $pos, Doku_Handler $handler) {
2632
* Code heavily copied from the header renderer from inc/parser/xhtml.php, just
2733
* added an href parameter to the anchor tag linking to the wikilink.
2834
*/
29-
function render($mode, Doku_Renderer $renderer, $data) {
35+
public function render($mode, Doku_Renderer $renderer, $data)
36+
{
3037

31-
list($page, $sect, $sect_title, $flags, $redirect_id, $footer_lvl) = $data;
38+
[$page, $sect, $sect_title, $flags, $redirect_id, $footer_lvl] = $data;
3239

3340
if ($mode == 'xhtml') {
3441
$renderer->doc .= $this->html_footer($page, $sect, $sect_title, $flags, $footer_lvl, $renderer);
35-
return true;
42+
return true;
3643
}
3744
return false;
3845
}
@@ -42,37 +49,31 @@ function render($mode, Doku_Renderer $renderer, $data) {
4249
* @param $renderer Doku_Renderer_xhtml The (xhtml) renderer
4350
* @return string The HTML code of the footer
4451
*/
45-
function html_footer($page, $sect, $sect_title, $flags, $footer_lvl, &$renderer) {
52+
public function html_footer($page, $sect, $sect_title, $flags, $footer_lvl, &$renderer)
53+
{
4654
global $conf, $ID;
4755

48-
if(!$flags['footer']) return '';
56+
if (!$flags['footer']) return '';
4957

5058
$meta = p_get_metadata($page);
5159
$exists = page_exists($page);
52-
$xhtml = array();
60+
$xhtml = [];
5361
// permalink
5462
if ($flags['permalink']) {
5563
$class = ($exists ? 'wikilink1' : 'wikilink2');
5664
$url = ($sect) ? wl($page) . '#' . $sect : wl($page);
5765
$name = ($sect) ? $sect_title : $page;
5866
$title = ($sect) ? $page . '#' . $sect : $page;
5967
if (!$title) $title = str_replace('_', ' ', noNS($page));
60-
$link = array(
61-
'url' => $url,
62-
'title' => $title,
63-
'name' => $name,
64-
'target' => $conf['target']['wiki'],
65-
'class' => $class . ' permalink',
66-
'more' => 'rel="bookmark"',
67-
);
68+
$link = ['url' => $url, 'title' => $title, 'name' => $name, 'target' => $conf['target']['wiki'], 'class' => $class . ' permalink', 'more' => 'rel="bookmark"'];
6869
$xhtml[] = $renderer->_formatLink($link);
6970
}
7071

7172
// date
7273
if ($flags['date'] && $exists) {
7374
$date = $meta['date']['created'];
7475
if ($date) {
75-
$xhtml[] = '<abbr class="published" title="'.dformat($date, '%Y-%m-%dT%H:%M:%SZ').'">'
76+
$xhtml[] = '<abbr class="published" title="' . dformat($date, '%Y-%m-%dT%H:%M:%SZ') . '">'
7677
. dformat($date)
7778
. '</abbr>';
7879
}
@@ -82,7 +83,7 @@ function html_footer($page, $sect, $sect_title, $flags, $footer_lvl, &$renderer)
8283
if ($flags['mdate'] && $exists) {
8384
$mdate = $meta['date']['modified'];
8485
if ($mdate) {
85-
$xhtml[] = '<abbr class="published" title="'.dformat($mdate, '%Y-%m-%dT%H:%M:%SZ').'">'
86+
$xhtml[] = '<abbr class="published" title="' . dformat($mdate, '%Y-%m-%dT%H:%M:%SZ') . '">'
8687
. dformat($mdate)
8788
. '</abbr>';
8889
}
@@ -117,7 +118,7 @@ function html_footer($page, $sect, $sect_title, $flags, $footer_lvl, &$renderer)
117118
// tags - let Tag Plugin do the work for us
118119
if (empty($sect) && $flags['tags'] && (!plugin_isdisabled('tag')) && ($tag = plugin_load('helper', 'tag'))) {
119120
$tags = $tag->td($page);
120-
if($tags) {
121+
if ($tags) {
121122
$xhtml .= '<div class="tags"><span>' . DOKU_LF
122123
. DOKU_TAB . $tags . DOKU_LF
123124
. DOKU_TAB . '</span></div>' . DOKU_LF;

syntax/header.php

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
<?php
2+
3+
use dokuwiki\Extension\SyntaxPlugin;
4+
25
/**
36
* Include plugin (permalink header component)
47
*
@@ -9,58 +12,62 @@
912
* @author Michael Klier <chi@chimeric.de>
1013
*/
1114

12-
class syntax_plugin_include_header extends DokuWiki_Syntax_Plugin {
13-
14-
function getType() {
15+
class syntax_plugin_include_header extends SyntaxPlugin
16+
{
17+
public function getType()
18+
{
1519
return 'formatting';
1620
}
17-
18-
function getSort() {
21+
22+
public function getSort()
23+
{
1924
return 50;
2025
}
2126

22-
function handle($match, $state, $pos, Doku_Handler $handler) {
27+
public function handle($match, $state, $pos, Doku_Handler $handler)
28+
{
2329
// this is a syntax plugin that doesn't offer any syntax, so there's nothing to handle by the parser
2430
}
2531

2632
/**
2733
* Renders a permalink header.
28-
*
34+
*
2935
* Code heavily copied from the header renderer from inc/parser/xhtml.php, just
3036
* added an href parameter to the anchor tag linking to the wikilink.
3137
*/
32-
function render($mode, Doku_Renderer $renderer, $data) {
38+
public function render($mode, Doku_Renderer $renderer, $data)
39+
{
3340
global $conf;
3441

35-
list($headline, $lvl, $pos, $page, $sect, $flags) = $data;
42+
[$headline, $lvl, $pos, $page, $sect, $flags] = $data;
3643

3744
if ($mode == 'xhtml') {
3845
/** @var Doku_Renderer_xhtml $renderer */
3946
$hid = $renderer->_headerToLink($headline, true);
4047
$renderer->toc_additem($hid, $headline, $lvl);
4148
$url = ($sect) ? wl($page) . '#' . $sect : wl($page);
42-
$renderer->doc .= DOKU_LF.'<h' . $lvl;
43-
$classes = array();
44-
if($flags['taglogos']) {
49+
$renderer->doc .= DOKU_LF . '<h' . $lvl;
50+
$classes = [];
51+
if ($flags['taglogos']) {
4552
$tag = $this->_get_firsttag($page);
46-
if($tag) {
53+
if ($tag) {
4754
$classes[] = 'include_firsttag__' . $tag;
4855
}
4956
}
5057
// the include header instruction is always at the beginning of the first section edit inside the include
5158
// wrap so there is no need to close a previous section edit.
5259
if ($lvl <= $conf['maxseclevel']) {
5360
if (defined('SEC_EDIT_PATTERN')) { // for DokuWiki Greebo and more recent versions
54-
$classes[] = $renderer->startSectionEdit($pos, array('target' => 'section', 'name' => $headline, 'hid' => $hid));
61+
$classes[] = $renderer->startSectionEdit($pos, ['target' => 'section', 'name' => $headline, 'hid' => $hid]);
5562
} else {
5663
$classes[] = $renderer->startSectionEdit($pos, 'section', $headline);
5764
}
5865
}
5966
if ($classes) {
60-
$renderer->doc .= ' class="'. implode(' ', $classes) . '"';
67+
$renderer->doc .= ' class="' . implode(' ', $classes) . '"';
6168
}
6269
$headline = $renderer->_xmlEntities($headline);
63-
$renderer->doc .= ' id="'.$hid.'"><a href="' . $url . '" title="' . $headline . '">';
70+
$renderer->doc .= ' id="' . $hid . '"><a href="' . $url . '" title="' . $headline . '">';
6471
$renderer->doc .= $headline;
6572
$renderer->doc .= '</a></h' . $lvl . '>' . DOKU_LF;
6673
return true;
@@ -75,17 +82,18 @@ function render($mode, Doku_Renderer $renderer, $data) {
7582
*
7683
* @author Michael Klier <chi@chimeric.de>
7784
*/
78-
function _get_firsttag($page) {
79-
if(plugin_isdisabled('tag') || (!plugin_load('helper', 'tag'))) {
85+
public function _get_firsttag($page)
86+
{
87+
if (plugin_isdisabled('tag') || (!plugin_load('helper', 'tag'))) {
8088
return false;
8189
}
8290
$subject = p_get_metadata($page, 'subject');
8391
if (is_array($subject)) {
8492
$tag = $subject[0];
8593
} else {
86-
list($tag, $rest) = explode(' ', $subject, 2);
94+
[$tag, $rest] = explode(' ', $subject, 2);
8795
}
88-
if($tag) {
96+
if ($tag) {
8997
return $tag;
9098
} else {
9199
return false;

0 commit comments

Comments
 (0)