Skip to content
This repository was archived by the owner on Apr 13, 2025. It is now read-only.

Commit b57e3d1

Browse files
authored
Merge pull request #5 from crazy-max/analysis-8mrj0p
Applied fixes from StyleCI
2 parents d9f7fa0 + 07839c8 commit b57e3d1

File tree

5 files changed

+133
-106
lines changed

5 files changed

+133
-106
lines changed

syntaxhighlighter4/action.php

Lines changed: 40 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,83 @@
11
<?php
22
/**
3-
* DokuWiki Plugin syntaxhighlighter4 (Action Component)
3+
* DokuWiki Plugin syntaxhighlighter4 (Action Component).
44
*
55
* @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
66
* @author Cr@zy <webmaster@crazyws.fr>
77
*/
88

99
// must be run within Dokuwiki
10-
if(!defined('DOKU_INC')) die();
11-
12-
class action_plugin_syntaxhighlighter4 extends DokuWiki_Action_Plugin {
10+
if (!defined('DOKU_INC')) {
11+
die();
12+
}
1313

14+
class action_plugin_syntaxhighlighter4 extends DokuWiki_Action_Plugin
15+
{
1416
/**
15-
* Registers a callback function for a given event
17+
* Registers a callback function for a given event.
1618
*
1719
* @param Doku_Event_Handler $controller DokuWiki's event controller object
20+
*
1821
* @return void
1922
*/
20-
public function register(Doku_Event_Handler $controller) {
21-
$controller->register_hook('TPL_METAHEADER_OUTPUT', 'BEFORE', $this, 'handle_metaheader');
22-
$controller->register_hook('TPL_ACT_RENDER', 'AFTER', $this, 'handle_jsprocessing');
23+
public function register(Doku_Event_Handler $controller)
24+
{
25+
$controller->register_hook('TPL_METAHEADER_OUTPUT', 'BEFORE', $this, 'handle_metaheader');
26+
$controller->register_hook('TPL_ACT_RENDER', 'AFTER', $this, 'handle_jsprocessing');
2327
}
2428

2529
/**
26-
* [Custom event handler which performs action]
30+
* [Custom event handler which performs action].
31+
*
32+
* @param Doku_Event $event event object by reference
33+
* @param mixed $param [the parameters passed as fifth argument to register_hook() when this
34+
* handler was registered]
2735
*
28-
* @param Doku_Event $event event object by reference
29-
* @param mixed $param [the parameters passed as fifth argument to register_hook() when this
30-
* handler was registered]
3136
* @return void
3237
*/
33-
34-
public function handle_metaheader(Doku_Event &$event, $param) {
38+
public function handle_metaheader(Doku_Event &$event, $param)
39+
{
3540
// Add SyntaxHighlighter theme.
36-
$event->data['link'][] = array('rel' => 'stylesheet',
37-
'type' => 'text/css',
38-
'href' => DOKU_BASE . 'lib/plugins/syntaxhighlighter4/dist/'.$this->getConf('theme'),
39-
);
41+
$event->data['link'][] = ['rel' => 'stylesheet',
42+
'type' => 'text/css',
43+
'href' => DOKU_BASE.'lib/plugins/syntaxhighlighter4/dist/'.$this->getConf('theme'),
44+
];
4045

4146
// Register SyntaxHighlighter javascript.
42-
$event->data["script"][] = array("type" => "text/javascript",
43-
"src" => DOKU_BASE . "lib/plugins/syntaxhighlighter4/dist/syntaxhighlighter.js",
44-
"_data" => ""
45-
);
47+
$event->data['script'][] = ['type' => 'text/javascript',
48+
'src' => DOKU_BASE.'lib/plugins/syntaxhighlighter4/dist/syntaxhighlighter.js',
49+
'_data' => '',
50+
];
4651
}
4752

48-
public function handle_jsprocessing(Doku_Event &$event, $param) {
53+
public function handle_jsprocessing(Doku_Event &$event, $param)
54+
{
4955
global $ID, $INFO;
5056

5157
// Ensures code will be written only on base page
52-
if ($ID != $INFO["id"]) {
58+
if ($ID != $INFO['id']) {
5359
return;
5460
}
5561

5662
// Load Syntaxhighlighter config
57-
ptln("");
63+
ptln('');
5864
ptln("<script type='text/javascript'>");
59-
ptln("syntaxhighlighterConfig = {");
60-
ptln(" autoLinks: " . ($this->getConf('autoLinks') == 1 ? 'true' : 'false') . ",");
65+
ptln('syntaxhighlighterConfig = {');
66+
ptln(' autoLinks: '.($this->getConf('autoLinks') == 1 ? 'true' : 'false').',');
6167
$firstLine = $this->getConf('first-line');
6268
if ($firstLine > 0) {
63-
ptln(" firstLine: " . $firstLine . ",");
69+
ptln(' firstLine: '.$firstLine.',');
6470
}
65-
ptln(" gutter: " . ($this->getConf('gutter') == 1 ? 'true' : 'false') . ",");
66-
ptln(" htmlScript: " . ($this->getConf('htmlScript') == 1 ? 'true' : 'false') . ",");
71+
ptln(' gutter: '.($this->getConf('gutter') == 1 ? 'true' : 'false').',');
72+
ptln(' htmlScript: '.($this->getConf('htmlScript') == 1 ? 'true' : 'false').',');
6773
$tabSize = $this->getConf('tabSize');
6874
if ($tabSize > 0) {
69-
ptln(" tabSize: " . $tabSize . ",");
75+
ptln(' tabSize: '.$tabSize.',');
7076
}
71-
ptln(" smartTabs: " . ($this->getConf('smartTabs') == 1 ? 'true' : 'false'));
72-
ptln("}");
73-
ptln("</script>");
77+
ptln(' smartTabs: '.($this->getConf('smartTabs') == 1 ? 'true' : 'false'));
78+
ptln('}');
79+
ptln('</script>');
7480
}
75-
7681
}
7782

7883
// vim:ts=4:sw=4:et:

syntaxhighlighter4/conf/default.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
<?php
22
/**
3-
* Default settings for the syntaxhighlighter4 plugin
3+
* Default settings for the syntaxhighlighter4 plugin.
44
*
55
* @author Cr@zy <webmaster@crazyws.fr>
66
*/
7-
87
$conf['theme'] = 'theme-default.css';
98

109
// defaults

syntaxhighlighter4/conf/metadata.php

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
<?php
22
/**
3-
* Options for the syntaxhighlighter4 plugin
3+
* Options for the syntaxhighlighter4 plugin.
44
*
55
* @author Cr@zy <webmaster@crazyws.fr>
66
*/
7-
8-
$meta['theme'] = array('multichoice','_choices' => array(
7+
$meta['theme'] = ['multichoice', '_choices' => [
98
'theme-default.css',
109
'theme-django.css',
1110
'theme-eclipse.css',
@@ -14,13 +13,13 @@
1413
'theme-mdultra.css',
1514
'theme-midnight.css',
1615
'theme-rdark.css',
17-
'theme-swift.css'
18-
));
16+
'theme-swift.css',
17+
]];
1918

2019
// defaults
21-
$meta['autoLinks'] = array('onoff');
22-
$meta['firstLine'] = array('numeric');
23-
$meta['gutter'] = array('onoff');
24-
$meta['htmlScript'] = array('onoff');
25-
$meta['smartTabs'] = array('onoff');
26-
$meta['tabSize'] = array('numeric');
20+
$meta['autoLinks'] = ['onoff'];
21+
$meta['firstLine'] = ['numeric'];
22+
$meta['gutter'] = ['onoff'];
23+
$meta['htmlScript'] = ['onoff'];
24+
$meta['smartTabs'] = ['onoff'];
25+
$meta['tabSize'] = ['numeric'];
Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
<?php
22
/**
3-
* english language file for syntaxhighlighter4 plugin
3+
* english language file for syntaxhighlighter4 plugin.
44
*
55
* @author Cr@zy <webmaster@crazyws.fr>
66
*/
7-
8-
$lang['theme'] = "CSS theme for SyntaxHiglighter 4";
7+
$lang['theme'] = 'CSS theme for SyntaxHiglighter 4';
98

109
// conf
1110
$lang['autoLinks'] = "(Default true) Allows you to turn detection of links in the highlighted element on and off. If the option is turned off, URLs won't be clickable";
12-
$lang['firstLine'] = "(Default 1) Allows you to change the first (starting) line number";
13-
$lang['gutter'] = "(Default true) Allows you to turn gutter with line numbers on and off";
14-
$lang['htmlScript'] = "(Default false) Allows you to highlight a mixture of HTML/XML code and a script which is very common in web development";
15-
$lang['smartTabs'] = "(Default true) Allows you to turn smart tabs feature on and off";
16-
$lang['tabSize'] = "(Default 4) Allows you to adjust tab size";
11+
$lang['firstLine'] = '(Default 1) Allows you to change the first (starting) line number';
12+
$lang['gutter'] = '(Default true) Allows you to turn gutter with line numbers on and off';
13+
$lang['htmlScript'] = '(Default false) Allows you to highlight a mixture of HTML/XML code and a script which is very common in web development';
14+
$lang['smartTabs'] = '(Default true) Allows you to turn smart tabs feature on and off';
15+
$lang['tabSize'] = '(Default 4) Allows you to adjust tab size';
1716

1817
//Setup VIM: ex: et ts=4 :

0 commit comments

Comments
 (0)