On 09.12.2014 22:47, Petko Yotov wrote:
This one is more advanced indeed, here is how to use it so that the
code is compatible with both PHP 5.5 and PHP 4.
First, instead of preg_replace() with arguments arrays, we use the
built-in PPRA() function which will call intelligently preg_replace()
or preg_replace_callback() for every element of the arrays:
if ($pg) $txt = preg_replace( # before
if ($pg) $txt = PPRA( # after
Sorry, I forgot to mention that PPRA() expects the first argument to be
an array with elements where the keys are search patterns and the values
are the replacement strings or functions:
array('/search/' => 'replace')
so here we should make some more changes and rewrite this array,
something like:
PPRA(
array(
'/\[\[[^\]]*?\bAttach:([^"\]\|]*)/' =>
PCCF("return
'[['.AttachtableCountUploadLinks('$pn','',\$m[1]);"),
# etc.
),
PHSC( $pg['text'], ENT_NOQUOTES )
);
Petko
_______________________________________________
pmwiki-users mailing list
[email protected]
http://www.pmichaud.com/mailman/listinfo/pmwiki-users