test
[squirrelmail.git] / functions / html.php
index ecdafd2eac790a65d1ca20ed9d76ec8689358a0e..ec7f90e37a186f7db2a9ce50ae3c902d36bc91ff 100644 (file)
 /**
  * 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)
+ * @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)
+ * @param string $name     The anchor name (OPTIONAL; default not used)
+ * @param array  $aAttribs Any extra attributes: this must be an 
+ *                         associative array, where keys will be 
+ *                         added as the attribute name, and values
+ *                         (which are optional - should be null if
+ *                         none should be used) will be placed in
+ *                         double quotes (pending template implementation)
+ *                         as the attribute value (OPTIONAL; default empty).
  *
  * @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='', $aAttribs=array()) {
 
     global $oTemplate;
 
@@ -43,6 +52,9 @@ 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);
+
+    $oTemplate->assign('aAttribs', $aAttribs);
 
     return $oTemplate->fetch('hyperlink.tpl');
 
@@ -80,6 +92,13 @@ function create_hyperlink($uri, $text, $target='', $onclick='', $class='', $id='
  *                                 if for some reason the image tag
  *                                 cannot or should not be produced
  *                                 (OPTIONAL; default not used)
+ * @param array  $aAttribs Any extra attributes: this must be an 
+ *                         associative array, where keys will be 
+ *                         added as the attribute name, and values
+ *                         (which are optional - should be null if
+ *                         none should be used) will be placed in
+ *                         double quotes (pending template implementation)
+ *                         as the attribute value (OPTIONAL; default empty).
  *
  * @return string The desired hyperlink tag.
  *
@@ -89,7 +108,7 @@ function create_hyperlink($uri, $text, $target='', $onclick='', $class='', $id='
 function create_image($src, $alt='', $width='', $height='', 
                       $border='', $class='', $id='', $onclick='', 
                       $title='', $align='', $hspace='', $vspace='',
-                      $text_alternative='') {
+                      $text_alternative='', $aAttribs=array()) {
 
     global $oTemplate;
 
@@ -107,11 +126,46 @@ function create_image($src, $alt='', $width='', $height='',
     $oTemplate->assign('vspace', $vspace);
     $oTemplate->assign('text_alternative', $text_alternative);
 
+    $oTemplate->assign('aAttribs', $aAttribs);
+
     return $oTemplate->fetch('image.tpl');
 
 }
 
 
+/**
+ * Generates a label tag
+ *
+ * @param string $value    The contents that belong inside the label
+ * @param string $for      The ID to which the label applies (OPTIONAL; 
+ *                         default not used)
+ * @param array  $aAttribs Any extra attributes: this must be an
+ *                         associative array, where keys will be
+ *                         added as the attribute name, and values
+ *                         (which are optional - should be null if
+ *                         none should be used) will be placed in
+ *                         double quotes (pending template implementation)
+ *                         as the attribute value (OPTIONAL; default empty).
+ *
+ * @return string The desired label tag.
+ *
+ * @since 1.5.2
+ *
+ */
+function create_label($value, $for='', $aAttribs=array()) {
+
+    global $oTemplate;
+
+    $oTemplate->assign('text', $value);
+    $oTemplate->assign('for', $for);
+
+    $oTemplate->assign('aAttribs', $aAttribs);
+
+    return $oTemplate->fetch('label.tpl');
+
+}
+
+
 /**
  * Generates a span tag
  *
@@ -119,13 +173,20 @@ function create_image($src, $alt='', $width='', $height='',
  * @param string $class   The CSS class name (OPTIONAL; default
  *                        not used)
  * @param string $id      The ID name (OPTIONAL; default not used)
+ * @param array  $aAttribs Any extra attributes: this must be an 
+ *                         associative array, where keys will be 
+ *                         added as the attribute name, and values
+ *                         (which are optional - should be null if
+ *                         none should be used) will be placed in
+ *                         double quotes (pending template implementation)
+ *                         as the attribute value (OPTIONAL; default empty).
  *
  * @return string The desired span tag.
  *
  * @since 1.5.2
  *
  */
-function create_span($value, $class='', $id='') {
+function create_span($value, $class='', $id='', $aAttribs=array()) {
 
     global $oTemplate;
 
@@ -133,6 +194,8 @@ function create_span($value, $class='', $id='') {
     $oTemplate->assign('class', $class);
     $oTemplate->assign('id', $id);
 
+    $oTemplate->assign('aAttribs', $aAttribs);
+
     return $oTemplate->fetch('span.tpl');
 
 }