containers
*
* @param mixed $attr Hash array with tag attributes or string with class name
* @param string $cont Div content
*
* @return string HTML code
* @see html::tag()
*/
public static function div($attr = null, $cont = null)
{
if (is_string($attr)) {
$attr = ['class' => $attr];
}
return self::tag('div', $attr, $cont, array_merge(self::$common_attrib, ['onclick']));
}
/**
* Derived method for
blocks
*
* @param mixed $attr Hash array with tag attributes or string with class name
* @param string $cont Paragraph content
*
* @return string HTML code
* @see html::tag()
*/
public static function p($attr = null, $cont = null)
{
if (is_string($attr)) {
$attr = ['class' => $attr];
}
return self::tag('p', $attr, $cont, self::$common_attrib);
}
/**
* Derived method to create
*
* @param string|array $attr Hash array with tag attributes or string with image source (src)
*
* @return string HTML code
* @see html::tag()
*/
public static function img($attr = null)
{
if (is_string($attr)) {
$attr = ['src' => $attr];
}
$allowed = ['src','alt','width','height','border','usemap','onclick','onerror','onload'];
return self::tag('img', $attr + ['alt' => ''], null, array_merge(self::$common_attrib, $allowed));
}
/**
* Derived method for link tags
*
* @param string|array $attr Hash array with tag attributes or string with link location (href)
* @param string $cont Link content
*
* @return string HTML code
* @see html::tag()
*/
public static function a($attr, $cont)
{
if (is_string($attr)) {
$attr = ['href' => $attr];
}
$allowed = ['href','target','name','rel','onclick','onmouseover','onmouseout','onmousedown','onmouseup'];
return self::tag('a', $attr, $cont, array_merge(self::$common_attrib, $allowed));
}
/**
* Derived method for inline span tags
*
* @param string|array $attr Hash array with tag attributes or string with class name
* @param string $cont Tag content
*
* @return string HTML code
* @see html::tag()
*/
public static function span($attr, $cont)
{
if (is_string($attr)) {
$attr = ['class' => $attr];
}
return self::tag('span', $attr, $cont, self::$common_attrib);
}
/**
* Derived method for form element labels
*
* @param string|array $attr Hash array with tag attributes or string with 'for' attrib
* @param string $cont Tag content
*
* @return string HTML code
* @see html::tag()
*/
public static function label($attr, $cont)
{
if (is_string($attr)) {
$attr = ['for' => $attr];
}
return self::tag('label', $attr, $cont, array_merge(self::$common_attrib, ['for','onkeypress']));
}
/**
* Derived method to create
*
* @param string|array $attr Hash array with tag attributes or string with frame source (src)
* @param string $cont Tag content
*
* @return string HTML code
* @see html::tag()
*/
public static function iframe($attr = null, $cont = null)
{
if (is_string($attr)) {
$attr = ['src' => $attr];
}
$allowed = ['src','name','width','height','border','frameborder','onload','allowfullscreen'];
return self::tag('iframe', $attr, $cont, array_merge(self::$common_attrib, $allowed));
}
/**
* Derived method to create