[pmwiki-users] attachtable for PHP 5.5 ?

Petko Yotov 5ko at 5ko.fr
Tue Dec 9 16:06:05 CST 2014

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:

       '/\[\[[^\]]*?\bAttach:([^"\]\|]*)/' =>
       # etc.
     PHSC( $pg['text'], ENT_NOQUOTES )


More information about the pmwiki-users mailing list