Ajout d'une étape de linting dans DroneCi (#3)
All checks were successful
continuous-integration/drone/push Build is passing

Corrige un doublons laissé par le rebase semi-manuel

Ajout d'une étape de linting dans DroneCi

Fix linting

Co-authored-by: Nigel Sheldon <nigelsheldon@live.fr>
Reviewed-on: https://gitea.nemunai.re/halo-battle/game/pulls/3
This commit is contained in:
Nigel 2020-11-21 18:54:32 +00:00
commit dd61d3b66b
263 changed files with 45327 additions and 42695 deletions

View file

@ -29,7 +29,7 @@
*/
function smarty_function_html_options($params, &$smarty)
{
require_once $smarty->_get_plugin_filepath('shared','escape_special_chars');
require_once $smarty->_get_plugin_filepath('shared', 'escape_special_chars');
$name = null;
$values = null;
@ -39,8 +39,8 @@ function smarty_function_html_options($params, &$smarty)
$extra = '';
foreach($params as $_key => $_val) {
switch($_key) {
foreach ($params as $_key => $_val) {
switch ($_key) {
case 'name':
$$_key = (string)$_val;
break;
@ -59,7 +59,7 @@ function smarty_function_html_options($params, &$smarty)
break;
default:
if(!is_array($_val)) {
if (!is_array($_val)) {
$extra .= ' '.$_key.'="'.smarty_function_escape_special_chars($_val).'"';
} else {
$smarty->trigger_error("html_options: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
@ -68,39 +68,38 @@ function smarty_function_html_options($params, &$smarty)
}
}
if (!isset($options) && !isset($values))
return ''; /* raise error here? */
if (!isset($options) && !isset($values)) {
return '';
} /* raise error here? */
$_html_result = '';
if (isset($options)) {
foreach ($options as $_key=>$_val)
foreach ($options as $_key=>$_val) {
$_html_result .= smarty_function_html_options_optoutput($_key, $_val, $selected);
}
} else {
foreach ($values as $_i=>$_key) {
$_val = isset($output[$_i]) ? $output[$_i] : '';
$_html_result .= smarty_function_html_options_optoutput($_key, $_val, $selected);
}
}
if(!empty($name)) {
if (!empty($name)) {
$_html_result = '<select name="' . $name . '"' . $extra . '>' . "\n" . $_html_result . '</select>' . "\n";
}
return $_html_result;
}
function smarty_function_html_options_optoutput($key, $value, $selected) {
if(!is_array($value)) {
function smarty_function_html_options_optoutput($key, $value, $selected)
{
if (!is_array($value)) {
$_html_result = '<option label="' . smarty_function_escape_special_chars($value) . '" value="' .
smarty_function_escape_special_chars($key) . '"';
if (in_array((string)$key, $selected))
if (in_array((string)$key, $selected)) {
$_html_result .= ' selected="selected"';
}
$_html_result .= '>' . smarty_function_escape_special_chars($value) . '</option>' . "\n";
} else {
$_html_result = smarty_function_html_options_optgroup($key, $value, $selected);
@ -108,7 +107,8 @@ function smarty_function_html_options_optoutput($key, $value, $selected) {
return $_html_result;
}
function smarty_function_html_options_optgroup($key, $values, $selected) {
function smarty_function_html_options_optgroup($key, $values, $selected)
{
$optgroup_html = '<optgroup label="' . smarty_function_escape_special_chars($key) . '">' . "\n";
foreach ($values as $key => $value) {
$optgroup_html .= smarty_function_html_options_optoutput($key, $value, $selected);
@ -118,5 +118,3 @@ function smarty_function_html_options_optgroup($key, $values, $selected) {
}
/* vim: set expandtab: */
?>