/** * Generate an HTML tag * * @uses attributes * @static * @param string $name The tag name, e.g. div, input, p, li, etc. * @param array $attr Optional. The HTML attributes as an associative array * @param mixed $text Optional. The HTML to go within the tag. If false, it's a self-closing tag (< />) * @return string * @author Matthew Boynes */ public static function tag($name, $attr = array(), $text = false) { if ($attr) { $attr = SCPT_Markup::attributes($attr); } else { $attr = ''; } if (false !== $text) { $text = '>' . $text . '</' . esc_attr($name) . '>'; } else { $text = ' />'; } return '<' . esc_attr($name) . $attr . $text; }
/** * Generate an HTML tag * * @uses attributes * @static * @param string $name The tag name, e.g. div, input, p, li, etc. * @param array $attr Optional. The HTML attributes as an associative array * @param mixed $text Optional. The HTML to go within the tag. If false, it's a self-closing tag (< />) * @return string * @author Matthew Boynes */ public static function tag($name, $attr = array(), $text = false) { if ($attr) { $attr = SCPT_Markup::attributes($attr); } else { $attr = ''; } if (false !== $text) { $text = ">{$text}</{$name}>"; } else { $text = ' />'; } return '<' . $name . $attr . $text; }