diff options
author | petko <petko@524c5546-5005-0410-9a3e-e25e191bd360> | 2022-12-31 00:08:00 +0000 |
---|---|---|
committer | petko <petko@524c5546-5005-0410-9a3e-e25e191bd360> | 2022-12-31 00:08:00 +0000 |
commit | c4333349efccdb9275e4ffc48097368ab96f9981 (patch) | |
tree | 918ade78a482c2db9088f7f24ec9b3ad5cb5b227 /pmwiki.php | |
parent | 6a1908bfe0083c08806a489439e64362d1cf232b (diff) | |
download | pmwiki.svn-c4333349efccdb9275e4ffc48097368ab96f9981.tar.bz2 |
Add helper function PRCB() for easy preg_replace_callback passing variables.
git-svn-id: svn://pmwiki.org/pmwiki/trunk@4332 524c5546-5005-0410-9a3e-e25e191bd360
Diffstat (limited to 'pmwiki.php')
-rw-r--r-- | pmwiki.php | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -761,6 +761,13 @@ function PPRA($array, $x) { } return $x; } +function PRCB($pat, $repl, $subj, $vars=null, $limit=-1, &$count=null, $flags=0) { + if (isset($vars)) { + $cb = new PPRC($vars, $repl); + $repl = array($cb, 'callback'); + } + return preg_replace_callback($pat, $repl, $subj, $limit, $count, $flags); +} ## callback functions class PPRC { # PmWiki preg replace callbacks + pass local vars var $vars; |