Commit fd28dbf2 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Make clean_html more forgiving when html filters are missing



When an html filter is removed from disk for some reason, but is still
listed in the config table, you get a fatal error.  If an upgrade
removes a filter, this will result in a broken-looking page before the
upgrade is run.  We don't need to throw a fatal error when a filter is
missing, the site will run just fine with more html stripped out.

Change-Id: Ic6498f368561c2e005d44562d518bde94bd3457c
Signed-off-by: default avatarRichard Mansfield <richard.mansfield@catalyst.net.nz>
parent afadb872
......@@ -2745,9 +2745,11 @@ function clean_html($text, $xhtml=false) {
$builtinfilters = array('YouTube', 'TeacherTube', 'SlideShare', 'SciVee', 'GoogleVideo');
if (!in_array($filter->file, $builtinfilters)) {
require_once(get_config('libroot') . 'htmlpurifiercustom/' . $filter->file . '.php');
include_once(get_config('libroot') . 'htmlpurifiercustom/' . $filter->file . '.php');
$classname = 'HTMLPurifier_Filter_' . $filter->file;
$customfilters[] = new $classname();
if (class_exists($classname)) {
$customfilters[] = new $classname();
}
}
}
$config->set('Filter.Custom', $customfilters);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment