[pmwiki-users] Using imagemap.php with php8.x
Petko Yotov
5ko at 5ko.fr
Thu Jun 23 05:02:28 PDT 2022
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
More information about the pmwiki-users
mailing list