Add name attribute to hyperlink template
[squirrelmail.git] / functions / html.php
index 3ce05b3f8e063345e2e618f9dc227f105150cb0e..cfd0652a0d4b30f4ca93e4e7e85a967563c60eb1 100644 (file)
  * @param string $class   The CSS class name (OPTIONAL; default
  *                        not used)
  * @param string $id      The ID name (OPTIONAL; default not used)
+ * @param string $name    The anchor name (OPTIONAL; default not used)
  *
  * @return string The desired hyperlink tag.
  *
  * @since 1.5.2
  *
  */
-function create_hyperlink($uri, $text, $target='', $onclick='', $class='', $id='') {
+function create_hyperlink($uri, $text, $target='', $onclick='', 
+                          $class='', $id='', $name='') {
 
     global $oTemplate;
 
@@ -43,6 +45,7 @@ function create_hyperlink($uri, $text, $target='', $onclick='', $class='', $id='
     $oTemplate->assign('onclick', $onclick);
     $oTemplate->assign('class', $class);
     $oTemplate->assign('id', $id);
+    $oTemplate->assign('name', $name);
 
     return $oTemplate->fetch('hyperlink.tpl');
 
@@ -74,6 +77,12 @@ function create_hyperlink($uri, $text, $target='', $onclick='', $class='', $id='
  *                        (OPTIONAL; default not used)
  * @param string $vspace  The image's vspace attribute value 
  *                        (OPTIONAL; default not used)
+ * @param string $text_alternative A text replacement for the entire
+ *                                 image tag, to be used at the 
+ *                                 discretion of the template set,
+ *                                 if for some reason the image tag
+ *                                 cannot or should not be produced
+ *                                 (OPTIONAL; default not used)
  *
  * @return string The desired hyperlink tag.
  *
@@ -82,7 +91,8 @@ function create_hyperlink($uri, $text, $target='', $onclick='', $class='', $id='
  */
 function create_image($src, $alt='', $width='', $height='', 
                       $border='', $class='', $id='', $onclick='', 
-                      $title='', $align='', $hspace='', $vspace='') {
+                      $title='', $align='', $hspace='', $vspace='',
+                      $text_alternative='') {
 
     global $oTemplate;
 
@@ -98,14 +108,43 @@ function create_image($src, $alt='', $width='', $height='',
     $oTemplate->assign('align', $align);
     $oTemplate->assign('hspace', $hspace);
     $oTemplate->assign('vspace', $vspace);
+    $oTemplate->assign('text_alternative', $text_alternative);
 
     return $oTemplate->fetch('image.tpl');
 
 }
 
 
+/**
+ * Generates a span tag
+ *
+ * @param string $value   The contents that belong inside the span
+ * @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 span tag.
+ *
+ * @since 1.5.2
+ *
+ */
+function create_span($value, $class='', $id='') {
+
+    global $oTemplate;
+
+    $oTemplate->assign('value', $value);
+    $oTemplate->assign('class', $class);
+    $oTemplate->assign('id', $id);
+
+    return $oTemplate->fetch('span.tpl');
+
+}
+
+
 /**
  * Generates html tags
+//FIXME: this should not be used anywhere in the core, or we should
+//       convert this to use templates.  We sould not be assuming HTML output.
  *
  * @param string $tag Tag to output
  * @param string $val Value between tags