clean up code in ZapHome and ZapDisplay (#19 and #20)

This commit is contained in:
Fabian de Boer 2026-07-20 01:14:00 +02:00
commit 3edb156749
5 changed files with 24 additions and 21 deletions

View file

@ -80,15 +80,11 @@ class ZAPDisplay implements ZAPHandler {
*/
private function handleWords() {
$words = array();
$ix = 1;
$postix = sprintf("%02d", $ix);
$wd = 'word' . $postix;
while(!empty($_POST[$wd])) {
array_push($words, $_POST[$wd]);
$ix++;
$postfix = sprintf("%02d", $ix);
$wd = 'word' . $postfix;
for ($i = 1; $i <= MAX_WORDS; $i++) {
$key = 'word' . sprintf("%02d", $i);
if (!empty($_POST[$key])) {
$words[] = $_POST[$key];
}
}
return $words;
}