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

default/core/settings/statistics/numentities.php (1 issue)

1
<?php
2
/**
3
 * Elgg statistics screen
4
 *
5
 * @package Elgg
6
 * @subpackage Core
7
 */
8
9
// Get entity statistics
10
$entity_stats = get_entity_statistics(elgg_get_page_owner_guid());
11
12
if ($entity_stats) {
0 ignored issues
show
Bug Best Practice introduced by Brett Profitt
The expression $entity_stats of type array is implicitly converted to a boolean; are you sure this is intended? If so, consider using ! empty($expr) instead to make it clear that you intend to check for an array without elements.

This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.

Consider making the comparison explicit by using empty(..) or ! empty(...) instead.

Loading history...
13
	$rows = '';
14
	
15
	foreach ($entity_stats as $k => $entry) {
16
		foreach ($entry as $a => $b) {
17
			if ($a == "__base__") {
18
				$a = elgg_echo("item:{$k}");
19
				if (empty($a)) {
20
					$a = $k;
21
				}
22
			} else {
23
				$a = elgg_echo("item:{$k}:{$a}");
24
				if (empty($a)) {
25
					$a = "$k $a";
26
				}
27
			}
28
			$rows .= <<< END
29
				<tr>
30
					<td class="column-one"><b>{$a}:</b></td>
31
					<td>{$b}</td>
32
				</tr>
33
END;
34
		}
35
	}
36
37
	$title = elgg_echo('usersettings:statistics:label:numentities');
38
	$content = "<table class=\"elgg-table-alt\">$rows</table>";
39
40
	echo elgg_view_module('info', $title, $content);
41
}
42