diff --git a/src/Integrations/Divi/Design/ItemKeys.php b/src/Integrations/Divi/Design/ItemKeys.php index 1facc73..b97a390 100644 --- a/src/Integrations/Divi/Design/ItemKeys.php +++ b/src/Integrations/Divi/Design/ItemKeys.php @@ -14,8 +14,13 @@ final class ItemKeys * @param list $allowed * @param array $errors gets one entry per unknown key (field.key) */ - public static function refuseUnknown(array $item, array $allowed, string $field, array &$errors, string $deleteHint): void - { + public static function refuseUnknown( + array $item, + array $allowed, + string $field, + array &$errors, + string $deleteHint + ): void { foreach (array_diff(array_map('strval', array_keys($item)), $allowed) as $key) { $errors[$field . '.' . $key] = $key === 'delete' ? 'unbekanntes Feld; ' . $deleteHint : 'unbekanntes Feld'; } diff --git a/src/Integrations/Divi/Design/VariableDetachRewrite.php b/src/Integrations/Divi/Design/VariableDetachRewrite.php index 514e0c4..4f3ca36 100644 --- a/src/Integrations/Divi/Design/VariableDetachRewrite.php +++ b/src/Integrations/Divi/Design/VariableDetachRewrite.php @@ -14,8 +14,8 @@ defined('ABSPATH') || exit; * with variable, ruling V9): every attribute value that is exactly one reference $variable({"type":"content", * "value":{"name":"",…}})$ becomes the value – for a strings variable with the reference's own before/after * around it. References embedded in a longer text stay (Divi resolves them inside the text; cutting them out would - * change the text) and are reported through leftover() (ReportsLeftovers). Other references – colors, other variables, dynamic content – stay - * untouched. Pure PHP. + * change the text) and are reported through leftover() (ReportsLeftovers). Other references – colors, other + * variables, dynamic content – stay untouched. Pure PHP. */ final class VariableDetachRewrite implements NodeRewrite, ReportsLeftovers { diff --git a/src/Integrations/Divi/Design/VariableValue.php b/src/Integrations/Divi/Design/VariableValue.php index 2ce8edb..625f884 100644 --- a/src/Integrations/Divi/Design/VariableValue.php +++ b/src/Integrations/Divi/Design/VariableValue.php @@ -77,8 +77,9 @@ final class VariableValue private static function links(string $value): ?string { - if (mb_strlen($value) > self::URL_MAX || preg_match(self::URL, $value) !== 1 - || preg_match(self::URL_CONTROL, $value) === 1) { + $invalid = mb_strlen($value) > self::URL_MAX || preg_match(self::URL, $value) !== 1 + || preg_match(self::URL_CONTROL, $value) === 1; + if ($invalid) { return 'Link: eine http(s)://- oder /-URL, mailto: oder tel: mit höchstens 2000 Zeichen.'; }