mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2024-11-09 23:28:42 +00:00
[1.7.0] Make doctype object available from config, switch generator over to it.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1076 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
parent
9728be4a52
commit
e4b621eec2
@ -46,6 +46,11 @@ class HTMLPurifier_Config
|
|||||||
*/
|
*/
|
||||||
var $autoFinalize = true;
|
var $autoFinalize = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instance of HTMLPurifier_Doctype, representing current doctype
|
||||||
|
*/
|
||||||
|
var $doctype;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $definition HTMLPurifier_ConfigSchema that defines what directives
|
* @param $definition HTMLPurifier_ConfigSchema that defines what directives
|
||||||
* are allowed.
|
* are allowed.
|
||||||
@ -225,6 +230,16 @@ class HTMLPurifier_Config
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the current doctype object
|
||||||
|
*/
|
||||||
|
function getDoctype() {
|
||||||
|
if (!$this->doctype) {
|
||||||
|
$this->getHTMLDefinition();
|
||||||
|
}
|
||||||
|
return $this->doctype;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads configuration values from an ini file
|
* Loads configuration values from an ini file
|
||||||
* @param $filename Name of ini file
|
* @param $filename Name of ini file
|
||||||
|
@ -93,8 +93,7 @@ class HTMLPurifier_DoctypeRegistry
|
|||||||
function make($config) {
|
function make($config) {
|
||||||
$original_doctype = $this->get($this->getDoctypeFromConfig($config));
|
$original_doctype = $this->get($this->getDoctypeFromConfig($config));
|
||||||
$doctype = $original_doctype->copy();
|
$doctype = $original_doctype->copy();
|
||||||
// FIXME!!! Set $doctype into $config so others can use it,
|
$config->doctype = $doctype;
|
||||||
// you might need to use two copies
|
|
||||||
return $doctype;
|
return $doctype;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,12 +84,11 @@ class HTMLPurifier_Generator
|
|||||||
$html = '';
|
$html = '';
|
||||||
if (!$config) $config = HTMLPurifier_Config::createDefault();
|
if (!$config) $config = HTMLPurifier_Config::createDefault();
|
||||||
$this->_clean_utf8 = $config->get('Output', 'EnableRedundantUTF8Cleaning');
|
$this->_clean_utf8 = $config->get('Output', 'EnableRedundantUTF8Cleaning');
|
||||||
|
|
||||||
// this should replaced with a query to the Doctype object in
|
|
||||||
// config to determine whether or not this is an XML-based language
|
|
||||||
$this->_xhtml = $config->get('HTML', 'XHTML');
|
|
||||||
|
|
||||||
$this->_scriptFix = $config->get('Output', 'CommentScriptContents');
|
$this->_scriptFix = $config->get('Output', 'CommentScriptContents');
|
||||||
|
|
||||||
|
$doctype = $config->getDoctype();
|
||||||
|
$this->_xhtml = $doctype->xml;
|
||||||
|
|
||||||
if (!$tokens) return '';
|
if (!$tokens) return '';
|
||||||
for ($i = 0, $size = count($tokens); $i < $size; $i++) {
|
for ($i = 0, $size = count($tokens); $i < $size; $i++) {
|
||||||
if ($this->_scriptFix && $tokens[$i]->name === 'script') {
|
if ($this->_scriptFix && $tokens[$i]->name === 'script') {
|
||||||
|
Loading…
Reference in New Issue
Block a user