4 * Represents an XHTML 1.1 module, with information on elements, tags
6 * @note Even though this is technically XHTML 1.1, it is also used for
7 * regular HTML parsing. We are using modulization as a convenient
8 * way to represent the internals of HTMLDefinition, and our
9 * implementation is by no means conforming and does not directly
10 * use the normative DTDs or XML schemas.
11 * @note The public variables in a module should almost directly
12 * correspond to the variables in HTMLPurifier_HTMLDefinition.
13 * However, the prefix info carries no special meaning in these
14 * objects (include it anyway if that's the correspondence though).
17 class HTMLPurifier_HTMLModule
20 * Short unique string identifier of the module
25 * Dynamically set integer that specifies when the module was loaded in.
30 * Informally, a list of elements this module changes. Not used in
31 * any significant way.
34 var $elements = array();
37 * Associative array of element names to element definitions.
38 * Some definitions may be incomplete, to be merged in later
39 * with the full definition.
45 * Associative array of content set names to content set additions.
46 * This is commonly used to, say, add an A element to the Inline
47 * content set. This corresponds to an internal variable $content_sets
48 * and NOT info_content_sets member variable of HTMLDefinition.
51 var $content_sets = array();
54 * Associative array of attribute collection names to attribute
55 * collection additions. More rarely used for adding attributes to
56 * the global collections. Example is the StyleAttribute module adding
57 * the style attribute to the Core. Corresponds to HTMLDefinition's
58 * attr_collections->info, since the object's data is only info,
59 * with extra behavior associated with it.
62 var $attr_collections = array();
65 * Associative array of deprecated tag name to HTMLPurifier_TagTransform
68 var $info_tag_transform = array();
71 * List of HTMLPurifier_AttrTransform to be performed before validation.
74 var $info_attr_transform_pre = array();
77 * List of HTMLPurifier_AttrTransform to be performed after validation.
80 var $info_attr_transform_post = array();
83 * Boolean flag that indicates whether or not getChildDef is implemented.
84 * For optimization reasons: may save a call to a function. Be sure
85 * to set it if you do implement getChildDef(), otherwise it will have
89 var $defines_child_def = false;
92 * Retrieves a proper HTMLPurifier_ChildDef subclass based on
93 * content_model and content_model_type member variables of
94 * the HTMLPurifier_ElementDef class. There is a similar function
95 * in HTMLPurifier_HTMLDefinition.
96 * @param $def HTMLPurifier_ElementDef instance
97 * @return HTMLPurifier_ChildDef subclass
100 function getChildDef($def) {return false;}
103 * Hook method that lets module perform arbitrary operations on
104 * HTMLPurifier_HTMLDefinition before the module gets processed.
105 * @param $definition Reference to HTMLDefinition being setup
107 function preProcess(&$definition) {}
110 * Hook method that lets module perform arbitrary operations
111 * on HTMLPurifier_HTMLDefinition after the module gets processed.
112 * @param $definition Reference to HTMLDefinition being setup
114 function postProcess(&$definition) {}
117 * Hook method that is called when a module gets registered to
119 * @param $definition Reference to HTMLDefinition being setup
121 function setup(&$definition) {}