diff options
author | Steve Beaver <sbeaver@netgate.com> | 2017-02-02 11:56:00 -0500 |
---|---|---|
committer | Steve Beaver <sbeaver@netgate.com> | 2017-02-02 11:56:00 -0500 |
commit | a9a7de5993d978a79ab15bbc86b2d174a50cd916 (patch) | |
tree | 8b8484b66e762ad8d6517ed6025cb27802ccfb46 /src/usr/local/www/classes/Form/Input.class.php | |
parent | 121dd971194df28221a679d5ceda12d1fea614f1 (diff) | |
download | pfsense-a9a7de5993d978a79ab15bbc86b2d174a50cd916.zip pfsense-a9a7de5993d978a79ab15bbc86b2d174a50cd916.tar.gz |
COnvert the setHelp method(s) to accept conventioanl printf style argument lists. e.g.: setHelp("%d interfaces have been detected", $numIfs);
Diffstat (limited to 'src/usr/local/www/classes/Form/Input.class.php')
-rw-r--r-- | src/usr/local/www/classes/Form/Input.class.php | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/src/usr/local/www/classes/Form/Input.class.php b/src/usr/local/www/classes/Form/Input.class.php index 7a05d76..a120991 100644 --- a/src/usr/local/www/classes/Form/Input.class.php +++ b/src/usr/local/www/classes/Form/Input.class.php @@ -110,10 +110,16 @@ class Form_Input extends Form_Element return $this->_tagName; } - public function setHelp($help, array $params = array()) + public function setHelp() { - $this->_help = $help; - $this->_helpParams = $params; + $args = func_get_args(); + + if (strlen($args[0]) < 4096) { + $args[0] = gettext($args[0]); + } + + $this->_help = call_user_func_array('sprintf', $args); + $this->_helpParams = ""; return $this; } @@ -239,17 +245,7 @@ class Form_Input extends Form_Element if (!empty($this->_help)) { - /* Strings longer than this will break gettext. */ - if (strlen($this->_help) < 4096) { - $help = gettext($this->_help); - } else { - $help = $this->_help; - } - - if (!empty($this->_helpParams)) - $help = call_user_func_array('sprintf', array_merge([$help], $this->_helpParams)); - - $help = '<span class="help-block">'. $help .'</span>'; + $help = '<span class="help-block">'. $this->_help .'</span>'; } return <<<EOT |