Code Duplication    Length = 17-17 lines in 2 locations

mod/gc_communities/start.php 2 locations

@@ 86-102 (lines=17) @@
83
	}
84
}
85
86
function gc_communities_permissions_hook($hook, $entity_type, $returnvalue, $params)
87
{
88
	$communities = json_decode(elgg_get_plugin_setting('communities', 'gc_communities'), true);
89
	$url = explode('gc_communities-', $params['entity']->context)[1];
90
91
	foreach ($communities as $community) {
92
		if ($community['community_url'] == $url) {
93
			$community_animator = $community['community_animator'];
94
			break;
95
		}
96
	}
97
98
	if ($community_animator == elgg_get_logged_in_user_entity()->username) {
99
		$returnvalue = true;
100
	}
101
102
	return $returnvalue;
103
}
104
105
function gc_communities_widget_permissions_hook($hook, $entity_type, $returnvalue, $params)
@@ 105-121 (lines=17) @@
102
	return $returnvalue;
103
}
104
105
function gc_communities_widget_permissions_hook($hook, $entity_type, $returnvalue, $params)
106
{
107
	$communities = json_decode(elgg_get_plugin_setting('communities', 'gc_communities'), true);
108
	$url = explode('gc_communities-', $params['context'])[1];
109
110
	foreach ($communities as $community) {
111
		if ($community['community_url'] == $url) {
112
			$community_animator = $community['community_animator'];
113
			break;
114
		}
115
	}
116
117
	if ($community_animator == elgg_get_logged_in_user_entity()->username) {
118
		$returnvalue = true;
119
	}
120
121
	return $returnvalue;
122
}
123
124
function gc_community_page_handler($page, $url)