diff options
author | petko <petko@524c5546-5005-0410-9a3e-e25e191bd360> | 2023-05-19 05:31:18 +0000 |
---|---|---|
committer | petko <petko@524c5546-5005-0410-9a3e-e25e191bd360> | 2023-05-19 05:31:18 +0000 |
commit | ea7537a9a2d83a751c6aafd0907d55e75012ed9a (patch) | |
tree | 5bfd24e19ae0e08662d3c4ea8437079c82f6cd6b /pmwiki.php | |
parent | 86ddfb652cd157f3a26f4d8da4fbb6d2b84cbdc8 (diff) | |
download | pmwiki.svn-ea7537a9a2d83a751c6aafd0907d55e75012ed9a.tar.bz2 |
Add InsertEditFunction($newfn, $where='<PostPage').
git-svn-id: svn://pmwiki.org/pmwiki/trunk@4468 524c5546-5005-0410-9a3e-e25e191bd360
Diffstat (limited to 'pmwiki.php')
-rw-r--r-- | pmwiki.php | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -1020,6 +1020,25 @@ function FileSizeCompact($n, $precision=1) { return round(pow(1024,$b-$fb),$precision).@$units[$fb]; } +function InsertEditFunction($newfn, $where='<PostPage') { + global $EditFunctions; + if ($where == "<") { + array_unshift($EditFunctions, $newfn); + return true; + } + if ($where == ">") { + $EditFunctions[] = $newfn; + return true; + } + if (!preg_match('/^([<>])(\\w+)$/', $where, $m)) return false; + + $offset = array_search($m[2], $EditFunctions); + if ($offset === false) return false; + if ($m[1]=='>') $offset++; + array_splice($EditFunctions, $offset, 0, $newfn); + return true; +} + ## AsSpaced converts a string with WikiWords into a spaced version ## of that string. (It can be overridden via $AsSpacedFunction.) function AsSpaced($text) { |