return implode(',', $onbits);
}
-// #################### Start isso_pre_parse_hook ####################
-// the pre-parse hook for ISSO's template engine
+/**
+ * Pre-parse hook for BSTemplate class. This merely substitutes help links
+ *
+ * @param string Template
+ * @return string
+ */
function isso_pre_parse_hook($template)
{
- $template = preg_replace('#\$help\[(.*)\]#', '" . fetch_help_link("\1") . "', $template);
+ $template = preg_replace('#\$help\[(.*)\]#', '<?php echo 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
+/**
+ * Returns the HTML used to generate a help link for a given topic
+ *
+ * @param string Topic name
+ * @return string
+ */
function fetch_help_link($topic)
{
- global $bugsys;
+ $tpl = new BSTemplate('help_link');
+ $tpl->vars = array('topic' => $topic);
if (isset(bugdar::$datastore['help']["$topic"]))
{
- eval('$temp = "' . $bugsys->template->fetch('help_link') . '";');
- return $temp;
+ return $tpl->evaluate()->getTemplate();
}
else
{
- if (BSApp::debug)
+ if (BSApp::get_debug())
{
return "[[INVALID TOPIC: $topic]]";
}
// do we want this?
else if (null == 1)
{
- return eval('$temp = "' . $bugsys->template->fetch('help_link') . '";');
+ return $tpl->evaluate()->getTemplate();
}
}
}