Skip to content

Commit 7f83b48

Browse files
committed
Setzen der Properties überarbeitet
- Probleme bei Properties mit '=' z.b. HTML - Prüfung und Fehlermeldungen im Backend angepasst - Versionserhöhung -> 1.2.0
1 parent 4cd3f1f commit 7f83b48

File tree

3 files changed

+26
-8
lines changed

3 files changed

+26
-8
lines changed

boot.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,24 @@ function propertiesCastToType($value)
6161
// [Section] als Prefix
6262
if (substr($_line, 0, 1) == '[' && substr($_line, -1) == ']') {
6363
$_prefix = trim(substr($_line, 1, -1));
64+
continue;
6465
}
6566
// Prefix
6667
if (trim($_set[0]) == 'PREFIX') {
6768
$_prefix = trim($_set[1]);
69+
continue;
6870
}
6971

70-
if (count($_set) === 2) {
71-
if (!rex::hasProperty($_prefix . trim($_set[0]))) {
72-
rex::setProperty($_prefix . trim($_set[0]), propertiesCastToType($_set[1]));
72+
// Set Property
73+
if (count($_set) > 1) {
74+
$_key = trim($_set[0]);
75+
$_val = trim($_set[1]);
76+
if (!rex::hasProperty($_prefix . $_key)) {
77+
if (count($_set) > 2) {
78+
unset($_set[0]);
79+
$_val = trim(implode('=', $_set));
80+
}
81+
rex::setProperty($_prefix . $_key, propertiesCastToType($_val));
7382
}
7483
}
7584
}

package.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
package: properties
2-
version: '1.1.0'
2+
version: '1.2.0'
33
author: Andreas Eberhard FriendsOfREDAXO
44
supportpage: www.redaxo.org/de/forum/
55

pages/system.properties.php

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,26 @@
3939
// [Section] als Prefix
4040
if (substr($_line, 0, 1) == '[' && substr($_line, -1) == ']') {
4141
$_prefix = trim(substr($_line, 1, -1));
42+
continue;
4243
}
4344
// Prefix
4445
if (trim($_set[0]) == 'PREFIX') {
4546
$_prefix = trim($_set[1]);
47+
continue;
4648
}
4749

48-
if (count($_set) === 2) {
49-
if (rex::hasProperty($_prefix . trim($_set[0])) || isset($_duplicate[$_prefix . trim($_set[0])])) {
50-
$_msg[] = 'Zeile ' . ($_lc+1) . ': ' . trim($_set[0]) . ' = ' . trim($_set[1]) . ' (Section/PREFIX=' .$_prefix . ')';
50+
// Check Property
51+
if (count($_set) > 1) {
52+
$_key = trim($_set[0]);
53+
$_val = trim($_set[1]);
54+
if (count($_set) > 2) {
55+
unset($_set[0]);
56+
$_val = trim(implode('=', $_set));
5157
}
52-
$_duplicate[$_prefix . trim($_set[0])] = true;
58+
if (rex::hasProperty($_prefix . $_key) || isset($_duplicate[$_prefix . $_key])) {
59+
$_msg[] = 'Zeile ' . ($_lc+1) . ': ' . $_key . ' = ' . htmlspecialchars($_val) . ' (Section/PREFIX=' .$_prefix . ')';
60+
}
61+
$_duplicate[$_prefix . $_key] = true;
5362
}
5463
}
5564
}

0 commit comments

Comments
 (0)