[pmwiki-users] attachtable for PHP 5.5 ?

Hans Bracker design at softflow.co.uk
Tue Dec 9 08:08:45 CST 2014


I  tried  to  update  the  attachtable.php  script, to make it PHP 5.5
compatible. But I could not get the following section (lines 174-186)
revise dfor PHP 5.5 compatibility:

foreach( $ls as $pn ) {
  $pg = RetrieveAuthPage( $pn, 'read', FALSE, READPAGE_CURRENT );
  if ($pg) $txt = preg_replace(
    array(
      "/(\n[^\\S\n]*)?\\[([=@])(.*?)\\2\\]/s",        ## preserved text
      '/\[\[[^\]]*?\bAttach:([^"\]\|]*)/e',           ## links to attachments
      "/\\bAttach:([^\\s$UrlExcludeChars]*[^\\s.,?!$UrlExcludeChars])/e" ),   ## raw attachments
   array(
      ' ',
      "'[['.AttachtableCountUploadLinks(\$pn,'','$1')",
      "AttachtableCountUploadLinks(\$pn,'','$1')" ),
      htmlspecialchars( $pg['text'], ENT_NOQUOTES ) );        ## assumes $MarkupFrame[0]['escape'] == 1
}

How  can  this  be  rewritten?  preg_replace  with /e modifier is used
twice, and I don't know how to create correct preg_replace_callback
or use PPRA or PPRE instead. I tried in various ways and get warnings,
and  the  Attach:  markup in links or otherwise is not picked up (when
the list of pages gets larger than 8).


Best regards,
 Hans      
mailto:design at softflow.co.uk
www.softflow.co.uk




More information about the pmwiki-users mailing list