/**
- * Checks for an image icon and returns a complete HTML img tag or a text
+ * Checks for an image icon and returns a complete image tag or a text
* string with the text icon based on what is found and user prefs.
*
* @param string $icon_theme_path User's chosen icon set
// If we found an icon, build an img tag to display it. If we didn't
// find an image, we will revert back to the text icon.
if (!is_null($icon_path)) {
- $icon = '<img src="'.$icon_path.'" ' .
- 'alt="'.$alt_text.'" '.
- (!empty($alt_text) ? 'title="'.$alt_text.'" ' : '') .
- (!is_null($w) ? 'width="'.$w.'" ' : '') .
- (!is_null($h) ? 'height="'.$h.'" ' : '') .
- ' />';
+ global $oTemplate;
+ $oTemplate->assign('src', $icon_path);
+ $oTemplate->assign('alt', $alt_text);
+ $oTemplate->assign('title', $alt_text);
+ $oTemplate->assign('width', $w);
+ $oTemplate->assign('height', $h);
+
+ // blank other attributes because the template
+ // object might already contain values due to
+ // having been used to show another image before
+ // this one
+ //
+ $oTemplate->assign('onclick', '');
+ $oTemplate->assign('align', '');
+ $oTemplate->assign('border', '');
+ $oTemplate->assign('hspace', '');
+ $oTemplate->assign('vspace', '');
+
+ $icon = $oTemplate->fetch('image.tpl');
} else {
$icon = $text_icon;
}
/* If they don't have a logo, don't bother.. */
$logo_str = '';
if (isset($org_logo) && $org_logo) {
- /* Display width and height like good little people */
- $width_and_height = '';
+
+ $oTemplate->assign('src', $org_logo);
+ $oTemplate->assign('alt', sprintf(_("%s Logo"), $org_name));
+ $oTemplate->assign('class', 'sqm_loginImage');
if (isset($org_logo_width) && is_numeric($org_logo_width) &&
$org_logo_width>0) {
- $width_and_height = "width=\"$org_logo_width\" ";
+ $oTemplate->assign('width', $worg_logo_width);
+ } else {
+ $oTemplate->assign('width', '');
}
if (isset($org_logo_height) && is_numeric($org_logo_height) &&
$org_logo_height>0) {
- $width_and_height .= "height=\"$org_logo_height\" ";
+ $oTemplate->assign('height', $worg_logo_height);
+ } else {
+ $oTemplate->assign('height', '');
}
-
- $logo_str = '<img src="'.$org_logo.'" ' .
- 'alt="'. sprintf(_("%s Logo"), $org_name).'" ' .
- $width_and_height .
- 'class="sqm_loginImage" /><br />'."\n";
+ $oTemplate->assign('onclick', '');
+ $oTemplate->assign('align', '');
+ $oTemplate->assign('border', '');
+ $oTemplate->assign('hspace', '');
+ $oTemplate->assign('vspace', '');
+ $logo_str = $oTemplate->fetch('image.tpl');
}
$sm_attribute_str = '';
--- /dev/null
+<?php
+
+/**
+ * image.tpl
+ *
+ * Template for constructing an image.
+ *
+ * The following variables are available in this template:
+ * + $src - the image source path
+ * + $class - CSS class name (optional; may not be present)
+ * + $alt - alternative link text
+ * (optional; may not be present)
+ * + $title - the image's title attribute value
+ * (optional; may not be present)
+ * + $width - the width the image should be shown in
+ * (optional; may not be present)
+ * + $height - the height the image should be shown in
+ * (optional; may not be present)
+ * + $align - the image's alignment attribute value
+ * (optional; may not be present)
+ * + $border - the image's border attribute value
+ * (optional; may not be present)
+ * + $hspace - the image's hspace attribute value
+ * (optional; may not be present)
+ * + $vspace - the image's vspace attribute value
+ * (optional; may not be present)
+ * + $onclick - onClick JavaScript handler (optional; may not be present)
+ *
+ * @copyright © 1999-2006 The SquirrelMail Project Team
+ * @license http://opensource.org/licenses/gpl-license.php GNU Public License
+ * @version $Id$
+ * @package squirrelmail
+ * @subpackage templates
+ */
+
+
+// retrieve the template vars
+//
+extract($t);
+
+
+?><img src="<?php echo $src ?>"<?php if (!empty($class)) echo ' class="' . $class . '"'; ?><?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 . '"'; ?> />
<table cellspacing="0">
<tr>
<td class="sqm_loginTop" colspan="2">
- <?php echo $logo_str; ?>
+ <?php echo $logo_str; if (!empty($logo_str)) echo '<br />'; ?>
<?php echo $sm_attribute_str; ?>
</td>
</tr>