[pmwiki-users] attachtable for PHP 5.5 ?
Hans Bracker
design at softflow.co.uk
Tue Dec 9 18:54:19 CST 2014
thank you so much, Petko, for the detailed tuition in use of those
helper functions!
I got it working, and uploaded to pmwiki.org
http://www.pmwiki.org/wiki/Cookbook/Attachtable
This is the rewritten section:
foreach( $ls as $pn ) {
$pg = RetrieveAuthPage( $pn, 'read', FALSE, READPAGE_CURRENT );
if ($pg) {
$txt = PHSC( $pg['text'], ENT_NOQUOTES );
## preserved text
$txt = preg_replace("/(\n[^\\S\n]*)?\\[([=@])(.*?)\\2\\]/s", " ", $txt);
## links to attachments
$txt = PPRA( array('/\[\[[^\]]*?\bAttach:([^"\]\|]*)/'
=> PCCF("return '[['.AttachtableCountUploadLinks('$pn','',\$m[1]);")), $txt);
## raw attachments
$txt = PPRA( array("/\\bAttach:([^\\s$UrlExcludeChars]*[^\\s.,?!$UrlExcludeChars])/"
=> PCCF("return AttachtableCountUploadLinks('$pn','',\$m[1]);")), $txt);
}
}
There was a note in the function:
## FIXME: these really ought to be cached
Without caching whenever action=upload the references are getting
pulled out of all the pages, which means usually all the pages of the
wiki group, and each page is opened and read and the text processed.
But I would not know how to do the caching.
And sofar I have not found it greatly detrimental without caching.
Mostly a user wants to upload a file, and the Attach Table list is
secondary.
Best regards,
Hans
mailto:design at softflow.co.uk
www.softflow.co.uk
More information about the pmwiki-users
mailing list