[pmwiki-users] Using imagemap.php with php8.x

Hans-Jürgen Godau juergen at godau-witten.de
Wed Jun 22 05:02:50 PDT 2022


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.pmichaud.com/pipermail/pmwiki-users/attachments/20220622/318f65ea/attachment.html>


More information about the pmwiki-users mailing list