Test Failed
Push — master ( ae8a24...a393f2 )
by Stefan
09:54
created
web/lib/admin/OptionDisplay.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
      * @return string HTML code <table>
86 86
      */
87 87
     public function prefilledOptionTable(string $attributePrefix) {
88
-        $retval = "<table id='expandable_$attributePrefix" . "_options'>";
88
+        $retval = "<table id='expandable_$attributePrefix"."_options'>";
89 89
 
90 90
         $prepopulate = [];
91 91
         foreach ($this->listOfOptions as $existingAttribute) {
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
                 $prepopulate[] = $existingAttribute;
94 94
             }
95 95
         }
96
-        if (is_array($prepopulate) && ( count($prepopulate) > 0 || $attributePrefix == "device-specific" || $attributePrefix == "eap-specific" )) { // editing... fill with values
96
+        if (is_array($prepopulate) && (count($prepopulate) > 0 || $attributePrefix == "device-specific" || $attributePrefix == "eap-specific")) { // editing... fill with values
97 97
             $retval .= $this->addOptionEdit($attributePrefix, $prepopulate);
98 98
         } else {
99 99
             $retval .= $this->addOptionNew($attributePrefix);
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
                 $optiontypearray = $optioninfo->optionType($option['name']);
126 126
                 $loggerInstance = new \core\common\Logging();
127 127
                 $loggerInstance->debug(5, "About to execute optiontext with PREFILL!\n");
128
-                $retval .= $this->optiontext([$option['name']], ($optiontypearray["type"] == "file" ? 'ROWID-' . $option['level'] . '-' . $option['row'] : $option['value']), $option['lang']);
128
+                $retval .= $this->optiontext([$option['name']], ($optiontypearray["type"] == "file" ? 'ROWID-'.$option['level'].'-'.$option['row'] : $option['value']), $option['lang']);
129 129
             }
130 130
         }
131 131
         return $retval;
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
         $descriptions["media:force_proxy"] = sprintf(_("The format of this option is: IPv4|IPv6|hostname:port . Forcing your users through a content filter of your own is a significant invasion of user self-determination. It also has technical issues. Please throughly read the discussion at %s before specifying a proxy with this option. This feature is currently experimental and only has an effect in Apple installers."), "https://github.com/GEANT/CAT/issues/96");
195 195
         $descriptions["managedsp:realmforvlan"] = sprintf(_("If you are also using %s, then your own realm is automatically tagged with the VLAN you choose, there is no need to add it here manually."), \core\ProfileSilverbullet::PRODUCTNAME);
196 196
         $descriptions["media:openroaming"] = 
197
-                sprintf(_("By opting in to OpenRoaming, you agree to be bound by the %s."),"eduroam Ecosystem Broker OpenRoaming Identity Provider Policy").
197
+                sprintf(_("By opting in to OpenRoaming, you agree to be bound by the %s."), "eduroam Ecosystem Broker OpenRoaming Identity Provider Policy").
198 198
                 " ".
199 199
                 sprintf(_("Note that your requirement to inform users about the OpenRoaming End User Terms and Conditions is fulfilled when directing your end users to the %s download portal for installer download. Any other means of providing the installers needs to present this information via its own channel."), \config\Master::APPEARANCE['productname']).
200 200
                 " ".
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
         if (!isset($descriptions[$input])) {
206 206
             return "";
207 207
         }
208
-        return "<span class='tooltip' id='S$rowid-tooltip-$input' style='display:" . ($isVisible ? "block" : "none") . "' onclick='alert(\"" . $descriptions[$input] . "\")'><img src='../resources/images/icons/question-mark-icon.png" . "'></span>";
208
+        return "<span class='tooltip' id='S$rowid-tooltip-$input' style='display:".($isVisible ? "block" : "none")."' onclick='alert(\"".$descriptions[$input]."\")'><img src='../resources/images/icons/question-mark-icon.png"."'></span>";
209 209
     }
210 210
 
211 211
     /**
@@ -218,18 +218,18 @@  discard block
 block discarded – undo
218 218
      */
219 219
     private function selectElement($rowid, $list) {
220 220
         $jsmagic = "onchange='
221
-                               if (/#ML#/.test(document.getElementById(\"option-S" . $rowid . "-select\").value)) {
221
+                               if (/#ML#/.test(document.getElementById(\"option-S" . $rowid."-select\").value)) {
222 222
                                    document.getElementById(\"S$rowid-input-langselect\").style.display = \"block\";
223 223
                                    } else {
224 224
                                    document.getElementById(\"S$rowid-input-langselect\").style.display = \"none\";
225 225
                                    }";
226 226
         foreach (array_keys(OptionDisplay::HTML_DATATYPE_TEXTS) as $key) {
227
-            $jsmagic .= "if (/#" . $key . "#/.test(document.getElementById(\"option-S" . $rowid . "-select\").value)) {
228
-                                  document.getElementById(\"S$rowid-input-file\").style.display = \"" . ($key == \core\Options::TYPECODE_FILE ? "block" : "none") . "\";
229
-                                  document.getElementById(\"S$rowid-input-text\").style.display = \"" . ($key == \core\Options::TYPECODE_TEXT ? "block" : "none") . "\";
230
-                                  document.getElementById(\"S$rowid-input-string\").style.display = \"" . ($key == \core\Options::TYPECODE_STRING ? "block" : "none") . "\";
231
-                                  document.getElementById(\"S$rowid-input-boolean\").style.display = \"" . ($key == \core\Options::TYPECODE_BOOLEAN ? "block" : "none") . "\";
232
-                                  document.getElementById(\"S$rowid-input-integer\").style.display = \"" . ($key == \core\Options::TYPECODE_INTEGER ? "block" : "none") . "\";
227
+            $jsmagic .= "if (/#".$key."#/.test(document.getElementById(\"option-S".$rowid."-select\").value)) {
228
+                                  document.getElementById(\"S$rowid-input-file\").style.display = \"".($key == \core\Options::TYPECODE_FILE ? "block" : "none")."\";
229
+                                  document.getElementById(\"S$rowid-input-text\").style.display = \"".($key == \core\Options::TYPECODE_TEXT ? "block" : "none")."\";
230
+                                  document.getElementById(\"S$rowid-input-string\").style.display = \"".($key == \core\Options::TYPECODE_STRING ? "block" : "none")."\";
231
+                                  document.getElementById(\"S$rowid-input-boolean\").style.display = \"".($key == \core\Options::TYPECODE_BOOLEAN ? "block" : "none")."\";
232
+                                  document.getElementById(\"S$rowid-input-integer\").style.display = \"".($key == \core\Options::TYPECODE_INTEGER ? "block" : "none")."\";
233 233
                              }
234 234
                              ";
235 235
             // hide all tooltips (each is a <span>, and there are no other <span>s)
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
                 $value = array_shift($list);
261 261
                 $listtype = $optioninfo->optionType($value);
262 262
                 $retval .= $uiElements->displayName($value);
263
-                $retval .= "<input type='hidden' name='option[S$rowid]' value='$value#" . $listtype["type"] . "#" . $listtype["flag"] . "#'/>";
263
+                $retval .= "<input type='hidden' name='option[S$rowid]' value='$value#".$listtype["type"]."#".$listtype["flag"]."#'/>";
264 264
                 $activelisttype = $listtype;
265 265
                 $tooltips = $this->tooltip($rowid, $value, TRUE);
266 266
                 break;
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
                 $retval .= "<select id='option-S$rowid-select' name='option[S$rowid]' $jsmagic>";
269 269
                 foreach ($list as $value) {
270 270
                     $listtype = $optioninfo->optionType($value);
271
-                    $retval .= "<option id='option-S$rowid-v-$value' value='$value#" . $listtype["type"] . "#" . $listtype["flag"] . "#' ";
271
+                    $retval .= "<option id='option-S$rowid-v-$value' value='$value#".$listtype["type"]."#".$listtype["flag"]."#' ";
272 272
                     if ($iterator == $this->optionIterator) {
273 273
                         $retval .= "selected='selected'";
274 274
                         $activelisttype = $listtype;
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
                     } else {
277 277
                         $tooltips .= $this->tooltip($rowid, $value, FALSE);
278 278
                     }
279
-                    $retval .= ">" . $uiElements->displayName($value) . "</option>";
279
+                    $retval .= ">".$uiElements->displayName($value)."</option>";
280 280
                     $iterator++;
281 281
                 }
282 282
 
@@ -301,9 +301,9 @@  discard block
 block discarded – undo
301 301
      */
302 302
     private function selectLanguage($rowid, $makeVisible) {
303 303
         \core\common\Entity::intoThePotatoes();
304
-        $retval = "<select style='display:" . ($makeVisible ? "block" : "none") . "' name='value[S$rowid-lang]' id='S" . $rowid . "-input-langselect'>
305
-            <option value='' name='select_language' selected>" . _("select language") . "</option>
306
-            <option value='C' name='all_languages'>" . _("default/other languages") . "</option>";
304
+        $retval = "<select style='display:".($makeVisible ? "block" : "none")."' name='value[S$rowid-lang]' id='S".$rowid."-input-langselect'>
305
+            <option value='' name='select_language' selected>" . _("select language")."</option>
306
+            <option value='C' name='all_languages'>" . _("default/other languages")."</option>";
307 307
         foreach (\config\Master::LANGUAGES as $langindex => $possibleLang) {
308 308
             $thislang = $possibleLang['display'];
309 309
             $retval .= "<option value='$langindex' name='$langindex'>$thislang</option>";
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
     private function inputFields($rowid, $activetype) {
332 332
         $retval = "";
333 333
         foreach (OptionDisplay::HTML_DATATYPE_TEXTS as $key => $type) {
334
-            $retval .= "<" . $type['html'] . " style='display:" . ($activetype['type'] == $key ? "block" : "none") . "' name='value[S$rowid-$key]' id='S" . $rowid . "-input-" . $key . "'" . $type['tail'] . ">";
334
+            $retval .= "<".$type['html']." style='display:".($activetype['type'] == $key ? "block" : "none")."' name='value[S$rowid-$key]' id='S".$rowid."-input-".$key."'".$type['tail'].">";
335 335
         }
336 336
         return $retval;
337 337
     }
@@ -346,11 +346,11 @@  discard block
 block discarded – undo
346 346
     private function noPrefillText(int $rowid, array $list) {
347 347
         // first column: the <select> element with the names of options and their field-toggling JS magic
348 348
         $selectorInfo = $this->selectElement($rowid, $list);
349
-        $retval = "<td>" . $selectorInfo["TEXT"] . "</td>";
349
+        $retval = "<td>".$selectorInfo["TEXT"]."</td>";
350 350
         // second column: the <select> element for language selection - only visible if the active option is multi-lang
351
-        $retval .= "<td>" . $this->selectLanguage($rowid, $selectorInfo['ACTIVE']['flag'] == "ML") . "</td>";
351
+        $retval .= "<td>".$this->selectLanguage($rowid, $selectorInfo['ACTIVE']['flag'] == "ML")."</td>";
352 352
         // third column: the actual input fields; the data type of the active option is visible, all others hidden
353
-        $retval .= "<td>" . $this->inputFields($rowid, $selectorInfo['ACTIVE']) . "</td>";
353
+        $retval .= "<td>".$this->inputFields($rowid, $selectorInfo['ACTIVE'])."</td>";
354 354
         return $retval;
355 355
     }
356 356
 
@@ -373,20 +373,20 @@  discard block
 block discarded – undo
373 373
         $retval .= "<td>";
374 374
         $uiElements = new UIElements();
375 375
         $listtype = $optioninfo->optionType($optionName);
376
-        $retval .= "<span style='display:flex;'>" . $uiElements->displayName($optionName);
377
-        $retval .= $this->tooltip($rowid, $optionName, TRUE) . "</span>";
378
-        $retval .= "<input type='hidden' id='option-S$rowid-select' name='option[S$rowid]' value='$optionName#" . $listtype["type"] . "#" . $listtype["flag"] . "#' ></td>";
376
+        $retval .= "<span style='display:flex;'>".$uiElements->displayName($optionName);
377
+        $retval .= $this->tooltip($rowid, $optionName, TRUE)."</span>";
378
+        $retval .= "<input type='hidden' id='option-S$rowid-select' name='option[S$rowid]' value='$optionName#".$listtype["type"]."#".$listtype["flag"]."#' ></td>";
379 379
 
380 380
         // language tag if any
381 381
         $retval .= "<td>";
382 382
         if ($listtype["flag"] == "ML") {
383 383
 
384
-            $language = "(" . strtoupper($optionLang) . ")";
384
+            $language = "(".strtoupper($optionLang).")";
385 385
             if ($optionLang == 'C') {
386 386
                 $language = _("(default/other languages)");
387 387
             }
388 388
             $retval .= $language;
389
-            $retval .= "<input type='hidden' name='value[S$rowid-lang]' id='S" . $rowid . "-input-langselect' value='" . $optionLang . "' style='display:block'>";
389
+            $retval .= "<input type='hidden' name='value[S$rowid-lang]' id='S".$rowid."-input-langselect' value='".$optionLang."' style='display:block'>";
390 390
         }
391 391
         $retval .= "</td>";
392 392
 // attribute content
@@ -396,12 +396,12 @@  discard block
 block discarded – undo
396 396
             case \core\Options::TYPECODE_COORDINATES:
397 397
                 $this->allLocationCount = $this->allLocationCount + 1;
398 398
                 // display of the locations varies by map provider
399
-                $classname = "\web\lib\admin\Map" . \config\ConfAssistant::MAPPROVIDER['PROVIDER'];
399
+                $classname = "\web\lib\admin\Map".\config\ConfAssistant::MAPPROVIDER['PROVIDER'];
400 400
                 $link = $classname::optionListDisplayCode($optionValue, $this->allLocationCount);
401
-                $retval .= "<input readonly style='display:none' type='text' name='value[S$rowid-" . \core\Options::TYPECODE_TEXT . "]' id='S$rowid-input-text' value='$optionValue'>$link";
401
+                $retval .= "<input readonly style='display:none' type='text' name='value[S$rowid-".\core\Options::TYPECODE_TEXT."]' id='S$rowid-input-text' value='$optionValue'>$link";
402 402
                 break;
403 403
             case \core\Options::TYPECODE_FILE:
404
-                $retval .= "<input readonly type='text' name='value[S$rowid-" . \core\Options::TYPECODE_STRING . "]' id='S" . $rowid . "-input-string' style='display:none' value='" . urlencode($optionValue) . "'>";
404
+                $retval .= "<input readonly type='text' name='value[S$rowid-".\core\Options::TYPECODE_STRING."]' id='S".$rowid."-input-string' style='display:none' value='".urlencode($optionValue)."'>";
405 405
                 $uiElements = new UIElements();
406 406
                 switch ($optionName) {
407 407
                     case "eap:ca_file":
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
                 if ($listtype['type'] == \core\Options::TYPECODE_BOOLEAN) {// only modify in this one case
432 432
                     $displayedVariant = ($optionValue == "on" ? _("on") : _("off"));
433 433
                 }
434
-                $retval .= "<strong>$displayedVariant</strong><input type='hidden' name='value[S$rowid-" . $listtype['type'] . "]' id='S" . $rowid . "-input-" . $listtype["type"] . "' value=\"" . htmlspecialchars($optionValue) . "\" style='display:block'>";
434
+                $retval .= "<strong>$displayedVariant</strong><input type='hidden' name='value[S$rowid-".$listtype['type']."]' id='S".$rowid."-input-".$listtype["type"]."' value=\"".htmlspecialchars($optionValue)."\" style='display:block'>";
435 435
                 break;
436 436
             default:
437 437
                 // this should never happen!
@@ -476,10 +476,10 @@  discard block
 block discarded – undo
476 476
        <td>
477 477
           <button type='button' class='delete' onclick='";
478 478
         if ($prefillValue !== NULL && $item == "general:geo_coordinates") {
479
-            $funcname = "Map" . \config\ConfAssistant::MAPPROVIDER['PROVIDER'] . 'DeleteCoord';
480
-            $retval .= 'if (typeof ' . $funcname . ' === "function") { ' . $funcname . '(' . $this->allLocationCount . '); } ';
479
+            $funcname = "Map".\config\ConfAssistant::MAPPROVIDER['PROVIDER'].'DeleteCoord';
480
+            $retval .= 'if (typeof '.$funcname.' === "function") { '.$funcname.'('.$this->allLocationCount.'); } ';
481 481
         }
482
-        $retval .= 'deleteOption("option-S' . $rowid . '")';
482
+        $retval .= 'deleteOption("option-S'.$rowid.'")';
483 483
         $retval .= "'>-</button>
484 484
        </td>
485 485
     </tr>";
Please login to merge, or discard this patch.