[ Index ] |
PHP Cross Reference of phpBB-3.3.12-deutsch |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * @package s9e\TextFormatter 5 * @copyright Copyright (c) 2010-2022 The s9e authors 6 * @license http://www.opensource.org/licenses/mit-license.php The MIT License 7 */ 8 namespace s9e\TextFormatter\Configurator\TemplateNormalizations; 9 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 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Jun 23 12:25:44 2024 | Cross-referenced by PHPXref 0.7.1 |