summaryrefslogtreecommitdiff
path: root/lib/util.php
diff options
context:
space:
mode:
authorRobin Millette <millette@controlyourself.ca>2009-05-11 13:45:00 -0400
committerRobin Millette <millette@controlyourself.ca>2009-05-11 13:45:00 -0400
commitd010d811ba812ccc8fbb1a49fcba7a30226ea779 (patch)
tree0d3c9d910ce1dacbeaa684701b3976f1cb004481 /lib/util.php
parent8fc8eaa1b6199d74f0e17197650c6316b4594203 (diff)
db stuff for URLs: redirections, oembed, etc.
Diffstat (limited to 'lib/util.php')
-rw-r--r--lib/util.php8
1 files changed, 6 insertions, 2 deletions
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);