File tree 2 files changed +17
-6
lines changed
2 files changed +17
-6
lines changed Original file line number Diff line number Diff line change @@ -55,12 +55,7 @@ public function apply(array &$json): bool {
55
55
$ tools [] = $ t ;
56
56
}
57
57
} else {
58
- $ tools = array_map (function ($ t ) {
59
- $ t = trim ($ t );
60
- $ t = $ this ->textCleaner ->cleanUp ($ t , false );
61
-
62
- return $ t ;
63
- }, $ json [self ::TOOLS ]);
58
+ $ tools = $ this ->processArrayRecursively ($ json [self ::TOOLS ]);
64
59
$ tools = array_filter ($ tools , fn ($ t ) => ($ t ));
65
60
ksort ($ tools );
66
61
$ tools = array_values ($ tools );
@@ -71,4 +66,17 @@ public function apply(array &$json): bool {
71
66
72
67
return $ changed ;
73
68
}
69
+
70
+ private function processArrayRecursively ($ array ) {
71
+ return array_map (function ($ item ) {
72
+ if (is_array ($ item )) {
73
+ return $ this ->processArrayRecursively ($ item );
74
+ } else {
75
+ $ item = trim ($ item );
76
+ $ item = $ this ->textCleaner ->cleanUp ($ item , false );
77
+ return $ item ;
78
+ }
79
+ }, $ array );
80
+ }
81
+
74
82
}
Original file line number Diff line number Diff line change @@ -81,6 +81,9 @@ function isSameItemInstance(url1, url2) {
81
81
*/
82
82
83
83
function escapeHTML ( text ) {
84
+ if ( typeof text !== 'string' ) {
85
+ return text ;
86
+ }
84
87
return text . replace (
85
88
/ [ " & ' < > ] / g,
86
89
( a ) =>
You can’t perform that action at this time.
0 commit comments