Code Duplication    Length = 7-7 lines in 4 locations

manager/includes/functions/nodes.php 4 locations

@@ 223-229 (lines=7) @@
220
221
                // invoke OnManagerNodePrerender event
222
                $prenode = $modx->invokeEvent("OnManagerNodePrerender", array('ph' => $ph));
223
                if (is_array($prenode)) {
224
                    $phnew = array();
225
                    foreach ($prenode as $pnode) {
226
                        $phnew = array_merge($phnew, unserialize($pnode));
227
                    }
228
                    $ph = (count($phnew) > 0) ? $phnew : $ph;
229
                }
230
231
                if ($ph['contextmenu']) {
232
                    $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"';
@@ 281-287 (lines=7) @@
278
                            'ph'     => $ph,
279
                            'opened' => '1'
280
                        ));
281
                        if (is_array($prenode)) {
282
                            $phnew = array();
283
                            foreach ($prenode as $pnode) {
284
                                $phnew = array_merge($phnew, unserialize($pnode));
285
                            }
286
                            $ph = (count($phnew) > 0) ? $phnew : $ph;
287
                        }
288
289
                        if ($ph['contextmenu']) {
290
                            $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"';
@@ 319-325 (lines=7) @@
316
                            'ph'     => $ph,
317
                            'opened' => '0'
318
                        ));
319
                        if (is_array($prenode)) {
320
                            $phnew = array();
321
                            foreach ($prenode as $pnode) {
322
                                $phnew = array_merge($phnew, unserialize($pnode));
323
                            }
324
                            $ph = (count($phnew) > 0) ? $phnew : $ph;
325
                        }
326
327
                        if ($ph['contextmenu']) {
328
                            $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"';
@@ 405-411 (lines=7) @@
402
                            'ph'     => $ph,
403
                            'opened' => '0'
404
                        ));
405
                        if (is_array($prenode)) {
406
                            $phnew = array();
407
                            foreach ($prenode as $pnode) {
408
                                $phnew = array_merge($phnew, unserialize($pnode));
409
                            }
410
                            $ph = (count($phnew) > 0) ? $phnew : $ph;
411
                        }
412
413
                        if ($ph['showChildren'] == 0) {
414
                            $ph['icon_node_toggle'] = '';