Skip to content
Snippets Groups Projects
Commit bfe6c772 authored by Moritz Strohm's avatar Moritz Strohm
Browse files

BIESt #250

parent e07c5d15
No related branches found
No related tags found
No related merge requests found
...@@ -515,8 +515,7 @@ class StudipCoreFormat extends TextFormat ...@@ -515,8 +515,7 @@ class StudipCoreFormat extends TextFormat
$intern = $domain === $_SERVER['HTTP_HOST']; $intern = $domain === $_SERVER['HTTP_HOST'];
return sprintf('<a class="%s" href="mailto:%s">%s</a>', return sprintf('<a href="mailto:%1$s">%2$s</a>',
$intern ? "link-intern" : "link-extern",
$email, $email,
$link_text $link_text
); );
...@@ -655,7 +654,16 @@ class StudipCoreFormat extends TextFormat ...@@ -655,7 +654,16 @@ class StudipCoreFormat extends TextFormat
$linkmarkup->removeMarkup('links'); $linkmarkup->removeMarkup('links');
$linkmarkup->removeMarkup('wiki-links'); $linkmarkup->removeMarkup('wiki-links');
return sprintf('<a class="%s" href="%s"%s>%s</a>%s', if (strpos($url, 'mailto:') === 0) {
return sprintf(
'<a href="%1$s">%2$s</a>%3$s',
$url,
$linkmarkup->format($title),
$postfix
);
} else {
return sprintf(
'<a class="%s" href="%s"%s>%s</a>%s',
$intern ? 'link-intern' : 'link-extern', $intern ? 'link-intern' : 'link-extern',
$url, $url,
$intern ? '' : ' target="_blank" rel="noreferrer noopener"', $intern ? '' : ' target="_blank" rel="noreferrer noopener"',
...@@ -663,6 +671,7 @@ class StudipCoreFormat extends TextFormat ...@@ -663,6 +671,7 @@ class StudipCoreFormat extends TextFormat
$postfix $postfix
); );
} }
}
protected static function htmlAnchor($markup, $matches, $contents) protected static function htmlAnchor($markup, $matches, $contents)
{ {
......
...@@ -13,8 +13,10 @@ class HTMLPurifier_Injector_ClassifyLinks extends HTMLPurifier_Injector ...@@ -13,8 +13,10 @@ class HTMLPurifier_Injector_ClassifyLinks extends HTMLPurifier_Injector
{ {
if ($token->name === 'a' && isset($token->attr['href'])) { if ($token->name === 'a' && isset($token->attr['href'])) {
$is_link_intern = isLinkIntern($token->attr['href']); $is_link_intern = isLinkIntern($token->attr['href']);
$token->attr['class'] = $is_link_intern ? 'link-intern' : 'link-extern'; if ($is_link_intern) {
if (!$is_link_intern) { $token->attr['class'] = 'link-intern';
} elseif (strpos($token->attr['href'], 'mailto:') !== 0) {
$token->attr['class'] = 'link-extern';
$token->attr['target'] = '_blank'; $token->attr['target'] = '_blank';
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment