[pmwiki-users] Fix PHP compatibility bugs in HG
Michael Eager
eager at eagercon.com
Wed Apr 22 11:12:21 PDT 2020
Attached is a fix for errors in HG when run under PHP-7.2.11.
I am not quite sure of the change of the Markup('hgbreadcrumb'... from
>var to <block. This appears to work, though.
--
Michael Eager
-------------- next part --------------
From a69e5e787877ad0ceb41bf3673fd379dea439bae Mon Sep 17 00:00:00 2001
From: Michael Eager <eager at eagercon.com>
Date: Wed, 15 Apr 2020 12:28:00 -0700
Subject: Fix PHP compatibility bugs in HG.
diff --git a/cookbook/hg.php b/cookbook/hg.php
index fc2de9b..3a9597a 100644
--- a/cookbook/hg.php
+++ b/cookbook/hg.php
@@ -140,9 +140,11 @@ function hgCreateFmt($x) {
}
####### Hierarchical links shortcut notation.
-Markup('[[hg','<links', '/\\[\\[(-|[\\*\\^]+)(.*?)\\]\\]/e', "hgLinks1('$1', PSS('$2'))");
-function hgLinks1($x,$y) {
+Markup('[[hg','<links', '/\\[\\[(-|[\\*\\^]+)(.*?)\\]\\]/', "hgLinks1");
+function hgLinks1($m) {
global $hglinkprefix, $hgseparator, $hggroup;
+ $x = $m[0];
+ $y = $m[1];
if (substr($x, 0, 1) == "-") return "[[$hggroup-$y]]";
$hggroups = explode($hgseparator, $hggroup);
$link = '';
@@ -160,8 +162,8 @@ function hgLinks1($x,$y) {
}
####### Breadcrumb markup
-Markup('hgbreadcrumb', '>var', '/\(:breadcrumb:\)/e', 'hgBreadCrumb()');
-function hgBreadCrumb() {
+Markup('hgbreadcrumb', '<block', '/\\(:breadcrumb:\\)/i', 'hgBreadCrumb');
+function hgBreadCrumb($m) {
global $hgseparator, $hgbreadcrumbseparator, $hgmaxlevels, $hggroup, $hgname, $pagename, $SiteGroup, $EnableBreadCrumbName, $DefaultName;
$groups = explode($hgseparator, $hggroup);
if (PageExists("$SiteGroup.HgBreadCrumbs")) $t = "true";
More information about the pmwiki-users
mailing list