public function registerModule($module, $overload = false)
    {
        if (is_string($module)) {
            // attempt to load the module
            $original_module = $module;
            $ok = false;
            foreach ($this->prefixes as $prefix) {
                $module = $prefix . $original_module;
                if (class_exists($module)) {
                    $ok = true;
                    break;
                }
            }
            if (!$ok) {
                $module = $original_module;
                if (!class_exists($module)) {
                    trigger_error(
                        $original_module . ' module does not exist',
                        E_USER_ERROR
                    );
                    return;
                }
            }
            $module = new $module();
        }
        if (empty($module->name)) {
            trigger_error('Module instance of ' . get_class($module) . ' must have name');
            return;
        }
        if (!$overload && isset($this->registeredModules[$module->name])) {
            trigger_error('Overloading ' . $module->name . ' without explicit overload parameter', E_USER_WARNING);
        }
        $this->registeredModules[$module->name] = $module;
    }
public function registerModule($module, $overload = false)
    {
        if (is_string($module)) {
            // attempt to load the module
            $original_module = $module;
            $ok = false;
            foreach ($this->prefixes as $prefix) {
                $module = $prefix . $original_module;
                if (class_exists($module)) {
                    $ok = true;
                    break;
                }
            }
            if (!$ok) {
                $module = $original_module;
                if (!class_exists($module)) {
                    trigger_error(
                        $original_module . ' module does not exist',
                        E_USER_ERROR
                    );
                    return;
                }
            }
            $module = new $module();
        }
        if (empty($module->name)) {
            trigger_error('Module instance of ' . get_class($module) . ' must have name');
            return;
        }
        if (!$overload && isset($this->registeredModules[$module->name])) {
            trigger_error('Overloading ' . $module->name . ' without explicit overload parameter', E_USER_WARNING);
        }
        $this->registeredModules[$module->name] = $module;
    }
public function registerModule ( $ module , $ overload = false ) { if ( is_string ( $ module ) ) { // attempt to load the module
 $ original_module = $ module ; $ ok = false ; foreach ( $ this -> prefixes as $ prefix ) { $ module = $ prefix . $ original_module ; if ( class_exists ( $ module ) ) { $ ok = true ; break ; } } if ( ! $ ok ) { $ module = $ original_module ; if ( ! class_exists ( $ module ) ) { trigger_error ( $ original_module . ' module does not exist' , E_USER_ERROR ) ; return ; } } $ module = new $ module ( ) ; } if ( empty ( $ module -> name ) ) { trigger_error ( 'Module instance of ' . get_class ( $ module ) . ' must have name' ) ; return ; } if ( ! $ overload && isset ( $ this -> registeredModules [ $ module -> name ] ) ) { trigger_error ( 'Overloading ' . $ module -> name . ' without explicit overload parameter' , E_USER_WARNING ) ; } $ this -> registeredModules [ $ module -> name ] = $ module ; }
Registers a module to the recognized module list, useful for
overloading pre-existing modules.
@param $module Mixed: string module name, with or without
HTMLPurifier_HTMLModule prefix, or instance of
subclass of HTMLPurifier_HTMLModule.
@param $overload Boolean whether or not to overload previous modules.
If this is not set, and you do overload a module,
HTML Purifier will complain with a warning.
@note This function will not call autoload, you must instantiate
(and thus invoke) autoload outside the method.
@note If a string is passed as a module name, different variants
will be tested in this order:
- Check for HTMLPurifier_HTMLModule_$name
- Check all prefixes with $name in order they were added
- Check for literal object name
- Throw fatal error
If your object name collides with an internal class, specify
your module manually. All modules must have been included
externally: registerModule will not perform inclusions for you!
Registers a module to the recognized module list useful for overloading pre - existing modules .