Files
newznab-tmux/resources/smarty/plugins/modifier.magicurl.php
T
DariusIII 47e4734869 CS fixes
2024-11-28 14:20:45 +01:00

22 lines
442 B
PHP
Executable File

<?php
/**
* Smarty plugin.
*/
/**
* Smarty magicurl modifier plugin.
*
* Type: modifier<br>
* Name: magicurl<br>
* Purpose: turn www addresses into hyperlinks
*
* @author bb
*
* @param string
* @return string
*/
function smarty_modifier_magicurl($str, $dereferrer = '')
{
return preg_replace('/(https?):\/\/([A-Za-z0-9\._\-\/\?=&;%]+)/is', '<a href="'.$dereferrer.'$1://$2" target="_blank">$1://$2</a>', $str);
}