From c6e629bf89b2b625f2f84ad73620f5a82b7a207e Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Tue, 13 Aug 2013 01:53:23 +1000 Subject: [PATCH] allow wordfilters to be callbacks --- inc/functions.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/inc/functions.php b/inc/functions.php index 74ab96e9..848d9204 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -1415,7 +1415,10 @@ function wordfilters(&$body) { foreach ($config['wordfilters'] as $filter) { if (isset($filter[2]) && $filter[2]) { - $body = preg_replace($filter[0], $filter[1], $body); + if (is_callable($filter[1])) + $body = preg_replace_callback($filter[0], $filter[1], $body); + else + $body = preg_replace($filter[0], $filter[1], $body); } else { $body = str_ireplace($filter[0], $filter[1], $body); }