From b2a5b6b31960b3ecce98a86e037becce90d27881 Mon Sep 17 00:00:00 2001 From: jaquer Date: Wed, 26 Jan 2022 12:25:36 -0800 Subject: Replaced autolink function with 'iamcal/lib_autolink'. https://github.com/iamcal/lib_autolink Closes #5. --- functions.php | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'functions.php') diff --git a/functions.php b/functions.php index 19325d1..3dac79b 100644 --- a/functions.php +++ b/functions.php @@ -6,17 +6,6 @@ function path($fragment=null) { return (!empty($config['path'][$fragment])) ? $config['path'][$fragment] : false; } -function autolink($text='') { - // https://stackoverflow.com/a/10002262/3625228 - $pattern = '(?xi)\b((?:https?://|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:\'".,<>?«»“”‘’]))'; - - return preg_replace_callback("#$pattern#i", function($matches) { - $input = $matches[0]; - $url = preg_match('!^https?://!i', $input) ? $input : "http://$input"; - return '' . "$input"; - }, $text); -} - function db_insert($message, $timestamp=NOW) { global $db; if(empty($db)) return false; -- cgit v1.2.3