* @param string target the target frame for this link
*/
function makeInternalLink($path, $text, $target='') {
- global $base_uri;
+ global $base_uri, $oTemplate;
// sqgetGlobalVar('base_uri', $base_uri, SQ_SESSION);
- if ($target != '') {
- $target = " target=\"$target\"";
- }
// This is an inefficient hook and is only used by
// one plugin that still needs to patch this code,
//
//do_hook('internal_link', $text);
- return '<a href="'.$base_uri.$path.'"'.$target.'>'.$text.'</a>';
+ $oTemplate->assign('uri', $base_uri . $path);
+ $oTemplate->assign('text', $text);
+ $oTemplate->assign('target', $target);
+ return $oTemplate->fetch('hyperlink.tpl');
}
/**
* @since 1.4.2
*/
function makeComposeLink($url, $text = null, $target='') {
- global $compose_new_win,$javascript_on, $compose_width, $compose_height;
+ global $compose_new_win, $javascript_on, $compose_width,
+ $compose_height, $oTemplate;
if(!$text) {
$text = _("Compose");
if($javascript_on) {
sqgetGlobalVar('base_uri', $base_uri, SQ_SESSION);
$compuri = SM_BASE_URI.$url;
- return "<a href=\"javascript:void(0)\" onclick=\"comp_in_new('$compuri','$compose_width','$compose_height')\">$text</a>";
+ $oTemplate->assign('uri', 'javascript:void(0)');
+ $oTemplate->assign('text', $text);
+ $oTemplate->assign('onclick', "comp_in_new('$compuri','$compose_width','$compose_height')");
+ return $oTemplate->fetch('hyperlink.tpl');
}
// otherwise, just open new window using regular HTML
* internal function that builds mailing list links
*/
function plugin_listcommands_menu_do() {
- global $passed_id, $passed_ent_id, $color, $mailbox, $message, $startMessage;
+ global $passed_id, $passed_ent_id, $color, $mailbox, $message, $startMessage, $oTemplate;
/**
* Array of commands we can deal with from the header. The Reply option
$links[] = makeComposeLink($url, $fieldsdescr['reply']);
}
} else if ($proto == 'href') {
- $links[] = '<a href="' . $act . '" target="_blank">'
- . $fieldsdescr[$cmd] . '</a>';
+ $oTemplate->assign('uri', $act);
+ $oTemplate->assign('target', '_blank');
+ $oTemplate->assign('text', $fieldsdescr[$cmd]);
+ $output = $oTemplate->fetch('hyperlink.tpl');
+ $links[] = $output;
}
}
if (count($links) > 0) {
- global $oTemplate;
$oTemplate->assign('links', $links);
$output = $oTemplate->fetch('plugins/listcommands/read_body_header.tpl');
return array('read_body_header' => $output);
--- /dev/null
+<?php
+
+/**
+ * hyperlink.tpl
+ *
+ * Template for constructing a hyperlink.
+ *
+ * The following variables are available in this template:
+ * + $uri - the target link location
+ * + $text - link text
+ * + $target - the location where the link should be opened
+ * (optional; may not be present)
+ * + $onclick - onClick JavaScript handler (optional; may not be present)
+ * + $extra - any extra text to be directly inserted into the hyperlink
+ * (note to core developers - PLEASE AVOID using this, as it
+ * usually means you are adding template-engine specific output
+ * to the core)
+ *
+ * @copyright © 1999-2006 The SquirrelMail Project Team
+ * @license http://opensource.org/licenses/gpl-license.php GNU Public License
+ * @version $Id$
+ * @package squirrelmail
+ * @subpackage plugins
+ */
+
+
+// retrieve the template vars
+//
+extract($t);
+
+
+?><a href="<?php echo $uri ?>"<?php if (!empty($target)) echo ' target="' . $target . '"'; ?><?php if (!empty($onclick)) echo ' onclick="' . $onclick . '"'; ?>><?php echo $text; ?></a>