1 | <?php |
||
25 | class ItemDiffView implements DiffView { |
||
26 | |||
27 | /** |
||
28 | * @var string[] |
||
29 | */ |
||
30 | private $path; |
||
31 | |||
32 | /** |
||
33 | * @var Diff |
||
34 | */ |
||
35 | private $diff; |
||
36 | |||
37 | /** |
||
38 | * @var SiteLookup |
||
39 | */ |
||
40 | private $siteLookup; |
||
41 | |||
42 | /** |
||
43 | * @var EntityIdFormatter |
||
44 | */ |
||
45 | private $entityIdFormatter; |
||
46 | |||
47 | /** |
||
48 | * @var MessageLocalizer |
||
49 | */ |
||
50 | private $messageLocalizer; |
||
51 | |||
52 | /** |
||
53 | * @var string |
||
54 | */ |
||
55 | private $siteLinkPath; |
||
56 | |||
57 | /** |
||
58 | * @param string[] $path |
||
59 | * @param Diff $diff |
||
60 | * @param SiteLookup $siteLookup |
||
61 | * @param EntityIdFormatter $entityIdFormatter that must return only HTML! otherwise injections might be possible |
||
62 | * @param MessageLocalizer $messageLocalizer |
||
63 | */ |
||
64 | public function __construct( |
||
79 | |||
80 | /** |
||
81 | * Builds and returns the HTML to represent the Diff. |
||
82 | * |
||
83 | * @return string |
||
84 | */ |
||
85 | public function getHtml() { |
||
88 | |||
89 | /** |
||
90 | * Does the actual work. |
||
91 | * |
||
92 | * @param string[] $path |
||
93 | * @param DiffOp $op |
||
94 | * |
||
95 | * @return string |
||
96 | * @throws MWException |
||
97 | */ |
||
98 | protected function generateOpHtml( array $path, DiffOp $op ) { |
||
143 | |||
144 | /** |
||
145 | * Generates HTML for an change diffOp |
||
146 | * |
||
147 | * @param string|null $oldValue |
||
148 | * @param string|null $newValue |
||
149 | * @param string[] $path |
||
150 | * |
||
151 | * @return string |
||
152 | */ |
||
153 | protected function generateChangeOpHtml( $oldValue, $newValue, array $path ) { |
||
173 | |||
174 | /** |
||
175 | * @param string $value |
||
176 | * @param string[] $path |
||
177 | * |
||
178 | * @return string |
||
179 | */ |
||
180 | private function getDeletedLine( $value, array $path ) { |
||
183 | |||
184 | /** |
||
185 | * @param string $value |
||
186 | * @param string[] $path |
||
187 | * |
||
188 | * @return string |
||
189 | */ |
||
190 | private function getAddedLine( $value, array $path ) { |
||
193 | |||
194 | /** |
||
195 | * @param string $tag |
||
196 | * @param string $value |
||
197 | * @param string[] $path |
||
198 | * |
||
199 | * @return string |
||
200 | */ |
||
201 | private function getChangedLine( $tag, $value, array $path ) { |
||
210 | |||
211 | /** |
||
212 | * @param string $siteId |
||
213 | * @param string $pageName |
||
214 | * |
||
215 | * @return string |
||
216 | */ |
||
217 | private function getSiteLinkElement( $siteId, $pageName ) { |
||
234 | |||
235 | /** |
||
236 | * @param string $idString |
||
237 | * |
||
238 | * @return string HTML |
||
239 | */ |
||
240 | private function getBadgeLinkElement( $idString ) { |
||
249 | |||
250 | /** |
||
251 | * Generates HTML for the header of the diff operation |
||
252 | * |
||
253 | * @param string $name |
||
254 | * |
||
255 | * @return string |
||
256 | */ |
||
257 | protected function generateDiffHeaderHtml( $name ) { |
||
265 | |||
266 | } |
||
267 |