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 |
SetRelNoreferrerOnTargetedLinks.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 DOMElement;
11
12 /**
13 * Add rel="noreferrer" on links that open in a new context that would allow window.opener to be
14 * accessed.
15 *
16 * @link https://mathiasbynens.github.io/rel-noopener/
17 * @link https://wiki.whatwg.org/wiki/Links_to_Unrelated_Browsing_Contexts
18 */
19 class SetRelNoreferrerOnTargetedLinks extends AddAttributeValueToElements
20 {
21 /**
22 * {@inheritdoc}
23 */
24 public function __construct(string $query = '//a[@target] | //area[@target]', string $attrName = 'rel', string $value = 'noreferrer')
25 {
26 parent::__construct($query, $attrName, $value);
27 }
28
29 /**
30 * {@inheritdoc}
31 */
32 protected function normalizeElement(DOMElement $element): void
33 {
34 if (!preg_match('(\\bno(?:open|referr)er\\b)', $element->getAttribute('rel')))
35 {
36 parent::normalizeElement($element);
37 }
38 }
39 }