ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
TargetNoreferrer.php
Go to the documentation of this file.
1<?php
2
3// must be called POST validation
4
13{
20 public function transform($attr, $config, $context)
21 {
22 if (isset($attr['rel'])) {
23 $rels = explode(' ', $attr['rel']);
24 } else {
25 $rels = array();
26 }
27 if (isset($attr['target']) && !in_array('noreferrer', $rels)) {
28 $rels[] = 'noreferrer';
29 }
30 if (!empty($rels) || isset($attr['rel'])) {
31 $attr['rel'] = implode(' ', $rels);
32 }
33
34 return $attr;
35 }
36}
37
An exception for terminatinating execution or to throw for unit testing.
Adds rel="noreferrer" to any links which target a different window than the current one.
Processes an entire attribute array for corrections needing multiple values.