Differences From Artifact [c134309b5d]:

To Artifact [7bf98c3058]:


469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
...
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
...
684
685
686
687
688
689
690




691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
...
713
714
715
716
717
718
719




720
721
722
723
724
725
726
    static public function checkBIC($bic)
    {
        return preg_match('!^[A-Z]{4}[A-Z]{2}[1-9A-Z]{2}(?:[A-Z\d]{3})?$!', $bic);
    }

    static public function normalizePhoneNumber($n)
    {
        $n = preg_replace('!(\+\d+)\(0\)!', '\\1', $n);
        $n = preg_replace('![^\d\+]!', '', $n);
        return $n;
    }

    static public function write_ini_string($in)
    {
        $out = '';
        $get_ini_line = function ($key, $value) use (&$get_ini_line)
        {
................................................................................
        array_walk($row, function (&$field) {
            $field = strtr($field, ['"' => '""', "\r\n" => "\n"]);
        });

        return sprintf("\"%s\"\r\n", implode('","', $row));
    }

    static public function toCSV($name, $iterator, $header = null)
    {
        header('Content-type: application/csv');
        header(sprintf('Content-Disposition: attachment; filename="%s.csv"', $name));

        $fp = fopen('php://output', 'w');

        if ($header)
................................................................................
        foreach ($iterator as $row)
        {
            if (!$header)
            {
                fputs($fp, self::row_to_csv(array_keys($row)));
                $header = true;
            }





            fputs($fp, self::row_to_csv($row));
        }

        fclose($fp);

        return true;
    }

    static public function toODS($name, $iterator, $header = null)
    {
        header('Content-type: application/vnd.oasis.opendocument.spreadsheet');
        header(sprintf('Content-Disposition: attachment; filename="%s.ods"', $name));

        $ods = new ODSWriter;
        $ods->table_name = $name;

................................................................................
        foreach ($iterator as $row)
        {
            if (!$header)
            {
                $ods->add(array_keys($row));
                $header = true;
            }





            $ods->add((array) $row);
        }

        $ods->output();

        return true;







<
|
<







 







|







 







>
>
>
>









|







 







>
>
>
>







469
470
471
472
473
474
475

476

477
478
479
480
481
482
483
...
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
...
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
...
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
    static public function checkBIC($bic)
    {
        return preg_match('!^[A-Z]{4}[A-Z]{2}[1-9A-Z]{2}(?:[A-Z\d]{3})?$!', $bic);
    }

    static public function normalizePhoneNumber($n)
    {

        return preg_replace('![^\d\+\(\)p#,;-]!', '', trim($n));

    }

    static public function write_ini_string($in)
    {
        $out = '';
        $get_ini_line = function ($key, $value) use (&$get_ini_line)
        {
................................................................................
        array_walk($row, function (&$field) {
            $field = strtr($field, ['"' => '""', "\r\n" => "\n"]);
        });

        return sprintf("\"%s\"\r\n", implode('","', $row));
    }

    static public function toCSV($name, $iterator, $header = null, $row_map_callback = null)
    {
        header('Content-type: application/csv');
        header(sprintf('Content-Disposition: attachment; filename="%s.csv"', $name));

        $fp = fopen('php://output', 'w');

        if ($header)
................................................................................
        foreach ($iterator as $row)
        {
            if (!$header)
            {
                fputs($fp, self::row_to_csv(array_keys($row)));
                $header = true;
            }

            if (null !== $row_map_callback) {
                $row = call_user_func($row_map_callback, $row);
            }

            fputs($fp, self::row_to_csv($row));
        }

        fclose($fp);

        return true;
    }

    static public function toODS($name, $iterator, $header = null, $row_map_callback = null)
    {
        header('Content-type: application/vnd.oasis.opendocument.spreadsheet');
        header(sprintf('Content-Disposition: attachment; filename="%s.ods"', $name));

        $ods = new ODSWriter;
        $ods->table_name = $name;

................................................................................
        foreach ($iterator as $row)
        {
            if (!$header)
            {
                $ods->add(array_keys($row));
                $header = true;
            }

            if (null !== $row_map_callback) {
                $row = call_user_func($row_map_callback, $row);
            }

            $ods->add((array) $row);
        }

        $ods->output();

        return true;