/**
  *
  * Returns a "void" tag (i.e., one with no body and no closing tag).
  *
  * @param string $tag The tag name.
  *
  * @param array $attr The attributes for the tag.
  *
  * @return string
  *
  */
 protected function void($tag, array $attr = array())
 {
     $attr = $this->escaper->attr($attr);
     $html = "<{$tag} {$attr} />";
     return $html;
 }
Example #2
0
 /**
  * @param  array              $data
  * @param  string             $strategy
  * @param  \Aura\Html\Escaper $escaper
  * @param  string             $encoding
  * @return array|string
  */
 private function escapeArray(array $data, $strategy, AuraHtmlEscaper $escaper, $encoding)
 {
     if ($strategy === 'attr') {
         return $escaper->attr($data);
     }
     array_walk($data, function (&$item) use($strategy, $encoding) {
         $item = $this->escape($item, $strategy, $encoding);
     });
     return $data;
 }
Example #3
0
 /**
  *
  * Static escaping for unquoted HTML attribute context.
  *
  * @param string $raw The raw string.
  *
  * @return string The escaped string.
  *
  */
 public static function a($raw)
 {
     return static::$escaper->attr($raw);
 }