Ejemplo n.º 1
0
 /**
  * Purify HTML for field.
  * @return string HTML.
  */
 public function recordDisplay(ActiveRecord $record, $field = 'content', $options = array())
 {
     $purifier = $this->getPurifier($field);
     $htmlField = $field . 'Html';
     $content = $record->{$htmlField};
     if (isset($options['break']) and $options['break']) {
         $sections = explode('<div class="break"></div>', $content);
         $content = $sections[0];
     }
     $html = $this->applyFilters($field, 'prerender', $content);
     if (isset($options['maxLength']) and Unicode::length($html) > $options['maxLength']) {
         $html = Unicode::slice($html, 0, $options['maxLength']);
         if (isset($options['append'])) {
             $html .= $options['append'];
         }
     }
     return $purifier->purify($html);
 }