|
1
|
|
|
<?php |
|
2
|
|
|
/* |
|
3
|
|
|
* You may not change or alter any portion of this comment or credits |
|
4
|
|
|
* of supporting developers from this source code or any supporting source code |
|
5
|
|
|
* which is considered copyrighted (c) material of the original comment or credit authors. |
|
6
|
|
|
* |
|
7
|
|
|
* This program is distributed in the hope that it will be useful, |
|
8
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
9
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace Xoops\Upgrade; |
|
13
|
|
|
|
|
14
|
|
|
use ArrayObject; |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* XOOPS Upgrade Smarty4RepairOutput |
|
18
|
|
|
* |
|
19
|
|
|
* Used to report Smarty4 issues corrected in migration fixes |
|
20
|
|
|
* |
|
21
|
|
|
* @category Xoops\Upgrade |
|
22
|
|
|
* @package Xoops |
|
23
|
|
|
* @author Richard Griffith <[email protected]> |
|
24
|
|
|
* @copyright 2023 XOOPS Project (https://xoops.org) |
|
25
|
|
|
* @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) |
|
26
|
|
|
* @link https://xoops.org |
|
27
|
|
|
*/ |
|
28
|
|
|
class Smarty4RepairOutput extends ScannerOutput |
|
29
|
|
|
{ |
|
30
|
|
|
/** |
|
31
|
|
|
* @var string $content accumulated output |
|
32
|
|
|
*/ |
|
33
|
|
|
protected $content = ''; |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* @var int $issueCounts |
|
37
|
|
|
*/ |
|
38
|
|
|
protected $issueCounts; |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* Initialize |
|
42
|
|
|
*/ |
|
43
|
|
|
public function __construct() |
|
44
|
|
|
{ |
|
45
|
|
|
$this->content = ''; |
|
46
|
|
|
$this->issueCounts = 0; |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
/** |
|
50
|
|
|
* add to count of fixed issues |
|
51
|
|
|
* |
|
52
|
|
|
* @param int $count |
|
53
|
|
|
* |
|
54
|
|
|
* @return void |
|
55
|
|
|
*/ |
|
56
|
|
|
public function addToCount($count) |
|
57
|
|
|
{ |
|
58
|
|
|
$this->issueCounts += (int) $count; |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
/** |
|
62
|
|
|
* Return recorded output |
|
63
|
|
|
* |
|
64
|
|
|
* @returns string |
|
65
|
|
|
*/ |
|
66
|
|
|
public function outputFetch() |
|
67
|
|
|
{ |
|
68
|
|
|
return $this->content; |
|
69
|
|
|
} |
|
70
|
|
|
|
|
71
|
|
|
/** |
|
72
|
|
|
* Add item to report |
|
73
|
|
|
* |
|
74
|
|
|
* @param string $item |
|
75
|
|
|
* |
|
76
|
|
|
* @return void |
|
77
|
|
|
*/ |
|
78
|
|
|
public function outputAppend($item) |
|
79
|
|
|
{ |
|
80
|
|
|
$this->content .= $item . "\n"; |
|
81
|
|
|
} |
|
82
|
|
|
|
|
83
|
|
|
/** |
|
84
|
|
|
* Called to |
|
85
|
|
|
*/ |
|
86
|
|
|
public function outputStart() |
|
87
|
|
|
{ |
|
88
|
|
|
$this->outputAppend('<h2>' . _XOOPS_SMARTY4_SCANNER_RESULTS . '</h2>'); |
|
89
|
|
|
$this->outputAppend('<table class="table"><tr><th>' |
|
90
|
|
|
. _XOOPS_SMARTY4_SCANNER_FILE . '</th><th>' |
|
91
|
|
|
. _XOOPS_SMARTY4_SCANNER_FIXED . '</th></tr>'); |
|
92
|
|
|
} |
|
93
|
|
|
|
|
94
|
|
|
public function outputWrapUp() |
|
95
|
|
|
{ |
|
96
|
|
|
$this->outputAppend('</table>'); |
|
97
|
|
|
} |
|
98
|
|
|
|
|
99
|
|
|
/** |
|
100
|
|
|
* @param ArrayObject $args should contain these keys: filename, count |
|
101
|
|
|
*/ |
|
102
|
|
|
public function outputIssue(ArrayObject $args) |
|
103
|
|
|
{ |
|
104
|
|
|
$filename = $args['filename']; |
|
105
|
|
|
$count = (int) $args['count']; |
|
106
|
|
|
$this->outputAppend("<tr><td>{$filename}</td><td>{$count}</td></tr>"); |
|
107
|
|
|
|
|
108
|
|
|
$this->addToCount($count); |
|
109
|
|
|
} |
|
110
|
|
|
|
|
111
|
|
|
/** |
|
112
|
|
|
* @param string $filename |
|
113
|
|
|
* @param int $count |
|
114
|
|
|
* |
|
115
|
|
|
* @returns ArrayObject with keys 'filename', 'count' |
|
116
|
|
|
*/ |
|
117
|
|
|
public function makeOutputIssue($filename, $count) |
|
118
|
|
|
{ |
|
119
|
|
|
return new ArrayObject( |
|
120
|
|
|
[ |
|
121
|
|
|
'filename' => $filename, |
|
122
|
|
|
'count' => $count, |
|
123
|
|
|
], |
|
124
|
|
|
); |
|
125
|
|
|
} |
|
126
|
|
|
} |
|
127
|
|
|
//$output->outputIssue($output->makeOutputIssue($filename, $count)); |
|
128
|
|
|
|