Пример #1
0
 public static function createTag($tagName, $attributes = null, $content = null, $quickClose = false, $escapeContent = true)
 {
     $tag = '<' . $tagName;
     if ($attributes) {
         foreach (array_keys($attributes) as $atb) {
             $tag .= ' ' . $atb . '="' . StringTools::escapeHtml($attributes[$atb]) . '"';
         }
     }
     if (!$content && $quickClose) {
         $tag .= ' />';
         return $tag;
     }
     $tag .= '>';
     if ($content) {
         $tag .= $escapeContent ? StringTools::escapeHtml($content) : $content;
     }
     $tag .= '</' . $tagName . '>';
     return $tag;
 }