/** * Returns a guaranteed valid HTML attribute. Removes illegal characters. * Allows for 'naked' attributes, without a value. * @param string $name * @param string|array|bool $value * @return string */ public static function attribute($name, $value) { if ($name === $value) { return ' ' . self::name($name); } else { if (is_numeric($name)) { return ' ' . self::name($value); } else { return \arc\xml::attribute($name, $value); } } }
protected function getAttributes($attributes) { $result = ''; if (count($attributes)) { foreach ($attributes as $name => $value) { $result .= \arc\xml::attribute($name, $value); } } return $result; }
public static function attribute($name, $value) { return \arc\xml::attribute($name, $value); }