File tree Expand file tree Collapse file tree 2 files changed +17
-6
lines changed Expand file tree Collapse file tree 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 {
5555 $ tools [] = $ t ;
5656 }
5757 } 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 ]);
6459 $ tools = array_filter ($ tools , fn ($ t ) => ($ t ));
6560 ksort ($ tools );
6661 $ tools = array_values ($ tools );
@@ -71,4 +66,17 @@ public function apply(array &$json): bool {
7166
7267 return $ changed ;
7368 }
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+
7482}
Original file line number Diff line number Diff line change @@ -81,6 +81,9 @@ function isSameItemInstance(url1, url2) {
8181 */
8282
8383function escapeHTML ( text ) {
84+ if ( typeof text !== 'string' ) {
85+ return text ;
86+ }
8487 return text . replace (
8588 / [ " & ' < > ] / g,
8689 ( a ) =>
You can’t perform that action at this time.
0 commit comments