implements a modular view system

This commit is contained in:
Connor S. Parks
2016-08-18 13:33:43 +01:00
parent 445c1ed2d0
commit fa1b32c11a
30 changed files with 809 additions and 181 deletions
+24
View File
@@ -115,3 +115,27 @@ if (!function_exists('color_contrast')) {
return ($yiq >= 128) ? 'black' : 'white';
}
}
if (!function_exists('array_numeric_sort')) {
/**
* Numerically sort an array based on a specific key.
*
* @param array $array
* @param string $key
*
* @return array
*/
function array_numeric_sort(array $array = [], $key = 'order')
{
uasort($array, function ($a, $b) use ($key) {
$a = array_get($a, $key, PHP_INT_MAX);
$b = array_get($b, $key, PHP_INT_MAX);
$default = PHP_MAJOR_VERSION < 7 && !defined('HHVM_VERSION') ? 1 : 0;
return $a < $b ? -1 : ($a === $b ? $default : 1);
});
return $array;
}
}