|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace dokuwiki\Ui; |
|
4
|
|
|
|
|
5
|
|
|
use dokuwiki\Extension\Event; |
|
6
|
|
|
use dokuwiki\Form\Form; |
|
7
|
|
|
|
|
8
|
|
|
/** |
|
9
|
|
|
* DokuWiki Page Conflict Interface |
|
10
|
|
|
* |
|
11
|
|
|
* @package dokuwiki\Ui |
|
12
|
|
|
*/ |
|
13
|
|
|
class PageConflict extends Ui |
|
14
|
|
|
{ |
|
15
|
|
|
protected $text; |
|
16
|
|
|
protected $summary; |
|
17
|
|
|
|
|
18
|
|
|
/** |
|
19
|
|
|
* PageConflict Ui constructor |
|
20
|
|
|
* |
|
21
|
|
|
* @param string $text wiki text |
|
22
|
|
|
* @param string $summary edit summary |
|
23
|
|
|
*/ |
|
24
|
|
|
public function __construct($text = '', $summary = '') |
|
25
|
|
|
{ |
|
26
|
|
|
$this->text = $text; |
|
27
|
|
|
$this->summary = $summary; |
|
28
|
|
|
} |
|
29
|
|
|
|
|
30
|
|
|
/** |
|
31
|
|
|
* Show conflict form to ask whether save anyway or cancel the page edits |
|
32
|
|
|
* |
|
33
|
|
|
* @author Andreas Gohr <[email protected]> |
|
34
|
|
|
* |
|
35
|
|
|
* @triggers HTML_CONFLICTFORM_OUTPUT |
|
36
|
|
|
* @param string $text |
|
|
|
|
|
|
37
|
|
|
* @param string $summary |
|
|
|
|
|
|
38
|
|
|
* @return void |
|
39
|
|
|
*/ |
|
40
|
|
|
public function show() |
|
41
|
|
|
{ |
|
42
|
|
|
global $ID; |
|
43
|
|
|
global $lang; |
|
44
|
|
|
|
|
45
|
|
|
// print intro |
|
46
|
|
|
print p_locale_xhtml('conflict'); |
|
47
|
|
|
|
|
48
|
|
|
// create the form |
|
49
|
|
|
$form = new Form(['id' => 'dw__editform']); |
|
50
|
|
|
$form->addTagOpen('div')->addClass('no'); |
|
51
|
|
|
$form->setHiddenField('id', $ID); |
|
52
|
|
|
$form->setHiddenField('wikitext', $this->text); |
|
53
|
|
|
$form->setHiddenField('summary', $this->summary); |
|
54
|
|
|
|
|
55
|
|
|
$form->addButton('do[save]', $lang['btn_save'] )->attrs(['type' => 'submit', 'accesskey' => 's']); |
|
56
|
|
|
$form->addButton('do[cancel]', $lang['btn_cancel'] )->attrs(['type' => 'submit']); |
|
57
|
|
|
$form->addTagClose('div'); |
|
58
|
|
|
|
|
59
|
|
|
// emit HTML_CONFLICTFORM_OUTPUT event, print the form |
|
60
|
|
|
Event::createAndTrigger('HTML_CONFLICTFORM_OUTPUT', $form, 'html_form_output', false); |
|
61
|
|
|
|
|
62
|
|
|
print '<br /><br /><br /><br />'.DOKU_LF; |
|
63
|
|
|
|
|
64
|
|
|
(new Diff($this->text, false))->show(); |
|
65
|
|
|
print DOKU_LF; |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
} |
|
69
|
|
|
|
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italyis not defined by the methodfinale(...).The most likely cause is that the parameter was removed, but the annotation was not.