1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-25 17:01:43 +02:00

Added rel="noopener noreferrer" to external _blank target navigation links.

This commit is contained in:
Cameron
2021-09-15 12:51:39 -07:00
parent 4747ad3c6e
commit 6fa4982d30

View File

@@ -204,22 +204,26 @@ require_once(__DIR__.'/navigation_shortcodes_legacy.php');
### 0 - same window, 1 - target blank, 4 - 600x400 popup, 5 - 800x600 popup ### 0 - same window, 1 - target blank, 4 - 600x400 popup, 5 - 800x600 popup
### TODO - JS modal (i.e. bootstrap) ### TODO - JS modal (i.e. bootstrap)
$text = '';
switch($type) switch($type)
{ {
case 1: case 1:
return ' target="_blank"'; $text = ' target="_blank"';
$text .= (strpos($this->var['link_url'], 'http') !== false) ? ' rel="noopener noreferrer"' : '';
break; break;
case 4: case 4:
return " onclick=\"open_window('" . $this->var['link_url'] . "',600,400); return false;\""; $text = " onclick=\"open_window('" . $this->var['link_url'] . "',600,400); return false;\"";
break; break;
case 5: case 5:
return " onclick=\"open_window('" . $this->var['link_url'] . "',800,600); return false;\""; $text = " onclick=\"open_window('" . $this->var['link_url'] . "',800,600); return false;\"";
break; break;
} }
return ''; return $text;
} }