[pmwiki-users] Using imagemap.php with php8.x
Hans-Jürgen Godau
juergen at godau-witten.de
Fri Jun 24 07:16:33 PDT 2022
I've installed your version and it seems to work without problems. Thank
You!
jürgen
Am Do., 23. Juni 2022 um 14:02 Uhr schrieb Petko Yotov <5ko at 5ko.fr>:
> Thanks, I've updated the recipe on the cookbook:
>
> https://www.pmwiki.org/wiki/Cookbook/ImageMap
>
> The update is a little different from your suggestion, includes some
> refactoring and improvements for links, and should work at least until
> PHP 8.1.
>
> If you find any problems with the new recipe on existing PmWiki markup,
> please let me know.
>
> Petko
>
> --
> If you upgrade : https://www.pmwiki.org/Upgrades
>
>
> На 22/06/2022 15:02, Hans-Jürgen Godau написа:
> > While using imagemap.php from the cookbook I had to change the code
> > because of Warnings/Errors shown by php:
> >
> > --- imagemap.php 2022-06-21 17:42:57.389642705 +0200
> > +++ imagemap.php.new 2022-06-22 13:47:31.360706020 +0200
> > @@ -49,17 +49,22 @@
> > Markup('area', 'directives', "/\\(:area (.*?)?\\s*?:\\)/",
> > "MapArea");
> > function MapArea($m) {
> > global $ScriptUrl, $EnablePathInfo, $EnableOnclickJavascripting;
> > - $arg = PSS(ParseArgs($m[1]));
> > - if (isset($arg['href'])) {
> > + $out="";
> > + if (is_array($m) && array_key_exists(1,$m)) {
> > + /* $arg = ParseArgs($m[1]); */
> > + $arg = ParseArgs(PSS($m[1]));
> > + if (isset($arg['href'])) {
> > $tgt = $arg['href'];
> > if($EnablePathInfo) $LinkUrl = $ScriptUrl."/".$tgt;
> > else $LinkUrl = $ScriptUrl."?n=".$tgt;
> > - preg_match("/(http:)(.*?)/",$tgt,$m);
> > - if($m[1]) $LinkUrl = $tgt;
> > - preg_match("/(#)(.*?)/",$tgt,$m);
> > - if($m[1]) $LinkUrl = $tgt;
> > + if (preg_match("/(http:)(.*?)/",$tgt,$m)) {
> > + if($m[1]) $LinkUrl = $tgt;
> > + }
> > + if (preg_match("/(#)(.*?)/",$tgt,$m)) {
> > + if($m[1]) $LinkUrl = $tgt;
> > + }
> > }
> > - $out = "<area ";
> > + $out .= "<area ";
> > if (isset($arg['shape']))
> > $out .= " shape='".$arg['shape']."'";
> > if (isset($arg['coords']))
> > @@ -77,5 +82,7 @@
> > if (isset($arg['onclick']))
> > $out .= " onclick='".$arg['onclick']."'"; }
> > $out .= " />";
> > + }
> > return Keep($out);
> > +
> > }
> > ============================
> > Maybe you could adjust the imagemap.php code?
> >
> > Thanks,
> > H.-Jürgen Godau
> > _______________________________________________
> > pmwiki-users mailing list
> > pmwiki-users at pmichaud.com
> > http://www.pmichaud.com/mailman/listinfo/pmwiki-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.pmichaud.com/pipermail/pmwiki-users/attachments/20220624/47ec7040/attachment.html>
More information about the pmwiki-users
mailing list