[HTMLUtils] Add common function for form header

This commit is contained in:
logmanoriginal 2016-08-15 02:21:07 +02:00
parent f853f62270
commit 3ca2f030e7

View file

@ -40,11 +40,7 @@ CARD;
// If we don't have any parameter for the bridge, we print a generic form to load it. // If we don't have any parameter for the bridge, we print a generic form to load it.
if(count($bridgeElement->parameters) == 0) { if(count($bridgeElement->parameters) == 0) {
$card .= <<<CARD $card .= HTMLUtils::getFormHeader($bridgeName);
<form method="GET" action="?">
<input type="hidden" name="action" value="display" />
<input type="hidden" name="bridge" value="{$bridgeName}" />
CARD;
if ($isActive){ if ($isActive){
$card .= HTMLUtils::getHelperButtonsFormat($formats); $card .= HTMLUtils::getHelperButtonsFormat($formats);
@ -72,11 +68,7 @@ CARD;
if(!is_numeric($parameterName)) if(!is_numeric($parameterName))
$card .= '<h5>' . $parameterName . '</h5>' . PHP_EOL; $card .= '<h5>' . $parameterName . '</h5>' . PHP_EOL;
$card .= <<<CARD $card .= HTMLUtils::getFormHeader($bridgeName);
<form method="GET" action="?">
<input type="hidden" name="action" value="display" />
<input type="hidden" name="bridge" value="{$bridgeName}" />
CARD;
foreach($parameter as $inputEntry) { foreach($parameter as $inputEntry) {
$additionalInfoString = ''; $additionalInfoString = '';
@ -128,6 +120,14 @@ CARD;
return $card; return $card;
} }
private static function getFormHeader($bridge){
return <<<EOD
<form method="GET" action="?">
<input type="hidden" name="action" value="display" />
<input type="hidden" name="bridge" value="{$bridge}" />
EOD;
}
} }
class HTMLSanitizer { class HTMLSanitizer {