mirror of
https://github.com/e107inc/e107.git
synced 2025-08-09 16:17:14 +02:00
Issue #73 Deprecated admin_handlers.php file.
This commit is contained in:
@@ -240,4 +240,61 @@ function echo_gzipped_page()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Better Array-sort by key function by acecream (22-Apr-2003 11:02) http://php.net/manual/en/function.asort.php
|
||||
if (!function_exists('asortbyindex'))
|
||||
{
|
||||
function asortbyindex($array, $key)
|
||||
{
|
||||
foreach ($array as $i => $k)
|
||||
{
|
||||
$sort_values[$i] = $array[$i][$key];
|
||||
}
|
||||
asort ($sort_values);
|
||||
reset ($sort_values);
|
||||
while (list ($arr_key, $arr_val) = each ($sort_values))
|
||||
{
|
||||
$sorted_arr[] = $array[$arr_key];
|
||||
}
|
||||
return $sorted_arr;
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('multiarray_sort')) {
|
||||
function multiarray_sort(&$array, $key, $order = 'asc', $natsort = true, $case = true)
|
||||
{
|
||||
if(!is_array($array)) return $array;
|
||||
|
||||
$order = strtolower($order);
|
||||
foreach ($array as $i => $arr)
|
||||
{
|
||||
$sort_values[$i] = $arr[$key];
|
||||
}
|
||||
|
||||
if(!$natsort)
|
||||
{
|
||||
($order=='asc')? asort($sort_values) : arsort($sort_values);
|
||||
}
|
||||
elseif(isset($sort_values))
|
||||
{
|
||||
$case ? natsort($sort_values) : natcasesort($sort_values);
|
||||
if($order != 'asc') $sort_values = array_reverse($sort_values, true);
|
||||
}
|
||||
|
||||
if(!isset($sort_values))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
reset ($sort_values);
|
||||
|
||||
while (list ($arr_key, $arr_val) = each ($sort_values))
|
||||
{
|
||||
$sorted_arr[] = $array[$arr_key];
|
||||
}
|
||||
return $sorted_arr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
Reference in New Issue
Block a user