0) {
$adapterText = $adapter['Description'];
+ $foundAdapter = true;
break;
}
};
- if ($adapter == "") {
+ if (!$foundAdapter) {
foreach ($json_data['Network']['Adapters'] as $adapter) {
if ((bool) $adapter['PhysicalAdapter']) {
$adapterText = $adapter['Description'];
@@ -1204,7 +1206,7 @@ class="' . $flavor_color . '">' . (int)$drive_taken . ' GB
$part_size = $part['PartitionCapacity'];
$part_taken = $part_size - $part['PartitionFree'];
$part_display = "";
- if (!empty($part['PartitionLabel'])) {
+ if ($part['PartitionLabel'] !== '') {
$part_display .= $part['PartitionLabel'];
if (isset($part['PartitionLetter'])) {
$part_display .= " ({$part['PartitionLetter']})";
@@ -1212,7 +1214,7 @@ class="' . $flavor_color . '">' . (int)$drive_taken . ' GB
} else if (isset($part['PartitionLetter'])) { // and not partition label
$part_display = $part['PartitionLetter'];
}
- if (!empty($part_display))
+ if ($part_display !== '')
$part_display .= '
';
$fs_display = $part['Filesystem'] ?? 'Unknown';
@@ -1599,7 +1601,7 @@ class="' . $flavor_color . '">' . (int)$drive_taken . ' GB
';
}
- if (!empty($json_data['Hardware']['Batteries'])) {
+ if (count($json_data['Hardware']['Batteries']) > 0) {
foreach ($json_data['Hardware']['Batteries'] as $battery) {
$cap = floatval($battery["Remaining_Life_Percentage"]);
if (
@@ -1618,7 +1620,7 @@ class="' . $flavor_color . '">' . (int)$drive_taken . ' GB
foreach ($json_data['Hardware']['Storage'] as $disk) {
foreach ($disk['Partitions'] as $partNum => $part) {
if (isset($part['DirtyBitSet']) && $part['DirtyBitSet']) {
- if (empty($part['PartitionLetter'])) {
+ if ($part['PartitionLetter'] === '') {
$noteshtml .= "
Dirty bit set on partition $partNum ({$disk['DeviceName']})
@@ -1692,7 +1694,7 @@ class="' . $flavor_color . '">' . (int)$drive_taken . ' GB
- if (!empty($noteshtml)) {
+ if ($noteshtml !== '') {
$noteshtml = '
' . $noteshtml;
echo $noteshtml;
}
@@ -1738,7 +1740,7 @@ class="' . $flavor_color . '">' . (int)$drive_taken . ' GB
$driveKey += 1;
}
- if (!empty($drivehtml)) {
+ if ($drivehtml !== '') {
$drivehtml = '
Drive / SMART Notes
' . $drivehtml;
echo $drivehtml;
}
@@ -1757,7 +1759,7 @@ class="' . $flavor_color . '">' . (int)$drive_taken . ' GB
foreach ($json_data['System']['ChoiceRegistryValues'] as $regkey) {
- if ($regkey['Value'] && !in_array($regkey['Value'], $defaultRegKeys[$regkey['Name']])){
+ if ($regkey['Value'] && !in_array($regkey['Value'], $defaultRegKeys[$regkey['Name']], true)){
$reghtml .= '
Registry Value ' . $regkey['Name'] . ' found set, value of ' . $regkey['Value'] . '
@@ -1766,7 +1768,7 @@ class="' . $flavor_color . '">' . (int)$drive_taken . ' GB
}
- if (!empty($reghtml)) {
+ if ($reghtml !== '') {
$reghtml = '
Notable Registry Changes
' . $reghtml;
echo $reghtml;
}
@@ -1777,7 +1779,7 @@ class="' . $flavor_color . '">' . (int)$drive_taken . ' GB
0) {
$puphtml .= '
Notable Software found Installed
';
@@ -1790,7 +1792,7 @@ class="' . $flavor_color . '">' . (int)$drive_taken . ' GB
$puphtml .= '';
}
- if (!empty($pupsfoundRunning)) {
+ if (count($pupsfoundRunning) > 0) {
$puphtml .= '
Notable Software found Running
';
@@ -1803,7 +1805,7 @@ class="' . $flavor_color . '">' . (int)$drive_taken . ' GB
$puphtml .= '';
}
- if (!empty($puphtml)) {
+ if ($puphtml !== '') {
echo $puphtml;
} else {
echo '
No Notable Software found, yay!
';
@@ -1904,7 +1906,7 @@ class="' . $flavor_color . '">' . (int)$drive_taken . ' GB
';
foreach ($browser['Profiles'] as $browserprofile) {
- $profileKey = array_search($browserprofile, $browser['Profiles']);
+ $profileKey = array_search($browserprofile, $browser['Profiles'], true);
echo '
' . $browser['Name'] . ' Profile "' . $browser['Profiles'][$profileKey]['name'] . '"