2 // vim: set expandtab tabstop=4 softtabstop=4 shiftwidth=4:
3 // +----------------------------------------------------------------------+
5 // +----------------------------------------------------------------------+
6 // | Copyright (c) 1997-2003 The PHP Group |
7 // +----------------------------------------------------------------------+
8 // | This source file is subject to version 2.02 of the PHP license, |
9 // | that is bundled with this package in the file LICENSE, and is |
10 // | available at through the world-wide-web at |
11 // | http://www.php.net/license/2_02.txt. |
12 // | If you did not receive a copy of the PHP license and are unable to |
13 // | obtain it through the world-wide-web, please send a note to |
14 // | license@php.net so we can mail you a copy immediately. |
15 // +----------------------------------------------------------------------+
16 // | Created: Mon Jun 30 19:46:34 2003 |
17 // | Authors: Leandro Lucarella <llucar@mecon.gov.ar> |
18 // | MartÃn Marrese <mmarre@mecon.gov.ar> |
19 // +----------------------------------------------------------------------+
25 require_once 'HTML/Common.php';
28 // +X2C Class 214 :Image
30 * HTML Image representation.
34 class HTML_Image extends HTML_Common {
36 * List of valid HTML attributes for an Image.
38 * @var array $validAttrs
41 var $_validAttrs = array('src', 'alt', 'longdesc', 'width', 'height', 'usemap', 'ismap', 'align', 'border', 'hspace', 'vspace', 'id', 'class', 'style', 'title', 'lang', 'dir', 'onclick', 'ondblclick', 'onmousedown', 'onmouseup', 'onmouseover', 'onmousemove', 'onmouseout', 'onkeypress', 'onkeydown', 'onkeyup');
49 * @param string $src Image location.
50 * @param string $alt Alternate text.
51 * @param array $attrs Other image attributes.
56 function HTML_Image($src = '', $alt = '', $attrs = array())// ~X2C
58 if (is_array($attrs)) {
62 $attrs .= " src=$src alt=$alt";
64 parent::HTML_Common($attrs);
70 * Converts to HTML output.
75 function toHtml()// ~X2C
78 foreach ($this->getAttributes() as $key => $val) {
79 $attrs .= ' ' . $key . '="' . htmlentities($val) . '"';
81 return "<IMG$attrs/>";
87 * Gets image location.
92 function getSrc()// ~X2C
94 return $this->getAttribute('src');
100 * Sets image location.
102 * @param string $src Image location.
107 function setSrc($src)// ~X2C
109 $this->updateAttributes(array('src' => $src));
113 // +X2C Operation 219
115 * Gets image alternate text.
120 function getAlt()// ~X2C
122 return $this->getAttribute('alt');
126 // +X2C Operation 220
128 * Sets image alternate text.
130 * @param string $alt Alternate text.
135 function setAlt($alt)// ~X2C
137 $this->updateAttributes(array('alt' => $alt));
141 } // -X2C Class :Image