|
17 | 17 | use PhpMyAdmin\Plugins\ImportPlugin; |
18 | 18 | use PhpMyAdmin\Plugins\Plugin; |
19 | 19 | use PhpMyAdmin\Plugins\SchemaPlugin; |
| 20 | +use PhpMyAdmin\Properties\Options\Groups\OptionsPropertyMainGroup; |
20 | 21 | use PhpMyAdmin\Properties\Options\Groups\OptionsPropertySubgroup; |
21 | 22 | use PhpMyAdmin\Properties\Options\Items\BoolPropertyItem; |
22 | 23 | use PhpMyAdmin\Properties\Options\Items\DocPropertyItem; |
|
28 | 29 | use PhpMyAdmin\Properties\Options\Items\TextPropertyItem; |
29 | 30 | use PhpMyAdmin\Properties\Options\OptionsPropertyGroup; |
30 | 31 | use PhpMyAdmin\Properties\Options\OptionsPropertyItem; |
| 32 | +use PhpMyAdmin\Properties\Options\OptionsPropertyOneItem; |
31 | 33 | use SplFileInfo; |
32 | 34 | use Throwable; |
33 | 35 |
|
|
44 | 46 | use function mb_substr; |
45 | 47 | use function method_exists; |
46 | 48 | use function sprintf; |
47 | | -use function str_contains; |
48 | 49 | use function str_starts_with; |
49 | 50 | use function strcasecmp; |
50 | 51 | use function usort; |
@@ -297,7 +298,7 @@ private static function getOneOption( |
297 | 298 | $properties = null; |
298 | 299 | if (! $isSubgroup) { |
299 | 300 | // for subgroup headers |
300 | | - if (str_contains($propertyGroup::class, 'PropertyItem')) { |
| 301 | + if ($propertyGroup instanceof OptionsPropertyOneItem) { |
301 | 302 | $properties = [$propertyGroup]; |
302 | 303 | } else { |
303 | 304 | // for main groups |
@@ -326,14 +327,12 @@ private static function getOneOption( |
326 | 327 |
|
327 | 328 | $propertyClass = null; |
328 | 329 | if ($properties !== null) { |
329 | | - /** @var OptionsPropertySubgroup $propertyItem */ |
330 | 330 | foreach ($properties as $propertyItem) { |
331 | 331 | $propertyClass = $propertyItem::class; |
332 | 332 | // if the property is a subgroup, we deal with it recursively |
333 | | - if (str_contains($propertyClass, 'Subgroup')) { |
| 333 | + if ($propertyItem instanceof OptionsPropertySubgroup) { |
334 | 334 | // for subgroups |
335 | 335 | // each subgroup can have a header, which may also be a form element |
336 | | - /** @var OptionsPropertyItem|null $subgroupHeader */ |
337 | 336 | $subgroupHeader = $propertyItem->getSubgroupHeader(); |
338 | 337 | if ($subgroupHeader !== null) { |
339 | 338 | $ret .= self::getOneOption($plugin, $section, $pluginName, $subgroupHeader); |
@@ -363,7 +362,7 @@ private static function getOneOption( |
363 | 362 | $ret .= '</ul></div>'; |
364 | 363 | } |
365 | 364 |
|
366 | | - if (method_exists($propertyGroup, 'getDoc')) { |
| 365 | + if ($propertyGroup instanceof OptionsPropertyOneItem) { |
367 | 366 | $doc = $propertyGroup->getDoc(); |
368 | 367 | if (is_array($doc)) { |
369 | 368 | if (count($doc) === 3) { |
@@ -581,7 +580,8 @@ public static function getOptions(string $section, array $list): string |
581 | 580 | $ret .= '<h3>' . $plugin->getTranslatedText($text) . '</h3>'; |
582 | 581 |
|
583 | 582 | $noOptions = true; |
584 | | - if ($options !== null && count($options) > 0) { |
| 583 | + if ($options !== null && $options->count() > 0) { |
| 584 | + /** @var OptionsPropertyMainGroup $propertyMainGroup */ |
585 | 585 | foreach ($options->getProperties() as $propertyMainGroup) { |
586 | 586 | // check for hidden properties |
587 | 587 | $noOptions = true; |
|
0 commit comments