New onsite patient portal, take 4.
[openemr.git] / portal / patient / fwk / libs / savant / Savant3 / resources / Savant3_Plugin_htmlAttribs.php
blob42fba2fb2627d2a8c9b05df9a1fa2bf74b5bacfa
1 <?php
3 /**
4 *
5 * Plugin to convert an associative array to a string of tag attributes.
6 *
7 * @package Savant3
8 *
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 $
17 /**
19 * Plugin to convert an associative array to a string of tag attributes.
21 * @package Savant3
23 * @author Paul M. Jones <pmjones@ciaweb.net>
27 class Savant3_Plugin_htmlAttribs extends Savant3_Plugin {
29 /**
31 * Converts an associative array to a string of tag attributes.
33 * @access public
35 * @param array $attribs
36 * From this array, each key-value pair is
37 * converted to an attribute name and value.
39 * @return string The XHTML for the attributes.
42 public function htmlAttribs($attribs) {
43 $xhtml = '';
44 foreach ( ( array ) $attribs as $key => $val ) {
46 if ($val === null) {
47 continue;
50 if (is_array ( $val )) {
51 $val = implode ( ' ', $val );
54 $key = htmlspecialchars ( $key );
55 $val = htmlspecialchars ( $val );
57 $xhtml .= " $key=\"$val\"";
59 return $xhtml;