diff --git a/library/HTMLPurifier/ChildDef/StrictBlockquote.php b/library/HTMLPurifier/ChildDef/StrictBlockquote.php index 0352e488..9280a9f5 100644 --- a/library/HTMLPurifier/ChildDef/StrictBlockquote.php +++ b/library/HTMLPurifier/ChildDef/StrictBlockquote.php @@ -19,7 +19,7 @@ extends HTMLPurifier_ChildDef_Required if (!$this->init) { // allow all inline elements $this->real_elements = $this->elements; - $this->fake_elements = $def->content_sets['Flow']; + $this->fake_elements = $def->info_content_sets['Flow']; $this->fake_elements['#PCDATA'] = true; $this->init = true; } diff --git a/library/HTMLPurifier/HTMLDefinition.php b/library/HTMLPurifier/HTMLDefinition.php index 0a529f7a..1ad9bacb 100644 --- a/library/HTMLPurifier/HTMLDefinition.php +++ b/library/HTMLPurifier/HTMLDefinition.php @@ -99,20 +99,25 @@ HTMLPurifier_ConfigSchema::define( ); /** - * Defines the purified HTML type with large amounts of objects. + * Definition of the purified HTML that describes allowed children, + * attributes, and many other things. * - * The main function of this object is its $info array, which is an - * associative array of all the child and attribute definitions for - * each allowed element. It also contains special use information (always - * prefixed by info) for intelligent tag closing and global attributes. + * Conventions: * - * For optimization, the definition generation may be moved to - * a maintenance script and stipulate that definition be created - * by a factory method that unserializes a serialized version of Definition. - * Customization would entail copying the maintenance script, making the - * necessary changes, generating the serialized object, and then hooking it - * in via the factory method. We would also offer a LiveDefinition for - * automatic recompilation, suggesting that we would have a DefinitionGenerator. + * All member variables that are prefixed with info + * (including the main $info array) are used by HTML Purifier internals + * and should not be directly edited when customizing the HTMLDefinition. + * They can usually be set via configuration directives or custom + * modules. + * + * On the other hand, member variables without the info prefix are used + * internally by the HTMLDefinition and MUST NOT be used by other HTML + * Purifier internals. Many of them, however, are public, and may be + * edited by userspace code to tweak the behavior of HTMLDefinition. + * In practice, there will not be too many of them. + * + * HTMLPurifier_Printer_HTMLDefinition is a notable exception to this + * rule: in the interest of comprehensiveness, it will sniff everything. */ class HTMLPurifier_HTMLDefinition @@ -168,14 +173,19 @@ class HTMLPurifier_HTMLDefinition */ var $info_attr_transform_post = array(); + /** + * Nested lookup array of content set name (Block, Inline) to + * element name to whether or not it belongs in that content set. + * @public + */ + var $info_content_sets = array(); + /** * Boolean is a strict definition? * @public */ var $strict; - var $content_sets = array(); - /** * Initializes the definition, the meat of the class. */ @@ -355,7 +365,7 @@ class HTMLPurifier_HTMLDefinition } foreach ($e_Flow->elements as $name => $bool) { - $this->content_sets['Flow'][$name] = true; + $this->info_content_sets['Flow'][$name] = true; } ////////////////////////////////////////////////////////////////////// diff --git a/library/HTMLPurifier/XHTMLDefinition.php b/library/HTMLPurifier/XHTMLDefinition.php index 4e4d762f..9be09b98 100644 --- a/library/HTMLPurifier/XHTMLDefinition.php +++ b/library/HTMLPurifier/XHTMLDefinition.php @@ -53,13 +53,6 @@ class HTMLPurifier_XHTMLDefinition extends HTMLPurifier_HTMLDefinition */ var $attr_collection; - /** - * Nested lookup array of content set name (Block, Inline) to - * element name to whether or not it belongs in that content set. - * @public - */ - var $content_sets; - /** * Performs low-cost, preliminary initialization. * @param $config Instance of HTMLPurifier_Config @@ -120,7 +113,7 @@ class HTMLPurifier_XHTMLDefinition extends HTMLPurifier_HTMLDefinition $content_sets_keys = array_keys($content_sets); $content_sets_values = array_values($content_sets); foreach ($content_sets as $name => $set) { - $this->content_sets[$name] = $this->convertToLookup($set); + $this->info_content_sets[$name] = $this->convertToLookup($set); } foreach ($this->modules as $module_i => $module) {