Code Duplication    Length = 29-29 lines in 2 locations

engine/lib/user_settings.php 1 location

@@ 409-437 (lines=29) @@
406
 * @return array
407
 * @access private
408
 */
409
function _elgg_user_settings_menu_prepare($hook, $type, $value, $params) {
410
	if (empty($value)) {
411
		return $value;
412
	}
413
	
414
	if (!elgg_in_context("settings")) {
415
		return $value;
416
	}
417
	
418
	$configure = elgg_extract("configure", $value);
419
	if (empty($configure)) {
420
		return $value;
421
	}	
422
	
423
	foreach ($configure as $index => $menu_item) {
424
		if (!($menu_item instanceof ElggMenuItem)) {
425
			continue;	
426
		}
427
		
428
		if ($menu_item->getName() == "1_plugins") {
429
			if (!$menu_item->getChildren()) {
430
				// no need for this menu item if it has no children
431
				unset($value["configure"][$index]);	
432
			}
433
		}
434
	}
435
	
436
	return $value;
437
}
438
439
/**
440
 * Page handler for user settings

mod/wet4/lib/user_settings.php 1 location

@@ 380-408 (lines=29) @@
377
 * @return array
378
 * @access private
379
 */
380
function _elgg_user_settings_menu_prepare($hook, $type, $value, $params) {
381
	if (empty($value)) {
382
		return $value;
383
	}
384
	
385
	if (!elgg_in_context("settings")) {
386
		return $value;
387
	}
388
	
389
	$configure = elgg_extract("configure", $value);
390
	if (empty($configure)) {
391
		return $value;
392
	}	
393
	
394
	foreach ($configure as $index => $menu_item) {
395
		if (!($menu_item instanceof ElggMenuItem)) {
396
			continue;	
397
		}
398
		
399
		if ($menu_item->getName() == "1_plugins") {
400
			if (!$menu_item->getChildren()) {
401
				// no need for this menu item if it has no children
402
				unset($value["configure"][$index]);	
403
			}
404
		}
405
	}
406
	
407
	return $value;
408
}
409
410
/**
411
 * Page handler for user settings