From d010d811ba812ccc8fbb1a49fcba7a30226ea779 Mon Sep 17 00:00:00 2001 From: Robin Millette Date: Mon, 11 May 2009 13:45:00 -0400 Subject: db stuff for URLs: redirections, oembed, etc. --- lib/util.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/util.php b/lib/util.php index 198185338..c4a63a441 100644 --- a/lib/util.php +++ b/lib/util.php @@ -395,7 +395,7 @@ function common_render_text($text) return $r; } -function common_replace_urls_callback($text, $callback) { +function common_replace_urls_callback($text, $callback, $notice_id = null) { // Start off with a regex $regex = '#'. '(?:'. @@ -466,7 +466,11 @@ function common_replace_urls_callback($text, $callback) { $url = (mb_strpos($orig_url, htmlspecialchars($url)) === FALSE) ? $url:htmlspecialchars($url); // Call user specified func - $modified_url = call_user_func($callback, $url); + if (isset($notice_id)) { + $modified_url = call_user_func($callback, array($url, $notice_id)); + } else { + $modified_url = call_user_func($callback, $url); + } // Replace it! $start = mb_strpos($text, $url, $offset); -- cgit v1.2.3-54-g00ecf