new event: markup-url

This commit is contained in:
Michael Foster 2013-10-04 20:13:58 +10:00
parent f5422cad65
commit 9fb63b053f

View File

@ -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) {