From 769efe43e7590e3d84fc30a55cffdfb32c3e3160 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Wed, 21 Dec 2005 19:53:41 +0000 Subject: [PATCH] r639: Adding pre-parse hook so that the userland help system will work --- global.php | 1 + includes/functions.php | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/global.php b/global.php index a282077..9638f79 100755 --- a/global.php +++ b/global.php @@ -16,6 +16,7 @@ require_once('./includes/init.php'); // initialize template system $bugsys->load('template_fs'); $template->extension = 'tpl'; +$template->pre_parse_hook = 'isso_pre_parse_hook'; $template->templatedir = $bugsys->fetch_sourcepath('templates/'); // ################################################################### diff --git a/includes/functions.php b/includes/functions.php index 515289f..2505585 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -406,6 +406,31 @@ function fetch_on_bits($mask) return implode(',', $onbits); } +// #################### Start isso_pre_parse_hook #################### +// the pre-parse hook for ISSO's template engine +function isso_pre_parse_hook($template) +{ + $template = preg_replace('#\$help\[(.*)\]#', '" . fetch_help_link(\'\1\') . "', $template); + return $template; +} + +// ###################### Start fetch_help_link ###################### +// returns a prepared link to insert into templates that opens up a +// help popup in the user-end +function fetch_help_link($topic) +{ + global $bugsys; + + if (isset($bugsys->datastore['help']["$topic"])) + { + + } + else + { + return "[[INVALID TOPIC: $topic]]"; + } +} + /*=====================================================================*\ || ################################################################### || # $HeadURL$ -- 2.22.5