5 * Plugin to convert an associative array to a string of tag attributes.
9 * @author Paul M. Jones <pmjones@ciaweb.net>
11 * @license http://www.gnu.org/copyleft/lesser.html LGPL
13 * @version $Id: Savant3_Plugin_htmlAttribs.php,v 1.3 2005/09/12 17:49:27 pmjones Exp $
19 * Plugin to convert an associative array to a string of tag attributes.
23 * @author Paul M. Jones <pmjones@ciaweb.net>
27 class Savant3_Plugin_htmlAttribs
extends Savant3_Plugin
32 * Converts an associative array to a string of tag attributes.
36 * @param array $attribs
37 * From this array, each key-value pair is
38 * converted to an attribute name and value.
40 * @return string The XHTML for the attributes.
43 public function htmlAttribs($attribs)
46 foreach (( array ) $attribs as $key => $val) {
52 $val = implode(' ', $val);
55 $key = htmlspecialchars($key);
56 $val = htmlspecialchars($val);
58 $xhtml .= " $key=\"$val\"";