From eb4581abdb9bbcfaecf2d96fb38f61ab7c80f7fc Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Fri, 4 Oct 2013 20:13:58 +1000 Subject: [PATCH] new event: markup-url --- inc/functions.php | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/inc/functions.php b/inc/functions.php index 7c6d3df3..f6a217a5 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -1538,7 +1538,25 @@ function markup_url($matches) { $markup_urls[] = $url; - return '' . $url . '' . $after; + $link = (object) array( + 'href' => $url, + 'text' => $url, + 'rel' => 'nofollow', + 'target' => '_blank', + ); + + event('markup-url', $link); + $link = (array)$link; + + $parts = array(); + foreach ($link as $attr => $value) { + if ($attr == 'text' || $attr == 'after') + continue; + $parts[] = $attr . '="' . htmlspecialchars($value) . '"'; + } + if (isset($link['after'])) + $after = $link['after'] . $after; + return '' . utf8tohtml($link['text']) . '' . $after; } function unicodify($body) {