mirror of
https://github.com/pfsense/pfsense.git
synced 2025-10-26 11:38:35 +00:00
Add support for sprintf to setHelp
clean - fix typo in php-end-tag cleaner Input - support sprintf parameter Select - put option-names through gettext
This commit is contained in:
parent
d9f9836aa4
commit
276c29d403
4
clean.sh
4
clean.sh
@ -10,6 +10,6 @@ sed -i -e 's/> </></g' \
|
||||
-e 's/<?php include("fbegin.inc"); ?>//g' \
|
||||
-e 's/<?php include("fend.inc"); ?>/<?php include("foot.inc"); ?>/g' \
|
||||
-e 's/<?php echo /<?=/g' \
|
||||
-e 's/;\?\s*?>/?>/g' \
|
||||
-e 's/;?\s*?>/?>/g' \
|
||||
-e 's/<?\s*=\s*/<?=/g' \
|
||||
$1
|
||||
$1
|
||||
|
||||
@ -6,6 +6,7 @@ class Form_Input extends Form_Element
|
||||
protected $_name;
|
||||
protected $_attributes;
|
||||
protected $_help;
|
||||
protected $_helpParams = array();
|
||||
protected $_columnWidth;
|
||||
protected $_columnClasses = array();
|
||||
|
||||
@ -44,9 +45,10 @@ class Form_Input extends Form_Element
|
||||
return $this->_name;
|
||||
}
|
||||
|
||||
public function setHelp($help)
|
||||
public function setHelp($help, array $params = array())
|
||||
{
|
||||
$this->_help = $help;
|
||||
$this->_helpParams = $params;
|
||||
|
||||
return $this;
|
||||
}
|
||||
@ -119,7 +121,16 @@ class Form_Input extends Form_Element
|
||||
$this->_attributes['class'] = $this->getHtmlClass(false);
|
||||
|
||||
$input = $this->_getInput();
|
||||
$help = isset($this->_help) ? '<span class="help-block">'. gettext($this->_help). '</span>' : '';
|
||||
|
||||
if (isset($this->_help))
|
||||
{
|
||||
$help = gettext($this->_help);
|
||||
|
||||
if (!empty($this->_helpParams))
|
||||
$help = call_user_func_array('sprintf', array_merge([$help], $this->_helpParams));
|
||||
|
||||
$help = '<span class="help-block">'. $help .'</span>';
|
||||
}
|
||||
|
||||
return <<<EOT
|
||||
<div {$this->getColumnHtmlClass()}>
|
||||
|
||||
@ -27,7 +27,7 @@ class Form_Select extends Form_Input
|
||||
|
||||
$options = '';
|
||||
foreach ($this->_values as $value => $name)
|
||||
$options .= '<option value="'. htmlspecialchars($value) .'">'. $name .'</option>';
|
||||
$options .= '<option value="'. htmlspecialchars($value) .'">'. gettext($name) .'</option>';
|
||||
|
||||
return <<<EOT
|
||||
<{$element}>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user