mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-07-30 19:00:10 +02:00
Remove trailing whitespace.
Signed-off-by: Edward Z. Yang <edwardzyang@thewritingpot.com>
This commit is contained in:
@@ -5,29 +5,29 @@
|
||||
*/
|
||||
class HTMLPurifier_Printer_ConfigForm extends HTMLPurifier_Printer
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* Printers for specific fields
|
||||
*/
|
||||
protected $fields = array();
|
||||
|
||||
|
||||
/**
|
||||
* Documentation URL, can have fragment tagged on end
|
||||
*/
|
||||
protected $docURL;
|
||||
|
||||
|
||||
/**
|
||||
* Name of form element to stuff config in
|
||||
*/
|
||||
protected $name;
|
||||
|
||||
|
||||
/**
|
||||
* Whether or not to compress directive names, clipping them off
|
||||
* after a certain amount of letters. False to disable or integer letters
|
||||
* before clipping.
|
||||
*/
|
||||
protected $compress = false;
|
||||
|
||||
|
||||
/**
|
||||
* @param $name Form element name for directives to be stuffed into
|
||||
* @param $doc_url String documentation URL, will have fragment tagged on
|
||||
@@ -44,7 +44,7 @@ class HTMLPurifier_Printer_ConfigForm extends HTMLPurifier_Printer
|
||||
$this->fields[0] = new HTMLPurifier_Printer_ConfigForm_default();
|
||||
$this->fields[HTMLPurifier_VarParser::BOOL] = new HTMLPurifier_Printer_ConfigForm_bool();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets default column and row size for textareas in sub-printers
|
||||
* @param $cols Integer columns of textarea, null to use default
|
||||
@@ -54,21 +54,21 @@ class HTMLPurifier_Printer_ConfigForm extends HTMLPurifier_Printer
|
||||
if ($cols) $this->fields['default']->cols = $cols;
|
||||
if ($rows) $this->fields['default']->rows = $rows;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieves styling, in case it is not accessible by webserver
|
||||
*/
|
||||
public static function getCSS() {
|
||||
return file_get_contents(HTMLPURIFIER_PREFIX . '/HTMLPurifier/Printer/ConfigForm.css');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieves JavaScript, in case it is not accessible by webserver
|
||||
*/
|
||||
public static function getJavaScript() {
|
||||
return file_get_contents(HTMLPURIFIER_PREFIX . '/HTMLPurifier/Printer/ConfigForm.js');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns HTML output for a configuration form
|
||||
* @param $config Configuration object of current form state, or an array
|
||||
@@ -82,18 +82,18 @@ class HTMLPurifier_Printer_ConfigForm extends HTMLPurifier_Printer
|
||||
} else {
|
||||
$gen_config = $config;
|
||||
}
|
||||
|
||||
|
||||
$this->config = $config;
|
||||
$this->genConfig = $gen_config;
|
||||
$this->prepareGenerator($gen_config);
|
||||
|
||||
|
||||
$allowed = HTMLPurifier_Config::getAllowedDirectivesForForm($allowed, $config->def);
|
||||
$all = array();
|
||||
foreach ($allowed as $key) {
|
||||
list($ns, $directive) = $key;
|
||||
$all[$ns][$directive] = $config->get($ns, $directive);
|
||||
}
|
||||
|
||||
|
||||
$ret = '';
|
||||
$ret .= $this->start('table', array('class' => 'hp-config'));
|
||||
$ret .= $this->start('thead');
|
||||
@@ -118,7 +118,7 @@ class HTMLPurifier_Printer_ConfigForm extends HTMLPurifier_Printer
|
||||
$ret .= $this->end('table');
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Renders a single namespace
|
||||
* @param $ns String namespace name
|
||||
@@ -140,7 +140,7 @@ class HTMLPurifier_Printer_ConfigForm extends HTMLPurifier_Printer
|
||||
$ret .= $this->start('a', array('href' => $url));
|
||||
}
|
||||
$attr = array('for' => "{$this->name}:$ns.$directive");
|
||||
|
||||
|
||||
// crop directive name if it's too long
|
||||
if (!$this->compress || (strlen($directive) < $this->compress)) {
|
||||
$directive_disp = $directive;
|
||||
@@ -148,7 +148,7 @@ class HTMLPurifier_Printer_ConfigForm extends HTMLPurifier_Printer
|
||||
$directive_disp = substr($directive, 0, $this->compress - 2) . '...';
|
||||
$attr['title'] = $directive;
|
||||
}
|
||||
|
||||
|
||||
$ret .= $this->element(
|
||||
'label',
|
||||
$directive_disp,
|
||||
@@ -157,7 +157,7 @@ class HTMLPurifier_Printer_ConfigForm extends HTMLPurifier_Printer
|
||||
);
|
||||
if ($this->docURL) $ret .= $this->end('a');
|
||||
$ret .= $this->end('th');
|
||||
|
||||
|
||||
$ret .= $this->start('td');
|
||||
$def = $this->config->def->info[$ns][$directive];
|
||||
if (is_int($def)) {
|
||||
@@ -179,7 +179,7 @@ class HTMLPurifier_Printer_ConfigForm extends HTMLPurifier_Printer
|
||||
$ret .= $this->end('tbody');
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -205,7 +205,7 @@ class HTMLPurifier_Printer_ConfigForm_NullDecorator extends HTMLPurifier_Printer
|
||||
$gen_config = $config;
|
||||
}
|
||||
$this->prepareGenerator($gen_config);
|
||||
|
||||
|
||||
$ret = '';
|
||||
$ret .= $this->start('label', array('for' => "$name:Null_$ns.$directive"));
|
||||
$ret .= $this->element('span', "$ns.$directive:", array('class' => 'verbose'));
|
||||
@@ -328,12 +328,12 @@ class HTMLPurifier_Printer_ConfigForm_bool extends HTMLPurifier_Printer {
|
||||
$this->prepareGenerator($gen_config);
|
||||
$ret = '';
|
||||
$ret .= $this->start('div', array('id' => "$name:$ns.$directive"));
|
||||
|
||||
|
||||
$ret .= $this->start('label', array('for' => "$name:Yes_$ns.$directive"));
|
||||
$ret .= $this->element('span', "$ns.$directive:", array('class' => 'verbose'));
|
||||
$ret .= $this->text(' Yes');
|
||||
$ret .= $this->end('label');
|
||||
|
||||
|
||||
$attr = array(
|
||||
'type' => 'radio',
|
||||
'name' => "$name"."[$ns.$directive]",
|
||||
@@ -343,12 +343,12 @@ class HTMLPurifier_Printer_ConfigForm_bool extends HTMLPurifier_Printer {
|
||||
if ($value === true) $attr['checked'] = 'checked';
|
||||
if ($value === null) $attr['disabled'] = 'disabled';
|
||||
$ret .= $this->elementEmpty('input', $attr);
|
||||
|
||||
|
||||
$ret .= $this->start('label', array('for' => "$name:No_$ns.$directive"));
|
||||
$ret .= $this->element('span', "$ns.$directive:", array('class' => 'verbose'));
|
||||
$ret .= $this->text(' No');
|
||||
$ret .= $this->end('label');
|
||||
|
||||
|
||||
$attr = array(
|
||||
'type' => 'radio',
|
||||
'name' => "$name"."[$ns.$directive]",
|
||||
@@ -358,9 +358,9 @@ class HTMLPurifier_Printer_ConfigForm_bool extends HTMLPurifier_Printer {
|
||||
if ($value === false) $attr['checked'] = 'checked';
|
||||
if ($value === null) $attr['disabled'] = 'disabled';
|
||||
$ret .= $this->elementEmpty('input', $attr);
|
||||
|
||||
|
||||
$ret .= $this->end('div');
|
||||
|
||||
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user