diff --git a/library/HTMLPurifier.php b/library/HTMLPurifier.php
index 34d4e773..119c6f2a 100644
--- a/library/HTMLPurifier.php
+++ b/library/HTMLPurifier.php
@@ -232,15 +232,22 @@ class HTMLPurifier
* @param $class Class to load
*/
public static function autoload($class) {
+ $file = HTMLPurifier::getPath($class);
+ if (!$file) return false;
+ require_once $file;
+ return true;
+ }
+
+ /**
+ * Returns the path for a specific class.
+ */
+ public static function getPath($class) {
if (strncmp('HTMLPurifier', $class, 12) !== 0) return false;
- // Language classes have an unusual directory structure
if (strncmp('HTMLPurifier_Language_', $class, 22) === 0) {
$code = str_replace('_', '-', substr($class, 22));
- require_once 'HTMLPurifier/Language/classes/' . $code . '.php';
- return true;
+ return 'HTMLPurifier/Language/classes/' . $code . '.php';
}
- require_once str_replace('_', '/', $class) . '.php';
- return true;
+ return str_replace('_', '/', $class) . '.php';
}
diff --git a/library/HTMLPurifier/AttrTransform/BoolToCSS.php b/library/HTMLPurifier/AttrTransform/BoolToCSS.php
index bb1b8b65..5cbdd152 100644
--- a/library/HTMLPurifier/AttrTransform/BoolToCSS.php
+++ b/library/HTMLPurifier/AttrTransform/BoolToCSS.php
@@ -5,8 +5,7 @@ require_once 'HTMLPurifier/AttrTransform.php';
/**
* Pre-transform that changes converts a boolean attribute to fixed CSS
*/
-class HTMLPurifier_AttrTransform_BoolToCSS
-extends HTMLPurifier_AttrTransform {
+class HTMLPurifier_AttrTransform_BoolToCSS extends HTMLPurifier_AttrTransform {
/**
* Name of boolean attribute that is trigger
diff --git a/library/HTMLPurifier/ChildDef/StrictBlockquote.php b/library/HTMLPurifier/ChildDef/StrictBlockquote.php
index 53a3523c..baea9c3a 100644
--- a/library/HTMLPurifier/ChildDef/StrictBlockquote.php
+++ b/library/HTMLPurifier/ChildDef/StrictBlockquote.php
@@ -5,8 +5,7 @@ require_once 'HTMLPurifier/ChildDef/Required.php';
/**
* Takes the contents of blockquote when in strict and reformats for validation.
*/
-class HTMLPurifier_ChildDef_StrictBlockquote
-extends HTMLPurifier_ChildDef_Required
+class HTMLPurifier_ChildDef_StrictBlockquote extends HTMLPurifier_ChildDef_Required
{
protected $real_elements;
protected $fake_elements;