-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix some issues with the overview and contributors pages
Some organizational things
- Loading branch information
1 parent
17764dc
commit ecbf410
Showing
10 changed files
with
110 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
/* | ||
---------------------------------- | ||
------ Created: 013124 ------ | ||
------ Austin Best ------ | ||
---------------------------------- | ||
*/ | ||
|
||
function array_sort_by_key(&$array, $field, $direction = 'asc') | ||
{ | ||
if (!is_array($array)) { | ||
return $array; | ||
} | ||
|
||
uasort($array, function ($a, $b) use ($field, $direction) { | ||
if ($direction == 'asc') { | ||
return $a[$field] <=> $b[$field]; | ||
} else { | ||
return $b[$field] <=> $a[$field]; | ||
} | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
/* | ||
---------------------------------- | ||
------ Created: 013124 ------ | ||
------ Austin Best ------ | ||
---------------------------------- | ||
*/ | ||
|
||
function byteConversion($bytes, $measurement = false, $dec = 2) | ||
{ | ||
if (!$bytes || $bytes <= 0) { | ||
return 0; | ||
} | ||
|
||
//-- SEND LARGEST ONE | ||
if (!$measurement) { | ||
$units = ['B', 'KiB', 'MiB', 'GiB', 'TiB']; | ||
$bytes = max($bytes, 0); | ||
$pow = floor(($bytes ? log($bytes) : 0) / log(1024)); | ||
$pow = min($pow, count($units) - 1); | ||
$bytes /= (1 << (10 * $pow)); | ||
|
||
return round($bytes, $dec) . ' ' . $units[$pow]; | ||
} | ||
|
||
switch ($measurement) { | ||
case 'KiB': | ||
return round($bytes / 1024, $dec); | ||
case 'MiB': | ||
return round($bytes / pow(1024, 2), $dec); | ||
case 'GiB': | ||
return round($bytes / pow(1024, 3), $dec); | ||
case 'TiB': | ||
return round($bytes / pow(1024, 4), $dec); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
/* | ||
---------------------------------- | ||
------ Created: 013124 ------ | ||
------ Austin Best ------ | ||
---------------------------------- | ||
*/ | ||
|
||
function str_contains_any(string $haystack, array $needles): bool | ||
{ | ||
return array_reduce($needles, fn($a, $n) => $a || str_contains($haystack, $n), false); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters