Suggestion: Make link generation consistent
-
Links within messages are by default “automagically” made clickable.
Older messages are translated via PHP with this code:
$pattern = "/(http|https|ftp|ftps)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)?/"; $chat_text = preg_replace($pattern, '<a rel="external" href="\\0" title="Open link in new tab">\\0</a>', $chat_text);So this
https://example.com/is translated to this:<a rel="external" href="https://example.com/" title="Open link in new tab">https://example.com/</a>Live messages are translated via JavaScript with this code:
var re = /((http|https|ftp):\/\/[^ ]*)/gi; text = s.replace(re, '<a rel="external" href="$1" class="sac-chat-link">«link»</a>');So this
https://example.com/is translated to this:<a rel="external" href="https://example.com/" class="sac-chat-link">«link»</a>Note the difference, especially
«link»as linktext, this was too confusing for a client where we suggested your plugin, so we had to change the plugin code for now.Another suggestion would be to add some textual instructions to “Banned Phrases” setting, that by using
http://,https://or similar there, it is possible to disable the automatic translation of links, as it is probably used in plugin demo site. Maybe this is mentioned somewhere, didn’t see it though.Thanks for great plugin.
The topic ‘Suggestion: Make link generation consistent’ is closed to new replies.