Ejemplo n.º 1
0
 /**
  * @abstract Generates the formatted HTML for this element.
  * @param array $tagName A tag name as described by HTMLElement.
  * @param array $flags Flags as described by HTMLElement.
  * @param array $attributes Attributes as described by HTMLElement.
  * @param array $flags Flags as described by HTMLElement.
  * @return string A formatted XHTML string.
  */
 public static function build($tagName = '', $innerHTML = '', $attributes = array(), $flags = array())
 {
     /* Self-closing element */
     if ($innerHTML === false) {
         return sprintf(HTMLElement::TMPL_SELF_CLOSE, $tagName, HTMLElement::formatAttributes($attributes), HTMLElement::formatFlags($flags));
     }
     /* An open/close element */
     return sprintf(HTMLElement::TMPL_OPEN_CLOSE, $tagName, HTMLElement::formatAttributes($attributes), HTMLElement::formatFlags($flags), is_array($innerHTML) ? "\n\t" . implode("\n\t", $innerHTML) . "\n" : (is_string($innerHTML) ? $innerHTML : "\n\t" . $innerHTML . "\n"), $tagName);
 }