| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * image.tpl |
| 5 | * |
| 6 | * Template for constructing an image. |
| 7 | * |
| 8 | * The following variables are available in this template: |
| 9 | * + $src - the image source path |
| 10 | * + $id - ID name (optional; may not be present) |
| 11 | * + $class - CSS class name (optional; may not be present) |
| 12 | * + $alt - alternative link text |
| 13 | * (optional; may not be present) |
| 14 | * + $title - the image's title attribute value |
| 15 | * (optional; may not be present) |
| 16 | * + $width - the width the image should be shown in |
| 17 | * (optional; may not be present) |
| 18 | * + $height - the height the image should be shown in |
| 19 | * (optional; may not be present) |
| 20 | * + $align - the image's alignment attribute value |
| 21 | * (optional; may not be present) |
| 22 | * + $border - the image's border attribute value |
| 23 | * (optional; may not be present) |
| 24 | * + $hspace - the image's hspace attribute value |
| 25 | * (optional; may not be present) |
| 26 | * + $vspace - the image's vspace attribute value |
| 27 | * (optional; may not be present) |
| 28 | * + $onclick - onClick JavaScript handler (optional; may not be present) |
| 29 | * + $text_alternative - A text replacement for the entire |
| 30 | * image tag, if for some reason the |
| 31 | * image tag cannot or should not be |
| 32 | * produced (optional; may not be present) |
| 33 | * + $aAttribs - Any extra attributes: an associative array, where |
| 34 | * keys are attribute names, and values (which are |
| 35 | * optional and might be null) should be placed |
| 36 | * in double quotes as attribute values (optional; |
| 37 | * may not be present) |
| 38 | * |
| 39 | * @copyright 1999-2024 The SquirrelMail Project Team |
| 40 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License |
| 41 | * @version $Id$ |
| 42 | * @package squirrelmail |
| 43 | * @subpackage templates |
| 44 | */ |
| 45 | |
| 46 | |
| 47 | // retrieve the template vars |
| 48 | // |
| 49 | extract($t); |
| 50 | |
| 51 | |
| 52 | echo '<img src="' . $src . '"'; |
| 53 | if (!empty($class)) echo ' class="' . $class . '"'; |
| 54 | if (!empty($id)) echo ' id="' . $id . '"'; |
| 55 | if (!empty($alt)) echo ' alt="' . $alt . '"'; |
| 56 | if (!empty($title)) echo ' title="' . $title . '"'; |
| 57 | if (!empty($onclick)) echo ' onclick="' . $onclick . '"'; |
| 58 | if (!empty($width) || $width === '0') echo ' width="' . $width . '"'; |
| 59 | if (!empty($height) || $height === '0') echo ' height="' . $height . '"'; |
| 60 | if (!empty($align)) echo ' align="' . $align . '"'; |
| 61 | if (!empty($border) || $border === '0') echo ' border="' . $border . '"'; |
| 62 | if (!empty($hspace) || $hspace === '0') echo ' hspace="' . $hspace . '"'; |
| 63 | if (!empty($vspace) || $vspace === '0') echo ' vspace="' . $vspace . '"'; |
| 64 | foreach ($aAttribs as $key => $value) { |
| 65 | echo ' ' . $key . (is_null($value) ? '' : '="' . $value . '"'); |
| 66 | } |
| 67 | echo ' />'; |
| 68 | |
| 69 | |