Exemple #1
0
 /**
  * Given a set of content, filter the content by normalizing the content
  *
  * @since	5.0
  * @access	public
  * @param	string
  * @return
  */
 public function filterHtml($content = '')
 {
     static $filter;
     static $filterType;
     // If filter hasn't been initialized before, do it now.
     if (!isset($filter)) {
         jimport('joomla.filter.filterinput');
         // Get tags & attributes that should be stripped.
         $filterTags = EasyBlogAcl::getFilterTags();
         $filterAttrs = EasyBlogAcl::getFilterAttributes();
         $filterType = 'html';
         // Create filter instance.
         $filter = JFilterInput::getInstance($filterTags, $filterAttrs, 1, 1, 0);
         $filter->tagBlacklist = $filterTags;
         $filter->attrBlacklist = $filterAttrs;
         // Disable filtering if there's nothing to filter
         if (count($filterTags) < 1 && count($filterAttrs) < 1) {
             $filter = false;
         }
     }
     // If we can skip filtering, just return content.
     if ($filter == false) {
         return $content;
     }
     // Strip blacklisted tags & attributes.
     return $filter->clean($content, $filterType);
 }