better handle urls
This commit is contained in:
@@ -50,7 +50,14 @@ class CollapsibleTextBoxWidget
|
||||
|
||||
$out = nl2br($out);
|
||||
|
||||
$out = preg_replace('|(https?://[^\s]+)|i', '<a href="\1">\1</a>', $out);
|
||||
$out = preg_replace_callback('#\b((https?://|ftp://|mailto:)[^\s]+)#i', function($m) {
|
||||
$href = $m[1];
|
||||
$text = $href;
|
||||
if (strpos($text, 'mailto:') === 0) {
|
||||
$text = str_replace('mailto:', '', $text);
|
||||
}
|
||||
return "<a href=\"".e($href)."\">".e($text)."</a>";
|
||||
}, $out);
|
||||
|
||||
return $out;
|
||||
}
|
||||
@@ -67,7 +74,9 @@ class CollapsibleTextBoxWidget
|
||||
}
|
||||
|
||||
if ($this->collapsing) {
|
||||
return '<div class="block-collapse" style="max-height:'.$this->maxHeight.'">' . $prefix . $content . '</div>';
|
||||
return '<div class="block-collapse"
|
||||
title="Click to expand / Double-click to collapse"
|
||||
style="max-height:'.$this->maxHeight.'">' . $prefix . $content . '</div>';
|
||||
} else {
|
||||
return $prefix.'<div>' . $prefix . $content . '</div>';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user