From e38f8c2d1149919ee5af813e68132cb2b5f25ea1 Mon Sep 17 00:00:00 2001 From: alxndr-w Date: Sun, 12 May 2024 16:35:16 +0000 Subject: [PATCH] Apply php-cs-fixer changes --- install.php | 39 ++++++++++++++++++--------------------- lib/wildcard.php | 1 - 2 files changed, 18 insertions(+), 22 deletions(-) diff --git a/install.php b/install.php index e6a64ee..af71d65 100644 --- a/install.php +++ b/install.php @@ -4,8 +4,7 @@ $addon = rex_addon::get('wildcard'); if (rex_addon::get('yform')->isAvailable() && !rex::isSafeMode()) { - - // Laden Sie die JSON-Datei + // Laden Sie die JSON-Datei $tableset = rex_file::get(rex_path::addon($addon->getName(), 'install/rex_wildcard.tableset.json')); // Konvertieren Sie die JSON-Datei in ein PHP-Array @@ -13,30 +12,29 @@ // Durchsuchen Sie das Array nach dem Feld mit dem Namen "wildcard" und der Priorität 2 foreach ($data['rex_wildcard']['fields'] as $index => $field) { - if ($field['name'] === 'wildcard' && $field['prio'] === 2) { + if ('wildcard' === $field['name'] && 2 === $field['prio']) { foreach (rex_clang::getAll() as $clang) { - // Erstellen Sie das neue Feld $newField = [ - "table_name" => "rex_wildcard", - "prio" => 3, - "type_id" => "value", - "type_name" => "textarea", - "db_type" => "text", - "list_hidden" => 0, - "search" => 1, - "name" => "text_".$clang->getCode(), - "label" => "translate:wildcard_text_".$clang->getCode(), - "not_required" => "", - "attributes" => "", - "default" => "", - "no_db" => "0", - "notice" => "", + 'table_name' => 'rex_wildcard', + 'prio' => 3, + 'type_id' => 'value', + 'type_name' => 'textarea', + 'db_type' => 'text', + 'list_hidden' => 0, + 'search' => 1, + 'name' => 'text_' . $clang->getCode(), + 'label' => 'translate:wildcard_text_' . $clang->getCode(), + 'not_required' => '', + 'attributes' => '', + 'default' => '', + 'no_db' => '0', + 'notice' => '', ]; // Fügen Sie das neue Feld direkt nach dem gefundenen Feld ein array_splice($data['rex_wildcard']['fields'], $index + 1, 0, [$newField]); - } + } // Sobald das neue Feld hinzugefügt wurde, beenden Sie die Schleife break; } @@ -49,7 +47,6 @@ rex_yform_manager_table::deleteCache(); } - /* Zusätzliche Eigenschaften an der Tabelle direkt setzen, z.B. Index-Felder zur Performance-Optimierung */ $table = rex_sql_table::get(rex::getTable('wildcard')); @@ -58,7 +55,7 @@ $table = $table->ensureColumn(new rex_sql_column('wildcard', 'varchar(191)', false, '')); foreach (rex_clang::getAll() as $clang) { $table = $table->ensureColumn(new rex_sql_column('text_' . $clang->getId(), 'text', true)); - $table = $table->ensureColumn(new rex_sql_column('text_' . \rex_string::normalize($clang->getCode()), 'text', true)); + $table = $table->ensureColumn(new rex_sql_column('text_' . rex_string::normalize($clang->getCode()), 'text', true)); } $table = $table->ensureColumn(new rex_sql_column('createdate', 'datetime')); $table = $table->ensureColumn(new rex_sql_column('createuser', 'varchar(191)', false, '')); diff --git a/lib/wildcard.php b/lib/wildcard.php index 2435839..f7d7ff2 100644 --- a/lib/wildcard.php +++ b/lib/wildcard.php @@ -19,7 +19,6 @@ public static function getCurrentFieldName($field = 'text', $separator = '_') public static function findWildcard(string $wildcard, mixed $clang_code = null) { - $clang_code ??= rex_clang::getCurrent()->getCode(); $wildcard = self::query() ->where('wildcard', $wildcard)