Esempio n. 1
0
 /**
  * Get a safe HTML version of the contents of this object.
  *
  * @return SafeHtmlWrapper
  */
 public function getSafeHtml()
 {
     $result = $this->render();
     return Html::safe(Html::escape($result));
 }
Esempio n. 2
0
 /**
  * Render the content of the tag.
  *
  * @throws CoreException
  * @return string
  */
 protected function renderContent()
 {
     if (is_string($this->content) || $this->content instanceof SafeHtmlWrapper || $this->content instanceof SafeHtmlProducerInterface) {
         return Html::escape($this->content);
     } elseif ($this->content instanceof RenderableInterface) {
         return Html::escape($this->content->render());
     } elseif (is_array($this->content) || $this->content instanceof ArrayableInterface) {
         return ArrayList::of($this->content)->map(function ($child) {
             if (is_string($child) || $child instanceof SafeHtmlWrapper || $child instanceof SafeHtmlProducerInterface) {
                 return Html::escape($child);
             } elseif ($child instanceof RenderableInterface) {
                 return Html::escape($child->render());
             }
             throw new NodeChildRenderingException($child);
         })->join();
     }
     throw new NodeRenderingException($this->content);
 }