html::element PHP Method

element() public static method

public static element ( $name, $content = '', $attributes = null )
    public static function element($name, $content = '', $attributes = null)
    {
        $short = array('img', 'input', 'br', 'hr', 'frame', 'area', 'base', 'basefont', 'col', 'isindex', 'link', 'meta', 'param');
        if (in_array($name, $short)) {
            if ($content) {
                $attributes['value'] = $content;
            }
            return '<' . $name . static::attributes($attributes) . '>';
        }
        return '<' . $name . static::attributes($attributes) . '>' . $content . '</' . $name . '>';
    }

Usage Example

Esempio n. 1
0
 /**
  * Create the HTML for a modal
  *
  * @param string $action Name of AJAX action to run.
  * @param string|bool $atts Optional. Additional data-* to use in element.
  * @param string $text Text to use for link trigger.
  * *@param string|bool $api Optional. URL for AJAX API to process with. Default is WordPress' AJAX API
  *
  * @return string
  */
 public static function make($action, $atts = false, $text, $api = false)
 {
     $atts['data-modal'] = 'true';
     $modal = html::element($action, $atts, $text, $api);
     return $modal;
 }