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
60 parent::HTML_Common($attrs);
66 * Converts to HTML output.
71 function toHtml()// ~X2C
74 foreach ($this->getAttributes() as $key => $val) {
75 $attrs .= ' ' . $key . '="' . htmlentities($val) . '"';
77 return "<IMG$attrs/>";
83 * Gets image location.
88 function getSrc()// ~X2C
90 return $this->getAttribute('src');
96 * Sets image location.
98 * @param string $src Image location.
103 function setSrc($src)// ~X2C
105 $this->updateAttributes(array('src' => $src));
109 // +X2C Operation 219
111 * Gets image alternate text.
116 function getAlt()// ~X2C
118 return $this->getAttribute('alt');
122 // +X2C Operation 220
124 * Sets image alternate text.
126 * @param string $alt Alternate text.
131 function setAlt($alt)// ~X2C
133 $this->updateAttributes(array('alt' => $alt));
137 } // -X2C Class :Image