|
|
|
@ -13,7 +13,7 @@ |
|
|
|
|
* |
|
|
|
|
* @param array a dimensional array |
|
|
|
|
* @return array an array with unique values |
|
|
|
|
* |
|
|
|
|
* |
|
|
|
|
*/ |
|
|
|
|
function array_unique_dimensional($array) { |
|
|
|
|
if(!is_array($array)) |
|
|
|
@ -32,9 +32,9 @@ function array_unique_dimensional($array) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* |
|
|
|
|
* |
|
|
|
|
* Sort multidimensional arrays |
|
|
|
|
* |
|
|
|
|
* |
|
|
|
|
* @param array unsorted multidimensional array |
|
|
|
|
* @param string key to be sorted |
|
|
|
|
* @return array result array |
|
|
|
@ -84,16 +84,16 @@ function array_walk_recursive_limited(&$array, $function, $apply_to_keys_also = |
|
|
|
|
unset($array[$key]); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
$recursive_counter--; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function utf8_sort($array) { |
|
|
|
|
$old_locale = setlocale(LC_ALL, null); |
|
|
|
|
$old_locale = setlocale(LC_ALL, null); |
|
|
|
|
$code = api_get_language_isocode(); |
|
|
|
|
$locale_list = array($code.'.utf8', 'en.utf8','en_US.utf8','en_GB.utf8'); |
|
|
|
|
$try_sort = false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach($locale_list as $locale) { |
|
|
|
|
$my_local = setlocale(LC_COLLATE, $locale); |
|
|
|
|
if ($my_local) { |
|
|
|
@ -101,11 +101,11 @@ function utf8_sort($array) { |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($try_sort) { |
|
|
|
|
uasort($array, 'strcoll'); |
|
|
|
|
} |
|
|
|
|
setlocale(LC_COLLATE, $old_locale); |
|
|
|
|
setlocale(LC_COLLATE, $old_locale); |
|
|
|
|
return $array; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -114,4 +114,4 @@ function array_to_string($array, $separator = ',') { |
|
|
|
|
return ''; |
|
|
|
|
} |
|
|
|
|
return implode($separator.' ', $array); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|