On 8/01/14 12:31 PM, Petko Yotov wrote:
Or, you can write in your recipe page your requirement that it depends on php 5.3 or above.

Currently the PmWiki core does not restrict you at all to use closures in your recipes. You can have them, they will only work on PHP 5.3+ sites.
That works for me :-)

However, some advice on how best to convert the following case would be helpful. I use some code to extract the text of a link in the form:

$LinkTidy = array("/reg-exp1/" =>
"MakeLink(\$pagename, ... matches ... , '\$LinkText')",
                            "/reg-exp2/" =>
"MakeLink(\$pagename, ... matches ... , '\$LinkText')");
foreach ($LinkTidy as $exp => $repl) {
    $text = SomeFunction($exp, $repl, $text);
}

Currently, SomeFunction is preg_replace, $exp has an e modifier and matches contains '$1', '$2', etc as appropriate to the $exp. In some cases, $exp has no modifier and $repl is simply '$1'.

What is the best way to convert this? Preferably without a major code re-write, as I use this construct in several places.

Thanks

JR

--
John Rankin


_______________________________________________
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users

Reply via email to