Пример #1
0
 function merge_upper_rights()
 {
     $this->right_arr = array_overwrite($this->upper_dir->right_arr, $this->right_arr);
     if ($this->data['rel_to']) {
         $this->admin = $this->upper_dir->admin;
     } else {
         $this->admin = $this->data['owner'];
     }
 }
Пример #2
0
function html_csv($arr)
{
    if (empty($arr)) {
        return '';
    }
    $args = get_args_smart(func_get_args(), 1);
    $head_overwrite = $args['array'];
    $process = $args['callable'];
    foreach ($arr as &$item) {
        if (is_callable($process)) {
            $item = $process($item);
        }
        $rows[] = '"' . implode('","', $item) . '"';
    }
    $keys = array_keys_2d($arr);
    if (!empty($head_overwrite)) {
        $keys = array_overwrite($keys, $head_overwrite);
    }
    array_unshift($rows, '"' . implode('","', $keys) . '"');
    $csv = implode("\n", $rows);
    return $csv;
}
Пример #3
0
function array_overwrite($base, $ext)
{
    foreach ($ext as $key => $value) {
        $sub_base =& $base[$key];
        if (isset($sub_base) && is_array($value)) {
            $value = array_overwrite($sub_base, $value);
        }
        $sub_base = $value;
    }
    return $base;
}