* @since 1.3.0
*/
+
+/**
+ * Generates a hyperlink
+ *
+ * @param string $uri The target link location
+ * @param string $text The link text
+ * @param string $target The location where the link should
+ * be opened (OPTIONAL; default not used)
+ * @param string $onclick The onClick JavaScript handler (OPTIONAL;
+ * default not used)
+ * @param string $class The CSS class name (OPTIONAL; default
+ * not used)
+ * @param string $id The ID name (OPTIONAL; default not used)
+ *
+ * @return string The desired hyperlink tag.
+ *
+ * @since 1.5.2
+ *
+ */
+function create_hyperlink($uri, $text, $target='', $onclick='', $class='', $id='') {
+
+ global $oTemplate;
+
+ $oTemplate->assign('uri', $uri);
+ $oTemplate->assign('text', $text);
+ $oTemplate->assign('target', $target);
+ $oTemplate->assign('onclick', $onclick);
+ $oTemplate->assign('class', $class);
+ $oTemplate->assign('id', $id);
+
+ return $oTemplate->fetch('hyperlink.tpl');
+
+}
+
+
/**
* Generates html tags
*
return( $ret );
}
+
/**
* handy function to set url vars
*
}
return $url;
}
+
+
//
//do_hook('internal_link', $text);
- $oTemplate->assign('uri', $base_uri . $path);
- $oTemplate->assign('text', $text);
- $oTemplate->assign('target', $target);
-
- // blank the onclick because the template object might
- // already contain an onclick value due to having been
- // used to show a compose link (when comp_in_new is turned on)
- //
- $oTemplate->assign('onclick', '');
- $oTemplate->assign('class', '');
- $oTemplate->assign('id', '');
-
- return $oTemplate->fetch('hyperlink.tpl');
+ return create_hyperlink($base_uri . $path, $text, $target);
}
/**
if($javascript_on) {
sqgetGlobalVar('base_uri', $base_uri, SQ_SESSION);
$compuri = SM_BASE_URI.$url;
- $oTemplate->assign('uri', 'javascript:void(0)');
- $oTemplate->assign('text', $text);
- $oTemplate->assign('onclick', "comp_in_new('$compuri','$compose_width','$compose_height')");
- $oTemplate->assign('class', '');
- $oTemplate->assign('id', '');
- return $oTemplate->fetch('hyperlink.tpl');
+
+ return create_hyperlink('javascript:void(0)', $text, '', "comp_in_new('$compuri','$compose_width','$compose_height')");
}
// otherwise, just open new window using regular HTML
$links[] = makeComposeLink($url, $fieldsdescr['reply']);
}
} else if ($proto == 'href') {
- $oTemplate->assign('uri', $act);
- $oTemplate->assign('target', '_blank');
- $oTemplate->assign('text', $fieldsdescr[$cmd]);
- $oTemplate->assign('class', '');
- $oTemplate->assign('id', '');
- $oTemplate->assign('onclick', '');
- $output = $oTemplate->fetch('hyperlink.tpl');
- $links[] = $output;
+ $links[] = create_hyperlink($act, $fieldsdescr[$cmd], '_blank');
}
}