/**
* 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 $name The anchor 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.
*
*
*/
function create_hyperlink($uri, $text, $target='', $onclick='',
- $class='', $id='', $name='') {
+ $class='', $id='', $name='', $aAttribs=array()) {
global $oTemplate;
$oTemplate->assign('id', $id);
$oTemplate->assign('name', $name);
+ $oTemplate->assign('aAttribs', $aAttribs);
+
return $oTemplate->fetch('hyperlink.tpl');
}
* 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.
*
function create_image($src, $alt='', $width='', $height='',
$border='', $class='', $id='', $onclick='',
$title='', $align='', $hspace='', $vspace='',
- $text_alternative='') {
+ $text_alternative='', $aAttribs=array()) {
global $oTemplate;
$oTemplate->assign('vspace', $vspace);
$oTemplate->assign('text_alternative', $text_alternative);
+ $oTemplate->assign('aAttribs', $aAttribs);
+
return $oTemplate->fetch('image.tpl');
}
* @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;
$oTemplate->assign('class', $class);
$oTemplate->assign('id', $id);
+ $oTemplate->assign('aAttribs', $aAttribs);
+
return $oTemplate->fetch('span.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)
- * + $class - CSS class name (optional; may not be present)
- * + $id - ID name (optional; may not be present)
- * + $name - Anchor name (optional; may not be present)
+ * + $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)
+ * + $class - CSS class name (optional; may not be present)
+ * + $id - ID name (optional; may not be present)
+ * + $name - Anchor name (optional; may not be present)
+ * + $aAttribs - Any extra attributes: an associative array, where
+ * keys are attribute names, and values (which are
+ * optional and might be null) should be placed
+ * in double quotes as attribute values (optional;
+ * may not be present)
*
* @copyright © 1999-2006 The SquirrelMail Project Team
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
extract($t);
-?><a href="<?php echo $uri ?>"<?php if (!empty($target)) echo ' target="' . $target . '"'; ?><?php if (!empty($onclick)) echo ' onclick="' . $onclick . '"'; ?><?php if (!empty($name)) echo ' name="' . $name . '"'; ?><?php if (!empty($class)) echo ' class="' . $class . '"'; ?><?php if (!empty($id)) echo ' id="' . $id . '"'; ?>><?php echo $text; ?></a>
+echo '<a href="' . $uri . '"';
+if (!empty($target)) echo ' target="' . $target . '"';
+if (!empty($onclick)) echo ' onclick="' . $onclick . '"';
+if (!empty($name)) echo ' name="' . $name . '"';
+if (!empty($class)) echo ' class="' . $class . '"';
+if (!empty($id)) echo ' id="' . $id . '"';
+else if (!empty($name)) echo ' id="' . $name . '"';
+foreach ($aAttribs as $key => $value) {
+ echo ' ' . $key . (is_null($value) ? '' : '="' . $value . '"');
+}
+echo '>' . $text . '</a>';
+
+
* image tag, if for some reason the
* image tag cannot or should not be
* produced (optional; may not be present)
+ * + $aAttribs - Any extra attributes: an associative array, where
+ * keys are attribute names, and values (which are
+ * optional and might be null) should be placed
+ * in double quotes as attribute values (optional;
+ * may not be present)
*
* @copyright © 1999-2006 The SquirrelMail Project Team
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
extract($t);
-?><img src="<?php echo $src ?>"<?php if (!empty($class)) echo ' class="' . $class . '"'; ?><?php if (!empty($id)) echo ' id="' . $id . '"'; ?><?php if (!empty($alt)) echo ' alt="' . $alt . '"'; ?><?php if (!empty($title)) echo ' title="' . $title . '"'; ?><?php if (!empty($onclick)) echo ' onclick="' . $onclick . '"'; ?><?php if (!empty($width)) echo ' width="' . $width . '"'; ?><?php if (!empty($height)) echo ' height="' . $height . '"'; ?><?php if (!empty($align)) echo ' align="' . $align . '"'; ?><?php if (!empty($border)) echo ' border="' . $border . '"'; ?><?php if (!empty($hspace)) echo ' hspace="' . $hspace . '"'; ?><?php if (!empty($vspace)) echo ' vspace="' . $vspace . '"'; ?> />
+echo '<img src="' . $src . '"';
+if (!empty($class)) echo ' class="' . $class . '"';
+if (!empty($id)) echo ' id="' . $id . '"';
+if (!empty($alt)) echo ' alt="' . $alt . '"';
+if (!empty($title)) echo ' title="' . $title . '"';
+if (!empty($onclick)) echo ' onclick="' . $onclick . '"';
+if (!empty($width)) echo ' width="' . $width . '"';
+if (!empty($height)) echo ' height="' . $height . '"';
+if (!empty($align)) echo ' align="' . $align . '"';
+if (!empty($border)) echo ' border="' . $border . '"';
+if (!empty($hspace)) echo ' hspace="' . $hspace . '"';
+if (!empty($vspace)) echo ' vspace="' . $vspace . '"';
+foreach ($aAttribs as $key => $value) {
+ echo ' ' . $key . (is_null($value) ? '' : '="' . $value . '"');
+}
+echo ' />';
+
+
* Template for constructing a span tag.
*
* The following variables are available in this template:
- * + $value - The contents that belong inside the span
- * + $class - CSS class name (optional; may not be present)
- * + $id - ID name (optional; may not be present)
+ * + $value - The contents that belong inside the span
+ * + $class - CSS class name (optional; may not be present)
+ * + $id - ID name (optional; may not be present)
+ * + $aAttribs - Any extra attributes: an associative array, where
+ * keys are attribute names, and values (which are
+ * optional and might be null) should be placed
+ * in double quotes as attribute values (optional;
+ * may not be present)
*
* @copyright © 1999-2006 The SquirrelMail Project Team
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
extract($t);
-?><span<?php if (!empty($class)) echo ' class="' . $class . '"'; ?><?php if (!empty($id)) echo ' id="' . $id . '"'; ?>><?php echo $value; ?></span>
+echo '<span';
+if (!empty($class)) echo ' class="' . $class . '"';
+if (!empty($id)) echo ' id="' . $id . '"';
+foreach ($aAttribs as $key => $value) {
+ echo ' ' . $key . (is_null($value) ? '' : '="' . $value . '"');
+}
+echo '>' . $value . '</span>';
+
+