Skip to content

Commit 820f7b6

Browse files
committed
Manual code style fixes
1 parent b7b9d8d commit 820f7b6

17 files changed

+484
-392
lines changed

_test/action_edit_button.test.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ function testSetName()
1616
'target' => 'plugin_data'
1717
);
1818
$event = new Doku_Event('', $data);
19-
$action->_editbutton($event, null);
19+
$action->editButton($event, null);
2020

2121
$this->assertTrue(isset($data['name']));
2222
}
@@ -28,7 +28,7 @@ function testWrongTarget()
2828
'target' => 'default target'
2929
);
3030
$event = new Doku_Event('', $data);
31-
$action->_editbutton($event, null);
31+
$action->editButton($event, null);
3232

3333
$this->assertFalse(isset($data['name']));
3434
}

_test/action_handle.test.php

+5-6
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
*/
99
class action_handle_test extends DokuWikiTest
1010
{
11-
1211
protected $pluginsEnabled = array('data', 'sqlite');
1312

1413
protected $action;
@@ -30,15 +29,15 @@ public function setUp(): void
3029

3130
$this->action = new action_plugin_data();
3231
$this->helper = plugin_load('helper', 'data');
33-
$this->db = $this->helper->_getDB();
32+
$this->db = $this->helper->getDB();
3433

3534
$this->db->exec(
3635
'INSERT INTO pages ( pid, page, title , class , lastmod) VALUES (?, ?, ?, ?, ?)',
3736
[1, 'test', 'title', 'class', time()]
3837
);
3938
}
4039

41-
function testHandleStillPresent()
40+
public function testHandleStillPresent()
4241
{
4342

4443
$data = array(
@@ -49,13 +48,13 @@ function testHandleStillPresent()
4948
2 => 'test'
5049
);
5150
$event = new Doku_Event('', $data);
52-
$this->action->_handle($event, null);
51+
$this->action->handle($event, null);
5352

5453
$pid = $this->getTestPageId();
5554
$this->assertFalse(!$pid);
5655
}
5756

58-
function testHandleDelete()
57+
public function testHandleDelete()
5958
{
6059
$data = array(
6160
0 => array(
@@ -66,7 +65,7 @@ function testHandleDelete()
6665
);
6766

6867
$event = new Doku_Event('', $data);
69-
$this->action->_handle($event, null);
68+
$this->action->handle($event, null);
7069

7170
$pid = $this->db->queryValue('SELECT pid FROM pages WHERE page = ?', 'test');
7271
$this->assertTrue(!$pid);

_test/helper.test.php

+99-99
Large diffs are not rendered by default.

_test/helperAliases.test.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class helper_plugin_data_test_aliases extends DokuWikiTest
1212
public function testAliases()
1313
{
1414
$helper = new helper_plugin_data();
15-
$db = $helper->_getDB();
15+
$db = $helper->getDB();
1616
$this->assertTrue($db !== false);
1717
$db->exec(
1818
'INSERT INTO aliases (name, type, prefix, postfix, enum) VALUES (?,?,?,?,?)',
@@ -26,7 +26,7 @@ public function testAliases()
2626
'postfix' => ']]'
2727
)
2828
);
29-
$this->assertEquals($expect, $helper->_aliases());
29+
$this->assertEquals($expect, $helper->aliases());
3030

3131
}
3232
}

_test/syntax_plugin_data_entry.test.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ function testShowData()
341341

342342
$result = $plugin->handle($this->exampleEntry, 0, 10, $handler);
343343

344-
$plugin->_showData($result, $xhtml);
344+
$plugin->showData($result, $xhtml);
345345
$doc = (new DOMWrap\Document())->html($xhtml->doc);
346346

347347
$this->assertEquals(1, $doc->find('div.inline.dataplugin_entry.projects')->count());

action.php

+13-13
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ public function __construct()
3434
*/
3535
public function register(EventHandler $controller)
3636
{
37-
$controller->register_hook('IO_WIKIPAGE_WRITE', 'BEFORE', $this, '_handle');
38-
$controller->register_hook('HTML_SECEDIT_BUTTON', 'BEFORE', $this, '_editbutton');
39-
$controller->register_hook('HTML_EDIT_FORMSELECTION', 'BEFORE', $this, '_editform'); // deprecated
40-
$controller->register_hook('EDIT_FORM_ADDTEXTAREA', 'BEFORE', $this, '_editform'); // replacement
41-
$controller->register_hook('ACTION_ACT_PREPROCESS', 'BEFORE', $this, '_handle_edit_post');
42-
$controller->register_hook('AJAX_CALL_UNKNOWN', 'BEFORE', $this, '_handle_ajax');
37+
$controller->register_hook('IO_WIKIPAGE_WRITE', 'BEFORE', $this, 'handle');
38+
$controller->register_hook('HTML_SECEDIT_BUTTON', 'BEFORE', $this, 'editButton');
39+
$controller->register_hook('HTML_EDIT_FORMSELECTION', 'BEFORE', $this, 'editForm'); // deprecated
40+
$controller->register_hook('EDIT_FORM_ADDTEXTAREA', 'BEFORE', $this, 'editForm'); // replacement
41+
$controller->register_hook('ACTION_ACT_PREPROCESS', 'BEFORE', $this, 'handleEditPost');
42+
$controller->register_hook('AJAX_CALL_UNKNOWN', 'BEFORE', $this, 'handleAjax');
4343
}
4444

4545
/**
@@ -49,12 +49,12 @@ public function register(EventHandler $controller)
4949
* @param Event $event
5050
* @param null $param
5151
*/
52-
public function _handle(Event $event, $param)
52+
public function handle(Event $event, $param)
5353
{
5454
$data = $event->data;
5555
if (strpos($data[0][1], 'dataentry') !== false) return; // plugin seems still to be there
5656

57-
$sqlite = $this->dthlp->_getDB();
57+
$sqlite = $this->dthlp->getDB();
5858
if (!$sqlite) return;
5959
$id = ltrim($data[1] . ':' . $data[2], ':');
6060

@@ -70,7 +70,7 @@ public function _handle(Event $event, $param)
7070
* @param Event $event
7171
* @param null $param
7272
*/
73-
public function _editbutton($event, $param)
73+
public function editButton($event, $param)
7474
{
7575
if ($event->data['target'] !== 'plugin_data') {
7676
return;
@@ -83,7 +83,7 @@ public function _editbutton($event, $param)
8383
* @param Event $event
8484
* @param null $param
8585
*/
86-
public function _editform(Event $event, $param)
86+
public function editForm(Event $event, $param)
8787
{
8888
global $TEXT;
8989
if ($event->data['target'] !== 'plugin_data') {
@@ -113,7 +113,7 @@ public function _editform(Event $event, $param)
113113
/**
114114
* @param Event $event
115115
*/
116-
public function _handle_edit_post(Event $event)
116+
public function handleEditPost(Event $event)
117117
{
118118
if (!isset($_POST['data_edit'])) {
119119
return;
@@ -127,7 +127,7 @@ public function _handle_edit_post(Event $event)
127127
/**
128128
* @param Event $event
129129
*/
130-
public function _handle_ajax(Event $event)
130+
public function handleAjax(Event $event)
131131
{
132132
if ($event->data !== 'data_page') {
133133
return;
@@ -137,7 +137,7 @@ public function _handle_ajax(Event $event)
137137
$event->preventDefault();
138138

139139
$type = substr($_REQUEST['aliastype'], 10);
140-
$aliases = $this->dthlp->_aliases();
140+
$aliases = $this->dthlp->aliases();
141141

142142
if (!isset($aliases[$type])) {
143143
echo 'Unknown type';

admin/aliases.php

+4-3
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function handle()
7070
global $INPUT;
7171
if (!$INPUT->has('d') || !checkSecurityToken()) return;
7272

73-
$sqlite = $this->dthlp->_getDB();
73+
$sqlite = $this->dthlp->getDB();
7474
if (!$sqlite) return;
7575

7676
$sqlite->getPdo()->beginTransaction();
@@ -103,7 +103,7 @@ public function handle()
103103
*/
104104
public function html()
105105
{
106-
$sqlite = $this->dthlp->_getDB();
106+
$sqlite = $this->dthlp->getDB();
107107
if (!$sqlite) return;
108108

109109
echo $this->locale_xhtml('admin_intro');
@@ -138,7 +138,8 @@ public function html()
138138
$form->addElement('<td>');
139139
$form->addElement(form_makeMenuField(
140140
'd[' . $cur . '][type]',
141-
['', 'page', 'title', 'mail', 'url', 'dt', 'wiki', 'tag', 'hidden', 'img'], //'nspage' don't support post/prefixes
141+
//'nspage' don't support post/prefixes
142+
['', 'page', 'title', 'mail', 'url', 'dt', 'wiki', 'tag', 'hidden', 'img'],
142143
$row['type'],
143144
''
144145
));

admin/clean.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public function handle()
6666
{
6767
if (!isset($_REQUEST['data_go']) || !checkSecurityToken()) return;
6868

69-
$sqlite = $this->dthlp->_getDB();
69+
$sqlite = $this->dthlp->getDB();
7070
if (!$sqlite) return;
7171

7272
$rows = $sqlite->queryAll('SELECT pid, page FROM pages');

0 commit comments

Comments
 (0)