mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2024-12-31 20:01:52 +00:00
[3.1.0] Allow index to be false for config from for creation
- Static-ify Printer_ConfigForm's get* functions git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1690 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
parent
eaabccdd9b
commit
f295465ad4
2
NEWS
2
NEWS
@ -22,6 +22,8 @@ NEWS ( CHANGELOG and HISTORY ) HTMLPurifier
|
|||||||
+ HTMLPurifier_HTMLModule->addElement()
|
+ HTMLPurifier_HTMLModule->addElement()
|
||||||
+ HTMLPurifier_HTMLModule->addBlankElement()
|
+ HTMLPurifier_HTMLModule->addBlankElement()
|
||||||
+ HTMLPurifier_LanguageFactory::instance()
|
+ HTMLPurifier_LanguageFactory::instance()
|
||||||
|
# Printer_ConfigForm's get*() functions were static-ified
|
||||||
|
! Allow index to be false for config from form creation
|
||||||
- InterchangeBuilder now alphabetizes its lists
|
- InterchangeBuilder now alphabetizes its lists
|
||||||
- Validation error in configdoc output fixed
|
- Validation error in configdoc output fixed
|
||||||
- Iconv and other encoding errors muted even with custom error handlers that
|
- Iconv and other encoding errors muted even with custom error handlers that
|
||||||
|
@ -403,7 +403,7 @@ class HTMLPurifier_Config
|
|||||||
* @param $mq_fix Boolean whether or not to enable magic quotes fix
|
* @param $mq_fix Boolean whether or not to enable magic quotes fix
|
||||||
* @param $schema Instance of HTMLPurifier_ConfigSchema to use, if not global copy
|
* @param $schema Instance of HTMLPurifier_ConfigSchema to use, if not global copy
|
||||||
*/
|
*/
|
||||||
public static function loadArrayFromForm($array, $index, $allowed = true, $mq_fix = true, $schema = null) {
|
public static function loadArrayFromForm($array, $index = false, $allowed = true, $mq_fix = true, $schema = null) {
|
||||||
$ret = HTMLPurifier_Config::prepareArrayFromForm($array, $index, $allowed, $mq_fix, $schema);
|
$ret = HTMLPurifier_Config::prepareArrayFromForm($array, $index, $allowed, $mq_fix, $schema);
|
||||||
$config = HTMLPurifier_Config::create($ret, $schema);
|
$config = HTMLPurifier_Config::create($ret, $schema);
|
||||||
return $config;
|
return $config;
|
||||||
@ -413,7 +413,7 @@ class HTMLPurifier_Config
|
|||||||
* Merges in configuration values from $_GET/$_POST to object. NOT STATIC.
|
* Merges in configuration values from $_GET/$_POST to object. NOT STATIC.
|
||||||
* @note Same parameters as loadArrayFromForm
|
* @note Same parameters as loadArrayFromForm
|
||||||
*/
|
*/
|
||||||
public function mergeArrayFromForm($array, $index, $allowed = true, $mq_fix = true) {
|
public function mergeArrayFromForm($array, $index = false, $allowed = true, $mq_fix = true) {
|
||||||
$ret = HTMLPurifier_Config::prepareArrayFromForm($array, $index, $allowed, $mq_fix, $this->def);
|
$ret = HTMLPurifier_Config::prepareArrayFromForm($array, $index, $allowed, $mq_fix, $this->def);
|
||||||
$this->loadArray($ret);
|
$this->loadArray($ret);
|
||||||
}
|
}
|
||||||
@ -422,8 +422,8 @@ class HTMLPurifier_Config
|
|||||||
* Prepares an array from a form into something usable for the more
|
* Prepares an array from a form into something usable for the more
|
||||||
* strict parts of HTMLPurifier_Config
|
* strict parts of HTMLPurifier_Config
|
||||||
*/
|
*/
|
||||||
public static function prepareArrayFromForm($array, $index, $allowed = true, $mq_fix = true, $schema = null) {
|
public static function prepareArrayFromForm($array, $index = false, $allowed = true, $mq_fix = true, $schema = null) {
|
||||||
$array = (isset($array[$index]) && is_array($array[$index])) ? $array[$index] : array();
|
if ($index !== false) $array = (isset($array[$index]) && is_array($array[$index])) ? $array[$index] : array();
|
||||||
$mq = $mq_fix && function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc();
|
$mq = $mq_fix && function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc();
|
||||||
|
|
||||||
$allowed = HTMLPurifier_Config::getAllowedDirectivesForForm($allowed, $schema);
|
$allowed = HTMLPurifier_Config::getAllowedDirectivesForForm($allowed, $schema);
|
||||||
|
@ -55,14 +55,14 @@ class HTMLPurifier_Printer_ConfigForm extends HTMLPurifier_Printer
|
|||||||
/**
|
/**
|
||||||
* Retrieves styling, in case it is not accessible by webserver
|
* Retrieves styling, in case it is not accessible by webserver
|
||||||
*/
|
*/
|
||||||
public function getCSS() {
|
public static function getCSS() {
|
||||||
return file_get_contents(HTMLPURIFIER_PREFIX . '/HTMLPurifier/Printer/ConfigForm.css');
|
return file_get_contents(HTMLPURIFIER_PREFIX . '/HTMLPurifier/Printer/ConfigForm.css');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves JavaScript, in case it is not accessible by webserver
|
* Retrieves JavaScript, in case it is not accessible by webserver
|
||||||
*/
|
*/
|
||||||
public function getJavaScript() {
|
public static function getJavaScript() {
|
||||||
return file_get_contents(HTMLPURIFIER_PREFIX . '/HTMLPurifier/Printer/ConfigForm.js');
|
return file_get_contents(HTMLPURIFIER_PREFIX . '/HTMLPurifier/Printer/ConfigForm.js');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,8 +86,8 @@ class HTMLPurifier_Printer_ConfigForm extends HTMLPurifier_Printer
|
|||||||
$ret .= $this->start('table', array('class' => 'hp-config'));
|
$ret .= $this->start('table', array('class' => 'hp-config'));
|
||||||
$ret .= $this->start('thead');
|
$ret .= $this->start('thead');
|
||||||
$ret .= $this->start('tr');
|
$ret .= $this->start('tr');
|
||||||
$ret .= $this->element('th', 'Directive');
|
$ret .= $this->element('th', 'Directive', array('class' => 'hp-directive'));
|
||||||
$ret .= $this->element('th', 'Value');
|
$ret .= $this->element('th', 'Value', array('class' => 'hp-value'));
|
||||||
$ret .= $this->end('tr');
|
$ret .= $this->end('tr');
|
||||||
$ret .= $this->end('thead');
|
$ret .= $this->end('thead');
|
||||||
foreach ($all as $ns => $directives) {
|
foreach ($all as $ns => $directives) {
|
||||||
|
Loading…
Reference in New Issue
Block a user