Verzeichnisstruktur phpBB-3.3.15
- Veröffentlicht
- 28.08.2024
So funktioniert es
|
Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück |
Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
MinifyXPathExpressions.php
01 <?php
02
03 /**
04 * @package s9e\TextFormatter
05 * @copyright Copyright (c) 2010-2022 The s9e authors
06 * @license http://www.opensource.org/licenses/mit-license.php The MIT License
07 */
08 namespace s9e\TextFormatter\Configurator\TemplateNormalizations;
09
10 use DOMAttr;
11 use s9e\TextFormatter\Configurator\Helpers\AVTHelper;
12 use s9e\TextFormatter\Configurator\Helpers\XPathHelper;
13
14 class MinifyXPathExpressions extends AbstractNormalization
15 {
16 /**
17 * {@inheritdoc}
18 */
19 protected $queries = ['//@*[contains(., " ") or contains(., ")")]'];
20
21 /**
22 * {@inheritdoc}
23 */
24 protected function normalizeAttribute(DOMAttr $attribute)
25 {
26 $element = $attribute->parentNode;
27 if (!$this->isXsl($element))
28 {
29 // Replace XPath expressions in non-XSL elements
30 $this->replaceAVT($attribute);
31 }
32 elseif (in_array($attribute->nodeName, ['match', 'select', 'test'], true))
33 {
34 // Replace the content of match, select and test attributes of an XSL element
35 $expr = XPathHelper::minify($attribute->nodeValue);
36 $element->setAttribute($attribute->nodeName, $expr);
37 }
38 }
39
40 /**
41 * Minify XPath expressions in given attribute
42 *
43 * @param DOMAttr $attribute
44 * @return void
45 */
46 protected function replaceAVT(DOMAttr $attribute)
47 {
48 AVTHelper::replace(
49 $attribute,
50 function ($token)
51 {
52 if ($token[0] === 'expression')
53 {
54 $token[1] = XPathHelper::minify($token[1]);
55 }
56
57 return $token;
58 }
59 );
60 }
61 }