Passed
Push — master ( c0a3a7...3b84a4 )
by Jeroen
58:51
created

views/default/widgets/content_stats/content.php (1 issue)

1
<?php
2
/**
3
 * Content stats widget
4
 */
5
6
$widget = elgg_extract('entity', $vars);
7
8
$entity_stats = get_entity_statistics();
9
10
$registered_entity_types = get_registered_entity_types();
11
12
foreach ($registered_entity_types as $type => $subtypes) {
0 ignored issues
show
The expression $registered_entity_types of type false is not traversable.
Loading history...
13
	if (!empty($subtypes)) {
14
		foreach ($subtypes as $subtype) {
15
			$value = elgg_extract($subtype, $entity_stats[$type], false);
16
			if ($value !== false) {
17
				$stats[elgg_echo("item:$type:$subtype")] = $value;
18
			}
19
		}
20
	} else {
21
		$value = elgg_extract('__base__', $entity_stats[$type], false);
22
		if ($value !== false) {
23
			$stats[elgg_echo("item:$type")] = $value;
24
		}
25
	}
26
}
27
28
arsort($stats);
29
30
echo '<table class="elgg-table-alt">';
31
echo '<tr><th>' . elgg_echo('admin:statistics:numentities:type') . '</th>';
32
echo '<th>' . elgg_echo('admin:statistics:numentities:number') . '</th></tr>';
33
foreach ($stats as $name => $num) {
34
	echo "<tr><td>$name</td><td>$num</td></tr>";
35
}
36
echo '</table>';
37
38
echo '<div class="mtm elgg-widget-more">';
39
echo elgg_view('output/url', [
40
	'href' => 'admin/statistics/numentities',
41
	'text' => elgg_echo('more'),
42
	'is_trusted' => true,
43
]);
44
echo '</div>';
45