diff options
| author | Michael Foster <savetheinternet@tinyboard.org> | 2013-10-04 20:13:58 +1000 |
|---|---|---|
| committer | Michael Foster <savetheinternet@tinyboard.org> | 2013-10-04 20:13:58 +1000 |
| commit | 9fb63b053fbb552a2a8bbde1e230a8b73296fb6d (patch) | |
| tree | 62cecda3dac85244626a312c290db13672fe0e19 /inc/functions.php | |
| parent | f5422cad65e5cafd7d53da87d62a6fc247da3b1b (diff) | |
new event: markup-url
Diffstat (limited to 'inc/functions.php')
| -rw-r--r-- | inc/functions.php | 20 |
1 files changed, 19 insertions, 1 deletions
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 '<a target="_blank" rel="nofollow" href="'. $config['link_prefix'] . $url . '">' . $url . '</a>' . $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 '<a ' . implode(' ', $parts) . '>' . utf8tohtml($link['text']) . '</a>' . $after; } function unicodify($body) { |
