Changeset 243 for trunk/libs/HTMLPurifier.php
- Timestamp:
- 05/23/08 04:34:59 (8 months ago)
- Files:
-
- trunk/libs/HTMLPurifier.php (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/libs/HTMLPurifier.php
r2 r243 23 23 24 24 /* 25 HTML Purifier 2. 0.1- Standards Compliant HTML Filtering26 Copyright (C) 2006 Edward Z. Yang25 HTML Purifier 2.1.4 - Standards Compliant HTML Filtering 26 Copyright (C) 2006-2007 Edward Z. Yang 27 27 28 28 This library is free software; you can redistribute it and/or … … 41 41 */ 42 42 43 // almost every class has an undocumented dependency to these, so make sure 44 // they get included 45 require_once 'HTMLPurifier/ConfigSchema.php'; // important 43 // constants are slow, but we'll make one exception 44 define('HTMLPURIFIER_PREFIX', dirname(__FILE__)); 45 46 // every class has an undocumented dependency to these, must be included! 47 require_once 'HTMLPurifier/ConfigSchema.php'; // fatal errors if not included 46 48 require_once 'HTMLPurifier/Config.php'; 47 49 require_once 'HTMLPurifier/Context.php'; … … 58 60 'Core', 'CollectErrors', false, 'bool', ' 59 61 Whether or not to collect errors found while filtering the document. This 60 is a useful way to give feedback to your users. CURRENTLY NOT IMPLEMENTED. 61 This directive has been available since 2.0.0. 62 is a useful way to give feedback to your users. <strong>Warning:</strong> 63 Currently this feature is very patchy and experimental, with lots of 64 possible error messages not yet implemented. It will not cause any problems, 65 but it may not help your users either. This directive has been available 66 since 2.0.0. 62 67 '); 63 68 64 69 /** 65 * Main library execution class. 66 * 67 * Facade that performs calls to the HTMLPurifier_Lexer, 68 * HTMLPurifier_Strategy and HTMLPurifier_Generator subsystems in order to 69 * purify HTML. 70 * Facade that coordinates HTML Purifier's subsystems in order to purify HTML. 71 * 72 * @note There are several points in which configuration can be specified 73 * for HTML Purifier. The precedence of these (from lowest to 74 * highest) is as follows: 75 * -# Instance: new HTMLPurifier($config) 76 * -# Invocation: purify($html, $config) 77 * These configurations are entirely independent of each other and 78 * are *not* merged. 70 79 * 71 80 * @todo We need an easier way to inject strategies, it'll probably end … … 75 84 { 76 85 77 var $version = '2. 0.1';86 var $version = '2.1.4'; 78 87 79 88 var $config; 80 var $filters ;89 var $filters = array(); 81 90 82 91 var $strategy, $generator; 83 92 84 93 /** 85 * Final HTMLPurifier_Context of last run purification. Might be an array. 94 * Resultant HTMLPurifier_Context of last run purification. Is an array 95 * of contexts if the last called method was purifyArray(). 86 96 * @public 87 97 */ … … 147 157 $context->register('ErrorCollector', $error_collector); 148 158 } 159 160 // setup id_accumulator context, necessary due to the fact that 161 // AttrValidator can be called from many places 162 $id_accumulator = HTMLPurifier_IDAccumulator::build($config, $context); 163 $context->register('IDAccumulator', $id_accumulator); 149 164 150 165 $html = HTMLPurifier_Encoder::convertToUTF8($html, $config, $context); … … 196 211 /** 197 212 * Singleton for enforcing just one HTML Purifier in your system 198 */ 199 function &getInstance($prototype = null) { 213 * @param $prototype Optional prototype HTMLPurifier instance to 214 * overload singleton with. 215 */ 216 function &instance($prototype = null) { 200 217 static $htmlpurifier; 201 218 if (!$htmlpurifier || $prototype) { … … 203 220 $htmlpurifier = $prototype; 204 221 } elseif ($prototype) { 205 $htmlpurifier = new HTMLPurifier( HTMLPurifier_Config::create($prototype));222 $htmlpurifier = new HTMLPurifier($prototype); 206 223 } else { 207 224 $htmlpurifier = new HTMLPurifier(); … … 211 228 } 212 229 230 function &getInstance($prototype = null) { 231 return HTMLPurifier::instance($prototype); 232 } 213 233 214 234 }


