43         $ilDB = $DIC->database();
    46         if (!is_array($a_array) or !count($a_array)) {
    50         foreach ($a_array as $k => $item) {
    51             $a_array[$k] = 
$ilDB->quote($item);
    63         if (is_array($a_data)) {
    64             foreach ($a_data as $k => $v) {
    81     public static function stripSlashesArray(array $a_arr, 
bool $a_strip_html = 
true, 
string $a_allow = 
""): array
    83         foreach ($a_arr as $k => $v) {
    95         string $a_array_sortby_key,
    96         string $a_array_sortorder = 
"asc",
    97         bool $a_numeric = 
false,
    98         bool $a_keep_keys = 
false   101             return self::stableSortArray($array, $a_array_sortby_key, $a_array_sortorder, $a_numeric);
   104         global $array_sortby, $array_sortorder;
   105         $array_sortby = $a_array_sortby_key;
   107         if ($a_array_sortorder == 
"desc") {
   108             $array_sortorder = 
"desc";
   110             $array_sortorder = 
"asc";
   114                 uasort($array, [ilArrayUtil::class, 
"sort_func_numeric"]);
   116                 usort($array, [ilArrayUtil::class, 
"sort_func_numeric"]);
   120                 uasort($array, [ilArrayUtil::class, 
"sort_func"]);
   122                 usort($array, [ilArrayUtil::class, 
"sort_func"]);
   134         global $array_sortby, $array_sortorder;
   136         if (!isset($array_sortby)) {
   141         $leftValue = (string) ($left[$array_sortby] ?? 
'');
   142         $rightValue = (string) ($right[$array_sortby] ?? 
'');
   146         if ($array_sortorder === 
"asc") {
   148         } elseif ($array_sortorder === 
"desc") {
   160         global $array_sortby, $array_sortorder;
   162         $leftValue = (string) ($left[$array_sortby] ?? 
'');
   163         $rightValue = (string) ($right[$array_sortby] ?? 
'');
   165         if ($array_sortorder === 
"asc") {
   166             return $leftValue <=> $rightValue;
   167         } elseif ($array_sortorder === 
"desc") {
   168             return $rightValue <=> $leftValue;
   179     private static function mergesort(array &$array, callable $cmp_function = null): void
   181         if ($cmp_function === null) {
   182             $cmp_function = 
'strcmp';
   185         if (count($array) < 2) {
   190         $halfway = intval(count($array) / 2);
   191         $array1 = array_slice($array, 0, $halfway);
   192         $array2 = array_slice($array, $halfway);
   199         if (call_user_func($cmp_function, end($array1), $array2[0]) < 1) {
   200             $array = array_merge($array1, $array2);
   207         while ($ptr1 < count($array1) && $ptr2 < count($array2)) {
   208             if (call_user_func($cmp_function, $array1[$ptr1], $array2[$ptr2]) < 1) {
   209                 $array[] = $array1[$ptr1++];
   211                 $array[] = $array2[$ptr2++];
   216         while ($ptr1 < count($array1)) {
   217             $array[] = $array1[$ptr1++];
   219         while ($ptr2 < count($array2)) {
   220             $array[] = $array2[$ptr2++];
   233         string $a_array_sortby,
   234         string $a_array_sortorder = 
"asc",
   235         bool $a_numeric = 
false   237         global $array_sortby, $array_sortorder;
   239         $array_sortby = $a_array_sortby;
   241         if ($a_array_sortorder == 
"desc") {
   242             $array_sortorder = 
"desc";
   244             $array_sortorder = 
"asc";
   248         $sort_array = array_values($array);
 static sort_func(array $left, array $right)
 
static stripSlashesRecursive($a_data, bool $a_strip_html=true, string $a_allow="")
 
static quoteArray(array $a_array)
Quotes all members of an array for usage in DB query statement. 
 
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
 
static mergesort(array &$array, callable $cmp_function=null)
 
static sort_func_numeric(array $left, array $right)
 
static stableSortArray(array $array, string $a_array_sortby, string $a_array_sortorder="asc", bool $a_numeric=false)
Sort an aray using a stable sort algorithm, which preveserves the sequence of array elements which ha...
 
static strCmp(string $a, string $b)
 
static stripSlashesArray(array $a_arr, bool $a_strip_html=true, string $a_allow="")
 
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)